From a175314c3e5827eb193872241446f2f8f5c9d33c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:07:14 +0200 Subject: Adding upstream version 1:10.5.12. Signed-off-by: Daniel Baumann --- storage/mroonga/AUTHORS | 7 + storage/mroonga/CMakeLists.txt | 453 + storage/mroonga/COPYING | 504 + storage/mroonga/ChangeLog | 3 + storage/mroonga/Makefile.am | 175 + storage/mroonga/NEWS | 1 + storage/mroonga/README | 1 + storage/mroonga/appveyor.yml | 63 + storage/mroonga/autogen.sh | 11 + storage/mroonga/build/Makefile.am | 2 + storage/mroonga/build/cmake_modules/Makefile.am | 2 + .../mroonga/build/cmake_modules/ReadFileList.cmake | 27 + storage/mroonga/build/makefiles/LC_MESSAGES.am | 5 + storage/mroonga/build/makefiles/gettext.am | 86 + storage/mroonga/build/makefiles/locale.am | 12 + storage/mroonga/build/makefiles/sphinx-build.am | 17 + storage/mroonga/build/makefiles/sphinx.am | 179 + storage/mroonga/config.sh.in | 20 + storage/mroonga/configure.ac | 540 + storage/mroonga/data/Makefile.am | 4 + storage/mroonga/data/install.sql.in | 35 + storage/mroonga/data/uninstall.sql | 12 + storage/mroonga/gpg_uid | 1 + storage/mroonga/ha_mroonga.cpp | 17077 ++++ storage/mroonga/ha_mroonga.def | 18 + storage/mroonga/ha_mroonga.hpp | 1309 + storage/mroonga/lib/Makefile.am | 23 + storage/mroonga/lib/libmrn_need_mysql_sources.am | 50 + storage/mroonga/lib/libmrn_no_mysql_sources.am | 9 + .../mroonga/lib/libmysqlservices_compat_sources.am | 2 + .../mroonga/lib/mrn_auto_increment_value_lock.cpp | 42 + .../mroonga/lib/mrn_auto_increment_value_lock.hpp | 36 + storage/mroonga/lib/mrn_column_name.cpp | 69 + storage/mroonga/lib/mrn_column_name.hpp | 39 + storage/mroonga/lib/mrn_condition_converter.cpp | 637 + storage/mroonga/lib/mrn_condition_converter.hpp | 85 + storage/mroonga/lib/mrn_context_pool.cpp | 120 + storage/mroonga/lib/mrn_context_pool.hpp | 41 + storage/mroonga/lib/mrn_count_skip_checker.cpp | 303 + storage/mroonga/lib/mrn_count_skip_checker.hpp | 57 + storage/mroonga/lib/mrn_current_thread.hpp | 27 + storage/mroonga/lib/mrn_database.cpp | 89 + storage/mroonga/lib/mrn_database.hpp | 47 + storage/mroonga/lib/mrn_database_manager.cpp | 364 + storage/mroonga/lib/mrn_database_manager.hpp | 52 + storage/mroonga/lib/mrn_database_repairer.cpp | 300 + storage/mroonga/lib/mrn_database_repairer.hpp | 67 + storage/mroonga/lib/mrn_debug_column_access.cpp | 36 + storage/mroonga/lib/mrn_debug_column_access.hpp | 38 + storage/mroonga/lib/mrn_encoding.cpp | 242 + storage/mroonga/lib/mrn_encoding.hpp | 36 + storage/mroonga/lib/mrn_external_lock.cpp | 43 + storage/mroonga/lib/mrn_external_lock.hpp | 38 + storage/mroonga/lib/mrn_field_normalizer.cpp | 145 + storage/mroonga/lib/mrn_field_normalizer.hpp | 47 + storage/mroonga/lib/mrn_grn.hpp | 39 + storage/mroonga/lib/mrn_index_column_name.cpp | 96 + storage/mroonga/lib/mrn_index_column_name.hpp | 43 + storage/mroonga/lib/mrn_index_table_name.cpp | 136 + storage/mroonga/lib/mrn_index_table_name.hpp | 55 + storage/mroonga/lib/mrn_lock.cpp | 36 + storage/mroonga/lib/mrn_lock.hpp | 37 + .../lib/mrn_match_escalation_threshold_scope.cpp | 33 + .../lib/mrn_match_escalation_threshold_scope.hpp | 35 + .../mroonga/lib/mrn_multiple_column_key_codec.cpp | 712 + .../mroonga/lib/mrn_multiple_column_key_codec.hpp | 100 + storage/mroonga/lib/mrn_mysqlservices.cpp | 28 + storage/mroonga/lib/mrn_operation.cpp | 51 + storage/mroonga/lib/mrn_operation.hpp | 42 + storage/mroonga/lib/mrn_operations.cpp | 401 + storage/mroonga/lib/mrn_operations.hpp | 60 + storage/mroonga/lib/mrn_parameters_parser.cpp | 177 + storage/mroonga/lib/mrn_parameters_parser.hpp | 59 + storage/mroonga/lib/mrn_path_mapper.cpp | 229 + storage/mroonga/lib/mrn_path_mapper.hpp | 55 + storage/mroonga/lib/mrn_query_parser.cpp | 361 + storage/mroonga/lib/mrn_query_parser.hpp | 67 + storage/mroonga/lib/mrn_smart_bitmap.cpp | 42 + storage/mroonga/lib/mrn_smart_bitmap.hpp | 36 + storage/mroonga/lib/mrn_smart_grn_obj.cpp | 59 + storage/mroonga/lib/mrn_smart_grn_obj.hpp | 40 + .../mroonga/lib/mrn_table_fields_offset_mover.cpp | 47 + .../mroonga/lib/mrn_table_fields_offset_mover.hpp | 33 + storage/mroonga/lib/mrn_time_converter.cpp | 295 + storage/mroonga/lib/mrn_time_converter.hpp | 51 + storage/mroonga/lib/mrn_value_decoder.cpp | 75 + storage/mroonga/lib/mrn_value_decoder.hpp | 34 + storage/mroonga/lib/mrn_windows.hpp | 31 + storage/mroonga/mrn_constants.hpp | 49 + storage/mroonga/mrn_err.h | 46 + storage/mroonga/mrn_macro.hpp | 30 + storage/mroonga/mrn_mysql.h | 74 + storage/mroonga/mrn_mysql_compat.h | 422 + storage/mroonga/mrn_table.cpp | 1198 + storage/mroonga/mrn_table.hpp | 179 + storage/mroonga/mrn_variables.hpp | 51 + storage/mroonga/mrn_version.h.in | 40 + storage/mroonga/mysql-test/Makefile.am | 8 + .../mroonga/include/mroonga/check_64bit.inc | 22 + .../mroonga/include/mroonga/check_freebsd.inc | 20 + .../include/mroonga/check_ha_mroonga_so.inc | 26 + .../include/mroonga/check_libgroonga_embedded.inc | 19 + .../mroonga/check_libgroonga_support_lz4.inc | 20 + .../mroonga/check_libgroonga_support_zlib.inc | 20 + .../mroonga/check_libgroonga_support_zstd.inc | 20 + .../mroonga/include/mroonga/check_mariadb.inc | 19 + .../mroonga/include/mroonga/check_osx.inc | 31 + .../mroonga/include/mroonga/check_solaris.inc | 20 + .../include/mroonga/check_strict_sql_mode.inc | 21 + .../mroonga/include/mroonga/check_version.inc | 33 + .../mroonga/include/mroonga/check_windows.inc | 20 + .../include/mroonga/have_fractional_seconds.inc | 32 + .../mroonga/include/mroonga/have_freebsd.inc | 21 + .../mroonga/have_groonga_plugin_register.inc | 22 + .../mroonga/include/mroonga/have_mariadb.inc | 21 + .../include/mroonga/have_mariadb_10_2_or_later.inc | 26 + .../mroonga/include/mroonga/have_mroonga.inc | 47 + .../include/mroonga/have_mroonga_deinit.inc | 42 + .../include/mroonga/have_mroonga_helper.inc | 17 + .../mroonga/include/mroonga/have_mysql.inc | 21 + .../include/mroonga/have_mysql_5_7_or_later.inc | 26 + .../include/mroonga/have_signed_64bit_time_t.inc | 28 + .../mroonga/include/mroonga/have_solaris.inc | 21 + .../include/mroonga/have_strict_sql_mode.inc | 21 + .../mroonga/include/mroonga/have_version_10_0.inc | 21 + .../include/mroonga/have_version_10_0_or_later.inc | 21 + .../mroonga/include/mroonga/have_version_5_5.inc | 21 + .../mroonga/include/mroonga/have_version_5_6.inc | 21 + .../include/mroonga/have_version_5_6_or_later.inc | 21 + .../mroonga/include/mroonga/have_version_5_7.inc | 21 + .../include/mroonga/have_version_5_7_or_later.inc | 21 + .../include/mroonga/load_mroonga_functions.inc | 28 + .../include/mroonga/print_groonga_query_log.inc | 8 + .../mroonga/include/mroonga/skip_freebsd.inc | 21 + .../include/mroonga/skip_mariadb_10_0_or_later.inc | 24 + .../mroonga/include/mroonga/skip_mariadb_10_1.inc | 24 + .../mroonga/skip_mariadb_10_1_or_earlier.inc | 24 + .../include/mroonga/skip_mariadb_10_2_or_later.inc | 24 + .../mroonga/include/mroonga/skip_mariadb_5_5.inc | 24 + .../mroonga/include/mroonga/skip_mysql_5_5.inc | 24 + .../mroonga/include/mroonga/skip_mysql_5_7.inc | 24 + .../include/mroonga/skip_mysql_5_7_or_later.inc | 24 + .../mroonga/include/mroonga/skip_osx.inc | 21 + .../include/mroonga/skip_signed_64bit_time_t.inc | 28 + .../mroonga/include/mroonga/skip_solaris.inc | 21 + .../include/mroonga/skip_strict_sql_mode.inc | 21 + .../include/mroonga/support_libgroonga_lz4.inc | 22 + .../include/mroonga/support_libgroonga_zlib.inc | 22 + .../include/mroonga/support_libgroonga_zstd.inc | 22 + .../include/mroonga/unload_mroonga_functions.inc | 26 + .../include/mroonga/unsupport_libgroonga_lz4.inc | 22 + .../include/mroonga/unsupport_libgroonga_zlib.inc | 22 + .../include/mroonga/unsupport_libgroonga_zstd.inc | 22 + .../mysql-test/mroonga/storage/disabled.def | 10 + .../storage/r/alter_table_add_column_after.result | 26 + .../storage/r/alter_table_add_column_first.result | 26 + .../r/alter_table_add_column_flags_comment.result | 15 + .../alter_table_add_column_flags_parameter.result | 22 + ...er_table_add_column_groonga_type_comment.result | 23 + ..._table_add_column_groonga_type_parameter.result | 30 + .../alter_table_add_column_multibyte_cp932.result | 35 + .../r/alter_table_add_column_multibyte_utf8.result | 35 + .../r/alter_table_add_column_multiple.result | 44 + .../storage/r/alter_table_add_column_plain.result | 37 + .../r/alter_table_add_column_type_comment.result | 23 + ...add_index_token_filters_one_token_filter.result | 22 + .../alter_table_add_index_unique_duplicated.result | 17 + ..._index_unique_multiple_column_duplicated.result | 19 + ..._table_add_key_multiple_column_with_data.result | 31 + .../storage/r/alter_table_add_primary_key.result | 17 + ...le_change_column_comment_not_for_mroonga.result | 17 + .../r/alter_table_change_column_have_index.result | 16 + .../alter_table_change_column_rename_after.result | 28 + .../alter_table_change_column_rename_first.result | 28 + ...lter_table_change_column_rename_multiple.result | 32 + ...lter_table_change_column_rename_no_order.result | 28 + .../r/alter_table_change_engine_decimal.result | 35 + ...alter_table_change_engine_fulltext_index.result | 39 + .../r/alter_table_change_token_filter.result | 63 + ...alter_table_disable_keys_create_fulltext.result | 27 + .../alter_table_disable_keys_fulltext_table.result | 41 + .../alter_table_disable_keys_fulltext_ujis.result | 23 + .../alter_table_disable_keys_fulltext_utf8.result | 23 + ...alter_table_disable_keys_multiple_column.result | 27 + .../r/alter_table_disable_keys_normal.result | 25 + .../r/alter_table_disable_keys_primary.result | 23 + .../r/alter_table_disable_keys_truncate.result | 20 + .../r/alter_table_disable_keys_updating.result | 18 + .../r/alter_table_drop_column_multiple.result | 36 + .../storage/r/alter_table_drop_column_one.result | 37 + ...table_drop_key_multiple_column_with_data.result | 33 + .../storage/r/alter_table_drop_primary_key.result | 16 + .../r/alter_table_enable_keys_fulltext.result | 24 + .../alter_table_enable_keys_fulltext_table.result | 42 + .../r/alter_table_enable_keys_fulltext_ujis.result | 24 + .../r/alter_table_enable_keys_fulltext_utf8.result | 24 + .../alter_table_enable_keys_multiple_column.result | 28 + .../r/alter_table_enable_keys_normal.result | 26 + .../r/alter_table_enable_keys_primary.result | 24 + .../alter_table_fulltext_add_no_primary_key.result | 19 + .../r/alter_table_fulltext_add_normal.result | 14 + .../r/alter_table_fulltext_add_table.result | 21 + .../r/alter_table_fulltext_drop_table.result | 21 + .../r/alter_table_modify_column_after.result | 33 + .../r/alter_table_modify_column_first.result | 33 + .../r/alter_table_modify_column_no_order.result | 33 + ...r_table_recreate_anonymous_index_at_once.result | 29 + .../storage/r/alter_table_rename_table.result | 35 + .../mroonga/storage/r/alter_table_spatial.result | 132 + .../storage/r/auto_increment_TODO_SPLIT_ME.result | 53 + .../storage/r/auto_increment_table_param.result | 70 + .../mroonga/storage/r/auto_increment_text.result | 15 + .../mroonga/storage/r/binlog_TODO_SPLIT_ME.result | 34 + .../mroonga/storage/r/check_table_broken.result | 18 + .../storage/r/check_table_not_broken.result | 13 + .../r/collation_utf8_general_ci_french.result | 11 + .../r/collation_utf8_unicode_520_ci_french.result | 11 + .../collation_utf8_unicode_520_ci_japanese.result | 12 + .../r/collation_utf8_unicode_ci_french.result | 11 + .../r/collation_utf8_unicode_ci_japanese.result | 11 + .../r/column_comment_index_not_for_mroonga.result | 12 + .../r/column_comment_normal_not_for_mroonga.result | 13 + .../storage/r/column_date_with_index.result | 29 + .../storage/r/column_date_without_index.result | 27 + .../mroonga/storage/r/column_date_zero_date.result | 29 + .../storage/r/column_datetime_32bit_2038.result | 17 + .../column_datetime_32bit_before_unix_epoch.result | 14 + .../storage/r/column_datetime_32bit_max.result | 14 + .../r/column_datetime_32bit_out_of_range.result | 15 + .../storage/r/column_datetime_64bit_2038.result | 15 + .../column_datetime_64bit_before_unix_epoch.result | 12 + .../storage/r/column_datetime_64bit_max.result | 12 + ...etime_64bit_strict_sql_mode_out_of_range.result | 12 + ..._datetime_64bit_version_5_5_out_of_range.result | 15 + ..._64bit_version_5_6_or_later_out_of_range.result | 17 + ...n_datetime_fractional_seconds_with_index.result | 25 + ...atetime_fractional_seconds_without_index.result | 24 + ...olumn_datetime_freebsd_before_unix_epoch.result | 14 + ...datetime_mariadb_10_2_or_later_zero_date.result | 14 + ...ime_mariadb_10_2_or_later_zero_month_day.result | 12 + ...mn_datetime_mysql_5_7_or_later_zero_date.result | 14 + ...tetime_mysql_5_7_or_later_zero_month_day.result | 12 + .../mroonga/storage/r/column_datetime_null.result | 12 + .../storage/r/column_datetime_with_index.result | 24 + .../storage/r/column_datetime_without_index.result | 23 + .../storage/r/column_datetime_zero_date.result | 16 + .../r/column_datetime_zero_month_day.result | 20 + ...mn_decimal_fractional_seconds_with_index.result | 20 + ...decimal_fractional_seconds_without_index.result | 19 + .../storage/r/column_decimal_with_index.result | 20 + .../storage/r/column_decimal_without_index.result | 19 + .../storage/r/column_enum_less_with_index.result | 28 + .../storage/r/column_enum_many_with_index.result | 287 + .../r/column_generated_stored_add_column.result | 16 + .../r/column_generated_stored_delete.result | 15 + .../r/column_generated_stored_drop_column.result | 17 + .../r/column_generated_stored_insert.result | 15 + .../r/column_generated_stored_reindex.result | 17 + .../r/column_generated_stored_update.result | 15 + .../r/column_generated_virtual_add_column.result | 15 + .../r/column_generated_virtual_delete.result | 15 + .../r/column_generated_virtual_drop_column.result | 16 + .../r/column_generated_virtual_insert.result | 15 + ..._virtual_mariadb_10_2_or_later_add_index.result | 9 + ...db_10_2_or_later_create_table_with_index.result | 8 + ...ted_virtual_mysql_5_7_or_later_add_index.result | 9 + .../r/column_generated_virtual_update.result | 16 + .../storage/r/column_groonga__id__id.result | 13 + .../storage/r/column_groonga__id_invalid_id.result | 8 + ...olumn_groonga_index_fulltext_other_table.result | 30 + ...roonga_index_fulltext_vector_other_table.result | 38 + .../r/column_groonga_index_int_other_table.result | 39 + .../r/column_groonga_scalar_reference.result | 24 + .../r/column_groonga_scalar_support_lz4.result | 10 + .../r/column_groonga_scalar_support_zlib.result | 10 + .../r/column_groonga_scalar_support_zstd.result | 10 + .../r/column_groonga_scalar_unsupport_lz4.result | 12 + .../r/column_groonga_scalar_unsupport_zlib.result | 12 + .../r/column_groonga_scalar_unsupport_zstd.result | 12 + ...onga_scalar_with_not_for_mroonga_comment.result | 27 + ...mn_groonga_vector_order_by_with_function.result | 23 + .../r/column_groonga_vector_reference.result | 28 + .../r/column_int_with_index_zero_value.result | 21 + .../mroonga/storage/r/column_json_insert.result | 13 + .../storage/r/column_multibyte_cp932.result | 32 + .../mroonga/storage/r/column_multibyte_utf8.result | 32 + .../storage/r/column_set_16_with_index.result | 40 + .../storage/r/column_set_24_with_index.result | 48 + .../storage/r/column_set_32_with_index.result | 56 + .../storage/r/column_set_64_with_index.result | 88 + .../storage/r/column_set_8_with_index.result | 32 + .../r/column_signed_bigint_with_index.result | 28 + .../storage/r/column_signed_int_with_index.result | 28 + .../r/column_signed_mediumint_with_index.result | 26 + .../r/column_signed_smallint_with_index.result | 24 + .../r/column_signed_tinyint_with_index.result | 18 + ...olumn_time_fractional_seconds_with_index.result | 30 + .../storage/r/column_time_with_index.result | 30 + ..._timestamp_fractional_seconds_with_index.result | 32 + .../storage/r/column_timestamp_with_index.result | 25 + .../storage/r/column_tinyint_without_index.result | 18 + .../r/column_unsigned_bigint_with_index.result | 28 + .../r/column_unsigned_bigint_without_index.result | 17 + .../r/column_unsigned_int_with_index.result | 28 + .../r/column_unsigned_mediumint_with_index.result | 28 + .../r/column_unsigned_smallint_with_index.result | 25 + .../r/column_unsigned_tinyint_with_index.result | 18 + .../storage/r/column_year_with_index.result | 28 + .../storage/r/column_year_without_index.result | 27 + .../mysql-test/mroonga/storage/r/count_star.result | 11 + .../storage/r/create_database_name_slash.result | 33 + .../storage/r/create_table_TODO_SPLIT_ME.result | 172 + .../r/create_table_column_flags_comment.result | 15 + .../r/create_table_column_flags_parameter.result | 15 + ...create_table_column_groonga_type_comment.result | 23 + ...te_table_column_groonga_type_nonexistent.result | 6 + ...eate_table_column_groonga_type_parameter.result | 30 + .../r/create_table_column_type_comment.result | 23 + .../r/create_table_column_type_nonexistent.result | 6 + .../storage/r/create_table_comment_normal.result | 11 + .../r/create_table_default_tokenizer.result | 15 + .../r/create_table_index_flags_comment.result | 9 + .../r/create_table_index_flags_index_medium.result | 10 + .../r/create_table_index_flags_index_small.result | 10 + .../storage/r/create_table_index_flags_none.result | 9 + .../r/create_table_index_flags_parameter.result | 15 + .../r/create_table_index_index_flags_none.result | 9 + ...ndex_flags_with_position_and_with_weight.result | 9 + .../r/create_table_index_normalizer_comment.result | 16 + ...able_index_normalizer_fulltext_index_bin.result | 16 + .../create_table_index_normalizer_index_bin.result | 22 + ...zer_no_utf8_charset_with_utf8_normalizer.result | 12 + .../r/create_table_index_normalizer_none.result | 16 + .../create_table_index_normalizer_parameter.result | 21 + .../r/create_table_index_parser_comment.result | 29 + .../r/create_table_index_parser_default.result | 25 + .../storage/r/create_table_index_parser_off.result | 40 + ...dex_token_filters_multiple_token_filters.result | 22 + ...ble_index_token_filters_one_token_filter.result | 22 + ...eate_table_index_token_filters_parameter.result | 28 + .../r/create_table_index_tokenizer_comment.result | 23 + .../r/create_table_index_tokenizer_default.result | 25 + .../r/create_table_index_tokenizer_off.result | 34 + .../create_table_index_tokenizer_parameter.result | 22 + .../r/create_table_table_normalizer_default.result | 18 + .../r/create_table_table_normalizer_hash.result | 19 + ...ble_token_filters_multiple_token_filters.result | 30 + ...ble_table_token_filters_one_token_filter.result | 30 + ...eate_table_table_token_filters_stop_word.result | 23 + .../storage/r/delete_fulltext_column.result | 21 + .../r/delete_index_btree_many_records.result | 27 + .../r/delete_index_hash_id_no_unique.result | 19 + .../storage/r/delete_index_hash_id_unique.result | 19 + .../mroonga/storage/r/delete_normal_column.result | 34 + .../storage/r/delete_unsigned_bigint.result | 12 + .../storage/r/drop_database_TODO_SPLIT_ME.result | 14 + .../storage/r/drop_database_no_table.result | 20 + .../storage/r/drop_table_TODO_SPLIT_ME.result | 5 + .../mysql-test/mroonga/storage/r/flush_logs.result | 1 + .../mroonga/storage/r/foreign_key_alter_add.result | 24 + .../storage/r/foreign_key_alter_drop.result | 23 + .../mroonga/storage/r/foreign_key_create.result | 22 + .../storage/r/foreign_key_delete_existent.result | 53 + .../r/foreign_key_delete_nonexistent.result | 53 + .../storage/r/foreign_key_insert_existent.result | 51 + .../r/foreign_key_insert_nonexistent.result | 37 + .../mroonga/storage/r/foreign_key_rename.result | 28 + .../storage/r/foreign_key_update_existent.result | 55 + .../r/foreign_key_update_nonexistent.result | 53 + .../r/fulltext_boolean_mode_empty_query.result | 19 + .../storage/r/fulltext_boolean_mode_escape.result | 18 + .../r/fulltext_boolean_mode_leading_not.result | 15 + .../r/fulltext_boolean_mode_pragma_all.result | 21 + ...ragma_default_operator_minus_no_operator.result | 17 + ...de_pragma_default_operator_minus_with_or.result | 18 + ..._pragma_default_operator_minus_with_plus.result | 18 + ...e_pragma_default_operator_or_no_operator.result | 19 + ...de_pragma_default_operator_or_with_minus.result | 19 + ...ode_pragma_default_operator_or_with_plus.result | 19 + ...pragma_default_operator_plus_no_operator.result | 14 + ...agma_default_operator_plus_with_astarisk.result | 14 + ..._pragma_default_operator_plus_with_minus.result | 14 + ...ode_pragma_default_operator_plus_with_or.result | 15 + ...olean_mode_pragma_syntax_script_operator.result | 20 + ...olean_mode_pragma_syntax_script_selector.result | 25 + ...ext_boolean_mode_pragma_weight_full_spec.result | 20 + ...ext_boolean_mode_pragma_weight_no_weight.result | 20 + ..._boolean_mode_pragma_weight_omit_section.result | 20 + ..._mode_pragma_weight_ten_or_more_sections.result | 39 + ...ode_pragma_weight_three_or_more_sections.result | 21 + ...fulltext_boolean_mode_syntax_error_error.result | 17 + ..._boolean_mode_syntax_error_error_and_log.result | 17 + ...ulltext_boolean_mode_syntax_error_ignore.result | 17 + ...boolean_mode_syntax_error_ignore_and_log.result | 17 + .../storage/r/fulltext_charset_ascii.result | 29 + .../storage/r/fulltext_charset_cp932.result | 18 + .../storage/r/fulltext_charset_eucjpms.result | 18 + .../storage/r/fulltext_charset_japanese.result | 18 + .../storage/r/fulltext_charset_utf8mb4.result | 17 + .../mroonga/storage/r/fulltext_empty_query.result | 19 + .../mroonga/storage/r/fulltext_found_rows.result | 29 + .../r/fulltext_groonga_varchar_vector.result | 21 + .../storage/r/fulltext_index_recreate.result | 32 + .../storage/r/fulltext_insert_select.result | 46 + .../storage/r/fulltext_insert_values.result | 17 + .../r/fulltext_multiple_column_index_delete.result | 23 + .../r/fulltext_multiple_column_index_insert.result | 29 + .../fulltext_multiple_column_index_recreate.result | 31 + .../r/fulltext_multiple_column_index_update.result | 26 + .../storage/r/fulltext_multiple_index.result | 23 + .../storage/r/fulltext_no_primary_key.result | 14 + .../storage/r/fulltext_not_match_against.result | 68 + .../mroonga/storage/r/fulltext_or.result | 22 + ...ext_order_boolean_mode_different_against.result | 23 + ...ltext_order_boolean_mode_different_match.result | 24 + .../r/fulltext_order_boolean_mode_no_where.result | 22 + ...xt_order_boolean_mode_same_match_against.result | 22 + ...fulltext_order_natural_language_mode_asc.result | 34 + ...ulltext_order_natural_language_mode_desc.result | 34 + ..._natural_language_mode_different_against.result | 34 + ...er_natural_language_mode_different_match.result | 36 + ...ext_order_natural_language_mode_no_where.result | 37 + ...natural_language_mode_same_match_against.result | 34 + .../storage/r/fulltext_two_inner_join.result | 41 + .../r/fulltext_version_10_0_no_such_key.result | 25 + .../r/fulltext_version_5_5_no_such_key.result | 25 + .../r/fulltext_version_5_6_no_such_key.result | 25 + .../storage/r/function_command_auto-escape.result | 16 + .../storage/r/function_command_select.result | 13 + .../function_command_special-database-name.result | 22 + .../function_escape_error_query_is_missing.result | 3 + ...unction_escape_error_query_is_not_string.result | 3 + ...pe_error_target_characters_is_not_string.result | 3 + .../storage/r/function_escape_query_all.result | 4 + .../storage/r/function_escape_query_custom.result | 4 + .../storage/r/function_escape_query_join.result | 26 + .../r/function_escape_query_match_against.result | 18 + .../storage/r/function_escape_query_named.result | 4 + .../storage/r/function_escape_query_nested.result | 13 + .../r/function_escape_script_decimal.result | 11 + .../r/function_escape_script_integer.result | 4 + .../storage/r/function_escape_script_real.result | 11 + .../storage/r/function_escape_script_string.result | 4 + .../function_highlight_html_dynamic_keyword.result | 11 + .../r/function_highlight_html_japanese.result | 13 + ...unction_highlight_html_multiple_keywords.result | 4 + .../r/function_highlight_html_normalizer.result | 4 + .../storage/r/function_highlight_html_query.result | 13 + .../r/function_highlight_html_query_pragma.result | 13 + .../r/function_highlight_html_record.result | 32 + .../storage/r/function_last_insert_grn_id.result | 28 + .../r/function_last_insert_id_reference.result | 15 + .../storage/r/function_last_insert_id_set.result | 21 + .../storage/r/function_normalize_default.result | 3 + .../storage/r/function_normalize_normalizer.result | 3 + .../storage/r/function_normalize_record.result | 7 + .../r/function_query_expand_multiple.result | 18 + .../r/function_query_expand_no_index.result | 15 + .../storage/r/function_query_expand_one.result | 16 + .../storage/r/function_query_expand_pragma.result | 17 + .../storage/r/function_snippet_ascii.result | 120 + .../storage/r/function_snippet_cp932.result | 91 + .../storage/r/function_snippet_eucjpms.result | 91 + .../r/function_snippet_html_dynamic_keyword.result | 11 + .../r/function_snippet_html_japanese.result | 9 + .../function_snippet_html_multiple_keywords.result | 4 + .../function_snippet_html_multiple_snippets.result | 10 + .../storage/r/function_snippet_html_query.result | 9 + .../r/function_snippet_html_query_pragma.result | 9 + .../storage/r/function_snippet_html_record.result | 30 + ...tion_snippet_invalid_nonexistent_charset.result | 4 + ...tion_snippet_invalid_unsupported_charset.result | 4 + .../storage/r/function_snippet_japanese.result | 95 + .../storage/r/geometry_bulk_insert_null.result | 13 + .../mroonga/storage/r/geometry_contains.result | 167 + ...eometry_strict_sql_mode_bulk_insert_null.result | 9 + .../r/geometry_strict_sql_mode_contains.result | 169 + .../mysql-test/mroonga/storage/r/i_s.result | 7 + .../storage/r/index_btree_equal_datetime.result | 16 + .../storage/r/index_btree_equal_time.result | 16 + .../storage/r/index_btree_equal_timestamp.result | 16 + .../r/index_btree_normal_column_insert.result | 25 + .../mroonga/storage/r/index_hash_id_normal.result | 18 + .../mroonga/storage/r/index_hash_id_primary.result | 28 + .../mroonga/storage/r/index_hash_id_unique.result | 18 + .../r/index_hash_normal_column_insert.result | 25 + .../r/index_hash_strict_sql_mode_id_primary.result | 19 + .../storage/r/index_multiple_column_delete.result | 32 + .../index_multiple_column_nullable_smallint.result | 65 + ...multiple_column_nullable_unsigned_bigint.result | 65 + ...ex_multiple_column_nullable_unsigned_int.result | 65 + ...ltiple_column_nullable_unsigned_smallint.result | 65 + .../index_multiple_column_nullable_varchar.result | 65 + ...iple_column_order_by_where_equal_asc_asc.result | 40 + ...le_column_order_by_where_equal_desc_desc.result | 40 + .../r/index_multiple_column_primary_delete.result | 29 + ...index_multiple_column_primary_select_int.result | 37 + ...le_column_primary_strict_sql_mode_update.result | 26 + .../r/index_multiple_column_primary_update.result | 27 + ...tiple_column_range_all_used_greater_than.result | 28 + ...umn_range_all_used_greater_than_or_equal.result | 30 + ...multiple_column_range_all_used_less_than.result | 29 + ...column_range_all_used_less_than_or_equal.result | 30 + ..._partially_used_have_prefix_greater_than.result | 34 + ...y_used_have_prefix_greater_than_or_equal.result | 35 + ...nge_partially_used_have_prefix_less_than.result | 34 + ...ally_used_have_prefix_less_than_or_equal.result | 35 + ...ge_partially_used_no_prefix_greater_than.result | 29 + ...lly_used_no_prefix_greater_than_or_equal.result | 30 + ...range_partially_used_no_prefix_less_than.result | 30 + ...tially_used_no_prefix_less_than_or_equal.result | 31 + .../r/index_multiple_column_recreate.result | 39 + .../storage/r/index_multiple_column_replace.result | 39 + .../r/index_multiple_column_select_double.result | 28 + .../r/index_multiple_column_select_float.result | 28 + .../r/index_multiple_column_select_int.result | 37 + .../r/index_multiple_column_select_max.result | 20 + .../r/index_multiple_column_select_min.result | 20 + .../r/index_multiple_column_select_string.result | 40 + .../r/index_multiple_column_select_varchar.result | 41 + ..._multiple_column_unique_date_32bit_equal.result | 25 + ..._multiple_column_unique_date_64bit_equal.result | 16 + ...x_multiple_column_unique_date_index_read.result | 20 + ...tiple_column_unique_date_order_32bit_asc.result | 29 + ...iple_column_unique_date_order_32bit_desc.result | 29 + ...tiple_column_unique_date_order_64bit_asc.result | 19 + ...iple_column_unique_date_order_64bit_desc.result | 19 + ...dex_multiple_column_unique_date_reinsert.result | 17 + ...ltiple_column_unique_datetime_index_read.result | 20 + ...etime_insert_delete_insert_invalid_value.result | 21 + ...ultiple_column_unique_datetime_order_asc.result | 19 + ...ltiple_column_unique_datetime_order_desc.result | 19 + ...multiple_column_unique_datetime_reinsert.result | 17 + .../r/index_multiple_column_unique_decimal.result | 36 + ...x_multiple_column_unique_time_index_read.result | 22 + ...ex_multiple_column_unique_time_order_asc.result | 21 + ...x_multiple_column_unique_time_order_desc.result | 21 + ...dex_multiple_column_unique_time_reinsert.result | 17 + ...tiple_column_unique_timestamp_index_read.result | 20 + ...ltiple_column_unique_timestamp_order_asc.result | 19 + ...tiple_column_unique_timestamp_order_desc.result | 19 + ...ultiple_column_unique_timestamp_reinsert.result | 17 + .../r/index_multiple_column_unique_varchar.result | Bin 0 -> 1027 bytes ..._multiple_column_unique_year_32bit_equal.result | 25 + ..._multiple_column_unique_year_64bit_equal.result | 16 + ...x_multiple_column_unique_year_index_read.result | 20 + ...tiple_column_unique_year_order_32bit_asc.result | 29 + ...iple_column_unique_year_order_32bit_desc.result | 29 + ...tiple_column_unique_year_order_64bit_asc.result | 19 + ...iple_column_unique_year_order_64bit_desc.result | 19 + ...dex_multiple_column_unique_year_reinsert.result | 17 + .../r/index_multiple_column_update_int.result | 30 + .../r/index_multiple_column_update_string.result | 34 + .../r/index_primary_char_exact_length.result | 16 + .../r/index_primary_char_null_character.result | Bin 0 -> 387 bytes .../storage/r/index_primary_char_short.result | 16 + .../mroonga/storage/r/index_primary_date.result | 21 + ...primary_datetime_with_fractional_seconds.result | 23 + ...mary_datetime_without_fractional_seconds.result | 22 + ..._primary_decimal_with_fractional_seconds.result | 18 + ...imary_decimal_without_fractional_seconds.result | 18 + ...dex_primary_time_with_fractional_seconds.result | 22 + ..._primary_time_without_fractional_seconds.result | 22 + ...rimary_timestamp_with_fractional_seconds.result | 23 + ...ary_timestamp_without_fractional_seconds.result | 19 + .../r/index_primary_varchar_null_character.result | Bin 0 -> 390 bytes .../mroonga/storage/r/index_primary_year.result | 22 + .../r/index_range_normal_greater_than_asc.result | 18 + .../r/index_range_normal_greater_than_desc.result | 18 + ...x_range_normal_greater_than_or_equal_asc.result | 18 + ..._range_normal_greater_than_or_equal_desc.result | 18 + .../r/index_range_normal_less_than_asc.result | 18 + .../r/index_range_normal_less_than_desc.result | 18 + ...ndex_range_normal_less_than_or_equal_asc.result | 18 + ...dex_range_normal_less_than_or_equal_desc.result | 18 + .../r/index_range_primary_greater_than_asc.result | 16 + .../r/index_range_primary_greater_than_desc.result | 15 + ..._range_primary_greater_than_or_equal_asc.result | 16 + ...range_primary_greater_than_or_equal_desc.result | 16 + .../r/index_range_primary_less_than_asc.result | 16 + .../r/index_range_primary_less_than_desc.result | 16 + ...dex_range_primary_less_than_or_equal_asc.result | 16 + ...ex_range_primary_less_than_or_equal_desc.result | 16 + .../storage/r/index_read_multiple_bigint.result | 38 + .../r/index_read_multiple_bigint_unsigned.result | 31 + .../storage/r/index_read_multiple_double.result | 38 + .../storage/r/index_read_multiple_float.result | 38 + .../storage/r/index_read_multiple_int.result | 38 + .../r/index_read_multiple_int_unsigned.result | 31 + .../storage/r/index_read_multiple_mediumint.result | 38 + .../index_read_multiple_mediumint_unsigned.result | 31 + .../storage/r/index_read_multiple_smallint.result | 38 + .../r/index_read_multiple_smallint_unsigned.result | 31 + .../storage/r/index_read_multiple_tinyint.result | 38 + .../r/index_read_multiple_tinyint_unsigned.result | 31 + .../storage/r/index_read_multiple_varchar.result | 29 + .../r/index_read_multiple_varchar_collation.result | 31 + .../mroonga/storage/r/index_read_normal_int.result | 55 + .../storage/r/index_read_normal_varchar.result | 55 + .../storage/r/index_read_primary_int.result | 55 + .../storage/r/index_read_primary_varchar.result | 55 + .../storage/r/index_unique_delete_all.result | 14 + .../r/index_unique_delete_by_primary_key.result | 13 + .../r/index_unique_insert_after_error.result | 15 + .../r/index_unique_search_after_duplicated.result | 18 + .../mroonga/storage/r/index_unique_varchar.result | 15 + .../storage/r/index_update_multiple_column.result | 18 + .../storage/r/index_update_single_column.result | 17 + .../storage/r/information_schema_plugins.result.in | 4 + ...mation_schema_tables_auto_increment_none.result | 10 + ...rmation_schema_tables_auto_increment_use.result | 10 + .../r/information_schema_tables_data_length.result | 17 + .../mroonga/storage/r/insert_TODO_SPLIT_ME.result | 78 + .../mroonga/storage/r/insert_delayed.result | 9 + ...date_no_primary_key_and_unique_key_twice.result | 18 + ...sert_on_duplicate_key_update_primary_key.result | 19 + ...nsert_on_duplicate_key_update_unique_key.result | 24 + .../mroonga/storage/r/insert_virtual_column.result | 13 + .../mroonga/storage/r/like_unicode_ci.result | 13 + .../mroonga/storage/r/lock_tables_read.result | 7 + ...tion_count_skip_after_insert_multithread.result | 19 + ...on_count_skip_after_insert_single_thread.result | 19 + .../r/optimization_count_skip_disabled.result | 24 + .../r/optimization_count_skip_index_and.result | 20 + .../r/optimization_count_skip_index_between.result | 19 + .../r/optimization_count_skip_index_equal.result | 18 + ...p_index_full_text_search_in_boolean_mode.result | 19 + ...ull_text_search_in_natural_language_mode.result | 19 + .../r/optimization_count_skip_index_greater.result | 19 + ...imization_count_skip_index_greater_equal.result | 19 + .../r/optimization_count_skip_index_less.result | 19 + ...optimization_count_skip_index_less_equal.result | 19 + .../optimization_count_skip_index_not_equal.result | 18 + .../r/optimization_count_skip_index_view.result | 28 + ...imization_count_skip_multiple_conditions.result | 17 + ...imization_count_skip_primary_key_between.result | 18 + ...ptimization_count_skip_primary_key_equal.result | 17 + ...imization_count_skip_primary_key_greater.result | 18 + ...ion_count_skip_primary_key_greater_equal.result | 18 + ...optimization_count_skip_primary_key_less.result | 17 + ...zation_count_skip_primary_key_less_equal.result | 17 + ...ization_count_skip_primary_key_not_equal.result | 17 + ...ation_order_limit_not_optimized_disabled.result | 34 + ...it_not_optimized_multiple_match_againsts.result | 35 + ...ation_order_limit_not_optimized_no_limit.result | 34 + ...optimization_order_limit_optimized_cp932.result | 22 + ...n_order_limit_optimized_datetime_between.result | 26 + ...er_limit_optimized_datetime_between_over.result | 26 + ...ion_order_limit_optimized_datetime_equal.result | 26 + ...er_limit_optimized_datetime_greater_than.result | 26 + ...optimized_datetime_greater_than_or_equal.result | 26 + ...order_limit_optimized_datetime_less_than.result | 26 + ...it_optimized_datetime_less_than_or_equal.result | 26 + ...it_optimized_duplicated_order_by_columns.result | 19 + ...mization_order_limit_optimized_enum_name.result | 25 + ...ization_order_limit_optimized_enum_value.result | 25 + ...n_order_limit_optimized_have_primary_key.result | 30 + ...zation_order_limit_optimized_int_between.result | 25 + ...n_order_limit_optimized_int_between_over.result | 25 + ...mization_order_limit_optimized_int_equal.result | 32 + ...n_order_limit_optimized_int_greater_than.result | 32 + ...imit_optimized_int_greater_than_or_equal.result | 32 + ...tion_order_limit_optimized_int_less_than.result | 32 + ...r_limit_optimized_int_less_than_or_equal.result | 32 + ...ion_order_limit_optimized_no_primary_key.result | 30 + ...on_order_limit_optimized_no_where_clause.result | 19 + ...ation_order_limit_optimized_order_by_asc.result | 30 + ...tion_order_limit_optimized_order_by_desc.result | 30 + ...zation_order_limit_optimized_order_by_id.result | 32 + ...r_limit_optimized_order_by_match_against.result | 31 + ...der_limit_optimized_select_match_against.result | 32 + ...ation_order_limit_optimized_time_between.result | 26 + ..._order_limit_optimized_time_between_over.result | 26 + ...ization_order_limit_optimized_time_equal.result | 26 + ..._order_limit_optimized_time_greater_than.result | 26 + ...mit_optimized_time_greater_than_or_equal.result | 26 + ...ion_order_limit_optimized_time_less_than.result | 26 + ..._limit_optimized_time_less_than_or_equal.result | 26 + ...limit_optimized_varchar_equal_with_index.result | 32 + ...it_optimized_varchar_equal_without_index.result | 31 + ...ation_order_limit_optimized_year_between.result | 30 + ..._order_limit_optimized_year_between_over.result | 30 + ...ization_order_limit_optimized_year_equal.result | 32 + ..._order_limit_optimized_year_greater_than.result | 30 + ...mit_optimized_year_greater_than_or_equal.result | 30 + ...ion_order_limit_optimized_year_less_than.result | 30 + ..._limit_optimized_year_less_than_or_equal.result | 30 + .../mroonga/storage/r/partition_insert.result | 42 + .../mroonga/storage/r/partition_update.result | 43 + .../storage/r/repair_table_no_index_file.result | 31 + .../mroonga/storage/r/replace_geometry.result | 23 + .../storage/r/replace_select_varchar.result | 40 + .../mroonga/storage/r/replace_text.result | 25 + .../mroonga/storage/r/replace_varchar.result | 25 + .../mroonga/storage/r/replace_vector.result | 29 + .../mroonga/storage/r/replace_without_key.result | 10 + .../mysql-test/mroonga/storage/r/select_all.result | 198 + .../storage/r/select_empty_key_where_equal.result | 12 + .../r/select_empty_key_where_not_equal.result | 13 + .../storage/r/select_group_by_with_index.result | 15 + .../storage/r/select_group_by_without_index.result | 14 + .../mroonga/storage/r/select_pkey.result | 27 + .../mroonga/storage/r/select_secondary_key.result | 55 + .../r/show_create_table_TODO_SPLIT_ME.result | 25 + .../mroonga/storage/r/sub_query_fulltext.result | 35 + .../mroonga/storage/r/temporary_table.result | 14 + .../mysql-test/mroonga/storage/r/truncate.result | 47 + .../mroonga/storage/r/update_binlog_row.result | 16 + .../mroonga/storage/r/update_fulltext.result | 22 + .../mroonga/storage/r/update_id_hash_index.result | 20 + .../storage/r/update_id_unique_hash_index.result | 20 + .../mysql-test/mroonga/storage/r/update_int.result | 42 + .../storage/r/update_last_insert_grn_id.result | 29 + .../mroonga/storage/r/update_virtual_column.result | 29 + ...e_boolean_mode_syntax_flags_allow_column.result | 18 + ...lean_mode_syntax_flags_allow_leading_not.result | 16 + ...e_boolean_mode_syntax_flags_allow_update.result | 18 + ...e_boolean_mode_syntax_flags_syntax_query.result | 15 + ..._boolean_mode_syntax_flags_syntax_script.result | 16 + .../storage/r/variable_database_path_prefix.result | 17 + .../r/variable_default_parser_new_value.result | 6 + .../r/variable_default_parser_same_value.result | 4 + .../r/variable_default_tokenizer_new_value.result | 6 + .../r/variable_default_tokenizer_same_value.result | 4 + .../storage/r/variable_dry_write_delete.result | 20 + .../storage/r/variable_dry_write_insert.result | 22 + .../storage/r/variable_dry_write_update.result | 18 + ...iable_enable_operations_recording_insert.result | 32 + .../storage/r/variable_lock_timeout_disable.result | 4 + .../storage/r/variable_lock_timeout_invalid.result | 6 + .../r/variable_lock_timeout_no_retry.result | 4 + .../storage/r/variable_lock_timeout_valid.result | 4 + .../storage/r/variable_log_file_new_value.result | 6 + .../r/variable_log_file_nonexistent_path.result | 4 + .../storage/r/variable_log_file_same_value.result | 4 + .../r/variable_log_level_TODO_SPLIT_ME.result | 49 + ...riable_match_escalation_threshold_global.result | 24 + ...iable_match_escalation_threshold_session.result | 24 + ...riable_max_n_records_for_estimate_global.result | 20 + ...s_for_estimate_mysql_5_7_or_later_global.result | 22 + ...te_mysql_5_7_or_later_not_found_in_limit.result | 17 + ..._for_estimate_mysql_5_7_or_later_session.result | 22 + ..._records_for_estimate_not_found_in_limit.result | 16 + ...iable_max_n_records_for_estimate_session.result | 20 + ...able_query_log_file_disabled_empty_value.result | 9 + ...iable_query_log_file_disabled_null_value.result | 9 + ...iable_query_log_file_enabled_empty_value.result | 10 + ...riable_query_log_file_enabled_null_value.result | 10 + .../r/variable_query_log_file_new_value.result | 9 + .../r/variable_query_log_file_same_value.result | 10 + .../r/variable_vector_column_delimiter.result | 29 + .../mroonga/storage/r/variable_version.result.in | 3 + .../mroonga/mysql-test/mroonga/storage/suite.opt | 1 + .../mroonga/mysql-test/mroonga/storage/suite.pm | 23 + .../storage/t/alter_table_add_column_after.test | 38 + .../storage/t/alter_table_add_column_first.test | 38 + .../t/alter_table_add_column_flags_comment.test | 38 + .../t/alter_table_add_column_flags_parameter.test | 41 + ...lter_table_add_column_groonga_type_comment.test | 44 + ...er_table_add_column_groonga_type_parameter.test | 47 + .../t/alter_table_add_column_multibyte_cp932.test | 53 + .../t/alter_table_add_column_multibyte_utf8.test | 53 + .../storage/t/alter_table_add_column_multiple.test | 50 + .../storage/t/alter_table_add_column_plain.test | 45 + .../t/alter_table_add_column_type_comment.test | 43 + ...e_add_index_token_filters_one_token_filter.test | 42 + .../t/alter_table_add_index_unique_duplicated.test | 38 + ...dd_index_unique_multiple_column_duplicated.test | 39 + ...er_table_add_key_multiple_column_with_data.test | 45 + .../storage/t/alter_table_add_primary_key.test | 37 + ...able_change_column_comment_not_for_mroonga.test | 39 + .../t/alter_table_change_column_have_index.test | 35 + .../t/alter_table_change_column_rename_after.test | 39 + .../t/alter_table_change_column_rename_first.test | 39 + .../alter_table_change_column_rename_multiple.test | 43 + .../alter_table_change_column_rename_no_order.test | 39 + .../t/alter_table_change_engine_decimal.test | 45 + .../alter_table_change_engine_fulltext_index.test | 58 + .../storage/t/alter_table_change_token_filter.test | 55 + .../alter_table_disable_keys_create_fulltext.test | 55 + .../t/alter_table_disable_keys_fulltext_table.test | 46 + .../t/alter_table_disable_keys_fulltext_ujis.test | 49 + .../t/alter_table_disable_keys_fulltext_utf8.test | 49 + .../alter_table_disable_keys_multiple_column.test | 51 + .../storage/t/alter_table_disable_keys_normal.test | 49 + .../t/alter_table_disable_keys_primary.test | 47 + .../t/alter_table_disable_keys_truncate.test | 45 + .../t/alter_table_disable_keys_updating.test | 41 + .../t/alter_table_drop_column_multiple.test | 45 + .../storage/t/alter_table_drop_column_one.test | 44 + ...r_table_drop_key_multiple_column_with_data.test | 46 + .../storage/t/alter_table_drop_primary_key.test | 37 + .../t/alter_table_enable_keys_fulltext.test | 51 + .../t/alter_table_enable_keys_fulltext_table.test | 47 + .../t/alter_table_enable_keys_fulltext_ujis.test | 51 + .../t/alter_table_enable_keys_fulltext_utf8.test | 51 + .../t/alter_table_enable_keys_multiple_column.test | 53 + .../storage/t/alter_table_enable_keys_normal.test | 51 + .../storage/t/alter_table_enable_keys_primary.test | 49 + .../t/alter_table_fulltext_add_no_primary_key.test | 39 + .../storage/t/alter_table_fulltext_add_normal.test | 39 + .../storage/t/alter_table_fulltext_add_table.test | 47 + .../storage/t/alter_table_fulltext_drop_table.test | 48 + .../storage/t/alter_table_modify_column_after.test | 42 + .../storage/t/alter_table_modify_column_first.test | 42 + .../t/alter_table_modify_column_no_order.test | 42 + ...ter_table_recreate_anonymous_index_at_once.test | 48 + .../storage/t/alter_table_rename_table.test | 53 + .../mroonga/storage/t/alter_table_spatial.test | 151 + .../storage/t/auto_increment_TODO_SPLIT_ME.test | 53 + .../storage/t/auto_increment_table_param.test | 49 + .../mroonga/storage/t/auto_increment_text.test | 33 + .../mroonga/storage/t/binlog_TODO_SPLIT_ME.test | 53 + .../mroonga/storage/t/check_table_broken.test | 45 + .../mroonga/storage/t/check_table_not_broken.test | 38 + .../t/collation_utf8_general_ci_french.test | 35 + .../t/collation_utf8_unicode_520_ci_french.test | 36 + .../t/collation_utf8_unicode_520_ci_japanese.test | 37 + .../t/collation_utf8_unicode_ci_french.test | 35 + .../t/collation_utf8_unicode_ci_japanese.test | 35 + .../t/column_comment_index_not_for_mroonga.test | 34 + .../t/column_comment_normal_not_for_mroonga.test | 34 + .../mroonga/storage/t/column_date_with_index.test | 41 + .../storage/t/column_date_without_index.test | 40 + .../mroonga/storage/t/column_date_zero_date.test | 42 + .../storage/t/column_datetime_32bit_2038.test | 39 + .../t/column_datetime_32bit_before_unix_epoch.test | 37 + .../storage/t/column_datetime_32bit_max.test | 37 + .../t/column_datetime_32bit_out_of_range.test | 37 + .../storage/t/column_datetime_64bit_2038.test | 39 + .../t/column_datetime_64bit_before_unix_epoch.test | 39 + .../storage/t/column_datetime_64bit_max.test | 37 + ...atetime_64bit_strict_sql_mode_out_of_range.test | 41 + ...mn_datetime_64bit_version_5_5_out_of_range.test | 39 + ...me_64bit_version_5_6_or_later_out_of_range.test | 41 + ...umn_datetime_fractional_seconds_with_index.test | 46 + ..._datetime_fractional_seconds_without_index.test | 45 + .../column_datetime_freebsd_before_unix_epoch.test | 37 + ...n_datetime_mariadb_10_2_or_later_zero_date.test | 39 + ...etime_mariadb_10_2_or_later_zero_month_day.test | 39 + ...lumn_datetime_mysql_5_7_or_later_zero_date.test | 39 + ...datetime_mysql_5_7_or_later_zero_month_day.test | 39 + .../mroonga/storage/t/column_datetime_null.test | 36 + .../storage/t/column_datetime_with_index.test | 44 + .../storage/t/column_datetime_without_index.test | 43 + .../storage/t/column_datetime_zero_date.test | 42 + .../storage/t/column_datetime_zero_month_day.test | 39 + ...lumn_decimal_fractional_seconds_with_index.test | 40 + ...n_decimal_fractional_seconds_without_index.test | 39 + .../storage/t/column_decimal_with_index.test | 40 + .../storage/t/column_decimal_without_index.test | 39 + .../storage/t/column_enum_less_with_index.test | 41 + .../storage/t/column_enum_many_with_index.test | 298 + .../t/column_generated_stored_add_column.test | 41 + .../storage/t/column_generated_stored_delete.test | 42 + .../t/column_generated_stored_drop_column.test | 42 + .../storage/t/column_generated_stored_insert.test | 40 + .../storage/t/column_generated_stored_reindex.test | 42 + .../storage/t/column_generated_stored_update.test | 42 + .../t/column_generated_virtual_add_column.test | 41 + .../storage/t/column_generated_virtual_delete.test | 41 + .../t/column_generated_virtual_drop_column.test | 41 + .../storage/t/column_generated_virtual_insert.test | 39 + ...ed_virtual_mariadb_10_2_or_later_add_index.test | 35 + ...iadb_10_2_or_later_create_table_with_index.test | 32 + ...rated_virtual_mysql_5_7_or_later_add_index.test | 35 + .../storage/t/column_generated_virtual_update.test | 41 + .../mroonga/storage/t/column_groonga__id__id.test | 34 + .../storage/t/column_groonga__id_invalid_id.test | 34 + .../column_groonga_index_fulltext_other_table.test | 42 + ..._groonga_index_fulltext_vector_other_table.test | 54 + .../t/column_groonga_index_int_other_table.test | 55 + .../storage/t/column_groonga_scalar_reference.test | 45 + .../t/column_groonga_scalar_support_lz4.test | 37 + .../t/column_groonga_scalar_support_zlib.test | 37 + .../t/column_groonga_scalar_support_zstd.test | 37 + .../t/column_groonga_scalar_unsupport_lz4.test | 37 + .../t/column_groonga_scalar_unsupport_zlib.test | 37 + .../t/column_groonga_scalar_unsupport_zstd.test | 37 + ...roonga_scalar_with_not_for_mroonga_comment.test | 48 + ...lumn_groonga_vector_order_by_with_function.test | 45 + .../storage/t/column_groonga_vector_reference.test | 45 + .../t/column_int_with_index_zero_value.test | 40 + .../mroonga/storage/t/column_json_insert.test | 37 + .../mroonga/storage/t/column_multibyte_cp932.test | 51 + .../mroonga/storage/t/column_multibyte_utf8.test | 51 + .../storage/t/column_set_16_with_index.test | 56 + .../storage/t/column_set_24_with_index.test | 65 + .../storage/t/column_set_32_with_index.test | 74 + .../storage/t/column_set_64_with_index.test | 110 + .../mroonga/storage/t/column_set_8_with_index.test | 47 + .../storage/t/column_signed_bigint_with_index.test | 42 + .../storage/t/column_signed_int_with_index.test | 42 + .../t/column_signed_mediumint_with_index.test | 42 + .../t/column_signed_smallint_with_index.test | 41 + .../t/column_signed_tinyint_with_index.test | 38 + .../column_time_fractional_seconds_with_index.test | 49 + .../mroonga/storage/t/column_time_with_index.test | 48 + ...mn_timestamp_fractional_seconds_with_index.test | 54 + .../storage/t/column_timestamp_with_index.test | 45 + .../storage/t/column_tinyint_without_index.test | 35 + .../t/column_unsigned_bigint_with_index.test | 42 + .../t/column_unsigned_bigint_without_index.test | 38 + .../storage/t/column_unsigned_int_with_index.test | 42 + .../t/column_unsigned_mediumint_with_index.test | 42 + .../t/column_unsigned_smallint_with_index.test | 41 + .../t/column_unsigned_tinyint_with_index.test | 38 + .../mroonga/storage/t/column_year_with_index.test | 46 + .../storage/t/column_year_without_index.test | 45 + .../mysql-test/mroonga/storage/t/count_star.test | 35 + .../storage/t/create_database_name_slash.test | 60 + .../storage/t/create_table_TODO_SPLIT_ME.test | 149 + .../t/create_table_column_flags_comment.test | 37 + .../t/create_table_column_flags_parameter.test | 38 + .../create_table_column_groonga_type_comment.test | 42 + ...eate_table_column_groonga_type_nonexistent.test | 29 + ...create_table_column_groonga_type_parameter.test | 45 + .../t/create_table_column_type_comment.test | 42 + .../t/create_table_column_type_nonexistent.test | 29 + .../storage/t/create_table_comment_normal.test | 34 + .../storage/t/create_table_default_tokenizer.test | 38 + .../t/create_table_index_flags_comment.test | 39 + .../t/create_table_index_flags_index_medium.test | 39 + .../t/create_table_index_flags_index_small.test | 39 + .../storage/t/create_table_index_flags_none.test | 39 + .../t/create_table_index_flags_parameter.test | 41 + .../t/create_table_index_index_flags_none.test | 38 + ..._index_flags_with_position_and_with_weight.test | 38 + .../t/create_table_index_normalizer_comment.test | 42 + ..._table_index_normalizer_fulltext_index_bin.test | 42 + .../t/create_table_index_normalizer_index_bin.test | 37 + ...lizer_no_utf8_charset_with_utf8_normalizer.test | 40 + .../t/create_table_index_normalizer_none.test | 42 + .../t/create_table_index_normalizer_parameter.test | 40 + .../t/create_table_index_parser_comment.test | 42 + .../t/create_table_index_parser_default.test | 40 + .../storage/t/create_table_index_parser_off.test | 47 + ...index_token_filters_multiple_token_filters.test | 41 + ...table_index_token_filters_one_token_filter.test | 41 + ...create_table_index_token_filters_parameter.test | 44 + .../t/create_table_index_tokenizer_comment.test | 41 + .../t/create_table_index_tokenizer_default.test | 40 + .../t/create_table_index_tokenizer_off.test | 46 + .../t/create_table_index_tokenizer_parameter.test | 41 + .../t/create_table_table_normalizer_default.test | 46 + .../t/create_table_table_normalizer_hash.test | 47 + ...table_token_filters_multiple_token_filters.test | 46 + ...table_table_token_filters_one_token_filter.test | 46 + ...create_table_table_token_filters_stop_word.test | 53 + .../mroonga/storage/t/delete_fulltext_column.test | 36 + .../storage/t/delete_index_btree_many_records.test | 46 + .../storage/t/delete_index_hash_id_no_unique.test | 33 + .../storage/t/delete_index_hash_id_unique.test | 33 + .../mroonga/storage/t/delete_normal_column.test | 44 + .../mroonga/storage/t/delete_unsigned_bigint.test | 37 + .../storage/t/drop_database_TODO_SPLIT_ME.test | 40 + .../mroonga/storage/t/drop_database_no_table.test | 57 + .../storage/t/drop_table_TODO_SPLIT_ME.test | 29 + .../mysql-test/mroonga/storage/t/flush_logs.test | 21 + .../mroonga/storage/t/foreign_key_alter_add.test | 47 + .../mroonga/storage/t/foreign_key_alter_drop.test | 48 + .../mroonga/storage/t/foreign_key_create.test | 46 + .../storage/t/foreign_key_delete_existent.test | 53 + .../storage/t/foreign_key_delete_nonexistent.test | 53 + .../storage/t/foreign_key_insert_existent.test | 51 + .../storage/t/foreign_key_insert_nonexistent.test | 51 + .../mroonga/storage/t/foreign_key_rename.test | 51 + .../storage/t/foreign_key_update_existent.test | 53 + .../storage/t/foreign_key_update_nonexistent.test | 53 + .../t/fulltext_boolean_mode_empty_query.test | 41 + .../storage/t/fulltext_boolean_mode_escape.test | 43 + .../t/fulltext_boolean_mode_leading_not.test | 39 + .../t/fulltext_boolean_mode_pragma_all.test | 44 + ..._pragma_default_operator_minus_no_operator.test | 42 + ...mode_pragma_default_operator_minus_with_or.test | 42 + ...de_pragma_default_operator_minus_with_plus.test | 42 + ...ode_pragma_default_operator_or_no_operator.test | 42 + ...mode_pragma_default_operator_or_with_minus.test | 42 + ..._mode_pragma_default_operator_or_with_plus.test | 42 + ...e_pragma_default_operator_plus_no_operator.test | 39 + ...pragma_default_operator_plus_with_astarisk.test | 38 + ...de_pragma_default_operator_plus_with_minus.test | 39 + ..._mode_pragma_default_operator_plus_with_or.test | 39 + ...boolean_mode_pragma_syntax_script_operator.test | 43 + ...boolean_mode_pragma_syntax_script_selector.test | 50 + ...ltext_boolean_mode_pragma_weight_full_spec.test | 43 + ...ltext_boolean_mode_pragma_weight_no_weight.test | 43 + ...xt_boolean_mode_pragma_weight_omit_section.test | 43 + ...an_mode_pragma_weight_ten_or_more_sections.test | 63 + ..._mode_pragma_weight_three_or_more_sections.test | 44 + .../fulltext_boolean_mode_syntax_error_error.test | 45 + ...xt_boolean_mode_syntax_error_error_and_log.test | 45 + .../fulltext_boolean_mode_syntax_error_ignore.test | 44 + ...t_boolean_mode_syntax_error_ignore_and_log.test | 44 + .../mroonga/storage/t/fulltext_charset_ascii.test | 36 + .../mroonga/storage/t/fulltext_charset_cp932.test | 34 + .../storage/t/fulltext_charset_eucjpms.test | 34 + .../storage/t/fulltext_charset_japanese.test | 33 + .../storage/t/fulltext_charset_utf8mb4.test | 41 + .../mroonga/storage/t/fulltext_empty_query.test | 41 + .../mroonga/storage/t/fulltext_found_rows.test | 48 + .../storage/t/fulltext_groonga_varchar_vector.test | 47 + .../mroonga/storage/t/fulltext_index_recreate.test | 43 + .../mroonga/storage/t/fulltext_insert_select.test | 41 + .../mroonga/storage/t/fulltext_insert_values.test | 32 + .../t/fulltext_multiple_column_index_delete.test | 41 + .../t/fulltext_multiple_column_index_insert.test | 41 + .../t/fulltext_multiple_column_index_recreate.test | 49 + .../t/fulltext_multiple_column_index_update.test | 42 + .../mroonga/storage/t/fulltext_multiple_index.test | 46 + .../mroonga/storage/t/fulltext_no_primary_key.test | 38 + .../storage/t/fulltext_not_match_against.test | 47 + .../mysql-test/mroonga/storage/t/fulltext_or.test | 42 + ...ltext_order_boolean_mode_different_against.test | 42 + ...ulltext_order_boolean_mode_different_match.test | 44 + .../t/fulltext_order_boolean_mode_no_where.test | 41 + ...text_order_boolean_mode_same_match_against.test | 42 + .../fulltext_order_natural_language_mode_asc.test | 47 + .../fulltext_order_natural_language_mode_desc.test | 47 + ...er_natural_language_mode_different_against.test | 47 + ...rder_natural_language_mode_different_match.test | 49 + ...ltext_order_natural_language_mode_no_where.test | 46 + ...r_natural_language_mode_same_match_against.test | 47 + .../mroonga/storage/t/fulltext_two_inner_join.test | 69 + .../t/fulltext_version_10_0_no_such_key.test | 43 + .../t/fulltext_version_5_5_no_such_key.test | 42 + .../t/fulltext_version_5_6_no_such_key.test | 43 + .../storage/t/function_command_auto-escape.test | 41 + .../mroonga/storage/t/function_command_select.test | 41 + .../t/function_command_special-database-name.test | 43 + .../t/function_escape_error_query_is_missing.test | 27 + .../function_escape_error_query_is_not_string.test | 27 + ...cape_error_target_characters_is_not_string.test | 27 + .../storage/t/function_escape_query_all.test | 26 + .../storage/t/function_escape_query_custom.test | 26 + .../storage/t/function_escape_query_join.test | 54 + .../t/function_escape_query_match_against.test | 46 + .../storage/t/function_escape_query_named.test | 26 + .../storage/t/function_escape_query_nested.test | 40 + .../storage/t/function_escape_script_decimal.test | 39 + .../storage/t/function_escape_script_integer.test | 26 + .../storage/t/function_escape_script_real.test | 39 + .../storage/t/function_escape_script_string.test | 26 + .../t/function_highlight_html_dynamic_keyword.test | 45 + .../t/function_highlight_html_japanese.test | 31 + .../function_highlight_html_multiple_keywords.test | 25 + .../t/function_highlight_html_normalizer.test | 25 + .../storage/t/function_highlight_html_query.test | 31 + .../t/function_highlight_html_query_pragma.test | 31 + .../storage/t/function_highlight_html_record.test | 55 + .../storage/t/function_last_insert_grn_id.test | 48 + .../t/function_last_insert_id_reference.test | 35 + .../storage/t/function_last_insert_id_set.test | 37 + .../storage/t/function_normalize_default.test | 24 + .../storage/t/function_normalize_normalizer.test | 24 + .../storage/t/function_normalize_record.test | 40 + .../storage/t/function_query_expand_multiple.test | 46 + .../storage/t/function_query_expand_no_index.test | 43 + .../storage/t/function_query_expand_one.test | 44 + .../storage/t/function_query_expand_pragma.test | 45 + .../mroonga/storage/t/function_snippet_ascii.test | 43 + .../mroonga/storage/t/function_snippet_cp932.test | 43 + .../storage/t/function_snippet_eucjpms.test | 43 + .../t/function_snippet_html_dynamic_keyword.test | 45 + .../storage/t/function_snippet_html_japanese.test | 31 + .../t/function_snippet_html_multiple_keywords.test | 25 + .../t/function_snippet_html_multiple_snippets.test | 29 + .../storage/t/function_snippet_html_query.test | 31 + .../t/function_snippet_html_query_pragma.test | 31 + .../storage/t/function_snippet_html_record.test | 55 + ...nction_snippet_invalid_nonexistent_charset.test | 28 + ...nction_snippet_invalid_unsupported_charset.test | 28 + .../storage/t/function_snippet_japanese.test | 41 + .../storage/t/geometry_bulk_insert_null.test | 36 + .../mroonga/storage/t/geometry_contains.test | 154 + .../geometry_strict_sql_mode_bulk_insert_null.test | 37 + .../t/geometry_strict_sql_mode_contains.test | 152 + .../mroonga/mysql-test/mroonga/storage/t/i_s.test | 23 + .../storage/t/index_btree_equal_datetime.test | 44 + .../mroonga/storage/t/index_btree_equal_time.test | 40 + .../storage/t/index_btree_equal_timestamp.test | 40 + .../t/index_btree_normal_column_insert.test | 33 + .../mroonga/storage/t/index_hash_id_normal.test | 33 + .../mroonga/storage/t/index_hash_id_primary.test | 40 + .../mroonga/storage/t/index_hash_id_unique.test | 33 + .../storage/t/index_hash_normal_column_insert.test | 33 + .../t/index_hash_strict_sql_mode_id_primary.test | 44 + .../storage/t/index_multiple_column_delete.test | 40 + .../t/index_multiple_column_nullable_smallint.test | 53 + ...x_multiple_column_nullable_unsigned_bigint.test | 53 + ...ndex_multiple_column_nullable_unsigned_int.test | 53 + ...multiple_column_nullable_unsigned_smallint.test | 53 + .../t/index_multiple_column_nullable_varchar.test | 53 + ...ltiple_column_order_by_where_equal_asc_asc.test | 49 + ...iple_column_order_by_where_equal_desc_desc.test | 49 + .../t/index_multiple_column_primary_delete.test | 39 + .../index_multiple_column_primary_select_int.test | 40 + ...iple_column_primary_strict_sql_mode_update.test | 47 + .../t/index_multiple_column_primary_update.test | 46 + ...ultiple_column_range_all_used_greater_than.test | 44 + ...olumn_range_all_used_greater_than_or_equal.test | 44 + ...x_multiple_column_range_all_used_less_than.test | 44 + ...e_column_range_all_used_less_than_or_equal.test | 44 + ...ge_partially_used_have_prefix_greater_than.test | 50 + ...lly_used_have_prefix_greater_than_or_equal.test | 50 + ...range_partially_used_have_prefix_less_than.test | 50 + ...tially_used_have_prefix_less_than_or_equal.test | 50 + ...ange_partially_used_no_prefix_greater_than.test | 44 + ...ially_used_no_prefix_greater_than_or_equal.test | 44 + ...n_range_partially_used_no_prefix_less_than.test | 44 + ...artially_used_no_prefix_less_than_or_equal.test | 45 + .../storage/t/index_multiple_column_recreate.test | 50 + .../storage/t/index_multiple_column_replace.test | 43 + .../t/index_multiple_column_select_double.test | 43 + .../t/index_multiple_column_select_float.test | 43 + .../t/index_multiple_column_select_int.test | 46 + .../t/index_multiple_column_select_max.test | 44 + .../t/index_multiple_column_select_min.test | 44 + .../t/index_multiple_column_select_string.test | 41 + .../t/index_multiple_column_select_varchar.test | 44 + ...ex_multiple_column_unique_date_32bit_equal.test | 42 + ...ex_multiple_column_unique_date_64bit_equal.test | 44 + ...dex_multiple_column_unique_date_index_read.test | 45 + ...ultiple_column_unique_date_order_32bit_asc.test | 42 + ...ltiple_column_unique_date_order_32bit_desc.test | 42 + ...ultiple_column_unique_date_order_64bit_asc.test | 44 + ...ltiple_column_unique_date_order_64bit_desc.test | 44 + ...index_multiple_column_unique_date_reinsert.test | 40 + ...multiple_column_unique_datetime_index_read.test | 45 + ...atetime_insert_delete_insert_invalid_value.test | 40 + ..._multiple_column_unique_datetime_order_asc.test | 44 + ...multiple_column_unique_datetime_order_desc.test | 44 + ...x_multiple_column_unique_datetime_reinsert.test | 40 + .../t/index_multiple_column_unique_decimal.test | 39 + ...dex_multiple_column_unique_time_index_read.test | 43 + ...ndex_multiple_column_unique_time_order_asc.test | 43 + ...dex_multiple_column_unique_time_order_desc.test | 43 + ...index_multiple_column_unique_time_reinsert.test | 40 + ...ultiple_column_unique_timestamp_index_read.test | 42 + ...multiple_column_unique_timestamp_order_asc.test | 42 + ...ultiple_column_unique_timestamp_order_desc.test | 42 + ..._multiple_column_unique_timestamp_reinsert.test | 40 + .../t/index_multiple_column_unique_varchar.test | 39 + ...ex_multiple_column_unique_year_32bit_equal.test | 42 + ...ex_multiple_column_unique_year_64bit_equal.test | 42 + ...dex_multiple_column_unique_year_index_read.test | 43 + ...ultiple_column_unique_year_order_32bit_asc.test | 42 + ...ltiple_column_unique_year_order_32bit_desc.test | 42 + ...ultiple_column_unique_year_order_64bit_asc.test | 42 + ...ltiple_column_unique_year_order_64bit_desc.test | 42 + ...index_multiple_column_unique_year_reinsert.test | 40 + .../t/index_multiple_column_update_int.test | 43 + .../t/index_multiple_column_update_string.test | 40 + .../storage/t/index_primary_char_exact_length.test | 38 + .../t/index_primary_char_null_character.test | 37 + .../storage/t/index_primary_char_short.test | 37 + .../mroonga/storage/t/index_primary_date.test | 41 + ...x_primary_datetime_with_fractional_seconds.test | 44 + ...rimary_datetime_without_fractional_seconds.test | 42 + ...ex_primary_decimal_with_fractional_seconds.test | 38 + ...primary_decimal_without_fractional_seconds.test | 38 + ...index_primary_time_with_fractional_seconds.test | 43 + ...ex_primary_time_without_fractional_seconds.test | 42 + ..._primary_timestamp_with_fractional_seconds.test | 45 + ...imary_timestamp_without_fractional_seconds.test | 39 + .../t/index_primary_varchar_null_character.test | 37 + .../mroonga/storage/t/index_primary_year.test | 42 + .../t/index_range_normal_greater_than_asc.test | 41 + .../t/index_range_normal_greater_than_desc.test | 41 + ...dex_range_normal_greater_than_or_equal_asc.test | 41 + ...ex_range_normal_greater_than_or_equal_desc.test | 41 + .../t/index_range_normal_less_than_asc.test | 41 + .../t/index_range_normal_less_than_desc.test | 41 + .../index_range_normal_less_than_or_equal_asc.test | 41 + ...index_range_normal_less_than_or_equal_desc.test | 41 + .../t/index_range_primary_greater_than_asc.test | 39 + .../t/index_range_primary_greater_than_desc.test | 39 + ...ex_range_primary_greater_than_or_equal_asc.test | 39 + ...x_range_primary_greater_than_or_equal_desc.test | 39 + .../t/index_range_primary_less_than_asc.test | 39 + .../t/index_range_primary_less_than_desc.test | 39 + ...index_range_primary_less_than_or_equal_asc.test | 39 + ...ndex_range_primary_less_than_or_equal_desc.test | 39 + .../storage/t/index_read_multiple_bigint.test | 45 + .../t/index_read_multiple_bigint_unsigned.test | 43 + .../storage/t/index_read_multiple_double.test | 45 + .../storage/t/index_read_multiple_float.test | 45 + .../mroonga/storage/t/index_read_multiple_int.test | 46 + .../t/index_read_multiple_int_unsigned.test | 43 + .../storage/t/index_read_multiple_mediumint.test | 45 + .../t/index_read_multiple_mediumint_unsigned.test | 43 + .../storage/t/index_read_multiple_smallint.test | 45 + .../t/index_read_multiple_smallint_unsigned.test | 43 + .../storage/t/index_read_multiple_tinyint.test | 45 + .../t/index_read_multiple_tinyint_unsigned.test | 43 + .../storage/t/index_read_multiple_varchar.test | 44 + .../t/index_read_multiple_varchar_collation.test | 43 + .../mroonga/storage/t/index_read_normal_int.test | 41 + .../storage/t/index_read_normal_varchar.test | 41 + .../mroonga/storage/t/index_read_primary_int.test | 41 + .../storage/t/index_read_primary_varchar.test | 41 + .../mroonga/storage/t/index_unique_delete_all.test | 39 + .../t/index_unique_delete_by_primary_key.test | 37 + .../storage/t/index_unique_insert_after_error.test | 38 + .../t/index_unique_search_after_duplicated.test | 40 + .../mroonga/storage/t/index_unique_varchar.test | 36 + .../storage/t/index_update_multiple_column.test | 40 + .../storage/t/index_update_single_column.test | 39 + .../storage/t/information_schema_plugins.test | 22 + ...ormation_schema_tables_auto_increment_none.test | 34 + ...formation_schema_tables_auto_increment_use.test | 34 + .../t/information_schema_tables_data_length.test | 41 + .../mroonga/storage/t/insert_TODO_SPLIT_ME.test | 89 + .../mroonga/storage/t/insert_delayed.test | 38 + ...update_no_primary_key_and_unique_key_twice.test | 41 + ...insert_on_duplicate_key_update_primary_key.test | 42 + .../insert_on_duplicate_key_update_unique_key.test | 47 + .../mroonga/storage/t/insert_virtual_column.test | 42 + .../mroonga/storage/t/like_unicode_ci.test | 37 + .../mroonga/storage/t/lock_tables_read.test | 32 + ...zation_count_skip_after_insert_multithread.test | 51 + ...tion_count_skip_after_insert_single_thread.test | 40 + .../t/optimization_count_skip_disabled.test | 50 + .../t/optimization_count_skip_index_and.test | 44 + .../t/optimization_count_skip_index_between.test | 43 + .../t/optimization_count_skip_index_equal.test | 42 + ...kip_index_full_text_search_in_boolean_mode.test | 43 + ..._full_text_search_in_natural_language_mode.test | 43 + .../t/optimization_count_skip_index_greater.test | 43 + ...ptimization_count_skip_index_greater_equal.test | 43 + .../t/optimization_count_skip_index_less.test | 43 + .../optimization_count_skip_index_less_equal.test | 43 + .../t/optimization_count_skip_index_not_equal.test | 42 + .../t/optimization_count_skip_index_view.test | 56 + ...ptimization_count_skip_multiple_conditions.test | 41 + ...ptimization_count_skip_primary_key_between.test | 42 + .../optimization_count_skip_primary_key_equal.test | 41 + ...ptimization_count_skip_primary_key_greater.test | 41 + ...ation_count_skip_primary_key_greater_equal.test | 42 + .../optimization_count_skip_primary_key_less.test | 41 + ...mization_count_skip_primary_key_less_equal.test | 41 + ...imization_count_skip_primary_key_not_equal.test | 41 + ...ization_order_limit_not_optimized_disabled.test | 59 + ...imit_not_optimized_multiple_match_againsts.test | 57 + ...ization_order_limit_not_optimized_no_limit.test | 54 + .../optimization_order_limit_optimized_cp932.test | 46 + ...ion_order_limit_optimized_datetime_between.test | 49 + ...rder_limit_optimized_datetime_between_over.test | 49 + ...ation_order_limit_optimized_datetime_equal.test | 49 + ...rder_limit_optimized_datetime_greater_than.test | 49 + ...t_optimized_datetime_greater_than_or_equal.test | 49 + ...n_order_limit_optimized_datetime_less_than.test | 49 + ...imit_optimized_datetime_less_than_or_equal.test | 49 + ...imit_optimized_duplicated_order_by_columns.test | 45 + ...timization_order_limit_optimized_enum_name.test | 49 + ...imization_order_limit_optimized_enum_value.test | 49 + ...ion_order_limit_optimized_have_primary_key.test | 50 + ...mization_order_limit_optimized_int_between.test | 48 + ...ion_order_limit_optimized_int_between_over.test | 48 + ...timization_order_limit_optimized_int_equal.test | 55 + ...ion_order_limit_optimized_int_greater_than.test | 55 + ..._limit_optimized_int_greater_than_or_equal.test | 55 + ...zation_order_limit_optimized_int_less_than.test | 55 + ...der_limit_optimized_int_less_than_or_equal.test | 55 + ...ation_order_limit_optimized_no_primary_key.test | 50 + ...tion_order_limit_optimized_no_where_clause.test | 39 + ...ization_order_limit_optimized_order_by_asc.test | 54 + ...zation_order_limit_optimized_order_by_desc.test | 54 + ...mization_order_limit_optimized_order_by_id.test | 56 + ...der_limit_optimized_order_by_match_against.test | 55 + ...order_limit_optimized_select_match_against.test | 56 + ...ization_order_limit_optimized_time_between.test | 49 + ...on_order_limit_optimized_time_between_over.test | 49 + ...imization_order_limit_optimized_time_equal.test | 49 + ...on_order_limit_optimized_time_greater_than.test | 49 + ...limit_optimized_time_greater_than_or_equal.test | 49 + ...ation_order_limit_optimized_time_less_than.test | 49 + ...er_limit_optimized_time_less_than_or_equal.test | 49 + ...r_limit_optimized_varchar_equal_with_index.test | 56 + ...imit_optimized_varchar_equal_without_index.test | 55 + ...ization_order_limit_optimized_year_between.test | 53 + ...on_order_limit_optimized_year_between_over.test | 53 + ...imization_order_limit_optimized_year_equal.test | 55 + ...on_order_limit_optimized_year_greater_than.test | 53 + ...limit_optimized_year_greater_than_or_equal.test | 53 + ...ation_order_limit_optimized_year_less_than.test | 53 + ...er_limit_optimized_year_less_than_or_equal.test | 53 + .../mroonga/storage/t/partition_insert.test | 52 + .../mroonga/storage/t/partition_update.test | 54 + .../storage/t/repair_table_no_index_file.test | 57 + .../mroonga/storage/t/replace_geometry.test | 41 + .../mroonga/storage/t/replace_select_varchar.test | 65 + .../mysql-test/mroonga/storage/t/replace_text.test | 43 + .../mroonga/storage/t/replace_varchar.test | 43 + .../mroonga/storage/t/replace_vector.test | 46 + .../mroonga/storage/t/replace_without_key.test | 35 + .../mysql-test/mroonga/storage/t/select_all.test | 100 + .../storage/t/select_empty_key_where_equal.test | 36 + .../t/select_empty_key_where_not_equal.test | 36 + .../storage/t/select_group_by_with_index.test | 38 + .../storage/t/select_group_by_without_index.test | 37 + .../mysql-test/mroonga/storage/t/select_pkey.test | 40 + .../mroonga/storage/t/select_secondary_key.test | 51 + .../storage/t/show_create_table_TODO_SPLIT_ME.test | 35 + .../mroonga/storage/t/sub_query_fulltext.test | 54 + .../mroonga/storage/t/temporary_table.test | 38 + .../mysql-test/mroonga/storage/t/truncate.test | 61 + .../mroonga/storage/t/update_binlog_row.test | 38 + .../mroonga/storage/t/update_fulltext.test | 36 + .../mroonga/storage/t/update_id_hash_index.test | 33 + .../storage/t/update_id_unique_hash_index.test | 33 + .../mysql-test/mroonga/storage/t/update_int.test | 44 + .../storage/t/update_last_insert_grn_id.test | 48 + .../mroonga/storage/t/update_virtual_column.test | 49 + ...ble_boolean_mode_syntax_flags_allow_column.test | 46 + ...oolean_mode_syntax_flags_allow_leading_not.test | 44 + ...ble_boolean_mode_syntax_flags_allow_update.test | 46 + ...ble_boolean_mode_syntax_flags_syntax_query.test | 43 + ...le_boolean_mode_syntax_flags_syntax_script.test | 44 + .../storage/t/variable_database_path_prefix.test | 44 + .../t/variable_default_parser_new_value.test | 25 + .../t/variable_default_parser_same_value.test | 22 + .../t/variable_default_tokenizer_new_value.test | 25 + .../t/variable_default_tokenizer_same_value.test | 22 + .../storage/t/variable_dry_write_delete.test | 42 + .../storage/t/variable_dry_write_insert.test | 42 + .../storage/t/variable_dry_write_update.test | 41 + ...ariable_enable_operations_recording_insert.test | 50 + .../storage/t/variable_lock_timeout_disable.test | 28 + .../storage/t/variable_lock_timeout_invalid.test | 28 + .../storage/t/variable_lock_timeout_no_retry.test | 27 + .../storage/t/variable_lock_timeout_valid.test | 27 + .../storage/t/variable_log_file_new_value.test | 25 + .../t/variable_log_file_nonexistent_path.test | 22 + .../storage/t/variable_log_file_same_value.test | 22 + .../t/variable_log_level_TODO_SPLIT_ME.test | 61 + ...variable_match_escalation_threshold_global.test | 61 + ...ariable_match_escalation_threshold_session.test | 51 + ...variable_max_n_records_for_estimate_global.test | 60 + ...rds_for_estimate_mysql_5_7_or_later_global.test | 60 + ...mate_mysql_5_7_or_later_not_found_in_limit.test | 43 + ...ds_for_estimate_mysql_5_7_or_later_session.test | 47 + ..._n_records_for_estimate_not_found_in_limit.test | 44 + ...ariable_max_n_records_for_estimate_session.test | 47 + ...riable_query_log_file_disabled_empty_value.test | 31 + ...ariable_query_log_file_disabled_null_value.test | 31 + ...ariable_query_log_file_enabled_empty_value.test | 33 + ...variable_query_log_file_enabled_null_value.test | 33 + .../t/variable_query_log_file_new_value.test | 33 + .../t/variable_query_log_file_same_value.test | 34 + .../t/variable_vector_column_delimiter.test | 54 + .../mroonga/storage/t/variable_version.test | 22 + .../mysql-test/mroonga/wrapper/disabled.def | 2 + .../wrapper/r/alter_table_add_column.result | 22 + .../alter_table_add_column_multibyte_cp932.result | 33 + .../r/alter_table_add_column_multibyte_utf8.result | 33 + .../r/alter_table_change_column_comment.result | 17 + .../wrapper/r/alter_table_change_engine.result | 39 + .../r/alter_table_comment_change_engine.result | 27 + ...alter_table_disable_keys_create_fulltext.result | 27 + .../r/alter_table_disable_keys_fulltext.result | 23 + ...alter_table_disable_keys_multiple_column.result | 27 + .../r/alter_table_disable_keys_normal.result | 25 + .../r/alter_table_disable_keys_primary.result | 23 + .../r/alter_table_disable_keys_updating.result | 19 + .../wrapper/r/alter_table_drop_column.result | 22 + .../r/alter_table_enable_keys_fulltext.result | 24 + .../r/alter_table_enable_keys_lock_tables.result | 20 + .../alter_table_enable_keys_multiple_column.result | 28 + .../r/alter_table_enable_keys_normal.result | 26 + .../r/alter_table_enable_keys_primary.result | 24 + .../mroonga/wrapper/r/alter_table_fulltext.result | 34 + .../wrapper/r/alter_table_rename_table.result | 25 + .../mroonga/wrapper/r/alter_table_spatial.result | 122 + .../mroonga/wrapper/r/auto_increment_text.result | 15 + .../mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result | 34 + .../wrapper/r/check_table_for_upgrade.result | 18 + .../r/column_comment_index_not_for_mroonga.result | 16 + .../r/column_generated_stored_add_column.result | 15 + .../r/column_generated_stored_delete.result | 15 + .../r/column_generated_stored_drop_column.result | 17 + .../r/column_generated_stored_insert.result | 15 + .../r/column_generated_stored_reindex.result | 17 + .../r/column_generated_stored_update.result | 15 + .../r/column_generated_virtual_add_column.result | 15 + ...umn_generated_virtual_add_fulltext_index.result | 17 + .../r/column_generated_virtual_add_index.result | 19 + .../r/column_generated_virtual_delete.result | 15 + .../r/column_generated_virtual_drop_column.result | 16 + .../r/column_generated_virtual_insert.result | 15 + .../r/column_generated_virtual_update.result | 16 + .../wrapper/r/column_multibyte_cp932.result | 32 + .../mroonga/wrapper/r/column_multibyte_utf8.result | 32 + .../mroonga/wrapper/r/column_normal_comment.result | 13 + .../mysql-test/mroonga/wrapper/r/count_star.result | 11 + ...count_star_mysql_5_7_or_later_with_index.result | 30 + .../mroonga/wrapper/r/count_star_with_index.result | 26 + .../wrapper/r/create_table_TODO_SPLIT_ME.result | 109 + .../wrapper/r/create_table_comment_combined.result | 14 + .../wrapper/r/create_table_flags_comment.result | 9 + .../wrapper/r/create_table_flags_none.result | 9 + .../wrapper/r/create_table_flags_parameter.result | 16 + .../wrapper/r/create_table_index_flags_none.result | 9 + ...ndex_flags_with_position_and_with_weight.result | 9 + .../r/create_table_normalizer_comment.result | 21 + ...eate_table_normalizer_fulltext_index_bin.result | 21 + .../r/create_table_normalizer_parameter.result | 21 + .../wrapper/r/create_table_parser_comment.result | 25 + ...ken_filters_index_multiple_token_filters.result | 22 + ...ble_token_filters_index_one_token_filter.result | 22 + ...eate_table_token_filters_index_parameter.result | 30 + .../r/create_table_tokenizer_comment.result | 21 + .../r/create_table_tokenizer_parameter.result | 22 + .../mroonga/wrapper/r/delete_TODO_SPLIT_ME.result | 55 + .../mysql-test/mroonga/wrapper/r/delete_all.result | 19 + .../wrapper/r/drop_table_new_connection.result | 13 + .../r/fulltext_boolean_mode_leading_not.result | 15 + ...text_boolean_mode_multiple_match_against.result | 22 + ...ragma_default_operator_minus_no_operator.result | 18 + ...de_pragma_default_operator_minus_with_or.result | 19 + ..._pragma_default_operator_minus_with_plus.result | 19 + ...e_pragma_default_operator_or_no_operator.result | 20 + ...de_pragma_default_operator_or_with_minus.result | 20 + ...ode_pragma_default_operator_or_with_plus.result | 20 + ...pragma_default_operator_plus_no_operator.result | 15 + ..._pragma_default_operator_plus_with_minus.result | 15 + ...ode_pragma_default_operator_plus_with_or.result | 16 + ...ext_boolean_mode_pragma_weight_full_spec.result | 20 + ...ext_boolean_mode_pragma_weight_no_weight.result | 20 + ..._boolean_mode_pragma_weight_omit_section.result | 20 + .../wrapper/r/fulltext_charset_ascii.result | 29 + .../wrapper/r/fulltext_charset_cp932.result | 18 + .../wrapper/r/fulltext_charset_eucjpms.result | 18 + .../wrapper/r/fulltext_charset_japanese.result | 18 + .../wrapper/r/fulltext_index_recreate.result | 32 + .../wrapper/r/fulltext_insert_select.result | 70 + .../wrapper/r/fulltext_insert_values.result | 17 + .../mroonga/wrapper/r/fulltext_many_records.result | 4381 ++ ...and_not_matched_have_where_matched_order.result | 26 + ...ched_and_not_matched_have_where_no_order.result | 27 + ...ched_and_not_matched_no_where_both_order.result | 26 + .../r/fulltext_multiple_column_index_delete.result | 23 + .../r/fulltext_multiple_column_index_insert.result | 29 + .../fulltext_multiple_column_index_recreate.result | 31 + .../r/fulltext_multiple_column_index_update.result | 26 + .../wrapper/r/fulltext_multiple_index.result | 23 + .../mroonga/wrapper/r/fulltext_myisam.result | 194 + .../wrapper/r/fulltext_not_match_against.result | 68 + .../wrapper/r/fulltext_order_TODO_SPLIT_ME.result | 24 + .../wrapper/r/fulltext_order_transaction.result | 40 + .../r/function_last_insert_id_reference.result | 15 + .../wrapper/r/function_last_insert_id_set.result | 21 + .../mroonga/wrapper/r/geometry_contains.result | 160 + .../mroonga/wrapper/r/geometry_delete.result | 22 + .../mroonga/wrapper/r/geometry_update.result | 27 + .../wrapper/r/index_force_index_not_used.result | 8 + .../mroonga/wrapper/r/insert_TODO_SPLIT_ME.result | 78 + .../mroonga/wrapper/r/insert_bulk.result | 22 + ...pdate_multiple_column_primary_key_myisam.result | 36 + ...date_multiple_column_unique_index_myisam.result | 39 + .../wrapper/r/multi_range_read_disk_sweep.result | 18 + ...range_read_mysql_5_7_or_later_disk_sweep.result | 20 + .../optimization_order_limit_TODO_SPLIT_ME.result | 53 + .../r/optimization_order_limit_no_direction.result | 27 + ...optimization_order_limit_no_where_clause.result | 24 + ...ization_order_limit_order_by_primary_key.result | 27 + .../mroonga/wrapper/r/performance_schema.result | 22 + .../mroonga/wrapper/r/repair_table_no_files.result | 31 + .../wrapper/r/repair_table_no_index_file.result | 31 + .../mroonga/wrapper/r/temporary_table.result | 14 + .../wrapper/r/transaction_query_cache.result | 28 + .../r/transaction_rollback_delete_delete.result | 40 + .../r/transaction_rollback_delete_update.result | 37 + .../mysql-test/mroonga/wrapper/r/truncate.result | 47 + .../mroonga/wrapper/r/update_fulltext.result | 33 + .../mysql-test/mroonga/wrapper/r/update_int.result | 36 + .../wrapper/r/variable_dry_write_delete.result | 45 + .../wrapper/r/variable_dry_write_insert.result | 34 + .../wrapper/r/variable_dry_write_update.result | 31 + ...riable_match_escalation_threshold_global.result | 18 + ...iable_match_escalation_threshold_session.result | 24 + .../mroonga/mysql-test/mroonga/wrapper/suite.opt | 1 + .../mroonga/mysql-test/mroonga/wrapper/suite.pm | 23 + .../mroonga/wrapper/t/alter_table_add_column.test | 43 + .../t/alter_table_add_column_multibyte_cp932.test | 54 + .../t/alter_table_add_column_multibyte_utf8.test | 54 + .../t/alter_table_change_column_comment.test | 40 + .../wrapper/t/alter_table_change_engine.test | 59 + .../t/alter_table_comment_change_engine.test | 46 + .../alter_table_disable_keys_create_fulltext.test | 56 + .../t/alter_table_disable_keys_fulltext.test | 50 + .../alter_table_disable_keys_multiple_column.test | 52 + .../wrapper/t/alter_table_disable_keys_normal.test | 50 + .../t/alter_table_disable_keys_primary.test | 48 + .../t/alter_table_disable_keys_updating.test | 42 + .../mroonga/wrapper/t/alter_table_drop_column.test | 43 + .../t/alter_table_enable_keys_fulltext.test | 52 + .../t/alter_table_enable_keys_lock_tables.test | 45 + .../t/alter_table_enable_keys_multiple_column.test | 54 + .../wrapper/t/alter_table_enable_keys_normal.test | 52 + .../wrapper/t/alter_table_enable_keys_primary.test | 50 + .../mroonga/wrapper/t/alter_table_fulltext.test | 54 + .../wrapper/t/alter_table_rename_table.test | 47 + .../mroonga/wrapper/t/alter_table_spatial.test | 149 + .../mroonga/wrapper/t/auto_increment_text.test | 34 + .../mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test | 55 + .../mroonga/wrapper/t/check_table_for_upgrade.test | 44 + .../t/column_comment_index_not_for_mroonga.test | 37 + .../t/column_generated_stored_add_column.test | 43 + .../wrapper/t/column_generated_stored_delete.test | 43 + .../t/column_generated_stored_drop_column.test | 43 + .../wrapper/t/column_generated_stored_insert.test | 41 + .../wrapper/t/column_generated_stored_reindex.test | 43 + .../wrapper/t/column_generated_stored_update.test | 43 + .../t/column_generated_virtual_add_column.test | 42 + ...olumn_generated_virtual_add_fulltext_index.test | 46 + .../t/column_generated_virtual_add_index.test | 47 + .../wrapper/t/column_generated_virtual_delete.test | 42 + .../t/column_generated_virtual_drop_column.test | 42 + .../wrapper/t/column_generated_virtual_insert.test | 40 + .../wrapper/t/column_generated_virtual_update.test | 42 + .../mroonga/wrapper/t/column_multibyte_cp932.test | 53 + .../mroonga/wrapper/t/column_multibyte_utf8.test | 53 + .../mroonga/wrapper/t/column_normal_comment.test | 35 + .../mysql-test/mroonga/wrapper/t/count_star.test | 36 + .../count_star_mysql_5_7_or_later_with_index.test | 55 + .../mroonga/wrapper/t/count_star_with_index.test | 57 + .../wrapper/t/create_table_TODO_SPLIT_ME.test | 101 + .../wrapper/t/create_table_comment_combined.test | 35 + .../wrapper/t/create_table_flags_comment.test | 40 + .../mroonga/wrapper/t/create_table_flags_none.test | 40 + .../wrapper/t/create_table_flags_parameter.test | 42 + .../wrapper/t/create_table_index_flags_none.test | 39 + ..._index_flags_with_position_and_with_weight.test | 39 + .../wrapper/t/create_table_normalizer_comment.test | 40 + ...create_table_normalizer_fulltext_index_bin.test | 40 + .../t/create_table_normalizer_parameter.test | 41 + .../wrapper/t/create_table_parser_comment.test | 38 + ...token_filters_index_multiple_token_filters.test | 43 + ...table_token_filters_index_one_token_filter.test | 43 + ...create_table_token_filters_index_parameter.test | 46 + .../wrapper/t/create_table_tokenizer_comment.test | 37 + .../t/create_table_tokenizer_parameter.test | 42 + .../mroonga/wrapper/t/delete_TODO_SPLIT_ME.test | 59 + .../mysql-test/mroonga/wrapper/t/delete_all.test | 44 + .../wrapper/t/drop_table_new_connection.test | 46 + .../t/fulltext_boolean_mode_leading_not.test | 40 + ...lltext_boolean_mode_multiple_match_against.test | 43 + ..._pragma_default_operator_minus_no_operator.test | 43 + ...mode_pragma_default_operator_minus_with_or.test | 43 + ...de_pragma_default_operator_minus_with_plus.test | 43 + ...ode_pragma_default_operator_or_no_operator.test | 43 + ...mode_pragma_default_operator_or_with_minus.test | 43 + ..._mode_pragma_default_operator_or_with_plus.test | 43 + ...e_pragma_default_operator_plus_no_operator.test | 40 + ...de_pragma_default_operator_plus_with_minus.test | 40 + ..._mode_pragma_default_operator_plus_with_or.test | 40 + ...ltext_boolean_mode_pragma_weight_full_spec.test | 44 + ...ltext_boolean_mode_pragma_weight_no_weight.test | 44 + ...xt_boolean_mode_pragma_weight_omit_section.test | 44 + .../mroonga/wrapper/t/fulltext_charset_ascii.test | 38 + .../mroonga/wrapper/t/fulltext_charset_cp932.test | 35 + .../wrapper/t/fulltext_charset_eucjpms.test | 35 + .../wrapper/t/fulltext_charset_japanese.test | 35 + .../mroonga/wrapper/t/fulltext_index_recreate.test | 50 + .../mroonga/wrapper/t/fulltext_insert_select.test | 51 + .../mroonga/wrapper/t/fulltext_insert_values.test | 34 + .../mroonga/wrapper/t/fulltext_many_records.test | 4135 + ...d_and_not_matched_have_where_matched_order.test | 50 + ...atched_and_not_matched_have_where_no_order.test | 51 + ...atched_and_not_matched_no_where_both_order.test | 50 + .../t/fulltext_multiple_column_index_delete.test | 42 + .../t/fulltext_multiple_column_index_insert.test | 42 + .../t/fulltext_multiple_column_index_recreate.test | 50 + .../t/fulltext_multiple_column_index_update.test | 43 + .../mroonga/wrapper/t/fulltext_multiple_index.test | 47 + .../mroonga/wrapper/t/fulltext_myisam.test | 101 + .../wrapper/t/fulltext_not_match_against.test | 47 + .../wrapper/t/fulltext_order_TODO_SPLIT_ME.test | 46 + .../wrapper/t/fulltext_order_transaction.test | 73 + .../t/function_last_insert_id_reference.test | 36 + .../wrapper/t/function_last_insert_id_set.test | 38 + .../mroonga/wrapper/t/geometry_contains.test | 145 + .../mroonga/wrapper/t/geometry_delete.test | 48 + .../mroonga/wrapper/t/geometry_update.test | 50 + .../wrapper/t/index_force_index_not_used.test | 32 + .../mroonga/wrapper/t/insert_TODO_SPLIT_ME.test | 91 + .../mysql-test/mroonga/wrapper/t/insert_bulk.test | 43 + ..._update_multiple_column_primary_key_myisam.test | 51 + ...update_multiple_column_unique_index_myisam.test | 51 + .../wrapper/t/multi_range_read_disk_sweep.test | 46 + ...i_range_read_mysql_5_7_or_later_disk_sweep.test | 44 + .../t/optimization_order_limit_TODO_SPLIT_ME.test | 60 + .../t/optimization_order_limit_no_direction.test | 50 + .../optimization_order_limit_no_where_clause.test | 46 + ...imization_order_limit_order_by_primary_key.test | 50 + .../wrapper/t/performance_schema-master.opt | 1 + .../mroonga/wrapper/t/performance_schema.test | 41 + .../mroonga/wrapper/t/repair_table_no_files.test | 58 + .../wrapper/t/repair_table_no_index_file.test | 58 + .../mroonga/wrapper/t/temporary_table.test | 39 + .../mroonga/wrapper/t/transaction_query_cache.test | 63 + .../t/transaction_rollback_delete_delete.test | 58 + .../t/transaction_rollback_delete_update.test | 55 + .../mysql-test/mroonga/wrapper/t/truncate.test | 62 + .../mroonga/wrapper/t/update_fulltext.test | 43 + .../mysql-test/mroonga/wrapper/t/update_int.test | 41 + .../wrapper/t/variable_dry_write_delete.test | 54 + .../wrapper/t/variable_dry_write_insert.test | 46 + .../wrapper/t/variable_dry_write_update.test | 47 + ...variable_match_escalation_threshold_global.test | 60 + ...ariable_match_escalation_threshold_session.test | 52 + storage/mroonga/packages/Makefile.am | 7 + storage/mroonga/packages/apt/Makefile.am | 91 + storage/mroonga/packages/apt/Vagrantfile | 50 + storage/mroonga/packages/apt/build-deb.sh | 106 + storage/mroonga/packages/apt/env.sh.in | 16 + storage/mroonga/packages/apt/sign-packages.sh | 42 + storage/mroonga/packages/apt/sign-repository.sh | 46 + storage/mroonga/packages/apt/update-repository.sh | 130 + storage/mroonga/packages/rpm/Makefile.am | 2 + storage/mroonga/packages/rpm/centos/Makefile.am | 19 + .../packages/rpm/centos/mariadb-mroonga.spec.in | 486 + .../packages/rpm/centos/mysql55-mroonga.spec.in | 311 + .../rpm/centos/mysql56-community-mroonga.spec.in | 374 + .../rpm/centos/percona-server-56-mroonga.spec.in | 273 + storage/mroonga/packages/source/Makefile.am | 125 + .../patches/mariadb-10.0.3-windows-build.diff | 9 + storage/mroonga/packages/ubuntu/Makefile.am | 57 + storage/mroonga/packages/ubuntu/upload.rb | 247 + storage/mroonga/packages/windows/Makefile.am | 12 + storage/mroonga/packages/windows/README.md | 21 + .../packages/windows/build-vc2015-msi-32.bat | 8 + .../packages/windows/build-vc2015-msi-64.bat | 8 + .../packages/windows/build-vc2015-zip-32.bat | 13 + .../packages/windows/build-vc2015-zip-64.bat | 13 + storage/mroonga/packages/windows/build-vc2015.bat | 4 + storage/mroonga/packages/yum/Makefile.am | 77 + storage/mroonga/packages/yum/Vagrantfile | 42 + storage/mroonga/packages/yum/build-in-vm.sh | 85 + storage/mroonga/packages/yum/build-rpm.sh | 182 + storage/mroonga/packages/yum/env.sh.in | 32 + storage/mroonga/packages/yum/sign-rpm.sh | 52 + storage/mroonga/packages/yum/update-repository.sh | 27 + storage/mroonga/plugin_version | 1 + .../required_groonga_normalizer_mysql_version | 1 + storage/mroonga/required_groonga_version | 1 + storage/mroonga/sources.am | 12 + storage/mroonga/test/Makefile.am | 14 + storage/mroonga/test/run-sql-test.sh | 244 + storage/mroonga/test/run-unit-test.sh | 49 + storage/mroonga/test/unit/Makefile.am | 27 + storage/mroonga/test/unit/test_mrn_path_mapper.cpp | 134 + storage/mroonga/tools/Makefile.am | 6 + storage/mroonga/tools/prepare-sphinx-html.rb | 175 + storage/mroonga/tools/travis/before_script.sh | 97 + storage/mroonga/tools/travis/install.sh | 157 + storage/mroonga/tools/travis/script.sh | 136 + storage/mroonga/tools/upload-to-github.rb | 42 + storage/mroonga/udf/Makefile.am | 10 + storage/mroonga/udf/mrn_udf_command.cpp | 294 + storage/mroonga/udf/mrn_udf_escape.cpp | 245 + storage/mroonga/udf/mrn_udf_highlight_html.cpp | 494 + storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp | 55 + storage/mroonga/udf/mrn_udf_normalize.cpp | 212 + storage/mroonga/udf/mrn_udf_query_expand.cpp | 282 + storage/mroonga/udf/mrn_udf_snippet.cpp | 338 + storage/mroonga/udf/mrn_udf_snippet_html.cpp | 444 + storage/mroonga/udf/sources.am | 9 + storage/mroonga/vendor/groonga/CMakeLists.txt | 660 + storage/mroonga/vendor/groonga/COPYING | 502 + storage/mroonga/vendor/groonga/Makefile.am | 141 + storage/mroonga/vendor/groonga/README.md | 62 + storage/mroonga/vendor/groonga/appveyor.yml | 72 + storage/mroonga/vendor/groonga/autogen.sh | 33 + storage/mroonga/vendor/groonga/base_version | 1 + .../mroonga/vendor/groonga/benchmark/Makefile.am | 153 + .../groonga/benchmark/bench-between-sequential.c | 276 + .../mroonga/vendor/groonga/benchmark/bench-cache.c | 155 + .../vendor/groonga/benchmark/bench-ctx-create.c | 198 + .../vendor/groonga/benchmark/bench-geo-distance.c | 506 + .../vendor/groonga/benchmark/bench-geo-select.c | 276 + .../vendor/groonga/benchmark/bench-geo-select.sh | 38 + .../mroonga/vendor/groonga/benchmark/bench-nfkc.c | 275 + .../benchmark/bench-query-optimizer-ddl.grn | 16 + .../groonga/benchmark/bench-query-optimizer.c | 214 + .../vendor/groonga/benchmark/bench-range-select.c | 280 + .../vendor/groonga/benchmark/bench-result-set.c | 151 + .../vendor/groonga/benchmark/bench-table-factory.c | 277 + .../vendor/groonga/benchmark/fixtures/Makefile.am | 2 + .../benchmark/fixtures/geo-select/13_2010.CSV.xz | Bin 0 -> 2355640 bytes .../benchmark/fixtures/geo-select/Makefile.am | 4 + .../benchmark/fixtures/geo-select/README.txt | 6 + .../benchmark/fixtures/geo-select/format_2010.html | 111 + .../groonga/benchmark/geo-distance-summary.rb | 140 + .../groonga/benchmark/geo-select-generate-grn.rb | 53 + .../vendor/groonga/benchmark/lib/Makefile.am | 24 + .../vendor/groonga/benchmark/lib/bench-reporter.c | 315 + .../vendor/groonga/benchmark/lib/bench-reporter.h | 64 + .../vendor/groonga/benchmark/lib/bench-utils.c | 83 + .../vendor/groonga/benchmark/lib/bench-utils.h | 34 + .../vendor/groonga/benchmark/lib/benchmark.c | 35 + .../vendor/groonga/benchmark/lib/benchmark.h | 32 + .../mroonga/vendor/groonga/bindings/php/config.m4 | 66 + .../mroonga/vendor/groonga/bindings/php/config.w32 | 6 + .../mroonga/vendor/groonga/bindings/php/groonga.c | 221 + .../vendor/groonga/bindings/php/groonga.dsp | 112 + .../vendor/groonga/bindings/php/php_groonga.h | 125 + .../vendor/groonga/bindings/php/tests/001.phpt | 29 + .../vendor/groonga/bindings/python/ql/groongaql.c | 364 + .../vendor/groonga/bindings/python/ql/setup.py | 22 + storage/mroonga/vendor/groonga/build/Makefile.am | 2 + .../groonga/build/ac_macros/check_functions.m4 | 11 + .../groonga/build/ac_macros/check_headers.m4 | 19 + .../vendor/groonga/build/cmake_modules/Makefile.am | 2 + .../groonga/build/cmake_modules/ReadFileList.cmake | 27 + .../vendor/groonga/build/makefiles/LC_MESSAGES.am | 5 + .../vendor/groonga/build/makefiles/gettext.am | 84 + .../vendor/groonga/build/makefiles/locale.am | 12 + .../vendor/groonga/build/makefiles/sphinx-build.am | 14 + .../vendor/groonga/build/makefiles/sphinx.am | 80 + storage/mroonga/vendor/groonga/bundled_lz4_version | 1 + .../groonga/bundled_mecab_naist_jdic_version | 1 + .../mroonga/vendor/groonga/bundled_mecab_version | 1 + .../vendor/groonga/bundled_message_pack_version | 1 + storage/mroonga/vendor/groonga/config.h.cmake | 147 + storage/mroonga/vendor/groonga/config.sh.in | 7 + storage/mroonga/vendor/groonga/configure.ac | 1788 + .../mroonga/vendor/groonga/examples/Makefile.am | 1 + .../vendor/groonga/examples/dictionary/Makefile.am | 34 + .../groonga/examples/dictionary/edict/Makefile.am | 4 + .../examples/dictionary/edict/edict-import.sh | 27 + .../groonga/examples/dictionary/edict/edict2grn.rb | 34 + .../groonga/examples/dictionary/eijiro/Makefile.am | 4 + .../examples/dictionary/eijiro/eijiro-import.sh | 12 + .../examples/dictionary/eijiro/eijiro2grn.rb | 61 + .../groonga/examples/dictionary/gene95/Makefile.am | 4 + .../examples/dictionary/gene95/gene-import.sh | 26 + .../groonga/examples/dictionary/gene95/gene2grn.rb | 33 + .../examples/dictionary/html/css/dictionary.css | 3 + .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin 0 -> 180 bytes .../images/ui-bg_flat_75_ffffff_40x100.png | Bin 0 -> 178 bytes .../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin 0 -> 120 bytes .../images/ui-bg_glass_65_ffffff_1x400.png | Bin 0 -> 105 bytes .../images/ui-bg_glass_75_dadada_1x400.png | Bin 0 -> 111 bytes .../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin 0 -> 110 bytes .../images/ui-bg_glass_95_fef1ec_1x400.png | Bin 0 -> 119 bytes .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin 0 -> 101 bytes .../smoothness/images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes .../smoothness/images/ui-icons_2e83ff_256x240.png | Bin 0 -> 4369 bytes .../smoothness/images/ui-icons_454545_256x240.png | Bin 0 -> 4369 bytes .../smoothness/images/ui-icons_888888_256x240.png | Bin 0 -> 4369 bytes .../smoothness/images/ui-icons_cd0a0a_256x240.png | Bin 0 -> 4369 bytes .../css/smoothness/jquery-ui-1.8.12.custom.css | 578 + .../groonga/examples/dictionary/html/index.html | 28 + .../examples/dictionary/html/js/dictionary.js | 82 + .../examples/dictionary/html/js/jquery-1.7.2.js | 9404 +++ .../dictionary/html/js/jquery-ui-1.8.18.custom.js | 11802 +++ .../vendor/groonga/examples/dictionary/init-db.sh | 10 + .../groonga/examples/dictionary/jmdict/Makefile.am | 3 + .../groonga/examples/dictionary/jmdict/jmdict.rb | 42 + .../vendor/groonga/examples/dictionary/readme.txt | 71 + storage/mroonga/vendor/groonga/gpg_uid | 1 + storage/mroonga/vendor/groonga/groonga-arrow.pc.in | 4 + .../vendor/groonga/groonga-httpd-conf.sh.in | 34 + storage/mroonga/vendor/groonga/groonga.pc.in | 20 + .../mroonga/vendor/groonga/include/CMakeLists.txt | 18 + storage/mroonga/vendor/groonga/include/Makefile.am | 8 + storage/mroonga/vendor/groonga/include/groonga.h | 53 + storage/mroonga/vendor/groonga/include/groonga.hpp | 21 + .../vendor/groonga/include/groonga/Makefile.am | 43 + .../vendor/groonga/include/groonga/accessor.h | 34 + .../mroonga/vendor/groonga/include/groonga/array.h | 89 + .../mroonga/vendor/groonga/include/groonga/arrow.h | 38 + .../vendor/groonga/include/groonga/arrow.hpp | 21 + .../mroonga/vendor/groonga/include/groonga/cache.h | 49 + .../vendor/groonga/include/groonga/column.h | 29 + .../vendor/groonga/include/groonga/command.h | 79 + .../vendor/groonga/include/groonga/config.h | 65 + .../mroonga/vendor/groonga/include/groonga/dat.h | 100 + .../mroonga/vendor/groonga/include/groonga/db.h | 68 + .../mroonga/vendor/groonga/include/groonga/dump.h | 34 + .../mroonga/vendor/groonga/include/groonga/error.h | 29 + .../mroonga/vendor/groonga/include/groonga/expr.h | 123 + .../vendor/groonga/include/groonga/file_reader.h | 37 + .../mroonga/vendor/groonga/include/groonga/geo.h | 36 + .../vendor/groonga/include/groonga/groonga.h | 1700 + .../mroonga/vendor/groonga/include/groonga/hash.h | 104 + .../mroonga/vendor/groonga/include/groonga/id.h | 31 + .../mroonga/vendor/groonga/include/groonga/ii.h | 69 + .../mroonga/vendor/groonga/include/groonga/nfkc.h | 31 + .../vendor/groonga/include/groonga/normalizer.h | 53 + .../mroonga/vendor/groonga/include/groonga/obj.h | 81 + .../vendor/groonga/include/groonga/operator.h | 49 + .../vendor/groonga/include/groonga/output.h | 124 + .../mroonga/vendor/groonga/include/groonga/pat.h | 102 + .../vendor/groonga/include/groonga/plugin.h | 217 + .../vendor/groonga/include/groonga/portability.h | 201 + .../groonga/include/groonga/request_canceler.h | 37 + .../vendor/groonga/include/groonga/request_timer.h | 53 + .../vendor/groonga/include/groonga/scorer.h | 93 + .../mroonga/vendor/groonga/include/groonga/table.h | 246 + .../vendor/groonga/include/groonga/thread.h | 39 + .../mroonga/vendor/groonga/include/groonga/time.h | 61 + .../mroonga/vendor/groonga/include/groonga/token.h | 135 + .../vendor/groonga/include/groonga/token_filter.h | 67 + .../vendor/groonga/include/groonga/tokenizer.h | 260 + .../mroonga/vendor/groonga/include/groonga/type.h | 40 + .../mroonga/vendor/groonga/include/groonga/util.h | 44 + .../groonga/include/groonga/window_function.h | 73 + .../vendor/groonga/include/groonga/windows.h | 31 + .../groonga/include/groonga/windows_event_logger.h | 30 + storage/mroonga/vendor/groonga/lib/CMakeLists.txt | 185 + storage/mroonga/vendor/groonga/lib/Makefile.am | 99 + storage/mroonga/vendor/groonga/lib/alloc.c | 961 + storage/mroonga/vendor/groonga/lib/arrow.cpp | 849 + storage/mroonga/vendor/groonga/lib/c_sources.am | 112 + storage/mroonga/vendor/groonga/lib/cache.c | 1036 + storage/mroonga/vendor/groonga/lib/column.c | 49 + storage/mroonga/vendor/groonga/lib/com.c | 1202 + storage/mroonga/vendor/groonga/lib/command.c | 201 + storage/mroonga/vendor/groonga/lib/config.c | 289 + storage/mroonga/vendor/groonga/lib/cpp_sources.am | 3 + storage/mroonga/vendor/groonga/lib/ctx.c | 1873 + storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c | 324 + storage/mroonga/vendor/groonga/lib/dat.cpp | 1338 + storage/mroonga/vendor/groonga/lib/dat/Makefile.am | 11 + storage/mroonga/vendor/groonga/lib/dat/array.hpp | 98 + storage/mroonga/vendor/groonga/lib/dat/base.hpp | 67 + storage/mroonga/vendor/groonga/lib/dat/block.hpp | 94 + storage/mroonga/vendor/groonga/lib/dat/check.hpp | 149 + .../vendor/groonga/lib/dat/cursor-factory.cpp | 92 + .../vendor/groonga/lib/dat/cursor-factory.hpp | 44 + storage/mroonga/vendor/groonga/lib/dat/cursor.hpp | 46 + storage/mroonga/vendor/groonga/lib/dat/dat.hpp | 248 + storage/mroonga/vendor/groonga/lib/dat/entry.hpp | 59 + .../mroonga/vendor/groonga/lib/dat/file-impl.cpp | 279 + .../mroonga/vendor/groonga/lib/dat/file-impl.hpp | 73 + storage/mroonga/vendor/groonga/lib/dat/file.cpp | 73 + storage/mroonga/vendor/groonga/lib/dat/file.hpp | 60 + storage/mroonga/vendor/groonga/lib/dat/header.hpp | 179 + .../mroonga/vendor/groonga/lib/dat/id-cursor.cpp | 184 + .../mroonga/vendor/groonga/lib/dat/id-cursor.hpp | 83 + .../mroonga/vendor/groonga/lib/dat/key-cursor.cpp | 349 + .../mroonga/vendor/groonga/lib/dat/key-cursor.hpp | 88 + storage/mroonga/vendor/groonga/lib/dat/key.hpp | 110 + storage/mroonga/vendor/groonga/lib/dat/node.hpp | 127 + .../vendor/groonga/lib/dat/predictive-cursor.cpp | 206 + .../vendor/groonga/lib/dat/predictive-cursor.hpp | 84 + .../vendor/groonga/lib/dat/prefix-cursor.cpp | 175 + .../vendor/groonga/lib/dat/prefix-cursor.hpp | 78 + storage/mroonga/vendor/groonga/lib/dat/sources.am | 29 + storage/mroonga/vendor/groonga/lib/dat/string.hpp | 173 + storage/mroonga/vendor/groonga/lib/dat/trie.cpp | 1225 + storage/mroonga/vendor/groonga/lib/dat/trie.hpp | 285 + storage/mroonga/vendor/groonga/lib/dat/vector.hpp | 191 + storage/mroonga/vendor/groonga/lib/db.c | 14054 ++++ storage/mroonga/vendor/groonga/lib/dump.c | 112 + storage/mroonga/vendor/groonga/lib/error.c | 454 + storage/mroonga/vendor/groonga/lib/expr.c | 9294 +++ storage/mroonga/vendor/groonga/lib/expr_code.c | 55 + storage/mroonga/vendor/groonga/lib/expr_executor.c | 945 + storage/mroonga/vendor/groonga/lib/file_lock.c | 121 + storage/mroonga/vendor/groonga/lib/file_reader.c | 109 + storage/mroonga/vendor/groonga/lib/geo.c | 2788 + storage/mroonga/vendor/groonga/lib/grn.h | 759 + storage/mroonga/vendor/groonga/lib/grn_alloc.h | 163 + storage/mroonga/vendor/groonga/lib/grn_cache.h | 49 + storage/mroonga/vendor/groonga/lib/grn_com.h | 250 + storage/mroonga/vendor/groonga/lib/grn_config.h | 37 + storage/mroonga/vendor/groonga/lib/grn_ctx.h | 501 + storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h | 237 + .../mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h | 35 + storage/mroonga/vendor/groonga/lib/grn_dat.h | 95 + storage/mroonga/vendor/groonga/lib/grn_db.h | 493 + .../mroonga/vendor/groonga/lib/grn_ecmascript.c | 2542 + .../mroonga/vendor/groonga/lib/grn_ecmascript.h | 74 + .../vendor/groonga/lib/grn_ecmascript.lemon | 581 + storage/mroonga/vendor/groonga/lib/grn_error.h | 34 + storage/mroonga/vendor/groonga/lib/grn_expr.h | 86 + storage/mroonga/vendor/groonga/lib/grn_expr_code.h | 33 + .../mroonga/vendor/groonga/lib/grn_expr_executor.h | 39 + storage/mroonga/vendor/groonga/lib/grn_file_lock.h | 48 + storage/mroonga/vendor/groonga/lib/grn_geo.h | 200 + storage/mroonga/vendor/groonga/lib/grn_hash.h | 378 + storage/mroonga/vendor/groonga/lib/grn_ii.h | 192 + .../mroonga/vendor/groonga/lib/grn_index_column.h | 34 + storage/mroonga/vendor/groonga/lib/grn_io.h | 487 + storage/mroonga/vendor/groonga/lib/grn_load.h | 47 + storage/mroonga/vendor/groonga/lib/grn_logger.h | 35 + storage/mroonga/vendor/groonga/lib/grn_mrb.h | 42 + storage/mroonga/vendor/groonga/lib/grn_msgpack.h | 46 + storage/mroonga/vendor/groonga/lib/grn_nfkc.h | 39 + .../mroonga/vendor/groonga/lib/grn_normalizer.h | 42 + storage/mroonga/vendor/groonga/lib/grn_obj.h | 32 + storage/mroonga/vendor/groonga/lib/grn_output.h | 127 + storage/mroonga/vendor/groonga/lib/grn_pat.h | 129 + storage/mroonga/vendor/groonga/lib/grn_plugin.h | 62 + storage/mroonga/vendor/groonga/lib/grn_proc.h | 152 + .../mroonga/vendor/groonga/lib/grn_raw_string.h | 62 + storage/mroonga/vendor/groonga/lib/grn_report.h | 47 + .../vendor/groonga/lib/grn_request_canceler.h | 28 + .../mroonga/vendor/groonga/lib/grn_request_timer.h | 28 + storage/mroonga/vendor/groonga/lib/grn_rset.h | 114 + storage/mroonga/vendor/groonga/lib/grn_scanner.h | 40 + storage/mroonga/vendor/groonga/lib/grn_scorer.h | 49 + storage/mroonga/vendor/groonga/lib/grn_scorers.h | 31 + storage/mroonga/vendor/groonga/lib/grn_snip.h | 125 + storage/mroonga/vendor/groonga/lib/grn_store.h | 216 + storage/mroonga/vendor/groonga/lib/grn_str.h | 116 + storage/mroonga/vendor/groonga/lib/grn_string.h | 51 + storage/mroonga/vendor/groonga/lib/grn_time.h | 40 + .../mroonga/vendor/groonga/lib/grn_token_cursor.h | 81 + .../mroonga/vendor/groonga/lib/grn_tokenizers.h | 38 + storage/mroonga/vendor/groonga/lib/grn_ts.h | 48 + storage/mroonga/vendor/groonga/lib/grn_util.h | 49 + .../vendor/groonga/lib/grn_window_function.h | 40 + .../vendor/groonga/lib/grn_window_functions.h | 26 + storage/mroonga/vendor/groonga/lib/grn_windows.h | 33 + storage/mroonga/vendor/groonga/lib/hash.c | 3720 + storage/mroonga/vendor/groonga/lib/icudump.c | 298 + storage/mroonga/vendor/groonga/lib/id.c | 36 + storage/mroonga/vendor/groonga/lib/ii.c | 12816 +++ storage/mroonga/vendor/groonga/lib/index_column.c | 194 + storage/mroonga/vendor/groonga/lib/io.c | 2201 + storage/mroonga/vendor/groonga/lib/load.c | 1229 + storage/mroonga/vendor/groonga/lib/logger.c | 810 + storage/mroonga/vendor/groonga/lib/metadata.rc.in | 28 + storage/mroonga/vendor/groonga/lib/mrb.c | 220 + storage/mroonga/vendor/groonga/lib/mrb/Makefile.am | 21 + .../mroonga/vendor/groonga/lib/mrb/mrb_accessor.c | 121 + .../mroonga/vendor/groonga/lib/mrb/mrb_accessor.h | 33 + storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c | 92 + storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c | 373 + storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h | 41 + storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.c | 130 + storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.h | 33 + .../mroonga/vendor/groonga/lib/mrb/mrb_column.c | 173 + .../mroonga/vendor/groonga/lib/mrb/mrb_column.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_command.c | 196 + .../mroonga/vendor/groonga/lib/mrb/mrb_command.h | 34 + .../vendor/groonga/lib/mrb/mrb_command_input.c | 139 + .../vendor/groonga/lib/mrb/mrb_command_input.h | 32 + .../vendor/groonga/lib/mrb/mrb_command_version.c | 41 + .../vendor/groonga/lib/mrb/mrb_command_version.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_config.c | 90 + .../mroonga/vendor/groonga/lib/mrb/mrb_config.h | 31 + .../vendor/groonga/lib/mrb/mrb_content_type.c | 49 + .../vendor/groonga/lib/mrb/mrb_content_type.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_converter.c | 350 + .../mroonga/vendor/groonga/lib/mrb/mrb_converter.h | 64 + storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c | 838 + storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h | 33 + .../mroonga/vendor/groonga/lib/mrb/mrb_database.c | 206 + .../mroonga/vendor/groonga/lib/mrb/mrb_database.h | 32 + .../vendor/groonga/lib/mrb/mrb_double_array_trie.c | 60 + .../vendor/groonga/lib/mrb/mrb_double_array_trie.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c | 202 + storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h | 32 + .../vendor/groonga/lib/mrb/mrb_eval_context.c | 98 + .../vendor/groonga/lib/mrb/mrb_eval_context.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c | 1079 + storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h | 43 + .../vendor/groonga/lib/mrb/mrb_fixed_size_column.c | 59 + .../vendor/groonga/lib/mrb/mrb_fixed_size_column.h | 32 + .../vendor/groonga/lib/mrb/mrb_hash_table.c | 117 + .../vendor/groonga/lib/mrb/mrb_hash_table.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c | 79 + storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h | 32 + .../vendor/groonga/lib/mrb/mrb_index_column.c | 199 + .../vendor/groonga/lib/mrb/mrb_index_column.h | 32 + .../vendor/groonga/lib/mrb/mrb_index_cursor.c | 245 + .../vendor/groonga/lib/mrb/mrb_index_cursor.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_indexable.c | 170 + .../mroonga/vendor/groonga/lib/mrb/mrb_indexable.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_logger.c | 99 + .../mroonga/vendor/groonga/lib/mrb/mrb_logger.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_object.c | 346 + .../mroonga/vendor/groonga/lib/mrb/mrb_object.h | 34 + .../vendor/groonga/lib/mrb/mrb_object_flags.c | 96 + .../vendor/groonga/lib/mrb/mrb_object_flags.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_operator.c | 155 + .../mroonga/vendor/groonga/lib/mrb/mrb_operator.h | 34 + .../mroonga/vendor/groonga/lib/mrb/mrb_options.c | 39 + .../mroonga/vendor/groonga/lib/mrb/mrb_options.h | 38 + .../vendor/groonga/lib/mrb/mrb_patricia_trie.c | 59 + .../vendor/groonga/lib/mrb/mrb_patricia_trie.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_pointer.c | 77 + .../mroonga/vendor/groonga/lib/mrb/mrb_pointer.h | 31 + .../mroonga/vendor/groonga/lib/mrb/mrb_procedure.c | 108 + .../mroonga/vendor/groonga/lib/mrb/mrb_procedure.h | 32 + .../vendor/groonga/lib/mrb/mrb_query_logger.c | 76 + .../vendor/groonga/lib/mrb/mrb_query_logger.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_record.c | 162 + .../mroonga/vendor/groonga/lib/mrb/mrb_record.h | 31 + storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c | 493 + storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h | 32 + .../vendor/groonga/lib/mrb/mrb_table_cursor.c | 208 + .../vendor/groonga/lib/mrb/mrb_table_cursor.h | 32 + .../groonga/lib/mrb/mrb_table_cursor_flags.c | 60 + .../groonga/lib/mrb/mrb_table_cursor_flags.h | 32 + .../vendor/groonga/lib/mrb/mrb_table_group_flags.c | 48 + .../vendor/groonga/lib/mrb/mrb_table_group_flags.h | 32 + .../groonga/lib/mrb/mrb_table_group_result.c | 254 + .../groonga/lib/mrb/mrb_table_group_result.h | 31 + .../vendor/groonga/lib/mrb/mrb_table_sort_flags.c | 42 + .../vendor/groonga/lib/mrb/mrb_table_sort_flags.h | 31 + .../vendor/groonga/lib/mrb/mrb_table_sort_key.c | 159 + .../vendor/groonga/lib/mrb/mrb_table_sort_key.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_thread.c | 46 + .../mroonga/vendor/groonga/lib/mrb/mrb_thread.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c | 60 + storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h | 32 + .../groonga/lib/mrb/mrb_variable_size_column.c | 60 + .../groonga/lib/mrb/mrb_variable_size_column.h | 32 + storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c | 59 + storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h | 32 + .../vendor/groonga/lib/mrb/mrb_window_definition.c | 164 + .../vendor/groonga/lib/mrb/mrb_window_definition.h | 32 + .../mroonga/vendor/groonga/lib/mrb/mrb_writer.c | 253 + .../mroonga/vendor/groonga/lib/mrb/mrb_writer.h | 32 + .../vendor/groonga/lib/mrb/scripts/Makefile.am | 16 + .../vendor/groonga/lib/mrb/scripts/accessor.rb | 5 + .../groonga/lib/mrb/scripts/backtrace_entry.rb | 28 + .../vendor/groonga/lib/mrb/scripts/command.rb | 64 + .../groonga/lib/mrb/scripts/command_input.rb | 15 + .../lib/mrb/scripts/command_line/Makefile.am | 9 + .../groonga/lib/mrb/scripts/command_line/grndb.rb | 452 + .../lib/mrb/scripts/command_line/sources.am | 2 + .../groonga/lib/mrb/scripts/command_line_parser.rb | 168 + .../vendor/groonga/lib/mrb/scripts/context.rb | 85 + .../groonga/lib/mrb/scripts/context/Makefile.am | 9 + .../groonga/lib/mrb/scripts/context/error_level.rb | 30 + .../vendor/groonga/lib/mrb/scripts/context/rc.rb | 205 + .../groonga/lib/mrb/scripts/context/sources.am | 3 + .../vendor/groonga/lib/mrb/scripts/database.rb | 65 + .../vendor/groonga/lib/mrb/scripts/error.rb | 16 + .../vendor/groonga/lib/mrb/scripts/eval_context.rb | 18 + .../vendor/groonga/lib/mrb/scripts/expression.rb | 68 + .../groonga/lib/mrb/scripts/expression_rewriter.rb | 22 + .../lib/mrb/scripts/expression_rewriters.rb | 41 + .../lib/mrb/scripts/expression_size_estimator.rb | 54 + .../groonga/lib/mrb/scripts/expression_tree.rb | 9 + .../lib/mrb/scripts/expression_tree/Makefile.am | 9 + .../lib/mrb/scripts/expression_tree/accessor.rb | 14 + .../scripts/expression_tree/binary_operation.rb | 67 + .../lib/mrb/scripts/expression_tree/constant.rb | 22 + .../mrb/scripts/expression_tree/function_call.rb | 66 + .../mrb/scripts/expression_tree/index_column.rb | 14 + .../scripts/expression_tree/logical_operation.rb | 33 + .../lib/mrb/scripts/expression_tree/options.rb | 14 + .../lib/mrb/scripts/expression_tree/procedure.rb | 18 + .../lib/mrb/scripts/expression_tree/sources.am | 10 + .../lib/mrb/scripts/expression_tree/variable.rb | 18 + .../lib/mrb/scripts/expression_tree_builder.rb | 111 + .../groonga/lib/mrb/scripts/fixed_size_column.rb | 5 + .../mroonga/vendor/groonga/lib/mrb/scripts/id.rb | 12 + .../vendor/groonga/lib/mrb/scripts/index_column.rb | 39 + .../vendor/groonga/lib/mrb/scripts/index_cursor.rb | 18 + .../vendor/groonga/lib/mrb/scripts/index_info.rb | 10 + .../groonga/lib/mrb/scripts/initialize/Makefile.am | 9 + .../groonga/lib/mrb/scripts/initialize/post.rb | 28 + .../groonga/lib/mrb/scripts/initialize/pre.rb | 3 + .../groonga/lib/mrb/scripts/initialize/sources.am | 3 + .../vendor/groonga/lib/mrb/scripts/logger.rb | 34 + .../groonga/lib/mrb/scripts/logger/Makefile.am | 9 + .../vendor/groonga/lib/mrb/scripts/logger/level.rb | 40 + .../groonga/lib/mrb/scripts/logger/sources.am | 2 + .../vendor/groonga/lib/mrb/scripts/object.rb | 18 + .../vendor/groonga/lib/mrb/scripts/operator.rb | 22 + .../groonga/lib/mrb/scripts/plugin_loader.rb | 14 + .../vendor/groonga/lib/mrb/scripts/query_logger.rb | 9 + .../lib/mrb/scripts/query_logger/Makefile.am | 9 + .../groonga/lib/mrb/scripts/query_logger/flag.rb | 39 + .../lib/mrb/scripts/query_logger/sources.am | 2 + .../vendor/groonga/lib/mrb/scripts/record.rb | 38 + .../vendor/groonga/lib/mrb/scripts/require.rb | 71 + .../vendor/groonga/lib/mrb/scripts/scan_info.rb | 38 + .../groonga/lib/mrb/scripts/scan_info_builder.rb | 577 + .../groonga/lib/mrb/scripts/scan_info_data.rb | 324 + .../mrb/scripts/scan_info_data_size_estimator.rb | 185 + .../lib/mrb/scripts/scan_info_search_index.rb | 9 + .../vendor/groonga/lib/mrb/scripts/sources.am | 37 + .../vendor/groonga/lib/mrb/scripts/table.rb | 144 + .../vendor/groonga/lib/mrb/scripts/table_cursor.rb | 28 + .../lib/mrb/scripts/variable_size_column.rb | 5 + .../vendor/groonga/lib/mrb/scripts/writer.rb | 21 + storage/mroonga/vendor/groonga/lib/mrb/sources.am | 93 + .../vendor/groonga/lib/nfkc-custom-rules.txt | 1 + storage/mroonga/vendor/groonga/lib/nfkc.c | 45 + storage/mroonga/vendor/groonga/lib/nfkc.rb | 897 + storage/mroonga/vendor/groonga/lib/nfkc50.c | 77784 +++++++++++++++++++ storage/mroonga/vendor/groonga/lib/normalizer.c | 1193 + storage/mroonga/vendor/groonga/lib/obj.c | 689 + storage/mroonga/vendor/groonga/lib/operator.c | 1362 + storage/mroonga/vendor/groonga/lib/output.c | 2880 + storage/mroonga/vendor/groonga/lib/pat.c | 3674 + storage/mroonga/vendor/groonga/lib/plugin.c | 1396 + storage/mroonga/vendor/groonga/lib/proc.c | 4211 + .../mroonga/vendor/groonga/lib/proc/Makefile.am | 17 + .../mroonga/vendor/groonga/lib/proc/proc_column.c | 1019 + .../mroonga/vendor/groonga/lib/proc/proc_config.c | 139 + .../mroonga/vendor/groonga/lib/proc/proc_dump.c | 1138 + .../vendor/groonga/lib/proc/proc_fuzzy_search.c | 467 + .../vendor/groonga/lib/proc/proc_highlight.c | 503 + .../vendor/groonga/lib/proc/proc_in_records.c | 519 + .../mroonga/vendor/groonga/lib/proc/proc_lock.c | 172 + .../mroonga/vendor/groonga/lib/proc/proc_object.c | 138 + .../vendor/groonga/lib/proc/proc_object_inspect.c | 614 + .../vendor/groonga/lib/proc/proc_object_list.c | 413 + .../mroonga/vendor/groonga/lib/proc/proc_query.c | 118 + .../vendor/groonga/lib/proc/proc_query_log_flags.c | 220 + .../mroonga/vendor/groonga/lib/proc/proc_schema.c | 1226 + .../mroonga/vendor/groonga/lib/proc/proc_select.c | 3809 + .../mroonga/vendor/groonga/lib/proc/proc_snippet.c | 319 + .../mroonga/vendor/groonga/lib/proc/proc_table.c | 910 + .../vendor/groonga/lib/proc/proc_tokenize.c | 433 + storage/mroonga/vendor/groonga/lib/proc/sources.am | 18 + storage/mroonga/vendor/groonga/lib/raw_string.c | 38 + storage/mroonga/vendor/groonga/lib/report.c | 98 + .../mroonga/vendor/groonga/lib/request_canceler.c | 176 + storage/mroonga/vendor/groonga/lib/request_timer.c | 88 + storage/mroonga/vendor/groonga/lib/rset.c | 324 + storage/mroonga/vendor/groonga/lib/scanner.c | 73 + storage/mroonga/vendor/groonga/lib/scorer.c | 189 + storage/mroonga/vendor/groonga/lib/scorers.c | 96 + storage/mroonga/vendor/groonga/lib/snip.c | 841 + storage/mroonga/vendor/groonga/lib/store.c | 2864 + storage/mroonga/vendor/groonga/lib/str.c | 3276 + storage/mroonga/vendor/groonga/lib/string.c | 416 + storage/mroonga/vendor/groonga/lib/table.c | 122 + storage/mroonga/vendor/groonga/lib/thread.c | 59 + storage/mroonga/vendor/groonga/lib/time.c | 245 + storage/mroonga/vendor/groonga/lib/token_cursor.c | 386 + storage/mroonga/vendor/groonga/lib/token_filter.c | 59 + storage/mroonga/vendor/groonga/lib/tokenizer.c | 375 + storage/mroonga/vendor/groonga/lib/tokenizers.c | 890 + storage/mroonga/vendor/groonga/lib/ts.c | 906 + storage/mroonga/vendor/groonga/lib/ts/Makefile.am | 20 + storage/mroonga/vendor/groonga/lib/ts/sources.am | 25 + storage/mroonga/vendor/groonga/lib/ts/ts_buf.c | 244 + storage/mroonga/vendor/groonga/lib/ts/ts_buf.h | 111 + storage/mroonga/vendor/groonga/lib/ts/ts_cursor.c | 163 + storage/mroonga/vendor/groonga/lib/ts/ts_cursor.h | 59 + storage/mroonga/vendor/groonga/lib/ts/ts_expr.c | 219 + storage/mroonga/vendor/groonga/lib/ts/ts_expr.h | 87 + .../vendor/groonga/lib/ts/ts_expr_builder.c | 757 + .../vendor/groonga/lib/ts/ts_expr_builder.h | 128 + .../mroonga/vendor/groonga/lib/ts/ts_expr_node.c | 5325 ++ .../mroonga/vendor/groonga/lib/ts/ts_expr_node.h | 128 + .../mroonga/vendor/groonga/lib/ts/ts_expr_parser.c | 1329 + .../mroonga/vendor/groonga/lib/ts/ts_expr_parser.h | 107 + storage/mroonga/vendor/groonga/lib/ts/ts_log.h | 46 + storage/mroonga/vendor/groonga/lib/ts/ts_op.c | 131 + storage/mroonga/vendor/groonga/lib/ts/ts_op.h | 87 + storage/mroonga/vendor/groonga/lib/ts/ts_plan.c | 21 + storage/mroonga/vendor/groonga/lib/ts/ts_plan.h | 87 + storage/mroonga/vendor/groonga/lib/ts/ts_sorter.c | 2174 + storage/mroonga/vendor/groonga/lib/ts/ts_sorter.h | 98 + storage/mroonga/vendor/groonga/lib/ts/ts_str.c | 191 + storage/mroonga/vendor/groonga/lib/ts/ts_str.h | 106 + storage/mroonga/vendor/groonga/lib/ts/ts_types.h | 168 + storage/mroonga/vendor/groonga/lib/ts/ts_util.c | 129 + storage/mroonga/vendor/groonga/lib/ts/ts_util.h | 61 + storage/mroonga/vendor/groonga/lib/type.c | 87 + storage/mroonga/vendor/groonga/lib/util.c | 1643 + .../mroonga/vendor/groonga/lib/window_function.c | 464 + .../mroonga/vendor/groonga/lib/window_functions.c | 405 + storage/mroonga/vendor/groonga/lib/windows.c | 104 + .../vendor/groonga/lib/windows_event_logger.c | 203 + storage/mroonga/vendor/groonga/nginx_version | 1 + .../mroonga/vendor/groonga/plugins/CMakeLists.txt | 30 + storage/mroonga/vendor/groonga/plugins/Makefile.am | 19 + .../plugins/expression_rewriters/CMakeLists.txt | 26 + .../plugins/expression_rewriters/Makefile.am | 9 + .../plugins/expression_rewriters/optimizer.rb | 147 + .../plugins/expression_rewriters/sources.am | 2 + .../groonga/plugins/functions/CMakeLists.txt | 141 + .../vendor/groonga/plugins/functions/Makefile.am | 33 + .../groonga/plugins/functions/index_column.c | 266 + .../plugins/functions/index_column_sources.am | 2 + .../vendor/groonga/plugins/functions/math.c | 142 + .../groonga/plugins/functions/math_sources.am | 2 + .../vendor/groonga/plugins/functions/number.c | 187 + .../groonga/plugins/functions/number_sources.am | 2 + .../vendor/groonga/plugins/functions/string.c | 299 + .../groonga/plugins/functions/string_sources.am | 2 + .../vendor/groonga/plugins/functions/time.c | 376 + .../groonga/plugins/functions/time_sources.am | 2 + .../vendor/groonga/plugins/functions/vector.c | 401 + .../groonga/plugins/functions/vector_sources.am | 2 + .../groonga/plugins/query_expanders/CMakeLists.txt | 38 + .../groonga/plugins/query_expanders/Makefile.am | 20 + .../vendor/groonga/plugins/query_expanders/tsv.c | 314 + .../groonga/plugins/query_expanders/tsv_sources.am | 2 + .../vendor/groonga/plugins/ruby/CMakeLists.txt | 24 + .../vendor/groonga/plugins/ruby/Makefile.am | 9 + .../mroonga/vendor/groonga/plugins/ruby/eval.rb | 36 + .../mroonga/vendor/groonga/plugins/ruby/sources.am | 2 + .../mroonga/vendor/groonga/plugins/ruby_scripts.am | 2 + storage/mroonga/vendor/groonga/plugins/sharding.rb | 11 + .../vendor/groonga/plugins/sharding/CMakeLists.txt | 24 + .../vendor/groonga/plugins/sharding/Makefile.am | 9 + .../groonga/plugins/sharding/logical_count.rb | 169 + .../groonga/plugins/sharding/logical_enumerator.rb | 317 + .../groonga/plugins/sharding/logical_parameters.rb | 44 + .../plugins/sharding/logical_range_filter.rb | 642 + .../groonga/plugins/sharding/logical_select.rb | 975 + .../groonga/plugins/sharding/logical_shard_list.rb | 28 + .../plugins/sharding/logical_table_remove.rb | 345 + .../vendor/groonga/plugins/sharding/parameters.rb | 10 + .../plugins/sharding/range_expression_builder.rb | 88 + .../vendor/groonga/plugins/sharding/sources.am | 10 + .../vendor/groonga/plugins/suggest/CMakeLists.txt | 36 + .../vendor/groonga/plugins/suggest/Makefile.am | 24 + .../vendor/groonga/plugins/suggest/sources.am | 2 + .../vendor/groonga/plugins/suggest/suggest.c | 1035 + .../groonga/plugins/token_filters/CMakeLists.txt | 63 + .../groonga/plugins/token_filters/Makefile.am | 28 + .../vendor/groonga/plugins/token_filters/stem.c | 279 + .../groonga/plugins/token_filters/stem_sources.am | 2 + .../groonga/plugins/token_filters/stop_word.c | 159 + .../plugins/token_filters/stop_word_sources.am | 2 + .../groonga/plugins/tokenizers/CMakeLists.txt | 76 + .../vendor/groonga/plugins/tokenizers/Makefile.am | 33 + .../vendor/groonga/plugins/tokenizers/kytea.cpp | 358 + .../groonga/plugins/tokenizers/kytea_sources.am | 2 + .../vendor/groonga/plugins/tokenizers/mecab.c | 660 + .../groonga/plugins/tokenizers/mecab_sources.am | 2 + storage/mroonga/vendor/groonga/src/.gitignore | 2 + storage/mroonga/vendor/groonga/src/CMakeLists.txt | 62 + storage/mroonga/vendor/groonga/src/Makefile.am | 67 + storage/mroonga/vendor/groonga/src/grndb.c | 197 + .../mroonga/vendor/groonga/src/grndb_sources.am | 2 + storage/mroonga/vendor/groonga/src/grnslap.c | 375 + .../mroonga/vendor/groonga/src/grnslap_sources.am | 2 + storage/mroonga/vendor/groonga/src/groonga.c | 3763 + .../mroonga/vendor/groonga/src/groonga_benchmark.c | 3176 + .../groonga/src/groonga_benchmark_sources.am | 2 + storage/mroonga/vendor/groonga/src/groonga_mruby.c | 86 + .../vendor/groonga/src/groonga_mruby_sources.am | 2 + .../mroonga/vendor/groonga/src/groonga_sources.am | 2 + .../mroonga/vendor/groonga/src/httpd/Makefile.am | 32 + .../vendor/groonga/src/httpd/nginx-module/config | 56 + .../httpd/nginx-module/ngx_http_groonga_module.c | 1678 + .../vendor/groonga/src/suggest/CMakeLists.txt | 87 + .../mroonga/vendor/groonga/src/suggest/Makefile.am | 74 + .../groonga/src/suggest/create_dataset_sources.am | 2 + .../src/suggest/groonga_suggest_create_dataset.c | 223 + .../groonga/src/suggest/groonga_suggest_ddl.txt | 62 + .../groonga/src/suggest/groonga_suggest_httpd.c | 860 + .../groonga/src/suggest/groonga_suggest_learner.c | 843 + .../vendor/groonga/src/suggest/httpd_sources.am | 3 + .../vendor/groonga/src/suggest/learner_sources.am | 3 + storage/mroonga/vendor/groonga/src/suggest/util.c | 215 + storage/mroonga/vendor/groonga/src/suggest/util.h | 40 + .../vendor/groonga/src/suggest/util_sources.am | 3 + .../vendor/groonga/src/suggest/zmq_compatible.h | 33 + storage/mroonga/vendor/groonga/tools/Makefile.am | 7 + .../groonga/tools/check-small-index-limit.rb | 123 + .../groonga/tools/groonga-benchmark-indexing.rb | 129 + .../groonga/tools/groonga-memory-leak-checker.rb | 93 + .../groonga/tools/groonga-memory-usage-analyzer.rb | 127 + .../groonga/tools/groonga-object-list-checker.rb | 104 + .../groonga/tools/groonga-suggest-httpd-client.rb | 181 + .../tools/install/install-for-debian-jessie.sh | 17 + .../vendor/groonga/tools/prepare-sphinx-html.rb | 183 + .../vendor/groonga/tools/travis-before-script.sh | 53 + .../mroonga/vendor/groonga/tools/travis-install.sh | 38 + .../mroonga/vendor/groonga/tools/travis-script.sh | 75 + .../mroonga/vendor/groonga/vendor/CMakeLists.txt | 20 + storage/mroonga/vendor/groonga/vendor/Makefile.am | 29 + .../mroonga/vendor/groonga/vendor/download_lz4.rb | 54 + .../vendor/groonga/vendor/download_mecab.rb | 59 + .../vendor/groonga/vendor/download_message_pack.rb | 54 + .../vendor/groonga/vendor/lz4/CMakeLists.txt | 98 + .../mroonga/vendor/groonga/vendor/lz4/Makefile.am | 2 + .../vendor/groonga/vendor/mecab/CMakeLists.txt | 219 + .../vendor/groonga/vendor/mecab/Makefile.am | 4 + .../vendor/groonga/vendor/mecab/config.h.cmake | 1 + .../vendor/groonga/vendor/mecab/mecabrc.cmake | 3 + .../groonga/vendor/message_pack/CMakeLists.txt | 53 + .../vendor/groonga/vendor/message_pack/Makefile.am | 2 + .../vendor/groonga/vendor/mruby/CMakeLists.txt | 101 + .../vendor/groonga/vendor/mruby/Makefile.am | 79 + .../vendor/groonga/vendor/mruby/build_config.rb | 54 + .../vendor/groonga/vendor/mruby/built_sources.am | 14 + .../vendor/groonga/vendor/mruby/mruby_build.rb | 65 + .../mroonga/vendor/groonga/vendor/mruby/sources.am | 57 + .../mroonga/vendor/groonga/vendor/mruby/update.rb | 88 + .../mroonga/vendor/groonga/vendor/mruby/version | 1 + .../vendor/groonga/vendor/onigmo/CMakeLists.txt | 147 + .../vendor/groonga/vendor/onigmo/Makefile.am | 32 + .../vendor/groonga/vendor/onigmo/config.h.cmake | 1 + .../vendor/groonga/vendor/plugins/CMakeLists.txt | 28 + .../groonga-normalizer-mysql/CMakeLists.txt | 79 + .../plugins/groonga-normalizer-mysql/Makefile.am | 84 + .../plugins/groonga-normalizer-mysql/README.md | 211 + .../plugins/groonga-normalizer-mysql/autogen.sh | 20 + .../groonga-normalizer-mysql/build/Makefile.am | 18 + .../build/cmake_modules/Makefile.am | 18 + .../build/cmake_modules/ReadFileList.cmake | 27 + .../plugins/groonga-normalizer-mysql/configure.ac | 223 + .../groonga-normalizer-mysql/data/travis/setup.sh | 34 + .../groonga-normalizer-mysql/doc/Makefile.am | 18 + .../groonga-normalizer-mysql/doc/text/Makefile.am | 20 + .../groonga-normalizer-mysql/doc/text/lgpl-2.0.txt | 481 + .../groonga-normalizer-mysql/doc/text/news.md | 41 + .../plugins/groonga-normalizer-mysql/gpg_uid | 1 + .../groonga-normalizer-mysql.pc.in | 5 + .../normalizers/CMakeLists.txt | 43 + .../normalizers/Makefile.am | 90 + .../groonga-normalizer-mysql/normalizers/mysql.c | 778 + .../normalizers/mysql_general_ci_table.h | 565 + .../normalizers/mysql_sources.am | 7 + ...ept_kana_ci_kana_with_voiced_sound_mark_table.h | 5028 ++ .../normalizers/mysql_unicode_520_ci_table.h | 5028 ++ ...ept_kana_ci_kana_with_voiced_sound_mark_table.h | 1685 + .../normalizers/mysql_unicode_ci_table.h | 1685 + .../groonga-normalizer-mysql/packages/Makefile.am | 6 + .../packages/apt/Makefile.am | 67 + .../packages/apt/Vagrantfile | 26 + .../packages/apt/build-deb.sh | 57 + .../packages/apt/env.sh.in | 8 + .../packages/apt/sign-packages.sh | 42 + .../packages/apt/sign-repository.sh | 46 + .../packages/apt/update-repository.sh | 130 + .../packages/debian/changelog | 71 + .../packages/debian/compat | 1 + .../packages/debian/control | 31 + .../packages/debian/copyright | 85 + .../debian/groonga-normalizer-mysql.install | 1 + .../packages/debian/patches/series | 0 .../groonga-normalizer-mysql/packages/debian/rules | 17 + .../packages/debian/source/format | 1 + .../groonga-normalizer-mysql/packages/debian/watch | 2 + .../packages/rpm/Makefile.am | 1 + .../packages/rpm/centos/Makefile.am | 1 + .../rpm/centos/groonga-normalizer-mysql.spec.in | 92 + .../packages/rpm/fedora/Makefile.am | 2 + .../rpm/fedora/groonga-normalizer-mysql.spec.in | 91 + .../packages/source/Makefile.am | 25 + .../packages/ubuntu/Makefile.am | 28 + .../packages/yum/Makefile.am | 72 + .../packages/yum/Vagrantfile | 38 + .../packages/yum/build-rpm.sh | 67 + .../packages/yum/env.sh.in | 11 + .../packages/yum/sign-rpm.sh | 37 + .../packages/yum/update-repository.sh | 33 + .../required_groonga_version | 1 + .../tool/dump_difference_uca.rb | 50 + .../tool/dump_difference_utf8.rb | 50 + .../tool/generate_uca_table.rb | 304 + .../tool/generate_utf8_table.rb | 146 + .../groonga-normalizer-mysql/tool/parser.rb | 183 + .../tool/travis/before_script.sh | 23 + .../tool/travis/install.sh | 27 + .../plugins/groonga-normalizer-mysql/version_full | 1 + storage/mroonga/vendor/groonga/version-gen.sh | 35 + storage/mroonga/version_full | 1 + storage/mroonga/version_in_hex | 1 + storage/mroonga/version_major | 1 + storage/mroonga/version_micro | 1 + storage/mroonga/version_minor | 1 + 2365 files changed, 391224 insertions(+) create mode 100644 storage/mroonga/AUTHORS create mode 100644 storage/mroonga/CMakeLists.txt create mode 100644 storage/mroonga/COPYING create mode 100644 storage/mroonga/ChangeLog create mode 100644 storage/mroonga/Makefile.am create mode 100644 storage/mroonga/NEWS create mode 100644 storage/mroonga/README create mode 100644 storage/mroonga/appveyor.yml create mode 100755 storage/mroonga/autogen.sh create mode 100644 storage/mroonga/build/Makefile.am create mode 100644 storage/mroonga/build/cmake_modules/Makefile.am create mode 100644 storage/mroonga/build/cmake_modules/ReadFileList.cmake create mode 100644 storage/mroonga/build/makefiles/LC_MESSAGES.am create mode 100644 storage/mroonga/build/makefiles/gettext.am create mode 100644 storage/mroonga/build/makefiles/locale.am create mode 100644 storage/mroonga/build/makefiles/sphinx-build.am create mode 100644 storage/mroonga/build/makefiles/sphinx.am create mode 100644 storage/mroonga/config.sh.in create mode 100644 storage/mroonga/configure.ac create mode 100644 storage/mroonga/data/Makefile.am create mode 100644 storage/mroonga/data/install.sql.in create mode 100644 storage/mroonga/data/uninstall.sql create mode 100644 storage/mroonga/gpg_uid create mode 100644 storage/mroonga/ha_mroonga.cpp create mode 100644 storage/mroonga/ha_mroonga.def create mode 100644 storage/mroonga/ha_mroonga.hpp create mode 100644 storage/mroonga/lib/Makefile.am create mode 100644 storage/mroonga/lib/libmrn_need_mysql_sources.am create mode 100644 storage/mroonga/lib/libmrn_no_mysql_sources.am create mode 100644 storage/mroonga/lib/libmysqlservices_compat_sources.am create mode 100644 storage/mroonga/lib/mrn_auto_increment_value_lock.cpp create mode 100644 storage/mroonga/lib/mrn_auto_increment_value_lock.hpp create mode 100644 storage/mroonga/lib/mrn_column_name.cpp create mode 100644 storage/mroonga/lib/mrn_column_name.hpp create mode 100644 storage/mroonga/lib/mrn_condition_converter.cpp create mode 100644 storage/mroonga/lib/mrn_condition_converter.hpp create mode 100644 storage/mroonga/lib/mrn_context_pool.cpp create mode 100644 storage/mroonga/lib/mrn_context_pool.hpp create mode 100644 storage/mroonga/lib/mrn_count_skip_checker.cpp create mode 100644 storage/mroonga/lib/mrn_count_skip_checker.hpp create mode 100644 storage/mroonga/lib/mrn_current_thread.hpp create mode 100644 storage/mroonga/lib/mrn_database.cpp create mode 100644 storage/mroonga/lib/mrn_database.hpp create mode 100644 storage/mroonga/lib/mrn_database_manager.cpp create mode 100644 storage/mroonga/lib/mrn_database_manager.hpp create mode 100644 storage/mroonga/lib/mrn_database_repairer.cpp create mode 100644 storage/mroonga/lib/mrn_database_repairer.hpp create mode 100644 storage/mroonga/lib/mrn_debug_column_access.cpp create mode 100644 storage/mroonga/lib/mrn_debug_column_access.hpp create mode 100644 storage/mroonga/lib/mrn_encoding.cpp create mode 100644 storage/mroonga/lib/mrn_encoding.hpp create mode 100644 storage/mroonga/lib/mrn_external_lock.cpp create mode 100644 storage/mroonga/lib/mrn_external_lock.hpp create mode 100644 storage/mroonga/lib/mrn_field_normalizer.cpp create mode 100644 storage/mroonga/lib/mrn_field_normalizer.hpp create mode 100644 storage/mroonga/lib/mrn_grn.hpp create mode 100644 storage/mroonga/lib/mrn_index_column_name.cpp create mode 100644 storage/mroonga/lib/mrn_index_column_name.hpp create mode 100644 storage/mroonga/lib/mrn_index_table_name.cpp create mode 100644 storage/mroonga/lib/mrn_index_table_name.hpp create mode 100644 storage/mroonga/lib/mrn_lock.cpp create mode 100644 storage/mroonga/lib/mrn_lock.hpp create mode 100644 storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp create mode 100644 storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp create mode 100644 storage/mroonga/lib/mrn_multiple_column_key_codec.cpp create mode 100644 storage/mroonga/lib/mrn_multiple_column_key_codec.hpp create mode 100644 storage/mroonga/lib/mrn_mysqlservices.cpp create mode 100644 storage/mroonga/lib/mrn_operation.cpp create mode 100644 storage/mroonga/lib/mrn_operation.hpp create mode 100644 storage/mroonga/lib/mrn_operations.cpp create mode 100644 storage/mroonga/lib/mrn_operations.hpp create mode 100644 storage/mroonga/lib/mrn_parameters_parser.cpp create mode 100644 storage/mroonga/lib/mrn_parameters_parser.hpp create mode 100644 storage/mroonga/lib/mrn_path_mapper.cpp create mode 100644 storage/mroonga/lib/mrn_path_mapper.hpp create mode 100644 storage/mroonga/lib/mrn_query_parser.cpp create mode 100644 storage/mroonga/lib/mrn_query_parser.hpp create mode 100644 storage/mroonga/lib/mrn_smart_bitmap.cpp create mode 100644 storage/mroonga/lib/mrn_smart_bitmap.hpp create mode 100644 storage/mroonga/lib/mrn_smart_grn_obj.cpp create mode 100644 storage/mroonga/lib/mrn_smart_grn_obj.hpp create mode 100644 storage/mroonga/lib/mrn_table_fields_offset_mover.cpp create mode 100644 storage/mroonga/lib/mrn_table_fields_offset_mover.hpp create mode 100644 storage/mroonga/lib/mrn_time_converter.cpp create mode 100644 storage/mroonga/lib/mrn_time_converter.hpp create mode 100644 storage/mroonga/lib/mrn_value_decoder.cpp create mode 100644 storage/mroonga/lib/mrn_value_decoder.hpp create mode 100644 storage/mroonga/lib/mrn_windows.hpp create mode 100644 storage/mroonga/mrn_constants.hpp create mode 100644 storage/mroonga/mrn_err.h create mode 100644 storage/mroonga/mrn_macro.hpp create mode 100644 storage/mroonga/mrn_mysql.h create mode 100644 storage/mroonga/mrn_mysql_compat.h create mode 100644 storage/mroonga/mrn_table.cpp create mode 100644 storage/mroonga/mrn_table.hpp create mode 100644 storage/mroonga/mrn_variables.hpp create mode 100644 storage/mroonga/mrn_version.h.in create mode 100644 storage/mroonga/mysql-test/Makefile.am create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc create mode 100644 storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc create mode 100644 storage/mroonga/mysql-test/mroonga/storage/disabled.def create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_multiple_column_duplicated.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zlib.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_lz4.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zlib.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/count_star.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_nonexistent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_nonexistent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_different_match.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_no_where.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_natural_language_mode_same_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/i_s.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_greater_than_or_equal_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_normal_less_than_or_equal_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_single_thread.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_duplicated_order_by_columns.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/partition_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_all.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/truncate.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_leading_not.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_allow_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_query.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_boolean_mode_syntax_flags_syntax_script.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result create mode 100644 storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in create mode 100644 storage/mroonga/mysql-test/mroonga/storage/suite.opt create mode 100644 storage/mroonga/mysql-test/mroonga/storage/suite.pm create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_multiple_column_duplicated.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zlib.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_lz4.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zlib.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/count_star.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_different_match.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_no_where.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_natural_language_mode_same_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/i_s.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_greater_than_or_equal_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_normal_less_than_or_equal_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_duplicated_order_by_columns.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/repair_table_no_index_file.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_all.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/truncate.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_leading_not.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_allow_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_query.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_boolean_mode_syntax_flags_syntax_script.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test create mode 100644 storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/disabled.def create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_with_position_and_with_weight.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_order_by_primary_key.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/suite.opt create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/suite.pm create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_with_position_and_with_weight.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_order_by_primary_key.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test create mode 100644 storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test create mode 100644 storage/mroonga/packages/Makefile.am create mode 100644 storage/mroonga/packages/apt/Makefile.am create mode 100644 storage/mroonga/packages/apt/Vagrantfile create mode 100755 storage/mroonga/packages/apt/build-deb.sh create mode 100644 storage/mroonga/packages/apt/env.sh.in create mode 100755 storage/mroonga/packages/apt/sign-packages.sh create mode 100755 storage/mroonga/packages/apt/sign-repository.sh create mode 100755 storage/mroonga/packages/apt/update-repository.sh create mode 100644 storage/mroonga/packages/rpm/Makefile.am create mode 100644 storage/mroonga/packages/rpm/centos/Makefile.am create mode 100644 storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in create mode 100644 storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in create mode 100644 storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in create mode 100644 storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in create mode 100644 storage/mroonga/packages/source/Makefile.am create mode 100644 storage/mroonga/packages/source/patches/mariadb-10.0.3-windows-build.diff create mode 100644 storage/mroonga/packages/ubuntu/Makefile.am create mode 100755 storage/mroonga/packages/ubuntu/upload.rb create mode 100644 storage/mroonga/packages/windows/Makefile.am create mode 100644 storage/mroonga/packages/windows/README.md create mode 100644 storage/mroonga/packages/windows/build-vc2015-msi-32.bat create mode 100644 storage/mroonga/packages/windows/build-vc2015-msi-64.bat create mode 100644 storage/mroonga/packages/windows/build-vc2015-zip-32.bat create mode 100644 storage/mroonga/packages/windows/build-vc2015-zip-64.bat create mode 100644 storage/mroonga/packages/windows/build-vc2015.bat create mode 100644 storage/mroonga/packages/yum/Makefile.am create mode 100644 storage/mroonga/packages/yum/Vagrantfile create mode 100755 storage/mroonga/packages/yum/build-in-vm.sh create mode 100755 storage/mroonga/packages/yum/build-rpm.sh create mode 100644 storage/mroonga/packages/yum/env.sh.in create mode 100755 storage/mroonga/packages/yum/sign-rpm.sh create mode 100755 storage/mroonga/packages/yum/update-repository.sh create mode 100644 storage/mroonga/plugin_version create mode 100644 storage/mroonga/required_groonga_normalizer_mysql_version create mode 100644 storage/mroonga/required_groonga_version create mode 100644 storage/mroonga/sources.am create mode 100644 storage/mroonga/test/Makefile.am create mode 100755 storage/mroonga/test/run-sql-test.sh create mode 100755 storage/mroonga/test/run-unit-test.sh create mode 100644 storage/mroonga/test/unit/Makefile.am create mode 100644 storage/mroonga/test/unit/test_mrn_path_mapper.cpp create mode 100644 storage/mroonga/tools/Makefile.am create mode 100755 storage/mroonga/tools/prepare-sphinx-html.rb create mode 100755 storage/mroonga/tools/travis/before_script.sh create mode 100755 storage/mroonga/tools/travis/install.sh create mode 100755 storage/mroonga/tools/travis/script.sh create mode 100755 storage/mroonga/tools/upload-to-github.rb create mode 100644 storage/mroonga/udf/Makefile.am create mode 100644 storage/mroonga/udf/mrn_udf_command.cpp create mode 100644 storage/mroonga/udf/mrn_udf_escape.cpp create mode 100644 storage/mroonga/udf/mrn_udf_highlight_html.cpp create mode 100644 storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp create mode 100644 storage/mroonga/udf/mrn_udf_normalize.cpp create mode 100644 storage/mroonga/udf/mrn_udf_query_expand.cpp create mode 100644 storage/mroonga/udf/mrn_udf_snippet.cpp create mode 100644 storage/mroonga/udf/mrn_udf_snippet_html.cpp create mode 100644 storage/mroonga/udf/sources.am create mode 100644 storage/mroonga/vendor/groonga/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/COPYING create mode 100644 storage/mroonga/vendor/groonga/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/README.md create mode 100644 storage/mroonga/vendor/groonga/appveyor.yml create mode 100755 storage/mroonga/vendor/groonga/autogen.sh create mode 100644 storage/mroonga/vendor/groonga/base_version create mode 100644 storage/mroonga/vendor/groonga/benchmark/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-between-sequential.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-cache.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-ctx-create.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-geo-distance.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-geo-select.c create mode 100755 storage/mroonga/vendor/groonga/benchmark/bench-geo-select.sh create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-nfkc.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer-ddl.grn create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-query-optimizer.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-range-select.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-result-set.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/bench-table-factory.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/fixtures/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/benchmark/fixtures/geo-select/13_2010.CSV.xz create mode 100644 storage/mroonga/vendor/groonga/benchmark/fixtures/geo-select/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/benchmark/fixtures/geo-select/README.txt create mode 100644 storage/mroonga/vendor/groonga/benchmark/fixtures/geo-select/format_2010.html create mode 100755 storage/mroonga/vendor/groonga/benchmark/geo-distance-summary.rb create mode 100755 storage/mroonga/vendor/groonga/benchmark/geo-select-generate-grn.rb create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/bench-reporter.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/bench-reporter.h create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/bench-utils.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/bench-utils.h create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/benchmark.c create mode 100644 storage/mroonga/vendor/groonga/benchmark/lib/benchmark.h create mode 100644 storage/mroonga/vendor/groonga/bindings/php/config.m4 create mode 100644 storage/mroonga/vendor/groonga/bindings/php/config.w32 create mode 100644 storage/mroonga/vendor/groonga/bindings/php/groonga.c create mode 100644 storage/mroonga/vendor/groonga/bindings/php/groonga.dsp create mode 100644 storage/mroonga/vendor/groonga/bindings/php/php_groonga.h create mode 100644 storage/mroonga/vendor/groonga/bindings/php/tests/001.phpt create mode 100644 storage/mroonga/vendor/groonga/bindings/python/ql/groongaql.c create mode 100755 storage/mroonga/vendor/groonga/bindings/python/ql/setup.py create mode 100644 storage/mroonga/vendor/groonga/build/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/build/ac_macros/check_functions.m4 create mode 100644 storage/mroonga/vendor/groonga/build/ac_macros/check_headers.m4 create mode 100644 storage/mroonga/vendor/groonga/build/cmake_modules/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/build/cmake_modules/ReadFileList.cmake create mode 100644 storage/mroonga/vendor/groonga/build/makefiles/LC_MESSAGES.am create mode 100644 storage/mroonga/vendor/groonga/build/makefiles/gettext.am create mode 100644 storage/mroonga/vendor/groonga/build/makefiles/locale.am create mode 100644 storage/mroonga/vendor/groonga/build/makefiles/sphinx-build.am create mode 100644 storage/mroonga/vendor/groonga/build/makefiles/sphinx.am create mode 100644 storage/mroonga/vendor/groonga/bundled_lz4_version create mode 100644 storage/mroonga/vendor/groonga/bundled_mecab_naist_jdic_version create mode 100644 storage/mroonga/vendor/groonga/bundled_mecab_version create mode 100644 storage/mroonga/vendor/groonga/bundled_message_pack_version create mode 100644 storage/mroonga/vendor/groonga/config.h.cmake create mode 100644 storage/mroonga/vendor/groonga/config.sh.in create mode 100644 storage/mroonga/vendor/groonga/configure.ac create mode 100644 storage/mroonga/vendor/groonga/examples/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/edict/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/edict/edict-import.sh create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/edict/edict2grn.rb create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/eijiro/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro-import.sh create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/eijiro/eijiro2grn.rb create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/gene95/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene-import.sh create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/gene95/gene2grn.rb create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/dictionary.css create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_222222_256x240.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_2e83ff_256x240.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_454545_256x240.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_888888_256x240.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/images/ui-icons_cd0a0a_256x240.png create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/css/smoothness/jquery-ui-1.8.12.custom.css create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/index.html create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/js/dictionary.js create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/init-db.sh create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/jmdict/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/examples/dictionary/jmdict/jmdict.rb create mode 100644 storage/mroonga/vendor/groonga/examples/dictionary/readme.txt create mode 100644 storage/mroonga/vendor/groonga/gpg_uid create mode 100644 storage/mroonga/vendor/groonga/groonga-arrow.pc.in create mode 100644 storage/mroonga/vendor/groonga/groonga-httpd-conf.sh.in create mode 100644 storage/mroonga/vendor/groonga/groonga.pc.in create mode 100644 storage/mroonga/vendor/groonga/include/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/include/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/include/groonga.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga.hpp create mode 100644 storage/mroonga/vendor/groonga/include/groonga/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/include/groonga/accessor.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/array.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/arrow.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/arrow.hpp create mode 100644 storage/mroonga/vendor/groonga/include/groonga/cache.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/column.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/command.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/config.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/dat.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/db.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/dump.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/error.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/expr.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/file_reader.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/geo.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/groonga.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/hash.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/id.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/ii.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/nfkc.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/normalizer.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/obj.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/operator.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/output.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/pat.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/plugin.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/portability.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/request_canceler.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/request_timer.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/scorer.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/table.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/thread.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/time.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/token.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/token_filter.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/tokenizer.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/type.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/util.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/window_function.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/windows.h create mode 100644 storage/mroonga/vendor/groonga/include/groonga/windows_event_logger.h create mode 100644 storage/mroonga/vendor/groonga/lib/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/lib/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/alloc.c create mode 100644 storage/mroonga/vendor/groonga/lib/arrow.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/c_sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/cache.c create mode 100644 storage/mroonga/vendor/groonga/lib/column.c create mode 100644 storage/mroonga/vendor/groonga/lib/com.c create mode 100644 storage/mroonga/vendor/groonga/lib/command.c create mode 100644 storage/mroonga/vendor/groonga/lib/config.c create mode 100644 storage/mroonga/vendor/groonga/lib/cpp_sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/ctx.c create mode 100644 storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c create mode 100644 storage/mroonga/vendor/groonga/lib/dat.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/dat/array.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/base.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/block.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/check.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/cursor-factory.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/cursor.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/dat.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/entry.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/file-impl.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/file-impl.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/file.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/file.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/header.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/id-cursor.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/key-cursor.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/key-cursor.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/key.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/node.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/dat/string.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/trie.cpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/trie.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/dat/vector.hpp create mode 100644 storage/mroonga/vendor/groonga/lib/db.c create mode 100644 storage/mroonga/vendor/groonga/lib/dump.c create mode 100644 storage/mroonga/vendor/groonga/lib/error.c create mode 100644 storage/mroonga/vendor/groonga/lib/expr.c create mode 100644 storage/mroonga/vendor/groonga/lib/expr_code.c create mode 100644 storage/mroonga/vendor/groonga/lib/expr_executor.c create mode 100644 storage/mroonga/vendor/groonga/lib/file_lock.c create mode 100644 storage/mroonga/vendor/groonga/lib/file_reader.c create mode 100644 storage/mroonga/vendor/groonga/lib/geo.c create mode 100644 storage/mroonga/vendor/groonga/lib/grn.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_alloc.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_cache.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_com.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_config.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ctx.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_dat.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_db.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ecmascript.c create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ecmascript.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ecmascript.lemon create mode 100644 storage/mroonga/vendor/groonga/lib/grn_error.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_expr.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_expr_code.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_expr_executor.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_file_lock.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_geo.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_hash.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ii.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_index_column.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_io.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_load.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_logger.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_mrb.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_msgpack.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_nfkc.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_normalizer.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_obj.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_output.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_pat.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_plugin.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_proc.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_raw_string.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_report.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_request_canceler.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_request_timer.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_rset.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_scanner.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_scorer.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_scorers.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_snip.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_store.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_str.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_string.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_time.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_token_cursor.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_tokenizers.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_ts.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_util.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_window_function.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_window_functions.h create mode 100644 storage/mroonga/vendor/groonga/lib/grn_windows.h create mode 100644 storage/mroonga/vendor/groonga/lib/hash.c create mode 100644 storage/mroonga/vendor/groonga/lib/icudump.c create mode 100644 storage/mroonga/vendor/groonga/lib/id.c create mode 100644 storage/mroonga/vendor/groonga/lib/ii.c create mode 100644 storage/mroonga/vendor/groonga/lib/index_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/io.c create mode 100644 storage/mroonga/vendor/groonga/lib/load.c create mode 100644 storage/mroonga/vendor/groonga/lib/logger.c create mode 100644 storage/mroonga/vendor/groonga/lib/metadata.rc.in create mode 100644 storage/mroonga/vendor/groonga/lib/mrb.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_column.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command_input.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command_version.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_command_version.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_config.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_config.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_content_type.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_database.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_database.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_double_array_trie.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_eval_context.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_eval_context.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_fixed_size_column.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_hash_table.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_index_column.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_index_cursor.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_indexable.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_indexable.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_logger.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_object.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_object.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_object_flags.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_operator.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_options.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_options.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_patricia_trie.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_pointer.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_pointer.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_procedure.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_query_logger.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_query_logger.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_record.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_record.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_cursor_flags.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_flags.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_group_result.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_flags.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_table_sort_key.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_thread.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_thread.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_variable_size_column.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_window_definition.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_window_definition.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.c create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/mrb_writer.h create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/accessor.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/backtrace_entry.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command_input.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/grndb.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/command_line_parser.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/context.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/context/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/context/error_level.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/context/rc.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/context/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/database.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/error.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/eval_context.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_rewriter.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_rewriters.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_size_estimator.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/accessor.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/binary_operation.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/constant.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/function_call.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/index_column.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/logical_operation.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/options.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/procedure.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree/variable.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/expression_tree_builder.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/fixed_size_column.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/id.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/index_column.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/index_cursor.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/index_info.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/post.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/pre.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/initialize/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/logger.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/level.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/logger/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/object.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/operator.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/plugin_loader.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/query_logger.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/query_logger/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/query_logger/flag.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/query_logger/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/record.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/require.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_builder.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_data_size_estimator.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/scan_info_search_index.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/table.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/variable_size_column.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/scripts/writer.rb create mode 100644 storage/mroonga/vendor/groonga/lib/mrb/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/nfkc-custom-rules.txt create mode 100644 storage/mroonga/vendor/groonga/lib/nfkc.c create mode 100755 storage/mroonga/vendor/groonga/lib/nfkc.rb create mode 100644 storage/mroonga/vendor/groonga/lib/nfkc50.c create mode 100644 storage/mroonga/vendor/groonga/lib/normalizer.c create mode 100644 storage/mroonga/vendor/groonga/lib/obj.c create mode 100644 storage/mroonga/vendor/groonga/lib/operator.c create mode 100644 storage/mroonga/vendor/groonga/lib/output.c create mode 100644 storage/mroonga/vendor/groonga/lib/pat.c create mode 100644 storage/mroonga/vendor/groonga/lib/plugin.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_column.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_config.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_dump.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_fuzzy_search.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_highlight.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_in_records.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_lock.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_object.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_object_inspect.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_object_list.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_query.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_query_log_flags.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_schema.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_select.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_snippet.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_table.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/proc_tokenize.c create mode 100644 storage/mroonga/vendor/groonga/lib/proc/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/raw_string.c create mode 100644 storage/mroonga/vendor/groonga/lib/report.c create mode 100644 storage/mroonga/vendor/groonga/lib/request_canceler.c create mode 100644 storage/mroonga/vendor/groonga/lib/request_timer.c create mode 100644 storage/mroonga/vendor/groonga/lib/rset.c create mode 100644 storage/mroonga/vendor/groonga/lib/scanner.c create mode 100644 storage/mroonga/vendor/groonga/lib/scorer.c create mode 100644 storage/mroonga/vendor/groonga/lib/scorers.c create mode 100644 storage/mroonga/vendor/groonga/lib/snip.c create mode 100644 storage/mroonga/vendor/groonga/lib/store.c create mode 100644 storage/mroonga/vendor/groonga/lib/str.c create mode 100644 storage/mroonga/vendor/groonga/lib/string.c create mode 100644 storage/mroonga/vendor/groonga/lib/table.c create mode 100644 storage/mroonga/vendor/groonga/lib/thread.c create mode 100644 storage/mroonga/vendor/groonga/lib/time.c create mode 100644 storage/mroonga/vendor/groonga/lib/token_cursor.c create mode 100644 storage/mroonga/vendor/groonga/lib/token_filter.c create mode 100644 storage/mroonga/vendor/groonga/lib/tokenizer.c create mode 100644 storage/mroonga/vendor/groonga/lib/tokenizers.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/lib/ts/sources.am create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_buf.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_buf.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_cursor.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_cursor.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_builder.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_builder.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_parser.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_expr_parser.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_log.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_op.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_op.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_plan.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_plan.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_sorter.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_sorter.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_str.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_str.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_types.h create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_util.c create mode 100644 storage/mroonga/vendor/groonga/lib/ts/ts_util.h create mode 100644 storage/mroonga/vendor/groonga/lib/type.c create mode 100644 storage/mroonga/vendor/groonga/lib/util.c create mode 100644 storage/mroonga/vendor/groonga/lib/window_function.c create mode 100644 storage/mroonga/vendor/groonga/lib/window_functions.c create mode 100644 storage/mroonga/vendor/groonga/lib/windows.c create mode 100644 storage/mroonga/vendor/groonga/lib/windows_event_logger.c create mode 100644 storage/mroonga/vendor/groonga/nginx_version create mode 100644 storage/mroonga/vendor/groonga/plugins/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/expression_rewriters/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/expression_rewriters/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/expression_rewriters/optimizer.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/expression_rewriters/sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/index_column.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/index_column_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/math.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/math_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/number.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/number_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/string.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/string_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/time.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/time_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/vector.c create mode 100644 storage/mroonga/vendor/groonga/plugins/functions/vector_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/query_expanders/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/query_expanders/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c create mode 100644 storage/mroonga/vendor/groonga/plugins/query_expanders/tsv_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/ruby/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/ruby/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/ruby/eval.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/ruby/sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/ruby_scripts.am create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_count.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_enumerator.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_parameters.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_range_filter.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_select.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_shard_list.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/logical_table_remove.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/parameters.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/range_expression_builder.rb create mode 100644 storage/mroonga/vendor/groonga/plugins/sharding/sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/suggest/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/suggest/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/suggest/sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/suggest/suggest.c create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/stem.c create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/stem_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/stop_word.c create mode 100644 storage/mroonga/vendor/groonga/plugins/token_filters/stop_word_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/kytea.cpp create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/kytea_sources.am create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c create mode 100644 storage/mroonga/vendor/groonga/plugins/tokenizers/mecab_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/.gitignore create mode 100644 storage/mroonga/vendor/groonga/src/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/src/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/src/grndb.c create mode 100644 storage/mroonga/vendor/groonga/src/grndb_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/grnslap.c create mode 100644 storage/mroonga/vendor/groonga/src/grnslap_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/groonga.c create mode 100644 storage/mroonga/vendor/groonga/src/groonga_benchmark.c create mode 100644 storage/mroonga/vendor/groonga/src/groonga_benchmark_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/groonga_mruby.c create mode 100644 storage/mroonga/vendor/groonga/src/groonga_mruby_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/groonga_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/httpd/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/src/httpd/nginx-module/config create mode 100644 storage/mroonga/vendor/groonga/src/httpd/nginx-module/ngx_http_groonga_module.c create mode 100644 storage/mroonga/vendor/groonga/src/suggest/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/src/suggest/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/src/suggest/create_dataset_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_create_dataset.c create mode 100644 storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_ddl.txt create mode 100644 storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_httpd.c create mode 100644 storage/mroonga/vendor/groonga/src/suggest/groonga_suggest_learner.c create mode 100644 storage/mroonga/vendor/groonga/src/suggest/httpd_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/suggest/learner_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/suggest/util.c create mode 100644 storage/mroonga/vendor/groonga/src/suggest/util.h create mode 100644 storage/mroonga/vendor/groonga/src/suggest/util_sources.am create mode 100644 storage/mroonga/vendor/groonga/src/suggest/zmq_compatible.h create mode 100644 storage/mroonga/vendor/groonga/tools/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/tools/check-small-index-limit.rb create mode 100755 storage/mroonga/vendor/groonga/tools/groonga-benchmark-indexing.rb create mode 100755 storage/mroonga/vendor/groonga/tools/groonga-memory-leak-checker.rb create mode 100755 storage/mroonga/vendor/groonga/tools/groonga-memory-usage-analyzer.rb create mode 100755 storage/mroonga/vendor/groonga/tools/groonga-object-list-checker.rb create mode 100755 storage/mroonga/vendor/groonga/tools/groonga-suggest-httpd-client.rb create mode 100755 storage/mroonga/vendor/groonga/tools/install/install-for-debian-jessie.sh create mode 100755 storage/mroonga/vendor/groonga/tools/prepare-sphinx-html.rb create mode 100755 storage/mroonga/vendor/groonga/tools/travis-before-script.sh create mode 100755 storage/mroonga/vendor/groonga/tools/travis-install.sh create mode 100755 storage/mroonga/vendor/groonga/tools/travis-script.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/Makefile.am create mode 100755 storage/mroonga/vendor/groonga/vendor/download_lz4.rb create mode 100755 storage/mroonga/vendor/groonga/vendor/download_mecab.rb create mode 100755 storage/mroonga/vendor/groonga/vendor/download_message_pack.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/lz4/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/lz4/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/mecab/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/mecab/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/mecab/config.h.cmake create mode 100644 storage/mroonga/vendor/groonga/vendor/mecab/mecabrc.cmake create mode 100644 storage/mroonga/vendor/groonga/vendor/message_pack/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/message_pack/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/build_config.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/built_sources.am create mode 100755 storage/mroonga/vendor/groonga/vendor/mruby/mruby_build.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/sources.am create mode 100755 storage/mroonga/vendor/groonga/vendor/mruby/update.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/mruby/version create mode 100644 storage/mroonga/vendor/groonga/vendor/onigmo/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/onigmo/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/onigmo/config.h.cmake create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/README.md create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/autogen.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/build/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/build/cmake_modules/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/build/cmake_modules/ReadFileList.cmake create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/configure.ac create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/data/travis/setup.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/lgpl-2.0.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/doc/text/news.md create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/gpg_uid create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/groonga-normalizer-mysql.pc.in create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/CMakeLists.txt create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql.c create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_general_ci_table.h create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_520_ci_table.h create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_unicode_ci_table.h create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/Vagrantfile create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/build-deb.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/env.sh.in create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/sign-packages.sh create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/sign-repository.sh create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/apt/update-repository.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/changelog create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/compat create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/control create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/copyright create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/groonga-normalizer-mysql.install create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/patches/series create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/rules create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/source/format create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/debian/watch create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/centos/groonga-normalizer-mysql.spec.in create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/rpm/fedora/groonga-normalizer-mysql.spec.in create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/source/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/ubuntu/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Makefile.am create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/Vagrantfile create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/build-rpm.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/env.sh.in create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/sign-rpm.sh create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/packages/yum/update-repository.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/required_groonga_version create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/dump_difference_uca.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/dump_difference_utf8.rb create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_uca_table.rb create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/generate_utf8_table.rb create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/parser.rb create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/travis/before_script.sh create mode 100755 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/tool/travis/install.sh create mode 100644 storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/version_full create mode 100755 storage/mroonga/vendor/groonga/version-gen.sh create mode 100644 storage/mroonga/version_full create mode 100644 storage/mroonga/version_in_hex create mode 100644 storage/mroonga/version_major create mode 100644 storage/mroonga/version_micro create mode 100644 storage/mroonga/version_minor (limited to 'storage/mroonga') diff --git a/storage/mroonga/AUTHORS b/storage/mroonga/AUTHORS new file mode 100644 index 00000000..c29bd9cc --- /dev/null +++ b/storage/mroonga/AUTHORS @@ -0,0 +1,7 @@ +Active developers: +* Kentoku SHIBA +* Kouhei Sutou + +Inactive developers: +* Tetsuro IKEDA: The original author: Active +* Yoshinori Matsunobu: The original author of information schema diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt new file mode 100644 index 00000000..2a449a86 --- /dev/null +++ b/storage/mroonga/CMakeLists.txt @@ -0,0 +1,453 @@ +# -*- indent-tabs-mode: nil -*- +# +# Copyright(C) 2012-2015 Kouhei Sutou +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +cmake_minimum_required(VERSION 2.8.12) +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) + 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(MSVC) + 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(MRN_BUNDLED) + if(WITHOUT_MROONGA OR + WITHOUT_MROONGA_STORAGE_ENGINE OR + "${PLUGIN_MROONGA}" STREQUAL "NO") + return() + endif() +endif() + +set(MRN_BUNDLED_GROONGA_RELATIVE_DIR "vendor/groonga") +set(MRN_BUNDLED_GROONGA_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") +if(EXISTS "${MRN_BUNDLED_GROONGA_DIR}") + set(MRN_GROONGA_BUNDLED TRUE) + if(MSVC) + # Bundled Mroonga does not support MSVC yet + return() + endif() +else() + set(MRN_GROONGA_BUNDLED FALSE) +endif() + +set(MRN_PLUGIN_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) + +if(MRN_BUNDLED) + set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR}/storage/mroonga) +else() + set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR}) +endif() + +file(READ ${MRN_SOURCE_DIR}/version_full MRN_VERSION) +file(READ ${MRN_SOURCE_DIR}/version_major MRN_VERSION_MAJOR) +file(READ ${MRN_SOURCE_DIR}/version_minor MRN_VERSION_MINOR) +file(READ ${MRN_SOURCE_DIR}/version_micro MRN_VERSION_MICRO) +file(READ ${MRN_SOURCE_DIR}/version_in_hex MRN_VERSION_IN_HEX) +file(READ ${MRN_SOURCE_DIR}/plugin_version MRN_PLUGIN_VERSION) + +if(MRN_GROONGA_BUNDLED) + 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() + + file(READ "${MRN_BUNDLED_GROONGA_DIR}/bundled_lz4_version" + MRN_BUNDLED_LZ4_VERSION) + string(STRIP + "${MRN_BUNDLED_LZ4_VERSION}" + MRN_BUNDLED_LZ4_VERSION) + set(MRN_BUNDLED_LZ4_DIR + "${MRN_BUNDLED_GROONGA_DIR}/vendor/lz4-${MRN_BUNDLED_LZ4_VERSION}") + if(EXISTS ${MRN_BUNDLED_LZ4_DIR}) + set(GRN_WITH_BUNDLED_LZ4 ON) + set(GRN_WITH_LZ4 "yes") + else() + set(GRN_WITH_LZ4 "no") + endif() + + add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") +else() + set(MRN_GROONGA_EMBED OFF) + + file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION) + string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION) + + file(READ + ${MRN_SOURCE_DIR}/required_groonga_normalizer_mysql_version + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) + string(STRIP + "${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}" + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) +endif() + +set(MRN_PACKAGE_STRING "${PROJECT_NAME} ${MRN_VERSION}") + +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) +include(${MRN_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake) + +set(MRN_C_COMPILE_FLAGS "") +set(MRN_CXX_COMPILE_FLAGS "") + +if(MRN_BUNDLED) + set(MRN_RELATIVE_DIR_PREFIX "${MRN_SOURCE_DIR}/") +else() + set(MRN_RELATIVE_DIR_PREFIX "") +endif() + +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am 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" + LIBMRN_NO_MYSQL_SOURCES "${LIBMRN_NO_MYSQL_SOURCES}") +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_need_mysql_sources.am + LIBMRN_NEED_MYSQL_SOURCES) +string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}lib/\\1" + LIBMRN_NEED_MYSQL_SOURCES "${LIBMRN_NEED_MYSQL_SOURCES}") +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/udf/sources.am MRN_UDF_SOURCES) +string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}udf/\\1" + MRN_UDF_SOURCES "${MRN_UDF_SOURCES}") + +if(MRN_BUNDLED) + set(MYSQL_SOURCE_DIR ${CMAKE_SOURCE_DIR}) + set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR}) + set(MYSQL_CONFIG ${CMAKE_SOURCE_DIR}/scripts/mysql_config) +else() + set(MYSQL_SOURCE_DIR "/PATH/TO/MYSQL/SOURCE/DIRECTORY/" + CACHE PATH "MySQL source directory") + if(NOT EXISTS ${MYSQL_SOURCE_DIR}) + message(FATAL_ERROR + "MySQL source directory (MYSQL_SOURCE_DIR) doesn't exist: <${MYSQL_SOURCE_DIR}>") + endif() + set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR} CACHE PATH "MySQL build directory") + set(MYSQL_CONFIG "mysql_config" CACHE PATH "mysql-config command path") +endif() +find_path(MYSQL_CONFIG "${MYSQL_CONFIG}") + +if(EXISTS "${MYSQL_SOURCE_DIR}/storage/maria") + set(MYSQL_VARIANT "MariaDB") +else() + set(MYSQL_VARIANT "MySQL") +endif() + +set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/regex") + +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_BUILD_DIR}/libbinlogevents/include" + "${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) + set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}") + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_DIR}/libservices") + set(MYSQL_CFLAGS "${CMAKE_C_FLAGS}") + set(MYSQL_VERSION "${MYSQL_BASE_VERSION}") +else() + macro(SET_MYSQL_CONFIG_VALUE OPTION VARIABLE) + if(NOT ${VARIABLE}) + execute_process(COMMAND "${MYSQL_CONFIG}" ${OPTION} + OUTPUT_VARIABLE MYSQL_CONFIG_OUTPUT) + string(STRIP ${MYSQL_CONFIG_OUTPUT} ${VARIABLE}) + endif() + endmacro() + + set_mysql_config_value("--plugindir" MYSQL_PLUGIN_DIR) + set_mysql_config_value("--variable=pkglibdir" MYSQL_PKG_LIB_DIR) + set(MYSQL_BUILD_LIBSERVICES_DIR "${MYSQL_BUILD_DIR}/libservices") + if(EXISTS "${MYSQL_BUILD_LIBSERVICES_DIR}/libmysqlservices.a") + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_LIBSERVICES_DIR}") + else() + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_PKG_LIB_DIR}") + endif() + set_mysql_config_value("--cflags" MYSQL_CFLAGS) + set_mysql_config_value("--version" MYSQL_VERSION) +endif() + +if(${MYSQL_VERSION} VERSION_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 + "Mroonga doesn't support MariaDB 10.0.0-10.0.8: <${MYSQL_VERSION}>") + return() +endif() + +if(MRN_GROONGA_BUNDLED) + set(GROONGA_INCLUDE_DIRS "${MRN_BUNDLED_GROONGA_DIR}/include") + set(GROONGA_LIBRARY_DIRS "${MRN_BUNDLED_GROONGA_DIR}/lib") + set(GROONGA_LIBRARIES "libgroonga") + + 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}") + set(MRN_LIBRARY_DIRS + ${MRN_LIBRARY_DIRS} + ${GROONGA_LIBRARY_DIRS}) + set(MRN_LIBRARIES ${GROONGA_LIBRARIES}) +endif() + +include_directories( + "${PROJECT_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/lib" + ${MYSQL_INCLUDE_DIRS} + ${GROONGA_INCLUDE_DIRS}) + +if(WIN32) + set(MYSQL_LIBRARY_DIRS + "${MYSQL_BUILD_DIR}/lib" + "${MYSQL_BUILD_DIR}/libmysqld") +else() + set(MYSQL_LIBRARY_DIRS + "${MYSQL_SERVICES_LIB_DIR}") +endif() +link_directories( + ${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) + mysql_add_plugin(mroonga + ${MRN_ALL_SOURCES} + STORAGE_ENGINE MODULE_ONLY + LINK_LIBRARIES ${MRN_LIBRARIES}) + if(NOT TARGET mroonga) + return() + endif() +else() + add_library(mroonga MODULE ${MRN_ALL_SOURCES}) + + set(MYSQL_LIBRARIES "mysqlservices") + target_link_libraries(mroonga ${GROONGA_LIBRARIES} ${MYSQL_LIBRARIES}) + + option(WITH_DEBUG "Enable debug options" OFF) + if(WITH_DEBUG) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "SAFE_MUTEX") + if(CMAKE_COMPILER_IS_GNUCXX) + set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} -g3 -O0") + set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} -g3 -O0") + endif() + else() + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "DBUG_OFF") + endif() + + option(WITH_DEBUG_FULL "Enable full debug options" OFF) + if(WITH_DEBUG_FULL) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "SAFE_MUTEX" "SAFEMALLOC") + endif() + + option(DISABLE_FAST_MUTEXES "Force disabling fast mutex" OFF) + if(DISABLE_FAST_MUTEXES) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "FORCE_FAST_MUTEX_DISABLED=1") + endif() + + option(WITH_FAST_MUTEXES "Enable fast mutex" OFF) + if(WITH_FAST_MUTEXES) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MY_PTHREAD_FASTMUTEX") + endif() + + if(CMAKE_COMPILER_IS_GNUCXX) + MY_CHECK_AND_SET_COMPILER_FLAG("-Wall") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated") + MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions") + MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors") + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") + endif() + 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_CXX_COMPILE_FLAGS}") + set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES + COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") + set_target_properties(mroonga PROPERTIES + PREFIX "" + OUTPUT_NAME "ha_mroonga") + + install(TARGETS mroonga DESTINATION "${MYSQL_PLUGIN_DIR}") +endif() + +option(MRN_BUILD_FOR_EMBEDDED_SERVER + "Whether to build Mroonga for embedded server or not. You can't use Mroonga built for embedded server with non embedded server." + OFF) +if(MRN_BUILD_FOR_EMBEDDED_SERVER) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "EMBEDDED_LIBRARY") +endif() + +if(GROONGA_NORMALIZER_MYSQL_FOUND) + 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_EMBEDDED") + else() + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"") + endif() +endif() + +if(MRN_GROONGA_EMBED) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_GROONGA_EMBEDDED") +endif() + +set(MRN_DEFAULT_PARSER "" CACHE STRING + "The default fulltext parser (Deprecated. Use MRN_DEFAULT_TOKENIZER instead.)") +set(MRN_DEFAULT_TOKENIZER "" CACHE STRING + "The default tokenizer for fulltext index") +if(NOT ${MRN_DEFAULT_TOKENIZER} STREQUAL "") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_TOKENIZER}\"") +elseif(NOT ${MRN_DEFAULT_PARSER} STREQUAL "") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_PARSER}\"") +endif() + +configure_file( + "${PROJECT_SOURCE_DIR}/mrn_version.h.in" + "${PROJECT_BINARY_DIR}/mrn_version.h") + +configure_file( + "${PROJECT_SOURCE_DIR}/config.sh.in" + "${PROJECT_BINARY_DIR}/config.sh") + +set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga") +if(NOT EXISTS "${MRN_TEST_SUITE_DIR}") + set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga") +endif() +configure_file( + "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in" + "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result" + NEWLINE_STYLE LF) +configure_file( + "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in" + "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result" + NEWLINE_STYLE LF) + +configure_file( + "${PROJECT_SOURCE_DIR}/data/install.sql.in" + "${PROJECT_BINARY_DIR}/data/install.sql") + +if(MRN_BUNDLED) + set(MRN_DATA_DIR "${INSTALL_MYSQLSHAREDIR}/${PROJECT_NAME}") +else() + set(MRN_DATA_DIR "share/${PROJECT_NAME}") +endif() +install(FILES + "${PROJECT_SOURCE_DIR}/AUTHORS" + "${PROJECT_SOURCE_DIR}/COPYING" + "${PROJECT_BINARY_DIR}/data/install.sql" + "${PROJECT_SOURCE_DIR}/data/uninstall.sql" + DESTINATION "${MRN_DATA_DIR}/") diff --git a/storage/mroonga/COPYING b/storage/mroonga/COPYING new file mode 100644 index 00000000..21d4c6d6 --- /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-1335 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. + + + Copyright (C) + + This library is free software; you can redistribute it 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-1335 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. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/storage/mroonga/ChangeLog b/storage/mroonga/ChangeLog new file mode 100644 index 00000000..1a63e191 --- /dev/null +++ b/storage/mroonga/ChangeLog @@ -0,0 +1,3 @@ +2009-01-27 Tetsuro IKEDA + + * initial import for development diff --git a/storage/mroonga/Makefile.am b/storage/mroonga/Makefile.am new file mode 100644 index 00000000..69349ea6 --- /dev/null +++ b/storage/mroonga/Makefile.am @@ -0,0 +1,175 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_ARGS} +AUTOMAKE_OPTIONS = 1.9.7 + +LOCALES = ja + +AM_CPPFLAGS = $(MYSQL_INCLUDES) $(GROONGA_CFLAGS) -I$(top_srcdir)/lib + +include sources.am + +libraries = \ + $(top_builddir)/udf/libmrn_udf.la \ + $(top_builddir)/lib/libmrn_no_mysql.la \ + $(top_builddir)/lib/libmrn_need_mysql.la +if WITH_LIBMYSQLSERVICES_COMPAT +libraries += $(top_builddir)/lib/libmysqlservices.la +endif + +dynamic_plugin_ldflags = -module $(GROONGA_LIBS) $(MYSQL_LIBS) +dynamic_plugin_cxxflags = $(AM_CXXFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +dynamic_plugin_cflags = $(AM_CFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + +plugin_LTLIBRARIES = ha_mroonga.la +ha_mroonga_la_LDFLAGS = $(dynamic_plugin_ldflags) +ha_mroonga_la_CXXFLAGS = $(dynamic_plugin_cxxflags) +ha_mroonga_la_CFLAGS = $(dynamic_plugin_cflags) +ha_mroonga_la_SOURCES = $(sources) +ha_mroonga_la_LIBADD = $(libraries) + +SUBDIRS = \ + build \ + lib \ + udf \ + test \ + mysql-test \ + doc \ + tools \ + packages \ + data + +EXTRA_DIST = \ + AUTHORS \ + gpg_uid \ + CMakeLists.txt + +installcheck-local: install + test/run-sql-test.sh + +tag: + cd $(top_srcdir) && \ + git tag v$(VERSION) -a -m 'Mroonga $(VERSION)!!!' + +ensure-cutter-source-path: + @if test -z "$(CUTTER_SOURCE_PATH)"; then \ + echo "\$$(CUTTER_SOURCE_PATH) is missing"; \ + exit 1; \ + fi + +update-latest-release: ensure-cutter-source-path + @if test -z "$(OLD_RELEASE)"; then \ + echo "\$$(OLD_RELEASE) is missing"; \ + exit 1; \ + fi + @if test -z "$(OLD_RELEASE_DATE)"; then \ + echo "\$$(OLD_RELEASE_DATE) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_RELEASE_DATE)"; then \ + echo "\$$(NEW_RELEASE_DATE) is missing"; \ + exit 1; \ + fi + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/rpm/centos/mariadb-mroonga.spec.in \ + packages/rpm/centos/mariadb-10.1-mroonga.spec.in \ + packages/rpm/centos/mariadb-10.2-mroonga.spec.in \ + packages/rpm/centos/mysql55-mroonga.spec.in \ + packages/rpm/centos/mysql56-community-mroonga.spec.in \ + packages/rpm/centos/mysql57-community-mroonga.spec.in \ + packages/rpm/centos/percona-server-56-mroonga.spec.in \ + packages/rpm/centos/percona-server-57-mroonga.spec.in \ + doc/source/install/*.rst \ + doc/locale/*/LC_MESSAGES/install.po \ + $(MROONGA_GITHUB_COM_PATH)/_config.yml + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.5 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.5/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.6 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.6/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-5.7 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-5.7/changelog + cd $(top_srcdir) && \ + "$(CUTTER_SOURCE_PATH)/misc/update-latest-release.rb" \ + $(PACKAGE)-mariadb-10.0 $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/debian-mariadb-10.0/changelog + +update-po: + @for lang in $(LOCALES); do \ + (cd $(top_srcdir)/doc/locale/$$lang/LC_MESSAGES && make update) \ + done + +update-document: + @if test -z "$(MROONGA_GITHUB_COM_PATH)"; then \ + echo "\$$(MROONGA_GITHUB_COM_PATH) is missing"; \ + echo "add --with-mroonga-github-com-path in configure"; \ + exit 1; \ + fi + rm -rf tmp-doc + mkdir tmp-doc + (cd doc && $(MAKE) clean-html) + (cd doc && $(MAKE) install docdir=$(abs_srcdir)/tmp-doc/install) + ruby $(srcdir)/tools/prepare-sphinx-html.rb tmp-doc/install tmp-doc/dist + rm -rf $(MROONGA_GITHUB_COM_PATH)/docs + mv tmp-doc/dist/en $(MROONGA_GITHUB_COM_PATH)/docs + for locale in `cd tmp-doc/dist; echo *`; do \ + dest_base_dir=$(MROONGA_GITHUB_COM_PATH)/$${locale}; \ + mkdir -p $${dest_base_dir}; \ + dest_dir=$${dest_base_dir}/docs; \ + rm -rf $${dest_dir}; \ + mv tmp-doc/dist/$${locale} $${dest_dir}; \ + done + +update-files: + cd $(srcdir)/doc && $(MAKE) update-files + +update-version: + @if test -z "$(NEW_VERSION_MAJOR)"; then \ + echo "\$$(NEW_VERSION_MAJOR) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_VERSION_MINOR)"; then \ + echo "\$$(NEW_VERSION_MINOR) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_VERSION_MICRO)"; then \ + echo "\$$(NEW_VERSION_MICRO) is missing"; \ + exit 1; \ + fi + @echo -n $(NEW_VERSION_MAJOR) > $(srcdir)/version_major + @echo -n $(NEW_VERSION_MINOR) > $(srcdir)/version_minor + @echo -n $(NEW_VERSION_MICRO) > $(srcdir)/version_micro + @echo -n $(NEW_VERSION_MAJOR).$(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/version + @if test $(NEW_VERSION_MINOR) -eq 0 ; then \ + printf "0x%02x%02x" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \ + > $(srcdir)/version_in_hex; \ + printf "%d.%d" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \ + > $(srcdir)/plugin_version; \ + else \ + printf "0x%02x%02x" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/version_in_hex; \ + printf "%d.%d" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/plugin_version; \ + fi + +upload-to-github: + ruby $(srcdir)/tools/upload-to-github.rb \ + $$USER $(PACKAGE)-$(VERSION).tar.gz + +echo-cutter: + echo $(CUTTER) diff --git a/storage/mroonga/NEWS b/storage/mroonga/NEWS new file mode 100644 index 00000000..9dfa8b8d --- /dev/null +++ b/storage/mroonga/NEWS @@ -0,0 +1 @@ +See doc/source/news.txt or http://mroonga.github.com/docs/news.html. diff --git a/storage/mroonga/README b/storage/mroonga/README new file mode 100644 index 00000000..7c431018 --- /dev/null +++ b/storage/mroonga/README @@ -0,0 +1 @@ +See doc/locale/en/html/index.html or doc/locale/ja/html/index.html diff --git a/storage/mroonga/appveyor.yml b/storage/mroonga/appveyor.yml new file mode 100644 index 00000000..3cf8ff8d --- /dev/null +++ b/storage/mroonga/appveyor.yml @@ -0,0 +1,63 @@ +version: "{build}" +clone_depth: 10 +environment: + global: + MARIADB_VERSION: 10.1.26 + matrix: + - CMAKE_GENERATOR_NAME: "Visual Studio 14 2015" + - CMAKE_GENERATOR_NAME: "Visual Studio 14 2015 Win64" + +install: + - cd .. + - choco install -y curl 7zip.commandline + - curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-%MARIADB_VERSION%/source/mariadb-%MARIADB_VERSION%.tar.gz + - 7z x mariadb-%MARIADB_VERSION%.tar.gz + - 7z x mariadb-%MARIADB_VERSION%.tar > nul + - cd mariadb-%MARIADB_VERSION% + - rmdir /S /Q storage\mroonga\ + - move ..\mroonga storage\mroonga + - git clone --quiet --depth 1 --recursive https://github.com/groonga/groonga.git ..\groonga + - rmdir /S /Q ..\groonga\test\ + - cd ..\groonga\vendor + - c:\Ruby22-x64\bin\ruby -v download_lz4.rb + - c:\Ruby22-x64\bin\ruby -v download_mecab.rb + - cd ..\..\mariadb-%MARIADB_VERSION% + - 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 "%CMAKE_GENERATOR_NAME%" + -DCMAKE_BUILD_TYPE=Debug + -DPLUGIN_ARCHIVE=NO + -DPLUGIN_BLACKHOLE=NO + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_CONNECT=NO + -DPLUGIN_CSV=NO + -DPLUGIN_EXAMPLE=NO + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO + -DPLUGIN_HEAP=NO + -DPLUGIN_INNOBASE=NO + -DPLUGIN_MYISAM=NO + -DPLUGIN_MYISAMMRG=NO + -DPLUGIN_OQGRAPH=NO + -DPLUGIN_PERFSCHEMA=NO + -DPLUGIN_SEQUENCE=NO + -DPLUGIN_SPHINX=NO + -DPLUGIN_SPIDER=NO + -DPLUGIN_TEST_SQL_DISCOVERY=NO + -DPLUGIN_TOKUDB=NO + -DPLUGIN_XTRADB=NO + -DWITH_UNIT_TESTS=OFF + -DWITH_MARIABACKUP=OFF + -DGRN_WITH_BUNDLED_MECAB=ON + - cmake --build . --config Debug + +notifications: + - provider: Email + to: + - groonga-mysql-commit@lists.sourceforge.jp + on_build_status_changed: true + +test: off diff --git a/storage/mroonga/autogen.sh b/storage/mroonga/autogen.sh new file mode 100755 index 00000000..f795ad00 --- /dev/null +++ b/storage/mroonga/autogen.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +case $(uname -s) in +FreeBSD) + ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/" + ;; +esac + +mkdir -p m4 + +${AUTORECONF:-autoreconf} --force --install "$@" diff --git a/storage/mroonga/build/Makefile.am b/storage/mroonga/build/Makefile.am new file mode 100644 index 00000000..506a11dc --- /dev/null +++ b/storage/mroonga/build/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = \ + cmake_modules diff --git a/storage/mroonga/build/cmake_modules/Makefile.am b/storage/mroonga/build/cmake_modules/Makefile.am new file mode 100644 index 00000000..83fb0f0c --- /dev/null +++ b/storage/mroonga/build/cmake_modules/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = \ + ReadFileList.cmake diff --git a/storage/mroonga/build/cmake_modules/ReadFileList.cmake b/storage/mroonga/build/cmake_modules/ReadFileList.cmake new file mode 100644 index 00000000..204f59f6 --- /dev/null +++ b/storage/mroonga/build/cmake_modules/ReadFileList.cmake @@ -0,0 +1,27 @@ +# Copyright(C) 2012 Brazil +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +macro(read_file_list file_name output_variable) + file(READ ${file_name} ${output_variable}) + # Remove variable declaration at the first line: + # "libgroonga_la_SOURCES = \" -> "" + string(REGEX REPLACE "^.*=[ \t]*\\\\" "" + ${output_variable} "${${output_variable}}") + # Remove white spaces: " com.c \\\n com.h \\\n" -> "com.c\\com.h" + string(REGEX REPLACE "[ \t\n]" "" ${output_variable} "${${output_variable}}") + # Convert string to list: "com.c\\com.h" -> "com.c;com.h" + # NOTE: List in CMake is ";" separated string. + string(REGEX REPLACE "\\\\" ";" ${output_variable} "${${output_variable}}") +endmacro() diff --git a/storage/mroonga/build/makefiles/LC_MESSAGES.am b/storage/mroonga/build/makefiles/LC_MESSAGES.am new file mode 100644 index 00000000..acfc3da2 --- /dev/null +++ b/storage/mroonga/build/makefiles/LC_MESSAGES.am @@ -0,0 +1,5 @@ +BUILT_SOURCES = +EXTRA_DIST = +SUFFIXES = + +include $(top_srcdir)/build/makefiles/gettext.am diff --git a/storage/mroonga/build/makefiles/gettext.am b/storage/mroonga/build/makefiles/gettext.am new file mode 100644 index 00000000..9cea8ce6 --- /dev/null +++ b/storage/mroonga/build/makefiles/gettext.am @@ -0,0 +1,86 @@ +include $(top_srcdir)/doc/files.am +include $(top_srcdir)/build/makefiles/sphinx-build.am + +CLEANFILES = + +EXTRA_DIST += \ + $(po_files) + +if DOCUMENT_AVAILABLE +EXTRA_DIST += \ + $(mo_files) +endif + +if DOCUMENT_BUILDABLE +BUILT_SOURCES += \ + mo-build-stamp +CLEANFILES += \ + pot-build-stamp \ + edit-po-build-stamp \ + mo-build-stamp +endif + +SUFFIXES += .pot .po .mo .edit + +.PHONY: gettext update build + +.pot.edit: + if test -f $*.po; then \ + msgmerge \ + --quiet \ + --sort-by-file \ + --output-file=$@.tmp \ + $*.po \ + $<; \ + else \ + msginit \ + --input=$< \ + --output-file=$@.tmp \ + --locale=$(LOCALE) \ + --no-translator; \ + fi + (echo "# -*- po -*-"; \ + GREP_OPTIONS= grep -v '^# -\*- po -\*-' $@.tmp | \ + GREP_OPTIONS= grep -v '^"POT-Creation-Date:') > $@ + rm $@.tmp + +.edit.po: + msgcat --no-location --output $@ $< + +.po.mo: + msgfmt -o $@ $< + +if DOCUMENT_BUILDABLE +update: edit-po-build-stamp +build: mo-build-stamp +else +update: +build: +endif + +html: build +man: build +pdf: build + +gettext: + rm *.pot || true + $(SPHINX_BUILD_COMMAND) -d doctrees -b gettext $(ALLSPHINXOPTS) . + xgettext --language Python --output conf.pot \ + $(top_srcdir)/doc/source/conf.py + +pot-build-stamp: $(absolute_source_files) + $(MAKE) gettext + @touch $@ + +edit-po-build-stamp: 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/build/makefiles/locale.am b/storage/mroonga/build/makefiles/locale.am new file mode 100644 index 00000000..414c19a7 --- /dev/null +++ b/storage/mroonga/build/makefiles/locale.am @@ -0,0 +1,12 @@ +SUBDIRS = LC_MESSAGES + +BUILT_SOURCES = +EXTRA_DIST = + +include $(top_srcdir)/build/makefiles/sphinx.am + +init: + cd LC_MESSAGES && $(MAKE) $@ + +update-po: + cd LC_MESSAGES && $(MAKE) update diff --git a/storage/mroonga/build/makefiles/sphinx-build.am b/storage/mroonga/build/makefiles/sphinx-build.am new file mode 100644 index 00000000..57bbcd61 --- /dev/null +++ b/storage/mroonga/build/makefiles/sphinx-build.am @@ -0,0 +1,17 @@ +# You can set these variables from the command line. +DOCTREES_BASE = doctrees + +SPHINXOPTS = +PAPER = + +# Internal variables. +SOURCE_DIR = $(abs_top_srcdir)/doc/source +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR) + +SPHINX_BUILD_COMMAND = \ + DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \ + DOCUMENT_VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \ + LOCALE="$(LOCALE)" \ + $(SPHINX_BUILD) diff --git a/storage/mroonga/build/makefiles/sphinx.am b/storage/mroonga/build/makefiles/sphinx.am new file mode 100644 index 00000000..c68f62e2 --- /dev/null +++ b/storage/mroonga/build/makefiles/sphinx.am @@ -0,0 +1,179 @@ +include $(top_srcdir)/doc/files.am +include $(top_srcdir)/build/makefiles/sphinx-build.am + +$(html_files): html-build-stamp +$(html_files_relative_from_locale_dir): html-build-stamp +$(man_files): man-build-stamp + +am__nobase_dist_doc_locale_DATA_DIST = +if DOCUMENT_AVAILABLE +doc_localedir = $(docdir)/$(LOCALE) +nobase_dist_doc_locale_DATA = \ + $(html_files_relative_from_locale_dir) +am__nobase_dist_doc_locale_DATA_DIST += \ + $(nobase_dist_doc_locale_DATA) +endif + +document_source_files = \ + $(absolute_source_files) \ + $(absolute_theme_files) \ + $(po_files_relative_from_locale_dir) \ + $(mo_files_relative_from_locale_dir) + +required_build_stamps = \ + html-build-stamp \ + man-build-stamp \ + mo-build-stamp + +if DOCUMENT_BUILDABLE +EXTRA_DIST += $(required_build_stamps) +endif + +man_files = \ + man/$(PACKAGE_NAME).1 + +generated_files = \ + $(DOCTREES_BASE) \ + man \ + man-build-stamp \ + html \ + html-build-stamp \ + pdf \ + pdf-build-stamp \ + dirhtml \ + dirhtml-build-stamp \ + pickle \ + pikcle-build-stamp \ + json \ + json-build-stamp \ + htmlhelp \ + htmlhelp-build-stamp \ + qthelp \ + qthelp-build-stamp \ + latex \ + latex-build-stamp \ + changes \ + changes-build-stamp \ + linkcheck \ + linkcheck-build-stamp \ + doctest + +$(mo_files_relative_from_locale_dir): mo-build-stamp + +mo-build-stamp: $(po_files_relative_from_locale_dir) + cd LC_MESSAGES && $(MAKE) build + @touch $@ + +if DOCUMENT_BUILDABLE +clean-local: $(clean_targets) clean-doctrees + +clean-doctrees: + rm -rf $(DOCTREES_BASE) + +maintainer-clean-local: + rm -rf -- $(generated_files) +endif + +.PHONY: help +.PHONY: man clean-man +.PHONY: html clean-html +.PHONY: pdf +.PHONY: dirhtml +.PHONY: pickle +.PHONY: json +.PHONY: htmlhelp +.PHONY: qthelp +.PHONY: latex +.PHONY: changes +.PHONY: linkcheck +.PHONY: doctest + +if DOCUMENT_BUILDABLE +help: + @echo "Please use \`make ' where is one of" + @echo " man to make man files" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " rdoc to make RDoc files" + @echo " textile to make Textile files" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +man: man-build-stamp +html: html-recursive html-build-stamp +dirhtml: dirhtml-build-stamp +pickle: pickle-build-stamp +json: json-build-stamp +htmlhelp: htmlhelp-build-stamp +qthelp: qthelp-build-stamp +latex: latex-build-stamp +rdoc: rdoc-build-stamp +textile: textile-build-stamp +changes: changes-build-stamp +linkcheck: linkcheck-build-stamp +doctest: doctest-build-stamp + +clean_targets = \ + clean-man \ + clean-html \ + clean-dirhtml \ + clean-pickle \ + clean-json \ + clean-htmlhelp \ + clean-qthelp \ + clean-latex \ + clean-rdoc \ + clean-textile \ + clean-changes \ + clean-linkcheck \ + clean-doctest + +$(clean_targets): + target=`echo $@ | sed -e 's/^clean-//'`; \ + rm -rf $${target}-build-stamp $${target} + +build_stamps = \ + man-build-stamp \ + html-build-stamp \ + dirhtml-build-stamp \ + pickle-build-stamp \ + json-build-stamp \ + htmlhelp-build-stamp \ + qthelp-build-stamp \ + latex-build-stamp \ + rdoc-build-stamp \ + textile-build-stamp \ + changes-build-stamp \ + linkcheck-build-stamp \ + doctest-build-stamp + +$(build_stamps): $(document_source_files) + target=`echo $@ | sed -e 's/-build-stamp$$//'`; \ + $(SPHINX_BUILD_COMMAND) \ + -Dlanguage=$(LOCALE) \ + -d $(DOCTREES_BASE)/$${target} \ + -b $${target} \ + $(ALLSPHINXOPTS) \ + $${target} + @touch $@ + +qthelp: qthelp-message +qthelp-message: qthelp-build-stamp + @echo "Build finished; now you can run 'qcollectiongenerator' with the" \ + ".qhcp project file in qthelp/*, like this:" + @echo "# qcollectiongenerator qthelp/groonga.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile qthelp/groonga.qhc" + +latex: latex-message +latex-message: latex-build-stamp + @echo "Build finished; the LaTeX files are in latex/*." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." +endif diff --git a/storage/mroonga/config.sh.in b/storage/mroonga/config.sh.in new file mode 100644 index 00000000..4f02fb94 --- /dev/null +++ b/storage/mroonga/config.sh.in @@ -0,0 +1,20 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +MYSQL_SOURCE_DIR="@MYSQL_SOURCE_DIR@" +MYSQL_BUILD_DIR="@MYSQL_BUILD_DIR@" +MYSQL_VERSION="@MYSQL_VERSION@" +MRN_BUNDLED="@MRN_BUNDLED@" diff --git a/storage/mroonga/configure.ac b/storage/mroonga/configure.ac new file mode 100644 index 00000000..3ef31bdc --- /dev/null +++ b/storage/mroonga/configure.ac @@ -0,0 +1,540 @@ +AC_PREREQ(2.59) + +m4_define([mrn_version_major], m4_include(version_major)) +m4_define([mrn_version_minor], m4_include(version_minor)) +m4_define([mrn_version_micro], m4_include(version_micro)) +m4_define([mrn_version], m4_include(version)) +m4_define([mrn_version_in_hex], m4_include(version_in_hex)) +m4_define([mrn_plugin_version], m4_include(plugin_version)) + +AC_INIT([mroonga], [mrn_version], [groonga-talk@lists.sourceforge.net]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([tar-pax foreign subdir-objects]) + +MRN_VERSION=mrn_version +MRN_VERSION_MAJOR=mrn_version_major +MRN_VERSION_MINOR=mrn_version_minor +MRN_VERSION_MICRO=mrn_version_micro +MRN_VERSION_IN_HEX=mrn_version_in_hex +MRN_PLUGIN_VERSION=mrn_plugin_version +AC_SUBST([MRN_VERSION]) +AC_SUBST([MRN_VERSION_MAJOR]) +AC_SUBST([MRN_VERSION_MINOR]) +AC_SUBST([MRN_VERSION_MICRO]) +AC_SUBST([MRN_VERSION_IN_HEX]) +AC_SUBST([MRN_PLUGIN_VERSION]) + +MRN_PACKAGE_STRING="$PACKAGE_STRING" +AC_SUBST([MRN_PACKAGE_STRING]) + +MRN_BUNDLED=FALSE +AC_SUBST([MRN_BUNDLED]) + +AC_C_BIGENDIAN +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CPP +AC_PROG_LIBTOOL +m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) + +AC_DEFUN([CHECK_CFLAG], [ + AC_MSG_CHECKING([if gcc supports $1]) + old_CFLAGS=$CFLAGS + flag=`echo '$1' | sed -e 's,^-Wno-,-W,'` + CFLAGS="$CFLAGS $flag -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [check_cflag=yes], + [check_cflag=no]) + CFLAGS="$old_CFLAGS" + if test "x$check_cflag" = "xyes"; then + CFLAGS="$CFLAGS $1" + fi + AC_MSG_RESULT([$check_cflag]) +]) + +AC_DEFUN([CHECK_CXXFLAG], [ + AC_MSG_CHECKING([if g++ supports $1]) + old_CXXFLAGS=$CXXFLAGS + flag=`echo '$1' | sed -e 's,^-Wno-,-W,'` + CXXFLAGS="$CXXFLAGS $flag -Werror" + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [check_cxxflag=yes], + [check_cxxflag=no]) + AC_LANG_POP([C++]) + CXXFLAGS="$old_CXXFLAGS" + if test "x$check_cxxflag" = "xyes"; then + CXXFLAGS="$CXXFLAGS $1" + fi + AC_MSG_RESULT([$check_cxxflag]) +]) + +AC_DEFUN([CHECK_BUILD_FLAG], [ + CHECK_CFLAG([$1]) + CHECK_CXXFLAG([$1]) +]) + +if test "$GCC" = "yes"; then + CHECK_BUILD_FLAG([-Wall]) + CHECK_BUILD_FLAG([-Wextra]) + CHECK_BUILD_FLAG([-Wno-unused-parameter]) + CHECK_BUILD_FLAG([-Wno-strict-aliasing]) + # REMOVEME: workaround for MySQL/MariaDB 5.5.22 :< + # They use deprecated MYSQL::generate_name style in class definition. + CHECK_BUILD_FLAG([-Wno-deprecated]) +fi + +AC_MSG_CHECKING(for the suffix of plugin shared libraries) +shrext_cmds=$(./libtool --config | grep '^shrext_cmds=') +eval $shrext_cmds +module=yes eval MRN_PLUGIN_SUFFIX="$shrext_cmds" +AC_MSG_RESULT($MRN_PLUGIN_SUFFIX) +if test -z "$MRN_PLUGIN_SUFFIX"; then + AC_MSG_ERROR([can't detect plugin suffix]) +fi +AC_SUBST(MRN_PLUGIN_SUFFIX) + +AC_ARG_WITH(libmysqlservices-compat, + [AS_HELP_STRING([--with-libmysqlservices-compat], + [Use libmysqlservices compatible library for missing libmysqlservices.a]) + ], + [with_libmysqlservices_compat=$withval], + [with_libmysqlservices_compat=no]) +AM_CONDITIONAL([WITH_LIBMYSQLSERVICES_COMPAT], [test "${with_libmysqlservices_compat}" != "no"]) + +AC_DEFUN([CONFIG_OPTION_MYSQL],[ + AC_MSG_CHECKING([mysql source]) + + ac_mysql_source_dir= + AC_ARG_WITH([mysql-source], + [AS_HELP_STRING([--with-mysql-source=PATH], [MySQL source directory PATH])], + [ + ac_mysql_source_dir="$withval" + if test -f "$ac_mysql_source_dir/sql/handler.h"; then + case "$ac_mysql_source_dir" in + /*) + : + ;; + *) + ac_mysql_source_dir="$ac_pwd/$ac_mysql_source_dir" + ;; + esac + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([invalid MySQL source directory]) + fi + ], + [AC_MSG_ERROR([--with-mysql-source=PATH is required])] + ) + MYSQL_SOURCE_DIR="$ac_mysql_source_dir" + AC_SUBST(MYSQL_SOURCE_DIR) + + ac_mysql_build_dir= + AC_ARG_WITH([mysql-build], + [AS_HELP_STRING([--with-mysql-build=PATH], [MySQL build directory PATH])], + [ac_mysql_build_dir="$withval"], + [ac_mysql_build_dir="$ac_mysql_source_dir"] + ) + case "$ac_mysql_build_dir" in + /*) + : + ;; + *) + ac_mysql_build_dir="$ac_pwd/$ac_mysql_build_dir" + ;; + esac + MYSQL_BUILD_DIR="$ac_mysql_build_dir" + AC_SUBST(MYSQL_BUILD_DIR) + + AC_MSG_CHECKING([mysql_config]) + AC_ARG_WITH([mysql-config], + [AS_HELP_STRING([--with-mysql-config=PATH], + [mysql_config PATH])], + [ac_mysql_config="$withval"], + [ac_mysql_config=]) + if test -z "$ac_mysql_config"; then + AC_PATH_PROG(ac_mysql_config, mysql_config, mysql-config-not-found) + fi + if test "$ac_mysql_config" = "mysql-config-not-found"; then + AC_MSG_ERROR([can't detect mysql_config. Please specify mysql_config path by --with-mysql-config=PATH.]) + fi + AC_MSG_RESULT([$ac_mysql_config]) + + plugindir="$($ac_mysql_config --plugindir)" + if test $? -ne 0; then + AC_MSG_ERROR([failed to run "$ac_mysql_config": $plugindir]) + fi + AC_SUBST(plugindir) + + MYSQL_CFLAGS="$MYSQL_CFLAGS $($ac_mysql_config --cflags)" + AC_SUBST(MYSQL_CFLAGS) + + MYSQL_INCLUDES="" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/include" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql" + if test -d "$ac_mysql_source_dir/sql/auth"; then + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql/auth" + fi + 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/extra/regex"; then + mysql_regex_include_dir="$ac_mysql_source_dir/extra/regex" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" + else + mysql_regex_include_dir="$ac_mysql_source_dir/regex" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" + fi + if test -d "$ac_mysql_source_dir/libbinlogevents"; then + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/libbinlogevents/include" + 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) + + 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|8.*) + : + ;; + *) + MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS -fno-exceptions -fno-rtti" + ;; + esac + + if test "${with_libmysqlservices_compat}" = "no"; then + case "$MYSQL_MAJOR_MINOR_VERSION" in + 5.1) + MYSQL_LIBS="" + ;; + *) + AC_MSG_CHECKING([for libmysqlservices.a directory]) + pkglibdir="$($ac_mysql_config --variable=pkglibdir)" + mysql_build_libservices_dir="${MYSQL_BUILD_DIR}/libservices" + if test -f "${mysql_build_libservices_dir}/libmysqlservices.a"; then + mysql_services_lib_dir="${mysql_build_libservices_dir}" + else + if test -f "${pkglibdir}/libmysqlservices.a"; then + mysql_services_lib_dir="${pkglibdir}" + elif test -f "${pkglibdir}/mysql/libmysqlservices.a"; then + mysql_services_lib_dir="${pkglibdir}/mysql" + else + AC_MSG_ERROR([libmysqlservices.a is not found in <${pkglibdir}/> and <${pkglibdir}/mysql/>]) + fi + fi + AC_MSG_RESULT([$mysql_services_lib_dir]) + MYSQL_LIBS="$MYSQL_LIBS -L\"$mysql_services_lib_dir\" -lmysqlservices" + ;; + esac + AC_SUBST(MYSQL_LIBS) + fi +]) + +m4_define([mrn_required_groonga_version], m4_include(required_groonga_version)) +REQUIRED_GROONGA_VERSION=mrn_required_groonga_version +AC_SUBST(REQUIRED_GROONGA_VERSION) +AC_DEFUN([CONFIG_OPTION_GROONGA],[ + PKG_CHECK_MODULES(GROONGA, groonga >= ${REQUIRED_GROONGA_VERSION}) + _PKG_CONFIG(GROONGA_VERSION, variable=groonga_version, groonga) + GROONGA_VERSION=$pkg_cv_GROONGA_VERSION + AC_SUBST(GROONGA_VERSION) +]) + +m4_define([mrn_required_groonga_normalizer_mysql_version], + m4_include(required_groonga_normalizer_mysql_version)) +REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION=mrn_required_groonga_normalizer_mysql_version +AC_DEFUN([CONFIG_OPTION_GROONGA_NORMALIZER_MYSQL], [ + AC_MSG_CHECKING([for groonga-normalizer-mysql]) + PKG_CHECK_EXISTS([groonga-normalizer-mysql >= ${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}], + [WITH_GROONGA_NORMALIZER_MYSQL=yes], + [WITH_GROONGA_NORMALIZER_MYSQL=no]) + AC_MSG_RESULT($WITH_GROONGA_NORMALIZER_MYSQL) + if test "$WITH_GROONGA_NORMALIZER_MYSQL" = "yes"; then + AC_DEFINE([WITH_GROONGA_NORMALIZER_MYSQL], + [1], + [Use MySQL normalizer plugin for groonga]) + _PKG_CONFIG(plugin_name, variable=plugin_name, groonga-normalizer-mysql) + GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=$pkg_cv_plugin_name + AC_DEFINE_UNQUOTED([GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME], + "${GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME}", + [Name of MySQL normalizer plugin for groonga]) + fi +]) + +AC_ARG_WITH(debug, + [dnl +AS_HELP_STRING([--with-debug], + [Add debug code]) +AS_HELP_STRING([--with-debug=full], + [Add debug code (adds memory checker, very slow)])dnl + ], + [with_debug=$withval], + [with_debug=no]) +if test "$with_debug" = "yes" +then + # Medium debug. + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS -O0 -g3" + CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS -O0 -g3" +elif test "$with_debug" = "full" +then + # Full debug. Very slow in some cases + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS -O0 -g3" + CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS -O0 -g3" +else + # Optimized version. No debug + AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) + CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS" + CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS" +fi + +AC_ARG_WITH(valgrind, + [AS_HELP_STRING([--with-valgrind], [Use valgrind. [default=no]])], + [with_valgrind="$withval"], + [with_valgrind="no"]) +if test "$with_valgrind" != "no"; then + CFLAGS="-DHAVE_valgrind $CFLAGS" + CXXFLAGS="-DHAVE_valgrind $CXXFLAGS" +fi + +CONFIG_OPTION_MYSQL +CONFIG_OPTION_GROONGA +CONFIG_OPTION_GROONGA_NORMALIZER_MYSQL + +AC_ARG_WITH(default_parser, + [AS_HELP_STRING([--with-default-parser=PARSER], + [Deprecated. Use --with-default-tokenizer=TOKENIZER instead. + specify the default fulltext parser like + --with-default-parser=TokenMecab. + (default: TokenBigram)])], + [default_parser=$withval], + [default_parser=no]) +if test x"$default_parser" != x"no"; then + AC_DEFINE_UNQUOTED(MRN_TOKENIZER_DEFAULT, + "$default_parser", + "specified the default tokenizer for fulltext index") +fi + +AC_ARG_WITH(default_tokenizer, + [AS_HELP_STRING([--with-default-tokenizer=TOKENIZER], + [specify the default tokenizer for fulltext index like + --with-default-tokenizer=TokenMecab. + (default: TokenBigram)])], + [default_tokenizer=$withval], + [default_tokenizer=no]) +if test x"$default_tokenizer" != x"no"; then + AC_DEFINE_UNQUOTED(MRN_DEFAULT_TOKENIZER, + "$default_tokenizer", + "specified the default tokenizer for fulltext index") +fi + +AC_ARG_ENABLE(fast_mutexes, + [AS_HELP_STRING([--disable-fast-mutexes], + [Force disable fast mutex. + [default: use mysql_config output]])], + [enable_fast_mutexes=$enableval], + [enable_fast_mutexes=auto]) +if test "$enable_fast_mutexes" = "no"; then + AC_DEFINE(FORCE_FAST_MUTEX_DISABLED, [1], + [Define to 1 if force fast mutexes disabled]) +elif test "$enable_fast_mutexes" = "yes"; then + AC_DEFINE(MY_PTHREAD_FASTMUTEX, [1], + [Define to 1 if fast mutexes enabled]) +fi + +AC_ARG_ENABLE(dtrace, + [AS_HELP_STRING([--enable-dtrace], + [Enable DTrace. [default: no]])], + [enable_dtrace=$enableval], + [enable_dtrace=no]) +if test "$enable_dtrace" = "no"; then + AC_DEFINE(DISABLE_DTRACE, [1], [Define to 1 if DTrace is disabled]) +fi + +# check Cutter with C++ support if available +REQUIRED_MINIMUM_CUTTER_VERSION=1.1.3 +m4_ifdef([AC_CHECK_CPPCUTTER], [ +AC_CHECK_CPPCUTTER(>= $REQUIRED_MINIMUM_CUTTER_VERSION) +], +[ac_cv_use_cutter="no"]) +AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"]) + +# For mroonga.github.com +AC_ARG_WITH(mroonga-github-com-path, + [AS_HELP_STRING([--with-mroonga-github-com-path=PATH], + [specify mroonga.github.com path to update mroonga.github.com.])], + [MROONGA_GITHUB_COM_PATH="$withval"], + [MROONGA_GITHUB_COM_PATH=""]) +AC_SUBST(MROONGA_GITHUB_COM_PATH) + +# For package +AC_ARG_WITH(rsync-path, + [AS_HELP_STRING([--with-rsync-path=PATH], + [specify rsync path to upload mroonga packages.])], + [RSYNC_PATH="$withval"], + [RSYNC_PATH="packages@packages.groonga.org:public"]) +AC_SUBST(RSYNC_PATH) + +AC_ARG_WITH(launchpad-ppa, + [AS_HELP_STRING([--with-launchpad-ppa=PPA], + [specify Launchpad Personal Package Archive. [default=groonga-ppa]])], + [LAUNCHPAD_PPA="$withval"], + [LAUNCHPAD_PPA="groonga-ppa"]) +AC_SUBST(LAUNCHPAD_PPA) + +AC_ARG_WITH(launchpad-uploader-pgp-key, + [AS_HELP_STRING([--with-launchpad-uploader-pgp-key=KEY], + [specify PGP key UID to upload Groonga packages to Launchpad.])], + [LAUNCHPAD_UPLOADER_PGP_KEY="$withval"], + [LAUNCHPAD_UPLOADER_PGP_KEY=""]) +AC_SUBST(LAUNCHPAD_UPLOADER_PGP_KEY) + +GPG_UID=m4_include(gpg_uid) +AC_SUBST(GPG_UID) + +# For update-version +AC_ARG_WITH(cutter-source-path, + [AS_HELP_STRING([--with-cutter-source-path=PATH], + [specify Cutter source path for mroonga's release manager.])], + [CUTTER_SOURCE_PATH="$withval"]) +case "$CUTTER_SOURCE_PATH" in + ""|/*) + : # do nothing + ;; + *) + CUTTER_SOURCE_PATH="\$(top_builddir)/${CUTTER_SOURCE_PATH}" + ;; +esac +AC_SUBST(CUTTER_SOURCE_PATH) + + +# Document +AC_MSG_CHECKING([whether enable document]) +AC_ARG_ENABLE(document, + [AS_HELP_STRING([--enable-document], + [enable document generation by Sphinx. [default=auto]])], + [enable_document="$enableval"], + [enable_document="auto"]) +AC_MSG_RESULT($enable_document) + +document_available=no +document_buildable=no +have_built_document=no +if test x"$enable_document" != x"no"; then + if test -f "$srcdir/doc/build-stamp"; then + document_available=yes + have_built_document=yes + fi + + if test x"$enable_document" = x"yes"; then + AC_PATH_PROG(SPHINX_BUILD, sphinx-build, []) + if test -n "$SPHINX_BUILD"; then + sphinx_build_version=`"$SPHINX_BUILD" --version` + if ! echo "$sphinx_build_version" | grep -q ' 1\.[[2-6]]'; then + AC_MSG_ERROR([ +sphinx-build is old: $sphinx_build_version +Sphinx 1.2 or later is required.]) + fi + document_available=yes + document_buildable=yes + else + AC_MSG_ERROR([ +No sphinx-build found. +Install it and try again. + +How to install sphinx-build: + +For Debian GNU/Linux based system like Ubuntu: + % sudo apt-get install -y python-pip + % sudo pip install sphinx + +For Red Hat based system like CentOS: + % sudo yum install -y python-pip + % sudo pip install sphinx]) + fi + AC_SUBST(SPHINX_BUILD) + fi +fi + +AM_CONDITIONAL([DOCUMENT_AVAILABLE], + [test "${document_available}" = "yes"]) +AC_MSG_CHECKING([whether document available]) +AC_MSG_RESULT($document_available) + +AM_CONDITIONAL([DOCUMENT_BUILDABLE], + [test "${document_buildable}" = "yes"]) +AC_MSG_CHECKING([whether document buildable]) +AC_MSG_RESULT($document_buildable) + +AM_CONDITIONAL([HAVE_BUILT_DOCUMENT], + [test "${have_built_document}" = "yes"]) +AC_MSG_CHECKING([whether having built document]) +AC_MSG_RESULT($have_built_document) + +DOCUMENT_VERSION=mrn_version +DOCUMENT_VERSION_FULL="$DOCUMENT_VERSION" +AC_SUBST(DOCUMENT_VERSION) +AC_SUBST(DOCUMENT_VERSION_FULL) + +CFLAGS="$CFLAGS" +CXXFLAGS="$CXXFLAGS $MYSQL_CXXFLAGS" + +AC_CONFIG_FILES([ + Makefile + build/Makefile + build/cmake_modules/Makefile + lib/Makefile + udf/Makefile + test/Makefile + test/unit/Makefile + mysql-test/Makefile + packages/Makefile + packages/rpm/Makefile + packages/rpm/centos/Makefile + packages/yum/Makefile + packages/apt/Makefile + packages/source/Makefile + packages/ubuntu/Makefile + packages/windows/Makefile + tools/Makefile + doc/Makefile + doc/locale/Makefile + doc/locale/en/Makefile + doc/locale/en/LC_MESSAGES/Makefile + doc/locale/ja/Makefile + doc/locale/ja/LC_MESSAGES/Makefile + data/Makefile +]) +AC_OUTPUT([ + config.sh + mrn_version.h + mysql-test/mroonga/storage/information_schema/r/plugins.result + mysql-test/mroonga/storage/variable/r/version.result + packages/debian-5.5/control + packages/debian-5.6/control + packages/debian-5.7/control + packages/debian-mariadb-10.0/control + packages/apt/env.sh + packages/rpm/centos/mysql55-mroonga.spec + packages/rpm/centos/mysql56-community-mroonga.spec + packages/rpm/centos/mysql57-community-mroonga.spec + packages/rpm/centos/mariadb-mroonga.spec + packages/rpm/centos/mariadb-10.1-mroonga.spec + packages/rpm/centos/mariadb-10.2-mroonga.spec + packages/rpm/centos/percona-server-56-mroonga.spec + packages/rpm/centos/percona-server-57-mroonga.spec + packages/yum/env.sh + data/install.sql +]) diff --git a/storage/mroonga/data/Makefile.am b/storage/mroonga/data/Makefile.am new file mode 100644 index 00000000..c088c78c --- /dev/null +++ b/storage/mroonga/data/Makefile.am @@ -0,0 +1,4 @@ +sqldir = $(pkgdatadir) +dist_sql_DATA = \ + install.sql \ + uninstall.sql diff --git a/storage/mroonga/data/install.sql.in b/storage/mroonga/data/install.sql.in new file mode 100644 index 00000000..0a2f308a --- /dev/null +++ b/storage/mroonga/data/install.sql.in @@ -0,0 +1,35 @@ +SET @inst=IF(EXISTS(SELECT * FROM mysql.plugin WHERE NAME='mroonga'),'DO 1', "INSTALL PLUGIN mroonga SONAME 'ha_mroonga'"); +PREPARE s FROM @inst; +EXECUTE s; + +DROP FUNCTION IF EXISTS last_insert_grn_id; +CREATE FUNCTION last_insert_grn_id RETURNS INTEGER + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_snippet; +CREATE FUNCTION mroonga_snippet RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_command; +CREATE FUNCTION mroonga_command RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_escape; +CREATE FUNCTION mroonga_escape RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_snippet_html; +CREATE FUNCTION mroonga_snippet_html RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_normalize; +CREATE FUNCTION mroonga_normalize RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_highlight_html; +CREATE FUNCTION mroonga_highlight_html RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_query_expand; +CREATE FUNCTION mroonga_query_expand RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; diff --git a/storage/mroonga/data/uninstall.sql b/storage/mroonga/data/uninstall.sql new file mode 100644 index 00000000..5713e074 --- /dev/null +++ b/storage/mroonga/data/uninstall.sql @@ -0,0 +1,12 @@ +DROP FUNCTION IF EXISTS last_insert_grn_id; +DROP FUNCTION IF EXISTS mroonga_snippet; +DROP FUNCTION IF EXISTS mroonga_command; +DROP FUNCTION IF EXISTS mroonga_escape; +DROP FUNCTION IF EXISTS mroonga_snippet_html; +DROP FUNCTION IF EXISTS mroonga_normalize; +DROP FUNCTION IF EXISTS mroonga_highlight_html; +DROP FUNCTION IF EXISTS mroonga_query_expand; + +UNINSTALL PLUGIN Mroonga; + +FLUSH TABLES; diff --git a/storage/mroonga/gpg_uid b/storage/mroonga/gpg_uid new file mode 100644 index 00000000..7c1a800b --- /dev/null +++ b/storage/mroonga/gpg_uid @@ -0,0 +1 @@ +45499429 diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp new file mode 100644 index 00000000..d0608433 --- /dev/null +++ b/storage/mroonga/ha_mroonga.cpp @@ -0,0 +1,17077 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2017 Kouhei Sutou + Copyright(C) 2013 Kenji Maruyama + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_mysql.h" +#include "mrn_mysql_compat.h" + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef MRN_HAVE_BINLOG_H +# include +#endif + +#ifdef MRN_HAVE_SQL_OPTIMIZER_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifdef WIN32 +# include +# include +# define MRN_TABLE_SHARE_LOCK_SHARE_PROC "?key_TABLE_SHARE_LOCK_share@@3IA" +# define MRN_TABLE_SHARE_LOCK_HA_DATA_PROC "?key_TABLE_SHARE_LOCK_ha_data@@3IA" +# ifdef _WIN64 +# define MRN_BINLOG_FILTER_PROC "?binlog_filter@@3PEAVRpl_filter@@EA" +# define MRN_MY_TZ_UTC_PROC "?my_tz_UTC@@3PEAVTime_zone@@EA" +# else +# define MRN_BINLOG_FILTER_PROC "?binlog_filter@@3PAVRpl_filter@@A" +# define MRN_MY_TZ_UTC_PROC "?my_tz_UTC@@3PAVTime_zone@@A" +# endif +#else +# include +# include +#endif + +#include "mrn_err.h" +#include "mrn_table.hpp" +#include +#include "ha_mroonga.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +# include +#endif + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS +# include +#endif + +// for debug +#define MRN_CLASS_NAME "ha_mroonga" + +#define MRN_SHORT_TEXT_SIZE (1 << 12) // 4Kbytes +#define MRN_TEXT_SIZE (1 << 16) // 64Kbytes +#define MRN_LONG_TEXT_SIZE (1 << 31) // 2Gbytes + +#ifdef MRN_HAVE_TDC_LOCK_TABLE_SHARE +# ifdef MRN_TABLE_SHARE_TDC_IS_POINTER +# define mrn_open_mutex(share) &((share)->tdc->LOCK_table_share) +# else +# define mrn_open_mutex(share) &((share)->tdc.LOCK_table_share) +# endif +# define mrn_open_mutex_lock(share) do { \ + TABLE_SHARE *share_ = share; \ + if (share_ && share_->tmp_table == NO_TMP_TABLE) { \ + mysql_mutex_lock(mrn_open_mutex(share_)); \ + } \ +} while (0) +# define mrn_open_mutex_unlock(share) do { \ + TABLE_SHARE *share_ = share; \ + if (share_ && share_->tmp_table == NO_TMP_TABLE) { \ + mysql_mutex_unlock(mrn_open_mutex(share_)); \ + } \ +} while (0) +#else +# 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) +#endif + +#if MYSQL_VERSION_ID >= 50600 +# define MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK +#endif + +#ifdef MRN_MARIADB_P +# if MYSQL_VERSION_ID >= 100200 +# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +# else +# define MRN_ORDER_IS_ASC(order) ((order)->asc) +# endif +#else +# if MYSQL_VERSION_ID >= 50603 +# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +# else +# define MRN_ORDER_IS_ASC(order) ((order)->asc) +# endif +#endif + +#define MRN_STRINGIFY(macro_or_string) MRN_STRINGIFY_ARG(macro_or_string) +#define MRN_STRINGIFY_ARG(contents) #contents + +#define MRN_PLUGIN_NAME mroonga +#define MRN_PLUGIN_NAME_STRING "Mroonga" +#define MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "Mroonga" + +#ifdef MRN_MARIADB_P +# define st_mysql_plugin st_maria_plugin +# define mrn_declare_plugin(NAME) maria_declare_plugin(NAME) +# define mrn_declare_plugin_end maria_declare_plugin_end +# define MRN_PLUGIN_LAST_VALUES MRN_VERSION, MariaDB_PLUGIN_MATURITY_STABLE +#else +# define mrn_declare_plugin(NAME) mysql_declare_plugin(NAME) +# define mrn_declare_plugin_end mysql_declare_plugin_end +# define MRN_PLUGIN_LAST_VALUES NULL, 0 +#endif + +#if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P) +# define MRN_THD_GET_AUTOINC(thd, off, inc) thd_get_autoinc(thd, off, inc) +# define MRN_GET_ERR_MSG(code) my_get_err_msg(code) +#else +# define MRN_THD_GET_AUTOINC(thd, off, inc) \ + { \ + *(off) = thd->variables.auto_increment_offset; \ + *(inc) = thd->variables.auto_increment_increment; \ + } +# define MRN_GET_ERR_MSG(code) ER(code) +#endif + +#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)->first_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_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 + +PSI_memory_key mrn_memory_key; + +#ifdef MRN_HAVE_PSI_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"; + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_PSI_INTERFACE +# ifdef WIN32 +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE +PSI_mutex_key *mrn_table_share_lock_share; +# endif +PSI_mutex_key *mrn_table_share_lock_ha_data; +# 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_query_log_mutex_key; +static PSI_mutex_key mrn_db_manager_mutex_key; +static PSI_mutex_key mrn_context_pool_mutex_key; +static PSI_mutex_key mrn_operations_mutex_key; + +# if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_MUTEXT_INFO_ENTRY(key, name, flags, volatility) \ + {key, name, flags, volatility} +# else +# define MRN_MUTEXT_INFO_ENTRY(key, name, flags, volatility) \ + {key, name, flags} +# endif + +static PSI_mutex_info mrn_mutexes[] = +{ + MRN_MUTEXT_INFO_ENTRY(&mrn_open_tables_mutex_key, + "mrn::open_tables", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_long_term_share_mutex_key, + "mrn::long_term_share", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_allocated_thds_mutex_key, + "mrn::allocated_thds", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_share_mutex_key, + "mrn::share", 0, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_long_term_share_auto_inc_mutex_key, + "mrn::long_term_share::auto_inc", 0, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_log_mutex_key, + "mrn::log", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_query_log_mutex_key, + "mrn::query_log", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_db_manager_mutex_key, + "mrn::DatabaseManager", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_context_pool_mutex_key, + "mrn::ContextPool", PSI_FLAG_GLOBAL, 0), + MRN_MUTEXT_INFO_ENTRY(&mrn_operations_mutex_key, + "mrn::Operations", PSI_FLAG_GLOBAL, 0) +}; +#endif + +/* global variables */ +handlerton *mrn_hton_ptr; +HASH mrn_open_tables; +mysql_mutex_t mrn_open_tables_mutex; +HASH mrn_long_term_share; +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 mysql_mutex_t mrn_query_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; +static mysql_mutex_t mrn_context_pool_mutex; +mrn::ContextPool *mrn_context_pool = NULL; +static mysql_mutex_t mrn_operations_mutex; + + +#ifdef WIN32 +static inline double round(double x) +{ + return (floor(x + 0.5)); +} +#endif + +static void mrn_init_encoding_map() +{ + mrn::encoding::init(); +} + +static int mrn_change_encoding(grn_ctx *ctx, const CHARSET_INFO *charset) +{ + return mrn::encoding::set(ctx, charset); +} + +#if !defined(DBUG_OFF) && !defined(_lint) +static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type) +{ + const char *inspected = ""; + switch (lock_type) { + case TL_IGNORE: + inspected = "TL_IGNORE"; + break; + case TL_UNLOCK: + inspected = "TL_UNLOCK"; + break; + case TL_READ_DEFAULT: + inspected = "TL_READ_DEFAULT"; + break; + case TL_READ: + inspected = "TL_READ"; + break; + case TL_READ_WITH_SHARED_LOCKS: + inspected = "TL_READ_WITH_SHARED_LOCKS"; + break; + case TL_READ_HIGH_PRIORITY: + inspected = "TL_READ_HIGH_PRIORITY"; + break; + case TL_READ_NO_INSERT: + inspected = "TL_READ_NO_INSERT"; + break; + case TL_WRITE_ALLOW_WRITE: + inspected = "TL_WRITE_ALLOW_WRITE"; + break; +#ifdef MRN_HAVE_TL_WRITE_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; + case TL_WRITE_LOW_PRIORITY: + inspected = "TL_WRITE_LOW_PRIORITY"; + break; + case TL_WRITE: + inspected = "TL_WRITE"; + break; + case TL_WRITE_ONLY: + inspected = "TL_WRITE_ONLY"; + break; + } + return inspected; +} + +static const char *mrn_inspect_extra_function(enum ha_extra_function operation) +{ + const char *inspected = ""; + switch (operation) { + case HA_EXTRA_NORMAL: + inspected = "HA_EXTRA_NORMAL"; + break; + case HA_EXTRA_QUICK: + inspected = "HA_EXTRA_QUICK"; + break; + case HA_EXTRA_NOT_USED: + inspected = "HA_EXTRA_NOT_USED"; + break; + case HA_EXTRA_CACHE: + inspected = "HA_EXTRA_CACHE"; + break; + case HA_EXTRA_NO_CACHE: + inspected = "HA_EXTRA_NO_CACHE"; + break; + case HA_EXTRA_NO_READCHECK: + inspected = "HA_EXTRA_NO_READCHECK"; + break; + case HA_EXTRA_READCHECK: + inspected = "HA_EXTRA_READCHECK"; + break; + case HA_EXTRA_KEYREAD: + inspected = "HA_EXTRA_KEYREAD"; + break; + case HA_EXTRA_NO_KEYREAD: + inspected = "HA_EXTRA_NO_KEYREAD"; + break; + case HA_EXTRA_NO_USER_CHANGE: + inspected = "HA_EXTRA_NO_USER_CHANGE"; + break; + case HA_EXTRA_KEY_CACHE: + inspected = "HA_EXTRA_KEY_CACHE"; + break; + case HA_EXTRA_NO_KEY_CACHE: + inspected = "HA_EXTRA_NO_KEY_CACHE"; + break; + case HA_EXTRA_WAIT_LOCK: + inspected = "HA_EXTRA_WAIT_LOCK"; + break; + case HA_EXTRA_NO_WAIT_LOCK: + inspected = "HA_EXTRA_NO_WAIT_LOCK"; + break; + case HA_EXTRA_WRITE_CACHE: + inspected = "HA_EXTRA_WRITE_CACHE"; + break; + case HA_EXTRA_FLUSH_CACHE: + inspected = "HA_EXTRA_FLUSH_CACHE"; + break; + case HA_EXTRA_NO_KEYS: + inspected = "HA_EXTRA_NO_KEYS"; + break; + case HA_EXTRA_KEYREAD_CHANGE_POS: + inspected = "HA_EXTRA_KEYREAD_CHANGE_POS"; + break; + case HA_EXTRA_REMEMBER_POS: + inspected = "HA_EXTRA_REMEMBER_POS"; + break; + case HA_EXTRA_RESTORE_POS: + inspected = "HA_EXTRA_RESTORE_POS"; + break; + case HA_EXTRA_REINIT_CACHE: + inspected = "HA_EXTRA_REINIT_CACHE"; + break; + case HA_EXTRA_FORCE_REOPEN: + inspected = "HA_EXTRA_FORCE_REOPEN"; + break; + case HA_EXTRA_FLUSH: + inspected = "HA_EXTRA_FLUSH"; + break; + case HA_EXTRA_NO_ROWS: + inspected = "HA_EXTRA_NO_ROWS"; + break; + case HA_EXTRA_RESET_STATE: + inspected = "HA_EXTRA_RESET_STATE"; + break; + case HA_EXTRA_IGNORE_DUP_KEY: + inspected = "HA_EXTRA_IGNORE_DUP_KEY"; + break; + case HA_EXTRA_NO_IGNORE_DUP_KEY: + inspected = "HA_EXTRA_NO_IGNORE_DUP_KEY"; + break; + case HA_EXTRA_PREPARE_FOR_DROP: + inspected = "HA_EXTRA_PREPARE_FOR_DROP"; + break; + case HA_EXTRA_PREPARE_FOR_ALTER_TABLE: + inspected = "HA_EXTRA_PREPARE_FOR_ALTER_TABLE"; + break; + case HA_EXTRA_PREPARE_FOR_UPDATE: + inspected = "HA_EXTRA_PREPARE_FOR_UPDATE"; + break; + case HA_EXTRA_PRELOAD_BUFFER_SIZE: + inspected = "HA_EXTRA_PRELOAD_BUFFER_SIZE"; + break; + case HA_EXTRA_CHANGE_KEY_TO_UNIQUE: + inspected = "HA_EXTRA_CHANGE_KEY_TO_UNIQUE"; + break; + case HA_EXTRA_CHANGE_KEY_TO_DUP: + inspected = "HA_EXTRA_CHANGE_KEY_TO_DUP"; + break; + case HA_EXTRA_KEYREAD_PRESERVE_FIELDS: + inspected = "HA_EXTRA_KEYREAD_PRESERVE_FIELDS"; + break; + case HA_EXTRA_MMAP: + inspected = "HA_EXTRA_MMAP"; + break; + case HA_EXTRA_IGNORE_NO_KEY: + inspected = "HA_EXTRA_IGNORE_NO_KEY"; + break; + case HA_EXTRA_NO_IGNORE_NO_KEY: + inspected = "HA_EXTRA_NO_IGNORE_NO_KEY"; + break; + case HA_EXTRA_MARK_AS_LOG_TABLE: + inspected = "HA_EXTRA_MARK_AS_LOG_TABLE"; + break; + case HA_EXTRA_WRITE_CAN_REPLACE: + inspected = "HA_EXTRA_WRITE_CAN_REPLACE"; + break; + case HA_EXTRA_WRITE_CANNOT_REPLACE: + inspected = "HA_EXTRA_WRITE_CANNOT_REPLACE"; + break; + case HA_EXTRA_DELETE_CANNOT_BATCH: + inspected = "HA_EXTRA_DELETE_CANNOT_BATCH"; + break; + case HA_EXTRA_UPDATE_CANNOT_BATCH: + inspected = "HA_EXTRA_UPDATE_CANNOT_BATCH"; + break; + case HA_EXTRA_INSERT_WITH_UPDATE: + inspected = "HA_EXTRA_INSERT_WITH_UPDATE"; + break; + case HA_EXTRA_PREPARE_FOR_RENAME: + inspected = "HA_EXTRA_PREPARE_FOR_RENAME"; + break; + case HA_EXTRA_ADD_CHILDREN_LIST: + inspected = "HA_EXTRA_ADD_CHILDREN_LIST"; + break; + case HA_EXTRA_ATTACH_CHILDREN: + inspected = "HA_EXTRA_ATTACH_CHILDREN"; + break; + case HA_EXTRA_IS_ATTACHED_CHILDREN: + inspected = "HA_EXTRA_IS_ATTACHED_CHILDREN"; + break; + case HA_EXTRA_DETACH_CHILDREN: + inspected = "HA_EXTRA_DETACH_CHILDREN"; + break; + case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: + inspected = "HA_EXTRA_STARTING_ORDERED_INDEX_SCAN"; + break; + case HA_EXTRA_BEGIN_ALTER_COPY: + inspected = "HA_EXTRA_BEGIN_ALTER_COPY"; + break; + case HA_EXTRA_END_ALTER_COPY: + inspected = "HA_EXTRA_END_ALTER_COPY"; + break; +#ifdef MRN_HAVE_HA_EXTRA_EXPORT + case HA_EXTRA_EXPORT: + inspected = "HA_EXTRA_EXPORT"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_SECONDARY_SORT_ROWID + case HA_EXTRA_SECONDARY_SORT_ROWID: + inspected = "HA_EXTRA_SECONDARY_SORT_ROWID"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_DETACH_CHILD + case HA_EXTRA_DETACH_CHILD: + inspected = "HA_EXTRA_DETACH_CHILD"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE + case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE: + inspected = "HA_EXTRA_PREPARE_FOR_FORCED_CLOSE"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW + case HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW: + inspected = "HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_BEGIN_ALTER_COPY + case HA_EXTRA_BEGIN_ALTER_COPY: + inspected = "HA_EXTRA_BEGIN_ALTER_COPY"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_END_ALTER_COPY + case HA_EXTRA_END_ALTER_COPY: + inspected = "HA_EXTRA_END_ALTER_COPY"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_NO_AUTOINC_LOCKING + case HA_EXTRA_NO_AUTOINC_LOCKING: + inspected = "HA_EXTRA_NO_AUTOINC_LOCKING"; + break; +#endif + } + return inspected; +} +#endif + +static uchar *mrn_open_tables_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + MRN_SHARE *share = reinterpret_cast(const_cast(record)); + *length = share->table_name_length; + DBUG_RETURN(reinterpret_cast(share->table_name)); +} + +static uchar *mrn_long_term_share_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + MRN_LONG_TERM_SHARE *long_term_share = + reinterpret_cast(const_cast(record)); + *length = long_term_share->table_name_length; + DBUG_RETURN(reinterpret_cast(long_term_share->table_name)); +} + +/* status */ +static long mrn_count_skip = 0; +static long mrn_fast_order_limit = 0; + +/* logging */ +static char *mrn_log_file_path = NULL; +static FILE *mrn_log_file = NULL; +static bool mrn_log_file_opened = false; +static grn_log_level mrn_log_level_default = GRN_LOG_DEFAULT_LEVEL; +static ulong mrn_log_level = mrn_log_level_default; +static char *mrn_query_log_file_path = NULL; + +char *mrn_default_tokenizer = NULL; +char *mrn_default_wrapper_engine = NULL; +static int mrn_lock_timeout = grn_get_lock_timeout(); +static char *mrn_libgroonga_version = const_cast(grn_get_version()); +static char *mrn_version = const_cast(MRN_VERSION); +static char *mrn_vector_column_delimiter = NULL; +static mrn_bool mrn_libgroonga_support_zlib = false; +static mrn_bool mrn_libgroonga_support_lz4 = false; +static mrn_bool mrn_libgroonga_support_zstd = false; +static mrn_bool mrn_enable_operations_recording = true; +#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 +#ifdef MRN_GROONGA_EMBEDDED +static mrn_bool mrn_libgroonga_embedded = true; +#else +static mrn_bool mrn_libgroonga_embedded = false; +#endif + +static mrn::variables::ActionOnError mrn_action_on_fulltext_query_error_default = + mrn::variables::ACTION_ON_ERROR_ERROR_AND_LOG; + +static void mrn_logger_log(grn_ctx *ctx, grn_log_level level, + const char *timestamp, const char *title, + const char *message, const char *location, + void *user_data) +{ + const char level_marks[] = " EACewnid-"; + if (mrn_log_file_opened) { + mrn::Lock lock(&mrn_log_mutex); + fprintf(mrn_log_file, + "%s|%c|%08x|%s\n", + timestamp, + level_marks[level], + static_cast((ulong)(pthread_self())), + message); + fflush(mrn_log_file); + } +} + +static grn_logger mrn_logger = { + mrn_log_level_default, + GRN_LOG_TIME|GRN_LOG_MESSAGE, + NULL, + mrn_logger_log, + NULL, + NULL +}; + +static uchar *mrn_allocated_thds_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + *length = sizeof(THD *); + DBUG_RETURN(const_cast(record)); +} + +/* system functions */ + +static struct st_mysql_storage_engine storage_engine_structure = +{ MYSQL_HANDLERTON_INTERFACE_VERSION }; + +#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_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, + "mrn_log_level_typelib", + mrn_log_level_type_names, + NULL +}; + +static void mrn_log_level_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulong new_value = *static_cast(save); + ulong old_value = mrn_log_level; + mrn_log_level = new_value; + mrn_logger.max_level = static_cast(mrn_log_level); + grn_logger_set(&mrn_ctx, &mrn_logger); + grn_ctx *ctx = grn_ctx_open(0); + mrn_change_encoding(ctx, system_charset_info); + GRN_LOG(ctx, GRN_LOG_NOTICE, "log level changed from '%s' to '%s'", + mrn_log_level_type_names[old_value], + mrn_log_level_type_names[new_value]); + grn_ctx_fin(ctx); + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_ENUM(log_level, mrn_log_level, + PLUGIN_VAR_RQCMDARG, + "logging level", + NULL, + mrn_log_level_update, + static_cast(mrn_log_level), + &mrn_log_level_typelib); + +static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + + grn_ctx *ctx = &mrn_ctx; + mrn_change_encoding(ctx, system_charset_info); + + const char *new_log_file_name; + new_log_file_name = *old_value_ptr; + + if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "log file isn't changed " + "because the requested path isn't different: <%s>", + new_value); + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + + int log_file_open_errno = 0; + { + mrn::Lock lock(&mrn_log_mutex); + FILE *new_log_file; + new_log_file = fopen(new_value, "a"); + if (new_log_file) { + if (mrn_log_file_opened) { + fclose(mrn_log_file); + } + mrn_log_file = new_log_file; + mrn_log_file_opened = true; + } else { + log_file_open_errno = errno; + } + } + + if (log_file_open_errno == 0) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + new_log_file_name = new_value; + } else { + if (mrn_log_file) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "log file isn't changed " + "because the requested path can't be opened: <%s>: <%s>", + new_value, strerror(log_file_open_errno)); + } else { + GRN_LOG(ctx, GRN_LOG_ERROR, + "log file can't be opened: <%s>: <%s>", + new_value, strerror(log_file_open_errno)); + } + } + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + char *old_log_file_name = *old_value_ptr; + *old_value_ptr = mrn_my_strdup(new_log_file_name, MYF(MY_WME)); + my_free(old_log_file_name); +#else + *old_value_ptr = mrn_my_strdup(new_log_file_name, MYF(MY_WME)); +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(log_file, mrn_log_file_path, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "log file for " MRN_PLUGIN_NAME_STRING, + NULL, + mrn_log_file_update, + MRN_LOG_FILE_PATH); + +static void mrn_query_log_file_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + const char *normalized_new_value = NULL; + + grn_ctx *ctx = &mrn_ctx; + mrn_change_encoding(ctx, system_charset_info); + + const char *new_query_log_file_name; + new_query_log_file_name = *old_value_ptr; + + bool need_update = false; + if (!*old_value_ptr) { + if (new_value && new_value[0] != '\0') { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log is enabled: <%s>", + new_value); + need_update = true; + normalized_new_value = new_value; + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is still disabled"); + } + } else { + if (!new_value || new_value[0] == '\0') { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is disabled: <%s>", + *old_value_ptr); + need_update = true; + normalized_new_value = NULL; + } else if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file isn't changed " + "because the requested path isn't different: <%s>", + new_value); + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "query log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + need_update = true; + normalized_new_value = new_value; + } + } + + if (need_update) { + { // TODO: Remove me when Groonga 7.0.5 is released. + mrn::Lock lock(&mrn_query_log_mutex); + grn_default_query_logger_set_path(normalized_new_value); + } + grn_query_logger_reopen(ctx); + new_query_log_file_name = normalized_new_value; + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + char *old_query_log_file_name = *old_value_ptr; +#endif + if (new_query_log_file_name) { + *old_value_ptr = mrn_my_strdup(new_query_log_file_name, MYF(0)); + } else { + *old_value_ptr = NULL; + } +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(old_query_log_file_name); +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(query_log_file, mrn_query_log_file_path, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "query log file for " MRN_PLUGIN_NAME_STRING, + NULL, + mrn_query_log_file_update, + NULL); + +static void mrn_default_tokenizer_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + grn_ctx *ctx = &mrn_ctx; + + mrn_change_encoding(ctx, system_charset_info); + if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "default tokenizer for fulltext index isn't changed " + "because the requested default tokenizer isn't different: <%s>", + new_value); + } else { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "default tokenizer for fulltext index is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(*old_value_ptr); + *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME)); +#else + *old_value_ptr = (char *)new_value; +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(default_parser, mrn_default_tokenizer, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "default fulltext parser " + "(Deprecated. Use mroonga_default_tokenizer instead.)", + NULL, + mrn_default_tokenizer_update, + MRN_DEFAULT_TOKENIZER); // since 10.1.6 + +static MYSQL_SYSVAR_STR(default_tokenizer, mrn_default_tokenizer, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "default tokenizer for fulltext index", + NULL, + mrn_default_tokenizer_update, + MRN_DEFAULT_TOKENIZER); + +static MYSQL_THDVAR_BOOL( + dry_write, /* name */ + PLUGIN_VAR_OPCMDARG, /* options */ + "If dry_write is true, any write operations are ignored.", /* comment */ + NULL, /* check */ + NULL, /* update */ + false /* default */ +); + +static MYSQL_THDVAR_BOOL( + enable_optimization, /* name */ + PLUGIN_VAR_OPCMDARG, /* options */ + "If enable_optimization is true, some optimizations will be applied.", /* comment */ + NULL, /* check */ + NULL, /* update */ + true /* default */ +); + +static MYSQL_THDVAR_LONGLONG(match_escalation_threshold, + PLUGIN_VAR_RQCMDARG, + "The threshold to determin whether search method is escalated", + NULL, + NULL, + grn_get_default_match_escalation_threshold(), + -1, + INT_MAX64, + 0); + +static void mrn_vector_column_delimiter_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(*old_value_ptr); + *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME)); +#else + *old_value_ptr = (char *)new_value; +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(vector_column_delimiter, mrn_vector_column_delimiter, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "The vector column delimiter", + NULL, + &mrn_vector_column_delimiter_update, + " "); + +static void mrn_database_path_prefix_update(THD *thd, + struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + if (*old_value_ptr) + my_free(*old_value_ptr); + if (new_value) + *old_value_ptr = mrn_my_strdup(new_value, MYF(MY_WME)); + else + *old_value_ptr = NULL; +#else + *old_value_ptr = (char *)new_value; +#endif + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(database_path_prefix, + mrn::PathMapper::default_path_prefix, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "The database path prefix", + NULL, + &mrn_database_path_prefix_update, + NULL); + +static MYSQL_SYSVAR_STR(default_wrapper_engine, mrn_default_wrapper_engine, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "The default engine for wrapper mode", + NULL, + NULL, + NULL); + +static const char *mrn_action_on_error_names[] = { + "ERROR", + "ERROR_AND_LOG", + "IGNORE", + "IGNORE_AND_LOG", + NullS, +}; + +static TYPELIB mrn_action_on_error_typelib = +{ + array_elements(mrn_action_on_error_names) - 1, + "mrn_action_on_error_typelib", + mrn_action_on_error_names, + NULL +}; + +static MYSQL_THDVAR_ENUM(action_on_fulltext_query_error, + PLUGIN_VAR_RQCMDARG, + "action on fulltext query error", + NULL, + NULL, + mrn_action_on_fulltext_query_error_default, + &mrn_action_on_error_typelib); + +static void mrn_lock_timeout_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const int new_value = *static_cast(save); + int *old_value_ptr = static_cast(var_ptr); + + *old_value_ptr = new_value; + grn_set_lock_timeout(new_value); + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_INT(lock_timeout, + mrn_lock_timeout, + PLUGIN_VAR_RQCMDARG, + "lock timeout used in Groonga", + NULL, + mrn_lock_timeout_update, + grn_get_lock_timeout(), + -1, + INT_MAX, + 1); + +static MYSQL_SYSVAR_STR(libgroonga_version, mrn_libgroonga_version, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, + "The version of libgroonga", + NULL, + NULL, + grn_get_version()); + +static MYSQL_SYSVAR_STR(version, mrn_version, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, + "The version of mroonga", + NULL, + NULL, + MRN_VERSION); + +static mrn_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 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 mrn_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_lz4, mrn_libgroonga_support_lz4, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "The status of libgroonga supports LZ4", + NULL, + NULL, + grn_check_lz4_support()); + +static mrn_bool grn_check_zstd_support() +{ + bool is_zstd_support = false; + grn_obj grn_support_p; + + GRN_BOOL_INIT(&grn_support_p, 0); + grn_obj_get_info(&mrn_ctx, NULL, GRN_INFO_SUPPORT_ZSTD, &grn_support_p); + is_zstd_support = (GRN_BOOL_VALUE(&grn_support_p)); + grn_obj_unlink(&mrn_ctx, &grn_support_p); + + return is_zstd_support; +} + +static MYSQL_SYSVAR_BOOL(libgroonga_support_zstd, mrn_libgroonga_support_zstd, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "The status of libgroonga supports Zstandard", + NULL, + NULL, + grn_check_zstd_support()); + +static void mrn_enable_operations_recording_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const bool new_value = *static_cast(save); + bool *old_value_ptr = static_cast(var_ptr); + + *old_value_ptr = new_value; + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_BOOL(enable_operations_recording, mrn_enable_operations_recording, + PLUGIN_VAR_RQCMDARG, + "Whether recording operations for recovery is enabled or not", + NULL, + mrn_enable_operations_recording_update, + true); + +#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::variables::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 MYSQL_SYSVAR_BOOL(libgroonga_embedded, mrn_libgroonga_embedded, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "Whether libgroonga is embedded or not", + NULL, + NULL, + mrn_libgroonga_embedded); + +static struct st_mysql_sys_var *mrn_system_variables[] = +{ + MYSQL_SYSVAR(log_level), + MYSQL_SYSVAR(log_file), + MYSQL_SYSVAR(default_parser), + MYSQL_SYSVAR(default_tokenizer), + MYSQL_SYSVAR(dry_write), + MYSQL_SYSVAR(enable_optimization), + MYSQL_SYSVAR(match_escalation_threshold), + MYSQL_SYSVAR(database_path_prefix), + MYSQL_SYSVAR(default_wrapper_engine), + MYSQL_SYSVAR(action_on_fulltext_query_error), + MYSQL_SYSVAR(lock_timeout), + MYSQL_SYSVAR(libgroonga_version), + MYSQL_SYSVAR(version), + MYSQL_SYSVAR(vector_column_delimiter), + MYSQL_SYSVAR(libgroonga_support_zlib), + MYSQL_SYSVAR(libgroonga_support_lz4), + MYSQL_SYSVAR(libgroonga_support_zstd), +#ifdef MRN_SUPPORT_THDVAR_SET + MYSQL_SYSVAR(boolean_mode_syntax_flags), +#endif + MYSQL_SYSVAR(max_n_records_for_estimate), + MYSQL_SYSVAR(libgroonga_embedded), + MYSQL_SYSVAR(query_log_file), + MYSQL_SYSVAR(enable_operations_recording), + NULL +}; + +/* mroonga information schema */ +static struct st_mysql_information_schema i_s_info = +{ + MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION +}; + +namespace Show { +static ST_FIELD_INFO i_s_mrn_stats_fields_info[] = +{ + Column("VERSION", Varchar(40), NOT_NULL), + Column("rows_written", SLong(), NOT_NULL, "Rows written to Groonga"), + Column("rows_read", SLong(), NOT_NULL, "Rows read from Groonga"), + CEnd() +}; +} // namespace Show + +static int i_s_mrn_stats_deinit(void* p) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0); +} + +static int i_s_mrn_stats_fill( + THD* thd, TABLE_LIST* tables, Item* cond) +{ + TABLE* table = (TABLE *) tables->table; + int status = 0; + MRN_DBUG_ENTER_FUNCTION(); + table->field[0]->store(grn_get_version(), strlen(grn_get_version()), + system_charset_info); + table->field[0]->set_notnull(); + table->field[1]->store(1); /* TODO */ + table->field[2]->store(2); /* TODO */ + if (schema_table_store_record(thd, table)) { + status = 1; + } + DBUG_RETURN(status); +} + +static int i_s_mrn_stats_init(void* p) +{ + MRN_DBUG_ENTER_FUNCTION(); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + schema->fields_info = Show::i_s_mrn_stats_fields_info; + schema->fill_table = i_s_mrn_stats_fill; + DBUG_RETURN(0); +} + +struct st_mysql_plugin i_s_mrn_stats = +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &i_s_info, + MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_stats", + MRN_PLUGIN_AUTHOR, + "Statistics for " MRN_PLUGIN_NAME_STRING, + PLUGIN_LICENSE_GPL, + i_s_mrn_stats_init, +#ifdef MRN_ST_MYSQL_PLUGIN_HAVE_CHECK_UNINSTALL + NULL, +#endif + i_s_mrn_stats_deinit, + MRN_VERSION_IN_HEX, + NULL, + NULL, + MRN_PLUGIN_LAST_VALUES +}; +/* End of mroonga information schema implementations */ + +static handler *mrn_handler_create(handlerton *hton, + TABLE_SHARE *share, +#ifdef MRN_HANDLERTON_CREATE_HAVE_PARTITIONED + bool partitioned, +#endif + MEM_ROOT *root) +{ + MRN_DBUG_ENTER_FUNCTION(); + handler *new_handler = new (root) ha_mroonga(hton, share); + DBUG_RETURN(new_handler); +} + +static void mrn_drop_database(handlerton *hton, char *path) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_db_manager->drop(path); + DBUG_VOID_RETURN; +} + +static int mrn_close_connection(handlerton *hton, THD *thd) +{ + MRN_DBUG_ENTER_FUNCTION(); + void *p = thd_get_ha_data(thd, mrn_hton_ptr); + if (p) { + mrn_clear_slot_data(thd); + free(p); + { + mrn::Lock lock(&mrn_allocated_thds_mutex); + my_hash_delete(&mrn_allocated_thds, (uchar*) 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; + if (mrn_log_file_opened) { + mrn::Lock lock(&mrn_log_mutex); + fclose(mrn_log_file); + mrn_log_file = fopen(mrn_log_file_path, "a"); + } + DBUG_RETURN(result); +} + +static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field, + bool for_index_key) +{ + grn_builtin_type type = GRN_DB_VOID; + enum_field_types mysql_field_type = field->real_type(); + switch (mysql_field_type) { + case MYSQL_TYPE_DECIMAL: // DECIMAL; <= 65bytes + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_TINY: // TINYINT; 1byte + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT8; // 1byte + } else { + type = GRN_DB_INT8; // 1byte + } + break; + case MYSQL_TYPE_SHORT: // SMALLINT; 2bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT16; // 2bytes + } else { + type = GRN_DB_INT16; // 2bytes + } + break; + case MYSQL_TYPE_LONG: // INT; 4bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT32; // 4bytes + } else { + type = GRN_DB_INT32; // 4bytes + } + break; + case MYSQL_TYPE_FLOAT: // FLOAT; 4 or 8bytes + case MYSQL_TYPE_DOUBLE: // DOUBLE; 8bytes + type = GRN_DB_FLOAT; // 8bytes + break; + case MYSQL_TYPE_NULL: // NULL; 1byte + type = GRN_DB_INT8; // 1byte + break; + case MYSQL_TYPE_TIMESTAMP: // TIMESTAMP; 4bytes + type = GRN_DB_TIME; // 8bytes + break; + case MYSQL_TYPE_LONGLONG: // BIGINT; 8bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT64; // 8bytes + } else { + type = GRN_DB_INT64; // 8bytes + } + break; + case MYSQL_TYPE_INT24: // MEDIUMINT; 3bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT32; // 4bytes + } else { + type = GRN_DB_INT32; // 4bytes + } + break; + case MYSQL_TYPE_DATE: // DATE; 4bytes + case MYSQL_TYPE_TIME: // TIME; 3bytes + case MYSQL_TYPE_DATETIME: // DATETIME; 8bytes + case MYSQL_TYPE_YEAR: // YEAR; 1byte + case MYSQL_TYPE_NEWDATE: // DATE; 3bytes + type = GRN_DB_TIME; // 8bytes + break; + case MYSQL_TYPE_VARCHAR: // VARCHAR; <= 64KB * 4 + 2bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + if (field->field_length <= MRN_SHORT_TEXT_SIZE) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else if (field->field_length <= MRN_TEXT_SIZE) { + type = GRN_DB_TEXT; // 64Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + } + break; + case MYSQL_TYPE_BIT: // BIT; <= 8bytes + type = GRN_DB_INT64; // 8bytes + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: // TIMESTAMP; 4bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: // DATETIME; 8bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: // TIME(FSP); 3 + (FSP + 1) / 2 bytes + // 0 <= FSP <= 6; 3-6bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: // DECIMAL; <= 9bytes + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_ENUM: // ENUM; <= 2bytes + if (field->pack_length() == 1) { + type = GRN_DB_UINT8; // 1bytes + } else { + type = GRN_DB_UINT16; // 2bytes + } + break; + case MYSQL_TYPE_SET: // SET; <= 8bytes + switch (field->pack_length()) { + case 1: + type = GRN_DB_UINT8; // 1byte + break; + case 2: + type = GRN_DB_UINT16; // 2bytes + break; + case 3: + case 4: + type = GRN_DB_UINT32; // 3bytes + break; + case 8: + default: + type = GRN_DB_UINT64; // 8bytes + break; + } + break; + case MYSQL_TYPE_TINY_BLOB: // TINYBLOB; <= 256bytes + 1byte + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_MEDIUM_BLOB: // MEDIUMBLOB; <= 16Mbytes + 3bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_LONG_BLOB: // LONGBLOB; <= 4Gbytes + 4bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_BLOB: // BLOB; <= 64Kbytes + 2bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_VAR_STRING: // VARCHAR; <= 255byte * 4 + 1bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + if (field->field_length <= MRN_SHORT_TEXT_SIZE) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else if (field->field_length <= MRN_TEXT_SIZE) { + type = GRN_DB_TEXT; // 64Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + } + break; + case MYSQL_TYPE_STRING: // CHAR; < 1Kbytes =~ (255 * 4)bytes + // 4 is the maximum size of a character + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_GEOMETRY: // case-by-case + type = GRN_DB_WGS84_GEO_POINT; // 8bytes + break; + case MYSQL_TYPE_VARCHAR_COMPRESSED: + case MYSQL_TYPE_BLOB_COMPRESSED: + DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + type = GRN_DB_TEXT; + break; +#endif + } + return type; +} + +static bool mrn_parse_grn_column_create_flags(THD *thd, + grn_ctx *ctx, + const char *flag_names, + uint flag_names_length, + grn_obj_flags *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 >= 13 && !memcmp(flag_names, "COLUMN_SCALAR", 13)) { + *column_flags |= GRN_OBJ_COLUMN_SCALAR; + flag_names += 13; + found = true; + } else if (rest_length >= 13 && !memcmp(flag_names, "COLUMN_VECTOR", 13)) { + *column_flags |= GRN_OBJ_COLUMN_VECTOR; + flag_names += 13; + found = true; + } else if (rest_length >= 13 && !memcmp(flag_names, "COMPRESS_ZLIB", 13)) { + if (mrn_libgroonga_support_zlib) { + *column_flags |= GRN_OBJ_COMPRESS_ZLIB; + found = true; + } 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) { + *column_flags |= GRN_OBJ_COMPRESS_LZ4; + found = true; + } 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 if (rest_length >= 13 && !memcmp(flag_names, "COMPRESS_ZSTD", 13)) { + if (mrn_libgroonga_support_zstd) { + *column_flags |= GRN_OBJ_COMPRESS_ZSTD; + found = true; + } else { + push_warning_printf(thd, MRN_SEVERITY_WARNING, + ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM, + ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR, + "COMPRESS_ZSTD"); + } + flag_names += 13; + } else { + char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE, + "%.*s", + static_cast(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); + break; + } + } + return found; +} + +static bool mrn_parse_grn_index_column_flags(THD *thd, + grn_ctx *ctx, + const char *flag_names, + uint flag_names_length, + grn_column_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 if (rest_length >= 11 && !memcmp(flag_names, "INDEX_SMALL", 11)) { + *index_column_flags |= GRN_OBJ_INDEX_SMALL; + flag_names += 11; + found = true; + } else if (rest_length >= 12 && !memcmp(flag_names, "INDEX_MEDIUM", 12)) { + *index_column_flags |= GRN_OBJ_INDEX_MEDIUM; + flag_names += 12; + found = true; + } else { + char invalid_flag_name[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(invalid_flag_name, MRN_MESSAGE_BUFFER_SIZE, + "%.*s", + static_cast(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) +{ + int error = 0; + Geometry_buffer buffer; + Geometry *geometry; + + geometry = Geometry::construct(&buffer, wkb, wkb_size); + if (!geometry) { + return ER_CANT_CREATE_GEOMETRY_OBJECT; + } + switch (geometry->get_class_info()->m_type_id) { + case Geometry::wkb_point: + { + Gis_point *point = (Gis_point *)geometry; + double latitude = 0.0, longitude = 0.0; +#ifdef MRN_HAVE_POINT_XY + point_xy xy(0.0, 0.0); + point->get_xy(&xy); + longitude = xy.x; + latitude = xy.y; +#else + point->get_xy(&longitude, &latitude); +#endif + grn_obj_reinit(ctx, buf, GRN_DB_WGS84_GEO_POINT, 0); + GRN_GEO_POINT_SET(ctx, buf, + GRN_GEO_DEGREE2MSEC(latitude), + GRN_GEO_DEGREE2MSEC(longitude)); + break; + } + default: + my_printf_error(ER_MRN_GEOMETRY_NOT_SUPPORT_NUM, + ER_MRN_GEOMETRY_NOT_SUPPORT_STR, MYF(0)); + error = ER_MRN_GEOMETRY_NOT_SUPPORT_NUM; + break; + } + MRN_GEOMETRY_FREE(geometry); + + return error; +} +#endif + +#ifdef MRN_HAVE_HTON_ALTER_TABLE_FLAGS +static alter_table_operations mrn_alter_table_flags(alter_table_operations flags) +{ + ulonglong alter_flags = 0; +#ifdef HA_INPLACE_ADD_INDEX_NO_READ_WRITE + bool is_inplace_index_change; +# ifdef MRN_HAVE_ALTER_INFO + is_inplace_index_change = (((flags & ALTER_ADD_INDEX) && + (flags & ALTER_DROP_INDEX)) || + (flags & ALTER_CHANGE_COLUMN)); +# else + is_inplace_index_change = (((flags & ALTER_ADD_INDEX) && + (flags & ALTER_DROP_INDEX)) || + (flags & ALTER_CHANGE_COLUMN)); +# endif + if (!is_inplace_index_change) { + alter_flags |= + HA_INPLACE_ADD_INDEX_NO_READ_WRITE | + HA_INPLACE_DROP_INDEX_NO_READ_WRITE | + HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE | + HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE | + HA_INPLACE_ADD_INDEX_NO_WRITE | + HA_INPLACE_DROP_INDEX_NO_WRITE | + HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE | + HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE; + } +#endif + return alter_flags; +} +#endif + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS +static ha_create_table_option mrn_field_options[] = +{ + HA_FOPTION_STRING("GROONGA_TYPE", groonga_type), + HA_FOPTION_STRING("FLAGS", flags), + HA_FOPTION_END +}; + +static ha_create_table_option mrn_index_options[] = +{ + HA_IOPTION_STRING("TOKENIZER", tokenizer), + HA_IOPTION_STRING("NORMALIZER", normalizer), + HA_IOPTION_STRING("TOKEN_FILTERS", token_filters), + HA_IOPTION_STRING("FLAGS", flags), + HA_IOPTION_END +}; +#endif + +static int mrn_init(void *p) +{ + // init handlerton + grn_ctx *ctx = NULL; + handlerton *hton = static_cast(p); + hton->create = mrn_handler_create; + 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 +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + hton->field_options = mrn_field_options; + hton->index_options = mrn_index_options; +#endif + mrn_hton_ptr = hton; + +#ifdef _WIN32 + HMODULE current_module = GetModuleHandle(NULL); + mrn_binlog_filter = + *((Rpl_filter **)GetProcAddress(current_module, MRN_BINLOG_FILTER_PROC)); + mrn_my_tz_UTC = + *((Time_zone **)GetProcAddress(current_module, MRN_MY_TZ_UTC_PROC)); +# ifdef MRN_HAVE_TABLE_DEF_CACHE + mrn_table_def_cache = (HASH *)GetProcAddress(current_module, + "?table_def_cache@@3Ust_hash@@A"); +# endif +# ifndef MRN_HAVE_TDC_LOCK_TABLE_SHARE + mrn_LOCK_open = + (mysql_mutex_t *)GetProcAddress(current_module, + "?LOCK_open@@3Ust_mysql_mutex@@A"); +# endif +# 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 + mrn_table_share_lock_ha_data = + (PSI_mutex_key *)GetProcAddress(current_module, + MRN_TABLE_SHARE_LOCK_HA_DATA_PROC); +# endif +#else + mrn_binlog_filter = binlog_filter; + mrn_my_tz_UTC = my_tz_UTC; +# ifdef MRN_HAVE_TABLE_DEF_CACHE + mrn_table_def_cache = &table_def_cache; +# endif +# ifndef MRN_HAVE_TDC_LOCK_TABLE_SHARE + mrn_LOCK_open = &LOCK_open; +# endif +#endif + +#ifdef MRN_HAVE_PSI_SERVER + if (PSI_server) { + const char *category = "mroonga"; + int n_mutexes = array_elements(mrn_mutexes); + PSI_server->register_mutex(category, mrn_mutexes, n_mutexes); + } +#endif + + grn_default_query_logger_set_path(mrn_query_log_file_path); + + if (grn_init() != GRN_SUCCESS) { + goto err_grn_init; + } + + grn_set_lock_timeout(mrn_lock_timeout); + + mrn_init_encoding_map(); + + grn_ctx_init(&mrn_ctx, 0); + ctx = &mrn_ctx; + if (mrn_change_encoding(ctx, system_charset_info)) + goto err_mrn_change_encoding; + +#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; + } + if (mysql_mutex_init(mrn_query_log_mutex_key, + &mrn_query_log_mutex, + MY_MUTEX_INIT_FAST) != 0) { + goto err_query_log_mutex_init; + } + + mrn_logger.max_level = static_cast(mrn_log_level); + grn_logger_set(ctx, &mrn_logger); + if (!(mrn_log_file = fopen(mrn_log_file_path, "a"))) { + goto err_log_file_open; + } + mrn_log_file_opened = true; + GRN_LOG(ctx, GRN_LOG_NOTICE, "%s started.", MRN_PACKAGE_STRING); + GRN_LOG(ctx, GRN_LOG_NOTICE, "log level is '%s'", + mrn_log_level_type_names[mrn_log_level]); + + // init meta-info database + if (!(mrn_db = grn_db_create(ctx, NULL, NULL))) { + GRN_LOG(ctx, GRN_LOG_ERROR, "cannot create system database, exiting"); + goto err_db_create; + } + grn_ctx_use(ctx, mrn_db); + + grn_ctx_init(&mrn_db_manager_ctx, 0); + grn_logger_set(&mrn_db_manager_ctx, &mrn_logger); + 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 (mysql_mutex_init(mrn_context_pool_mutex_key, + &mrn_context_pool_mutex, + MY_MUTEX_INIT_FAST) != 0) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "failed to initialize mutex for context pool"); + goto error_context_pool_mutex_init; + } + mrn_context_pool = new mrn::ContextPool(&mrn_context_pool_mutex); + + if (mysql_mutex_init(mrn_operations_mutex_key, + &mrn_operations_mutex, + MY_MUTEX_INIT_FAST) != 0) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "failed to initialize mutex for operations"); + goto error_operations_mutex_init; + } + + 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 (mrn_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 ((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 (mrn_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 ((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 (mrn_my_hash_init(&mrn_long_term_share, system_charset_info, 32, 0, 0, + mrn_long_term_share_get_key, 0, 0)) { + goto error_allocated_long_term_share_hash_init; + } + +#ifdef MRN_USE_MYSQL_DATA_HOME + mrn::PathMapper::default_mysql_data_home_path = mysql_data_home; +#endif + + return 0; + +error_allocated_long_term_share_hash_init: + 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: + mysql_mutex_destroy(&mrn_open_tables_mutex); +err_allocated_open_tables_mutex_init: + my_hash_free(&mrn_allocated_thds); +error_allocated_thds_hash_init: + mysql_mutex_destroy(&mrn_allocated_thds_mutex); +err_allocated_thds_mutex_init: + mysql_mutex_destroy(&mrn_operations_mutex); +error_operations_mutex_init: + delete mrn_context_pool; + mysql_mutex_destroy(&mrn_context_pool_mutex); +error_context_pool_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: + if (mrn_log_file_opened) { + fclose(mrn_log_file); + mrn_log_file_opened = false; + } +err_log_file_open: + mysql_mutex_destroy(&mrn_query_log_mutex); +err_query_log_mutex_init: + mysql_mutex_destroy(&mrn_log_mutex); +err_log_mutex_init: +err_mrn_change_encoding: + grn_ctx_fin(ctx); + grn_fin(); +err_grn_init: + return -1; +} + +static int mrn_deinit(void *p) +{ + THD *thd = current_thd, *tmp_thd; + grn_ctx *ctx = &mrn_ctx; + MRN_LONG_TERM_SHARE *long_term_share; + + GRN_LOG(ctx, GRN_LOG_NOTICE, "%s deinit", MRN_PACKAGE_STRING); + + if (thd && thd_sql_command(thd) == SQLCOM_UNINSTALL_PLUGIN) { + mrn::Lock lock(&mrn_allocated_thds_mutex); + while ((tmp_thd = (THD *) my_hash_element(&mrn_allocated_thds, 0))) + { + mrn_clear_slot_data(tmp_thd); + void *slot_ptr = mrn_get_slot_data(tmp_thd, false); + if (slot_ptr) free(slot_ptr); + thd_set_ha_data(tmp_thd, mrn_hton_ptr, 0); + my_hash_delete(&mrn_allocated_thds, (uchar *) tmp_thd); + } + } + + { + mrn::Lock lock(&mrn_open_tables_mutex); + while ((long_term_share = (MRN_LONG_TERM_SHARE *) + my_hash_element(&mrn_long_term_share, 0))) + { + mrn_free_long_term_share(long_term_share); + } + } + + my_hash_free(&mrn_long_term_share); + mysql_mutex_destroy(&mrn_long_term_share_mutex); + my_hash_free(&mrn_open_tables); + mysql_mutex_destroy(&mrn_open_tables_mutex); + my_hash_free(&mrn_allocated_thds); + mysql_mutex_destroy(&mrn_allocated_thds_mutex); + mysql_mutex_destroy(&mrn_operations_mutex); + delete mrn_context_pool; + mysql_mutex_destroy(&mrn_context_pool_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); + grn_ctx_fin(ctx); + grn_fin(); + + if (mrn_log_file_opened) { + fclose(mrn_log_file); + mrn_log_file_opened = false; + } + mysql_mutex_destroy(&mrn_query_log_mutex); + mysql_mutex_destroy(&mrn_log_mutex); + + return 0; +} + +mrn_declare_plugin(MRN_PLUGIN_NAME) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &storage_engine_structure, + MRN_PLUGIN_NAME_STRING, + MRN_PLUGIN_AUTHOR, + "CJK-ready fulltext search, column store", + PLUGIN_LICENSE_GPL, + mrn_init, + mrn_deinit, + MRN_VERSION_IN_HEX, + mrn_status_variables, + mrn_system_variables, + MRN_PLUGIN_LAST_VALUES +}, +i_s_mrn_stats +mrn_declare_plugin_end; + +static 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(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + if (!info->ctx) { + DBUG_VOID_RETURN; + } + + if (info->cursor) { + grn_obj_unlink(info->ctx, info->cursor); + } + if (info->id_accessor) { + grn_obj_unlink(info->ctx, info->id_accessor); + } + if (info->key_accessor) { + grn_obj_unlink(info->ctx, info->key_accessor); + } + grn_obj_unlink(info->ctx, info->result); + grn_obj_unlink(info->ctx, info->score_column); + grn_obj_unlink(info->ctx, &(info->key)); + grn_obj_unlink(info->ctx, &(info->score)); + + info->ctx = NULL; + + DBUG_VOID_RETURN; +} + +static void mrn_generic_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + mrn_generic_ft_clear(handler); + delete info; + DBUG_VOID_RETURN; +} + +static int mrn_wrapper_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_wrapper_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + float score = 0.0; + grn_id record_id; + + mrn_change_encoding(info->ctx, NULL); + key_copy((uchar *)(GRN_TEXT_VALUE(&(info->key))), record, + info->primary_key_info, info->primary_key_info->key_length); + record_id = grn_table_get(info->ctx, + info->table, + GRN_TEXT_VALUE(&(info->key)), + GRN_TEXT_LEN(&(info->key))); + + if (record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &record_id, sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = mrn_get_score_value(&(info->score)); + } + } + + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_wrapper_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_generic_ft_close_search(handler); + DBUG_VOID_RETURN; +} + +static float mrn_wrapper_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + float score = 0.0; + grn_id record_id; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + record_id = grn_table_get(info->ctx, + info->table, + GRN_TEXT_VALUE(&(mroonga->key_buffer)), + GRN_TEXT_LEN(&(mroonga->key_buffer))); + + if (record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &record_id, sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = mrn_get_score_value(&(info->score)); + } + } + + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_wrapper_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_wrapper_ft_vft = { + mrn_wrapper_ft_read_next, + mrn_wrapper_ft_find_relevance, + mrn_wrapper_ft_close_search, + mrn_wrapper_ft_get_relevance, + mrn_wrapper_ft_reinit_search +}; + +static int mrn_storage_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_storage_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + + float score = 0.0; + if (mroonga->record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &(mroonga->record_id), sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = mrn_get_score_value(&(info->score)); + } + } + DBUG_PRINT("info", ("mroonga: record_id=%d score=%g", + mroonga->record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_storage_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_generic_ft_close_search(handler); + DBUG_VOID_RETURN; +} + +static float mrn_storage_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + + float score = 0.0; + if (mroonga->record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &(mroonga->record_id), sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = mrn_get_score_value(&(info->score)); + } + } + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", mroonga->record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_storage_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_storage_ft_vft = { + mrn_storage_ft_read_next, + mrn_storage_ft_find_relevance, + mrn_storage_ft_close_search, + mrn_storage_ft_get_relevance, + mrn_storage_ft_reinit_search +}; + +static int mrn_no_such_key_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_no_such_key_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0.0); +} + +static void mrn_no_such_key_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + delete info; + DBUG_VOID_RETURN; +} + +static float mrn_no_such_key_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0.0); +} + +static void mrn_no_such_key_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_no_such_key_ft_vft = { + mrn_no_such_key_ft_read_next, + mrn_no_such_key_ft_find_relevance, + mrn_no_such_key_ft_close_search, + mrn_no_such_key_ft_get_relevance, + mrn_no_such_key_ft_reinit_search +}; + +#ifdef HA_CAN_FULLTEXT_EXT +static uint mrn_generic_ft_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + // This value is not used in MySQL 5.6.7-rc. So it is + // meaningless. It may be used in the future... + uint version = 1; + DBUG_RETURN(version); +} + +static ulonglong mrn_generic_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + // TODO: Should we support FTS_ORDERED_RESULT? + // TODO: Shuold we support FTS_DOCID_IN_RESULT? + ulonglong flags = 0; + DBUG_RETURN(flags); +} + +// This function is used if we enable FTS_DOCID_IN_RESULT flag and the +// table has "FTS_DOC_ID" (defined as FTS_DOC_ID_COL_NAME macro) +// special name column. Should we support "FTS_DOC_ID" special name +// column? +// See also sql/sql_optimizer.cc:JOIN::optimize_fts_query(). +static ulonglong mrn_generic_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = GRN_ID_NIL; + DBUG_RETURN(id); +} + +static ulonglong mrn_generic_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = reinterpret_cast(handler); + ulonglong n_records = grn_table_size(info->ctx, info->result); + DBUG_RETURN(n_records); +} + +static uint mrn_wrapper_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_wrapper_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_wrapper_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = mrn_generic_ft_ext_get_docid(handler); + DBUG_RETURN(id); +} + +static ulonglong mrn_wrapper_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = mrn_generic_ft_ext_count_matches(handler); + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_wrapper_ft_vft_ext = { + mrn_wrapper_ft_ext_get_version, + mrn_wrapper_ft_ext_get_flags, + mrn_wrapper_ft_ext_get_docid, + mrn_wrapper_ft_ext_count_matches +}; + +static uint mrn_storage_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_storage_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_storage_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = mrn_generic_ft_ext_get_docid(handler); + DBUG_RETURN(id); +} + +static ulonglong mrn_storage_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = mrn_generic_ft_ext_count_matches(handler); + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_storage_ft_vft_ext = { + mrn_storage_ft_ext_get_version, + mrn_storage_ft_ext_get_flags, + mrn_storage_ft_ext_get_docid, + mrn_storage_ft_ext_count_matches +}; + +static uint mrn_no_such_key_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_no_such_key_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_no_such_key_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = GRN_ID_NIL; + DBUG_RETURN(id); +} + +static ulonglong mrn_no_such_key_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = 0; + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_no_such_key_ft_vft_ext = { + mrn_no_such_key_ft_ext_get_version, + mrn_no_such_key_ft_ext_get_flags, + mrn_no_such_key_ft_ext_get_docid, + mrn_no_such_key_ft_ext_count_matches +}; +#endif + +/* handler implementation */ +ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg) + :handler(hton, share_arg), + wrap_handler(NULL), + is_clone(false), + parent_for_clone(NULL), + mem_root_for_clone(NULL), + record_id(GRN_ID_NIL), + key_id(NULL), + del_key_id(NULL), + + wrap_ft_init_count(0), + share(NULL), + wrap_key_info(NULL), + base_key_info(NULL), + + analyzed_for_create(false), + wrap_handler_for_create(NULL), +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + hnd_add_index(NULL), +#endif +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + alter_key_info_buffer(NULL), +#else + wrap_alter_key_info(NULL), +#endif + mrn_lock_type(F_UNLCK), + + ctx_entity_(), + ctx(&ctx_entity_), + grn_table(NULL), + grn_columns(NULL), + grn_column_ranges(NULL), + grn_index_tables(NULL), + grn_index_columns(NULL), + + grn_source_column_geo(NULL), + cursor_geo(NULL), + cursor(NULL), + index_table_cursor(NULL), + empty_value_records(NULL), + empty_value_records_cursor(NULL), + + sorted_result(NULL), + matched_record_keys(NULL), + blob_buffers(NULL), + + dup_key(0), + + count_skip(false), + fast_order_limit(false), + fast_order_limit_with_index(false), + + ignoring_duplicated_key(false), + inserting_with_update(false), + fulltext_searching(false), + ignoring_no_key_columns(false), + replacing_(false), + written_by_row_based_binlog(0), + current_ft_item(NULL), + operations_(NULL) +{ + MRN_DBUG_ENTER_METHOD(); + grn_ctx_init(ctx, 0); + mrn_change_encoding(ctx, system_charset_info); + grn_ctx_use(ctx, mrn_db); + GRN_WGS84_GEO_POINT_INIT(&top_left_point, 0); + GRN_WGS84_GEO_POINT_INIT(&bottom_right_point, 0); + GRN_WGS84_GEO_POINT_INIT(&source_point, 0); + GRN_TEXT_INIT(&key_buffer, 0); + GRN_TEXT_INIT(&encoded_key_buffer, 0); + GRN_VOID_INIT(&old_value_buffer); + GRN_VOID_INIT(&new_value_buffer); + DBUG_VOID_RETURN; +} + +ha_mroonga::~ha_mroonga() +{ + MRN_DBUG_ENTER_METHOD(); + + delete operations_; + + if (analyzed_for_create) { + if (wrap_handler_for_create) { + delete wrap_handler_for_create; + } + if (share_for_create.wrapper_mode) { + plugin_unlock(NULL, share_for_create.plugin); + } + 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)); + } + if (blob_buffers) + { + delete [] blob_buffers; + } + grn_obj_unlink(ctx, &top_left_point); + grn_obj_unlink(ctx, &bottom_right_point); + grn_obj_unlink(ctx, &source_point); + grn_obj_unlink(ctx, &key_buffer); + grn_obj_unlink(ctx, &encoded_key_buffer); + grn_obj_unlink(ctx, &old_value_buffer); + grn_obj_unlink(ctx, &new_value_buffer); + grn_ctx_fin(ctx); + DBUG_VOID_RETURN; +} + +const char *ha_mroonga::table_type() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(MRN_PLUGIN_NAME_STRING); +} + +const char *ha_mroonga::index_type(uint key_nr) +{ + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->s->key_info[key_nr]); + if (key_info->algorithm == HA_KEY_ALG_FULLTEXT) { + DBUG_RETURN("FULLTEXT"); + } else if (key_info->algorithm == HA_KEY_ALG_HASH) { + DBUG_RETURN("HASH"); + } else { + DBUG_RETURN("BTREE"); + } +} + +static const char *ha_mroonga_exts[] = { + NullS +}; +const char **ha_mroonga::bas_ext() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(ha_mroonga_exts); +} + +uint ha_mroonga::wrapper_max_supported_record_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_record_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_record_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_record_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_record_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_record_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_record_length(); + } else { + res = storage_max_supported_record_length(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_keys() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_keys(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_keys(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_keys() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_keys() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_keys(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_keys(); + } else { + res = storage_max_supported_keys(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_key_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_key_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_key_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_key_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(GRN_TABLE_MAX_KEY_SIZE); +} + +uint ha_mroonga::max_supported_key_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_key_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_key_length(); + } else { + res = storage_max_supported_key_length(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_key_part_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_key_part_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_key_part_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_key_part_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(GRN_TABLE_MAX_KEY_SIZE); +} + +uint ha_mroonga::max_supported_key_part_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_key_part_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_key_part_length(); + } else { + res = storage_max_supported_key_part_length(); + } + + DBUG_RETURN(res); +} + +ulonglong ha_mroonga::wrapper_table_flags() const +{ + ulonglong table_flags; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + table_flags = wrap_handler_for_create->ha_table_flags(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + table_flags = wrap_handler->ha_table_flags(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + table_flags |= HA_CAN_FULLTEXT | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | + HA_CAN_RTREEKEYS | HA_REC_NOT_IN_SEQ; +#ifdef HA_CAN_REPAIR + table_flags |= HA_CAN_REPAIR; +#endif +#ifdef HA_CAN_FULLTEXT_EXT + table_flags |= HA_CAN_FULLTEXT_EXT; +#endif +#ifdef HA_GENERATED_COLUMNS + table_flags |= HA_GENERATED_COLUMNS; +#endif +#ifdef HA_CAN_VIRTUAL_COLUMNS + table_flags |= HA_CAN_VIRTUAL_COLUMNS; +#endif + table_flags |= HA_CAN_HASH_KEYS; + DBUG_RETURN(table_flags); +} + +ulonglong ha_mroonga::storage_table_flags() const +{ + MRN_DBUG_ENTER_METHOD(); + ulonglong flags = + HA_NO_TRANSACTIONS | + HA_PARTIAL_COLUMN_READ | + HA_REC_NOT_IN_SEQ | + HA_NULL_IN_KEY | + HA_CAN_INDEX_BLOBS | + HA_STATS_RECORDS_IS_EXACT | + HA_CAN_FULLTEXT | + HA_BINLOG_FLAGS | + HA_CAN_BIT_FIELD | + HA_DUPLICATE_POS | + HA_CAN_GEOMETRY | + HA_CAN_RTREEKEYS; + //HA_HAS_RECORDS; +#ifdef HA_MUST_USE_TABLE_CONDITION_PUSHDOWN + flags |= HA_MUST_USE_TABLE_CONDITION_PUSHDOWN; +#endif +#ifdef HA_CAN_REPAIR + flags |= HA_CAN_REPAIR; +#endif +#ifdef HA_CAN_FULLTEXT_EXT + flags |= HA_CAN_FULLTEXT_EXT; +#endif +#ifdef HA_GENERATED_COLUMNS + flags |= HA_GENERATED_COLUMNS; +#endif +#ifdef HA_CAN_VIRTUAL_COLUMNS + flags |= HA_CAN_VIRTUAL_COLUMNS; +#endif + flags |= HA_CAN_HASH_KEYS; + DBUG_RETURN(flags); +} + +ulonglong ha_mroonga::table_flags() const +{ + MRN_DBUG_ENTER_METHOD(); + + ulonglong flags; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + flags = wrapper_table_flags(); + } else if (wrap_handler && share && share->wrapper_mode) { + flags = wrapper_table_flags(); + } else { + flags = storage_table_flags(); + } + + DBUG_RETURN(flags); +} + +ulong ha_mroonga::wrapper_index_flags(uint idx, uint part, bool all_parts) const +{ + ulong index_flags; + KEY *key = &(table_share->key_info[idx]); + MRN_DBUG_ENTER_METHOD(); + if (key->algorithm == HA_KEY_ALG_BTREE || + key->algorithm == HA_KEY_ALG_UNDEF) { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + index_flags = wrap_handler->index_flags(idx, part, all_parts); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } else { + index_flags = HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR; + } + DBUG_RETURN(index_flags); +} + +ulong ha_mroonga::storage_index_flags(uint idx, uint part, bool all_parts) const +{ + MRN_DBUG_ENTER_METHOD(); + ulong flags; + KEY *key = &(table_share->key_info[idx]); + if (key->algorithm == HA_KEY_ALG_BTREE || + key->algorithm == HA_KEY_ALG_UNDEF) { + flags = HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE; + bool need_normalize_p = false; + // TODO: MariaDB 10.1 passes key->user_defined_key_parts as part + // for ORDER BY DESC. We just it fallback to part = 0. We may use + // it for optimization in the future. + // + // See also: test_if_order_by_key() in sql/sql_select.cc. + if (KEY_N_KEY_PARTS(key) == part) { + part = 0; + } + Field *field = &(key->key_part[part].field[0]); + if (field && (have_custom_normalizer(key) || should_normalize(field))) { + need_normalize_p = true; + } + if (!need_normalize_p) { + flags |= HA_KEYREAD_ONLY; + } + if (KEY_N_KEY_PARTS(key) > 1 || !need_normalize_p) { + flags |= HA_READ_ORDER; + } + } else { + flags = HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR; + } + DBUG_RETURN(flags); +} + +ulong ha_mroonga::index_flags(uint idx, uint part, bool all_parts) const +{ + MRN_DBUG_ENTER_METHOD(); + + KEY *key = &(table_share->key_info[idx]); + if (key->algorithm == HA_KEY_ALG_FULLTEXT) { + DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); + } + if (mrn_is_geo_key(key)) { + DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR | HA_READ_RANGE); + } + + int error = 0; + if (wrap_handler && share && share->wrapper_mode) + { + error = wrapper_index_flags(idx, part, all_parts); + } else { + error = storage_index_flags(idx, part, all_parts); + } + DBUG_RETURN(error); +} + +int ha_mroonga::create_share_for_create() const +{ + int error; + THD *thd = ha_thd(); + LEX *lex = thd->lex; + HA_CREATE_INFO *create_info = &lex->create_info; + TABLE_LIST *table_list = MRN_LEX_GET_TABLE_LIST(lex); + MRN_DBUG_ENTER_METHOD(); + wrap_handler_for_create = NULL; + table_for_create.reset(); + table_share_for_create.reset(); + memset(&share_for_create, 0, sizeof(MRN_SHARE)); + if (table_share) { + table_share_for_create.comment = table_share->comment; + table_share_for_create.connect_string = table_share->connect_string; + } else { +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + if (thd_sql_command(ha_thd()) != SQLCOM_CREATE_INDEX) { +#endif + table_share_for_create.comment = create_info->comment; + table_share_for_create.connect_string = create_info->connect_string; +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + } +#endif + if (thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX) { + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); + if (slot_data && slot_data->alter_create_info) { + create_info = slot_data->alter_create_info; + if (slot_data->alter_connect_string) { + table_share_for_create.connect_string.str = + slot_data->alter_connect_string; + table_share_for_create.connect_string.length = + strlen(slot_data->alter_connect_string); + } else { + table_share_for_create.connect_string.str = NULL; + table_share_for_create.connect_string.length = 0; + } + if (slot_data->alter_comment) { + table_share_for_create.comment.str = + slot_data->alter_comment; + table_share_for_create.comment.length = + strlen(slot_data->alter_comment); + } else { + table_share_for_create.comment.str = NULL; + table_share_for_create.comment.length = 0; + } + } + } + } + mrn_init_alloc_root(&mem_root_for_create, 1024, 0, MYF(0)); + analyzed_for_create = true; + if (table_list) { + share_for_create.table_name = mrn_my_strndup(table_list->table_name.str, + 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; + table_for_create.s = &table_share_for_create; +#ifdef WITH_PARTITION_STORAGE_ENGINE + table_for_create.part_info = NULL; +#endif + if ((error = mrn_parse_table_param(&share_for_create, &table_for_create))) + goto error; + + if (share_for_create.wrapper_mode) + { + wrap_handler_for_create = + share_for_create.hton->create(share_for_create.hton, NULL, + &mem_root_for_create); + if (!wrap_handler_for_create) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + wrap_handler_for_create->init(); + } + DBUG_RETURN(0); + +error: + if (share_for_create.wrapper_mode) { + plugin_unlock(NULL, share_for_create.plugin); + } + mrn_free_share_alloc(&share_for_create); + free_root(&mem_root_for_create, MYF(0)); + analyzed_for_create = false; + thd->clear_error(); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share) +{ + int error = 0; + handler *hnd; + MRN_DBUG_ENTER_METHOD(); + + if (table_share->primary_key == MAX_KEY) + { + my_message(ER_REQUIRES_PRIMARY_KEY, + MRN_GET_ERR_MSG(ER_REQUIRES_PRIMARY_KEY), MYF(0)); + DBUG_RETURN(ER_REQUIRES_PRIMARY_KEY); + } + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = wrapper_create_index(name, table, tmp_share); + if (error) + DBUG_RETURN(error); + + wrap_key_info = mrn_create_key_info_for_table(tmp_share, table, &error); + if (error) + DBUG_RETURN(error); + base_key_info = table->key_info; + + share = tmp_share; + MRN_SET_WRAP_SHARE_KEY(tmp_share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (parse_engine_table_options(ha_thd(), tmp_share->hton, table->s)) { + MRN_SET_BASE_SHARE_KEY(tmp_share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + share = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + error = MRN_GET_ERROR_NUMBER; + DBUG_RETURN(error); + } +#endif + hnd = get_new_handler(table->s, current_thd->mem_root, tmp_share->hton); + if (!hnd) + { + MRN_SET_BASE_SHARE_KEY(tmp_share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + share = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + error = hnd->ha_create(name, table, info); + MRN_SET_BASE_SHARE_KEY(tmp_share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + share = NULL; + delete hnd; + + if (error) { + mrn::PathMapper mapper(name); + generic_delete_table(name, mapper.table_name()); + } + + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_fulltext_validate(KEY *key_info) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + uint i; + for (i = 0; i < KEY_N_KEY_PARTS(key_info); i++) { + Field *field = key_info->key_part[i].field; + + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, true); + if (gtype != GRN_DB_SHORT_TEXT) + { + error = ER_CANT_CREATE_TABLE; + GRN_LOG(ctx, GRN_LOG_ERROR, + "key type must be text: <%d> " + "(TODO: We should show type name not type ID.)", + field->type()); + my_message(ER_CANT_CREATE_TABLE, + "key type must be text. (TODO: We should show type name.)", + MYF(0)); + DBUG_RETURN(error); + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + error = wrapper_create_index_fulltext_validate(key_info); + if (error) { + DBUG_RETURN(error); + } + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj_flags index_table_flags = + GRN_OBJ_TABLE_PAT_KEY | + GRN_OBJ_PERSISTENT; + grn_obj *index_table; + + grn_column_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); + error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); + if (error) { + DBUG_RETURN(error); + } + mrn::IndexTableName index_table_name(grn_table_name, key_info->name.str); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, + lexicon_key_type.get(), + 0); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + mrn_change_encoding(ctx, system_charset_info); + index_tables[i] = index_table; + + grn_obj *tokenizer = find_tokenizer(key_info, tmp_share, i); + if (tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, index_table, info_type, tokenizer); + grn_obj_unlink(ctx, tokenizer); + } + + { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters(key_info, &token_filters)) { + grn_obj_set_info(ctx, index_table, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + + if (have_custom_normalizer(key_info) || + should_normalize(&key_info->key_part->field[0])) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj *normalizer = find_normalizer(key_info); + if (normalizer) { + grn_obj_set_info(ctx, index_table, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + } + + grn_obj *index_column = grn_column_create(ctx, index_table, + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME), + NULL, + index_column_flags, + grn_table); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (index_columns) { + index_columns[i] = index_column; + } else { + grn_obj_unlink(ctx, index_column); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_geo(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + mrn::IndexTableName index_table_name(grn_table_name, key_info->name.str); + + grn_obj_flags index_table_flags = + GRN_OBJ_TABLE_PAT_KEY | + GRN_OBJ_PERSISTENT; + grn_obj *index_table; + + grn_obj_flags index_column_flags = + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + + grn_obj *lexicon_key_type = grn_ctx_at(ctx, GRN_DB_WGS84_GEO_POINT); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, lexicon_key_type, 0); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + grn_obj_unlink(ctx, lexicon_key_type); + DBUG_RETURN(error); + } + grn_obj_unlink(ctx, lexicon_key_type); + index_tables[i] = index_table; + + grn_obj *index_column = grn_column_create(ctx, index_table, + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME), + NULL, + index_column_flags, + grn_table); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (index_columns) { + index_columns[i] = index_column; + } else { + grn_obj_unlink(ctx, index_column); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index(const char *name, TABLE *table, + MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj *grn_index_table; + mrn::PathMapper mapper(name); + const char *grn_table_name = mapper.table_name(); + char *grn_table_path = NULL; // we don't specify path + grn_obj *pkey_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + grn_obj *pkey_value_type = NULL; // we don't use this + grn_obj_flags grn_table_flags = GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_HASH_KEY; + + grn_index_table = grn_table_create(ctx, grn_table_name, strlen(grn_table_name), + grn_table_path, grn_table_flags, + pkey_type, pkey_value_type); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (grn_table) { + grn_obj_unlink(ctx, grn_table); + } + grn_table = grn_index_table; + + uint i; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + if (!tmp_share->disable_keys) { + for (i = 0; i < n_keys; i++) { + index_tables[i] = NULL; + + KEY *key_info = &(table->s->key_info[i]); + if (key_info->algorithm == HA_KEY_ALG_FULLTEXT) { + error = wrapper_create_index_fulltext(grn_table_name, + i, key_info, + index_tables, NULL, tmp_share); + } else if (mrn_is_geo_key(key_info)) { + error = wrapper_create_index_geo(grn_table_name, + i, key_info, + index_tables, NULL, tmp_share); + } + } + } + + if (error) { + for (uint j = 0; j < i; j++) { + if (index_tables[j]) { + grn_obj_remove(ctx, index_tables[j]); + } + } + grn_obj_remove(ctx, grn_table); + grn_table = NULL; + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share) +{ + int error; + MRN_LONG_TERM_SHARE *long_term_share = tmp_share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + + if (info->auto_increment_value) { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = info->auto_increment_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + } + + error = storage_create_validate_pseudo_column(table); + if (error) + DBUG_RETURN(error); + + error = storage_create_validate_index(table); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj_flags table_flags = GRN_OBJ_PERSISTENT; + + /* primary key must be handled before creating table */ + grn_obj *pkey_type; + uint pkey_nr = table->s->primary_key; + if (pkey_nr != MAX_INDEXES) { + KEY *key_info = &(table->s->key_info[pkey_nr]); + bool is_id; + + int key_parts = KEY_N_KEY_PARTS(key_info); + if (key_parts == 1) { + Field *pkey_field = key_info->key_part[0].field; + const char *column_name = pkey_field->field_name.str; + is_id = (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0); + + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, pkey_field, false); + pkey_type = grn_ctx_at(ctx, gtype); + } else { + is_id = false; + pkey_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + } + + // default algorithm is BTREE ==> PAT + if (!is_id && key_info->algorithm == HA_KEY_ALG_HASH) { + table_flags |= GRN_OBJ_TABLE_HASH_KEY; + } else if (!is_id) { + table_flags |= GRN_OBJ_TABLE_PAT_KEY; + } else { + // for _id + table_flags |= GRN_OBJ_TABLE_NO_KEY; + pkey_type = NULL; + } + + } else { + // primary key doesn't exists + table_flags |= GRN_OBJ_TABLE_NO_KEY; + pkey_type = NULL; + } + + /* create table */ + grn_obj *table_obj; + mrn::PathMapper mapper(name); + + char *table_path = NULL; // we don't specify path + grn_obj *pkey_value_type = NULL; // we don't use this + + table_obj = grn_table_create(ctx, + mapper.table_name(), strlen(mapper.table_name()), + table_path, + table_flags, pkey_type, pkey_value_type); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + if (table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_PAT_KEY) || + 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); + } else { + Field *field = &(key_info->key_part->field[0]); + if (should_normalize(field)) { + normalizer = find_normalizer(key_info); + } + } + if (normalizer) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj_set_info(ctx, table_obj, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + if (tmp_share->default_tokenizer) { + grn_obj *default_tokenizer = + grn_ctx_get(ctx, + tmp_share->default_tokenizer, + tmp_share->default_tokenizer_length); + if (default_tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, table_obj, info_type, default_tokenizer); + grn_obj_unlink(ctx, default_tokenizer); + } + } + if (tmp_share->token_filters) { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters_fill(&token_filters, + tmp_share->token_filters, + tmp_share->token_filters_length)) { + grn_obj_set_info(ctx, table_obj, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + } + } + + /* create columns */ + uint n_columns = table->s->fields; + for (uint i = 0; i < n_columns; i++) { + Field *field = table->s->field[i]; + mrn::ColumnName column_name(field->field_name); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name.mysql_name()) == 0) { + continue; + } + +#ifdef MRN_SUPPORT_FOREIGN_KEYS + if (storage_create_foreign_key(table, mapper.table_name(), field, table_obj, + error)) { + continue; + } + if (error) { + grn_obj_remove(ctx, table_obj); + DBUG_RETURN(error); + } +#endif + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + if (!find_column_flags(field, tmp_share, i, &col_flags)) { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + + grn_obj *col_type; + { + int column_type_error_code = ER_CANT_CREATE_TABLE; + col_type = find_column_type(field, tmp_share, i, column_type_error_code); + if (!col_type) { + grn_obj_remove(ctx, table_obj); + DBUG_RETURN(column_type_error_code); + } + } + char *col_path = NULL; // we don't specify path + + grn_column_create(ctx, table_obj, + column_name.c_str(), column_name.length(), + col_path, col_flags, col_type); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + grn_obj_remove(ctx, table_obj); + DBUG_RETURN(error); + } + } + + error = storage_create_indexes(table, mapper.table_name(), table_obj, + tmp_share); + if (error) { + grn_obj_remove(ctx, table_obj); + table_obj = NULL; + } + + if (table_obj) { + grn_obj_unlink(ctx, table_obj); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_validate_pseudo_column(TABLE *table) +{ + int error = 0; + uint i, n_columns; + + MRN_DBUG_ENTER_METHOD(); + n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->s->field[i]; + const char *column_name = field->field_name.str; + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + switch (field->type()) { + case MYSQL_TYPE_TINY : + case MYSQL_TYPE_SHORT : + case MYSQL_TYPE_INT24 : + case MYSQL_TYPE_LONG : + case MYSQL_TYPE_LONGLONG : + break; + default: + GRN_LOG(ctx, GRN_LOG_ERROR, "_id must be numeric data type"); + error = ER_CANT_CREATE_TABLE; + my_message(error, "_id must be numeric data type", MYF(0)); + DBUG_RETURN(error); + } + } + } + + DBUG_RETURN(error); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +bool ha_mroonga::storage_create_foreign_key(TABLE *table, + const char *grn_table_name, + Field *field, + grn_obj *table_obj, int &error) +{ + MRN_DBUG_ENTER_METHOD(); + LEX *lex = ha_thd()->lex; + Alter_info *alter_info = &lex->alter_info; + List_iterator key_iterator(alter_info->key_list); + Key *key; + char ref_db_buff[NAME_LEN + 1], ref_table_buff[NAME_LEN + 1]; + while ((key = key_iterator++)) + { + if (key->type != MRN_KEYTYPE_FOREIGN) + { + continue; + } + if (key->columns.elements > 1) + { + error = ER_CANT_CREATE_TABLE; + my_message(error, "mroonga can't use FOREIGN_KEY with multiple columns", + MYF(0)); + DBUG_RETURN(false); + } + List_iterator key_part_col_iterator(key->columns); + Key_part_spec *key_part_col = key_part_col_iterator++; + LEX_CSTRING field_name = key_part_col->field_name; + DBUG_PRINT("info", ("mroonga: field_name=%s", field_name.str)); + DBUG_PRINT("info", ("mroonga: field->field_name=%s", field->field_name.str)); + if (strcmp(field->field_name.str, field_name.str)) + { + continue; + } + Foreign_key *fk = (Foreign_key *) key; + List_iterator key_part_ref_col_iterator(fk->ref_columns); + Key_part_spec *key_part_ref_col = key_part_ref_col_iterator++; + LEX_CSTRING 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); + my_casedn_str(system_charset_info, ref_db_buff); + ref_db_name.str = ref_db_buff; + DBUG_PRINT("info", ("mroonga: casedn ref_db_name=%s", ref_db_name.str)); + } +#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); + my_casedn_str(system_charset_info, ref_table_buff); + ref_table_name.str = ref_table_buff; + DBUG_PRINT("info", ("mroonga: casedn ref_table_name=%s", ref_table_name.str)); + } + if (ref_db_name.str && strcmp(table->s->db.str, ref_db_name.str)) + { + error = ER_CANT_CREATE_TABLE; + my_message(error, + "mroonga can't use FOREIGN_KEY during different database tables", + MYF(0)); + DBUG_RETURN(false); + } + + grn_obj *column, *column_ref = NULL, *grn_table_ref = NULL; + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table->s->db.str, ref_table_name.str, "", 0); + + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(false); + mrn::PathMapper mapper(ref_path); + grn_table_ref = grn_ctx_get(ctx, mapper.table_name(), + strlen(mapper.table_name())); + if (!grn_table_ref) { + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "reference table [%s.%s] is not mroonga table", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + + LEX_CSTRING tmp_db_name= { mapper.db_name(), strlen(mapper.db_name()) }; + LEX_CSTRING tmp_table_name= { mapper.mysql_table_name(), strlen(mapper.mysql_table_name()) }; + table_list.init_one_table(&tmp_db_name, &tmp_table_name, 0, TL_WRITE); + mrn_open_mutex_lock(table->s); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table->s); + if (!tmp_ref_table_share) { + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "reference table [%s.%s] is not found", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + if (ref_pkey_nr == MAX_KEY) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "reference table [%s.%s] has no primary key", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + uint ref_key_parts = KEY_N_KEY_PARTS(ref_key_info); + if (ref_key_parts > 1) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, + "reference table [%s.%s] primary key is multiple column", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + Field *ref_field = &ref_key_info->key_part->field[0]; + if (strcmp(ref_field->field_name.str, ref_field_name.str)) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, + "reference column [%s.%s.%s] is not used for primary key", + table->s->db.str, ref_table_name.str, ref_field_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + column = grn_column_create(ctx, table_obj, field->field_name.str, + field->field_name.length, + NULL, col_flags, grn_table_ref); + if (ctx->rc) { + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(false); + } + + mrn::IndexColumnName index_column_name(grn_table_name, field->field_name.str); + grn_obj_flags ref_col_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + column_ref = grn_column_create(ctx, grn_table_ref, + index_column_name.c_str(), + index_column_name.length(), + NULL, ref_col_flags, table_obj); + if (ctx->rc) { + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(false); + } + + grn_obj source_ids; + grn_id source_id = grn_obj_id(ctx, column); + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + if (error) { + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column_ref); + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + DBUG_RETURN(false); + } + grn_obj_set_info(ctx, column_ref, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column_ref); + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + error = 0; + DBUG_RETURN(true); + } + error = 0; + DBUG_RETURN(false); +} +#endif + +int ha_mroonga::storage_create_validate_index(TABLE *table) +{ + int error = 0; + uint i; + + MRN_DBUG_ENTER_METHOD(); + /* checking if index is used for virtual columns */ + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->s->key_info[i]); + // must be single column key + int key_parts = KEY_N_KEY_PARTS(key_info); + if (key_parts != 1) { + continue; + } + Field *field = key_info->key_part[0].field; + const char *column_name = field->field_name.str; + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (key_info->algorithm == HA_KEY_ALG_HASH) { + continue; // hash index is ok + } + GRN_LOG(ctx, GRN_LOG_ERROR, "only hash index can be defined for _id"); + error = ER_CANT_CREATE_TABLE; + my_message(error, "only hash index can be defined for _id", MYF(0)); + DBUG_RETURN(error); + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_index_table(TABLE *table, + const char *grn_table_name, + grn_obj *grn_table, + MRN_SHARE *tmp_share, + KEY *key_info, + grn_obj **index_tables, + uint i) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj *index_type; + grn_obj *index_table; + grn_obj_flags index_table_flags = GRN_OBJ_PERSISTENT; + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + + if (tmp_share->index_table && tmp_share->index_table[i]) { + index_table = grn_ctx_get(ctx, + tmp_share->index_table[i], + tmp_share->index_table_length[i]); + // TODO: add error check + index_tables[i] = index_table; + DBUG_RETURN(error); + } + + if (is_multiple_column_index) { + index_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + } else { + Field *field = key_info->key_part[0].field; + grn_builtin_type groonga_type = mrn_grn_type_from_field(ctx, field, true); + index_type = grn_ctx_at(ctx, groonga_type); + } + // TODO: Add NULL check for index_type + + int key_alg = key_info->algorithm; + if (key_info->flags & HA_FULLTEXT) { + index_table_flags |= GRN_OBJ_TABLE_PAT_KEY; + error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); + if (error) { + grn_obj_remove(ctx, grn_table); + DBUG_RETURN(error); + } + } else if (key_alg == HA_KEY_ALG_HASH) { + index_table_flags |= GRN_OBJ_TABLE_HASH_KEY; + } else { + index_table_flags |= GRN_OBJ_TABLE_PAT_KEY; + } + + { + mrn::IndexTableName index_table_name(grn_table_name, key_info->name.str); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, + index_type, + NULL); + } + if (ctx->rc) { + grn_obj_unlink(ctx, index_type); + grn_obj_remove(ctx, grn_table); + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + if (key_info->flags & HA_FULLTEXT) { + grn_obj *tokenizer = find_tokenizer(key_info, tmp_share, i); + if (tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, index_table, info_type, tokenizer); + grn_obj_unlink(ctx, tokenizer); + } + + { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters(key_info, &token_filters)) { + grn_obj_set_info(ctx, index_table, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + } + + { + grn_obj *normalizer = NULL; + Field *field = &(key_info->key_part->field[0]); + if (key_info->flags & HA_FULLTEXT) { + if (have_custom_normalizer(key_info) || + should_normalize(field)) { + normalizer = find_normalizer(key_info); + } + } else if (key_alg != HA_KEY_ALG_HASH) { + if (!is_multiple_column_index && + (have_custom_normalizer(key_info) || + should_normalize(field))) { + normalizer = find_normalizer(key_info); + } + } + if (normalizer) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj_set_info(ctx, index_table, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + } + + index_tables[i] = index_table; + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + grn_obj **index_columns, uint i) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj *index_column; + + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + if (!is_multiple_column_index) { + Field *field = key_info->key_part[0].field; + if (strcmp(MRN_COLUMN_NAME_ID, field->field_name.str) == 0) { + // skipping _id virtual column + DBUG_RETURN(0); + } + + if (is_foreign_key_field(table->s->table_name.str, + field->field_name.str)) { + DBUG_RETURN(0); + } + +#ifdef HA_CAN_VIRTUAL_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: storage: failed to create index: " + ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR, + field->field_name.str); + error = ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + } else { + int j, n_key_parts = KEY_N_KEY_PARTS(key_info); + for (j = 0; j < n_key_parts; j++) { + Field *field = key_info->key_part[j].field; + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: storage: failed to create index: " + ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR, + field->field_name.str); + error = ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + } +#endif + } + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = storage_create_index_table(table, grn_table_name, + grn_table, tmp_share, + key_info, index_tables, i); + if (error) + DBUG_RETURN(error); + + grn_obj *index_table = index_tables[i]; + + grn_column_flags index_column_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + + if (!find_index_column_flags(key_info, &index_column_flags)) { + grn_obj *tokenizer = grn_obj_get_info(ctx, index_table, + GRN_INFO_DEFAULT_TOKENIZER, NULL); + if (tokenizer) { + index_column_flags |= GRN_OBJ_WITH_POSITION; + } + if (is_multiple_column_index && (key_info->flags & HA_FULLTEXT)) { + index_column_flags |= GRN_OBJ_WITH_SECTION; + } + } + + const char *index_column_name; + if (tmp_share->index_table && tmp_share->index_table[i]) { + index_column_name = key_info->name.str; + } else { + index_column_name = INDEX_COLUMN_NAME; + } + index_column = grn_column_create(ctx, + index_table, + index_column_name, + strlen(index_column_name), + NULL, + index_column_flags, + grn_table); + + if (ctx->rc) { + grn_obj_remove(ctx, index_table); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, system_charset_info); + if (is_multiple_column_index) { + if (key_info->flags & HA_FULLTEXT) { + grn_obj source_ids; + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + + int j, n_key_parts = KEY_N_KEY_PARTS(key_info); + for (j = 0; j < n_key_parts; j++) { + Field *field = key_info->key_part[j].field; + mrn::ColumnName column_name(field->field_name); + grn_obj *source_column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); + grn_id source_id = grn_obj_id(ctx, source_column); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + grn_obj_unlink(ctx, source_column); + } + mrn_change_encoding(ctx, key_info->key_part->field->charset()); + grn_obj_set_info(ctx, index_column, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + } + } else { + Field *field = key_info->key_part[0].field; + mrn::ColumnName column_name(field->field_name); + grn_obj *column; + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); + if (column) { + grn_obj source_ids; + grn_id source_id = grn_obj_id(ctx, column); + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + mrn_change_encoding(ctx, key_info->key_part->field->charset()); + grn_obj_set_info(ctx, index_column, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column); + } + } + mrn_change_encoding(ctx, system_charset_info); + + if (index_columns) { + index_columns[i] = index_column; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_indexes(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + uint n_keys = table->s->keys; + uint i; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + for (i = 0; i < n_keys; i++) { + index_tables[i] = NULL; + if (i == table->s->primary_key) { + continue; // pkey is already handled + } + KEY *key_info = &table->s->key_info[i]; + if (tmp_share->disable_keys && !(key_info->flags & HA_NOSAME)) { + continue; // key is disabled + } + if ((error = storage_create_index(table, grn_table_name, grn_table, + tmp_share, key_info, + index_tables, NULL, i))) { + break; + } + } + if (error) { + while (true) { + if (index_tables[i] && + !(tmp_share->index_table && tmp_share->index_table[i])) { + grn_obj_remove(ctx, index_tables[i]); + } + if (!i) + break; + i--; + } + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + DBUG_RETURN(error); +} + +int ha_mroonga::ensure_database_open(const char *name, mrn::Database **db) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + if (db) + *db = NULL; + + mrn::Database *local_db; + error = mrn_db_manager->open(name, &local_db); + if (error) + DBUG_RETURN(error); + + if (db) + *db = local_db; + grn_ctx_use(ctx, local_db->get()); + + delete operations_; + operations_ = new mrn::Operations(ctx); + if (mrn_enable_operations_recording) { + operations_->enable_recording(); + } else { + operations_->disable_recording(); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::ensure_database_remove(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + delete operations_; + operations_ = NULL; + + mrn_db_manager->close(name); + + mrn::PathMapper mapper(name); + remove_related_files(mapper.db_path()); + + DBUG_RETURN(error); +} + + +int ha_mroonga::create(const char *name, + TABLE *table, + HA_CREATE_INFO *info +#ifdef MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION + , + dd::Table *table_def +#endif + ) +{ + int error = 0; + MRN_SHARE *tmp_share; + MRN_DBUG_ENTER_METHOD(); + /* checking data type of virtual columns */ + + if (!(tmp_share = mrn_get_share(name, table, &error))) + DBUG_RETURN(error); + + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), false); + if (slot_data && slot_data->disable_keys_create_info == info) { + tmp_share->disable_keys = true; + } + + if (tmp_share->wrapper_mode) + { + error = wrapper_create(name, table, info, tmp_share); + } else { + error = storage_create(name, table, info, tmp_share); + } + + if (error) { + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + } else { + error = add_wrap_hton(tmp_share->table_name, tmp_share->hton); + } + mrn_free_share(tmp_share); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_open(const char *name, int mode, uint open_options) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + mrn::Database *db = NULL; + error = ensure_database_open(name, &db); + if (error) + DBUG_RETURN(error); + + if (!(open_options & HA_OPEN_FOR_REPAIR)) { + error = open_table(name); + if (error) + DBUG_RETURN(error); + + error = wrapper_open_indexes(name); + if (error) { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + } + + 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); + base_key_info = table->key_info; + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (!is_clone) + { + wrap_handler = get_new_handler(table->s, &mem_root, share->hton); + if (!wrap_handler) + { + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#ifdef MRN_HANDLER_HAVE_SET_HA_SHARE_REF + wrap_handler->set_ha_share_ref(&table->s->ha_share); +#endif + error = wrap_handler->ha_open(table, name, mode, open_options); + } else { + if (!(wrap_handler = parent_for_clone->wrap_handler->clone(name, + mem_root_for_clone))) + { + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + ref_length = wrap_handler->ref_length; + key_used_on_scan = wrap_handler->key_used_on_scan; + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + init(); + wrapper_overwrite_index_bits(); + wrapper_set_keys_in_use(); + + pk_keypart_map = make_prev_keypart_map( + KEY_N_KEY_PARTS(&(table->key_info[table_share->primary_key]))); + + if (!error) { + if (open_options & HA_OPEN_FOR_REPAIR) { + // TODO: How to check whether is DISABLE KEYS used or not? + error = wrapper_recreate_indexes(ha_thd()); + } else if (db) { + mrn::Lock lock(&mrn_operations_mutex); + mrn::PathMapper mapper(name); + const char *table_name = mapper.table_name(); + size_t table_name_size = strlen(table_name); + if (db->is_broken_table(table_name, table_name_size)) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is started: <%s>", + name); + error = operations_->clear(table_name, table_name_size); + if (!error) { + db->mark_table_repaired(table_name, table_name_size); + if (!share->disable_keys) { + // TODO: implemented by "reindex" instead of "remove and recreate". + // Because "remove and recreate" invalidates opened indexes by + // other threads. + error = wrapper_disable_indexes_mroonga(HA_KEY_SWITCH_ALL); + if (!error) { + error = wrapper_enable_indexes_mroonga(HA_KEY_SWITCH_ALL); + } + } + } + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is done: <%s>: %s", + name, error == 0 ? "success" : "failure"); + } + } + } + + if (error) + { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + // TODO: free indexes. + + delete wrap_handler; + wrap_handler = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_open_indexes(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + uint n_keys = table->s->keys; + uint n_primary_keys = table->s->primary_key; + if (n_keys > 0) { + // TODO: reduce allocate memories. We only need just + // for HA_KEY_ALG_FULLTEXT keys. + grn_index_tables = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + grn_index_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + } else { + grn_index_tables = grn_index_columns = NULL; + } + + mrn::PathMapper mapper(name); + uint i = 0; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->s->key_info[i]); + + grn_index_tables[i] = NULL; + grn_index_columns[i] = NULL; + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + if (i == n_primary_keys) { + continue; + } + + mrn::IndexTableName index_table_name(mapper.table_name(), key_info->name.str); + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (ctx->rc == GRN_SUCCESS && !grn_index_tables[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } + if (ctx->rc) { + DBUG_PRINT("info", + ("mroonga: sql_command=%u", thd_sql_command(ha_thd()))); + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + + grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + if (!grn_index_columns[i]) { + /* just for backward compatibility before 1.0. */ + Field *field = key_info->key_part[0].field; + grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], + field->field_name.str, + field->field_name.length); + } + + if (ctx->rc) { + DBUG_PRINT("info", + ("mroonga: sql_command=%u", thd_sql_command(ha_thd()))); + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + grn_obj_unlink(ctx, grn_index_tables[i]); + goto error; + } + } + + grn_bulk_space(ctx, &key_buffer, table->key_info->key_length); + +error: + if (error) { + while (i-- > 0) { + grn_obj *index_column = grn_index_columns[i]; + if (index_column) { + grn_obj_unlink(ctx, index_column); + } + grn_obj *index_table = grn_index_tables[i]; + if (index_table) { + grn_obj_unlink(ctx, index_table); + } + } + free(grn_index_columns); + free(grn_index_tables); + grn_index_columns = NULL; + grn_index_tables = NULL; + } + + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_overwrite_index_bits() +{ + uint i, j; + longlong table_option = table_flags(); + MRN_DBUG_ENTER_METHOD(); + table_share->keys_for_keyread.clear_all(); + for (i = 0; i < table_share->fields; i++) + { + Field *field = table_share->field[i]; + field->part_of_key.clear_all(); +#ifdef MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED + field->part_of_key_not_clustered.clear_all(); +#endif + field->part_of_sortkey.clear_all(); + /* + TODO: We may need to update field->part_of_key_not_extended for + MySQL >= 5.7.18. If users report "raw InnoDB can use index for + this case but Mroonga wrapper mode for InnoDB can't use index + for the same case", we'll reconsider it again. + */ + } + for (i = 0; i < table_share->keys; i++) { + KEY *key_info = &table->s->key_info[i]; + KEY_PART_INFO *key_part = key_info->key_part; + for (j = 0 ; j < KEY_N_KEY_PARTS(key_info); key_part++, j++) + { + Field *field = key_part->field; + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + { + if (index_flags(i, j, 0) & HA_KEYREAD_ONLY) + { + table_share->keys_for_keyread.set_bit(i); + field->part_of_key.set_bit(i); +#ifdef MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED + field->part_of_key_not_clustered.set_bit(i); +#endif + } + if (index_flags(i, j, 1) & HA_READ_ORDER) + field->part_of_sortkey.set_bit(i); + } + if (i == table_share->primary_key && + (table_option & HA_PRIMARY_KEY_IN_READ_INDEX)) + { + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + field->part_of_key = table_share->keys_in_use; + if (field->part_of_sortkey.is_set(i)) + field->part_of_sortkey = table_share->keys_in_use; + } + } + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::storage_reindex() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + uint n_keys = table_share->keys; + KEY *key_info = table->key_info; + + bool have_multiple_column_index = false; + bitmap_clear_all(table->read_set); + for (uint i = 0; i < n_keys; ++i) { + if (!grn_index_columns[i]) + continue; + + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY); + grn_table_columns(ctx, grn_index_tables[i], NULL, 0, + reinterpret_cast(columns)); + unsigned int n_columns = + grn_table_size(ctx, reinterpret_cast(columns)); + grn_hash_close(ctx, columns); + + bool is_multiple_column_index = + (KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT)); + + if (n_columns == 1 || is_multiple_column_index) { + grn_table_truncate(ctx, grn_index_tables[i]); + if (ctx->rc != GRN_SUCCESS) { + error = ER_ERROR_ON_WRITE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + char index_table_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_table_name_size; + index_table_name_size = + grn_obj_name(ctx, grn_index_tables[i], + index_table_name, GRN_TABLE_MAX_KEY_SIZE); + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: reindex: failed to truncate index table: " + "<%.*s>: <%s>(%d)", + index_table_name_size, index_table_name, + ctx->errbuf, ctx->rc); + my_message(error, error_message, MYF(0)); + break; + } + } + + if (is_multiple_column_index) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } else { + grn_obj_reindex(ctx, grn_index_columns[i]); + if (ctx->rc != GRN_SUCCESS) { + error = ER_ERROR_ON_WRITE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + char index_column_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_column_name_size; + index_column_name_size = + grn_obj_name(ctx, grn_index_columns[i], + index_column_name, GRN_TABLE_MAX_KEY_SIZE); + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: reindex: failed to reindex: " + "<%.*s>: <%s>(%d)", + index_column_name_size, index_column_name, + ctx->errbuf, ctx->rc); + my_message(error, error_message, MYF(0)); + break; + } + } + } + + if (!error && have_multiple_column_index) + error = storage_add_index_multiple_columns(key_info, n_keys, + grn_index_tables, + grn_index_columns, + false); + bitmap_set_all(table->read_set); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_open(const char *name, int mode, uint open_options) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + mrn::Database *db; + error = ensure_database_open(name, &db); + if (error) + DBUG_RETURN(error); + + error = open_table(name); + if (error) + DBUG_RETURN(error); + + error = storage_open_columns(); + if (error) { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + + if (!(open_options & HA_OPEN_FOR_REPAIR)) { + error = storage_open_indexes(name); + if (error) { + storage_close_columns(); + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + + storage_set_keys_in_use(); + + { + mrn::Lock lock(&mrn_operations_mutex); + mrn::PathMapper mapper(name); + const char *table_name = mapper.table_name(); + size_t table_name_size = strlen(table_name); + if (db->is_broken_table(table_name, table_name_size)) { + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is started: <%s>", + name); + error = operations_->repair(table_name, table_name_size); + if (!error) + db->mark_table_repaired(table_name, table_name_size); + if (!share->disable_keys) { + if (!error) + error = storage_reindex(); + } + GRN_LOG(ctx, GRN_LOG_NOTICE, + "Auto repair is done: <%s>: %s", + name, error == 0 ? "success" : "failure"); + } + } + } + + ref_length = sizeof(grn_id); + DBUG_RETURN(0); +} + +int ha_mroonga::open_table(const char *name) +{ + int error; + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + mrn::PathMapper mapper(name); + grn_table = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (!grn_table) { + error = ER_CANT_OPEN_FILE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: failed to open table: <%s>", + mapper.table_name()); + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + + DBUG_RETURN(0); +} + +int ha_mroonga::storage_open_columns(void) +{ + int error; + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + int n_columns = table->s->fields; + grn_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_columns); + grn_column_ranges = (grn_obj **)malloc(sizeof(grn_obj *) * n_columns); + for (int i = 0; i < n_columns; i++) { + grn_columns[i] = NULL; + grn_column_ranges[i] = NULL; + } + + if (table_share->blob_fields) + { + DBUG_ASSERT(!blob_buffers); + if (!(blob_buffers = new (&table->mem_root) String[n_columns])) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + + for (int i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + mrn::ColumnName column_name(field->field_name); + if (table_share->blob_fields) + { + blob_buffers[i].set_charset(field->charset()); + } + if (strcmp(MRN_COLUMN_NAME_ID, column_name.mysql_name()) == 0) { + continue; + } +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + grn_columns[i] = NULL; + grn_column_ranges[i] = NULL; + continue; + } +#endif + + grn_columns[i] = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); + 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 (!grn_column_ranges[i]) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + break; + } + } + + if (error != 0) { + storage_close_columns(); + } + + DBUG_RETURN(error); +} + +void ha_mroonga::storage_close_columns(void) +{ + int n_columns = table->s->fields; + 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; +} + +int ha_mroonga::storage_open_indexes(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + uint n_keys = table->s->keys; + uint pkey_nr = table->s->primary_key; + if (n_keys > 0) { + grn_index_tables = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + grn_index_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + key_id = (grn_id *)malloc(sizeof(grn_id) * n_keys); + del_key_id = (grn_id *)malloc(sizeof(grn_id) * n_keys); + } else { + grn_index_tables = grn_index_columns = NULL; + key_id = NULL; + del_key_id = NULL; + } + + mrn::PathMapper mapper(name); + uint i, j; + for (i = 0; i < n_keys; i++) { + if (i == pkey_nr) { + grn_index_tables[i] = grn_index_columns[i] = NULL; + continue; + } + + KEY *key_info = &(table->s->key_info[i]); + if (KEY_N_KEY_PARTS(key_info) > 1) { + KEY_PART_INFO *key_part = key_info->key_part; + for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { + bitmap_set_bit(&multiple_column_key_bitmap, + key_part[j].field->field_index); + } + } + + MRN_SHARE *tmp_share; + tmp_share = mrn_get_share(name, table, &error); + if (tmp_share->index_table[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + tmp_share->index_table[i], + tmp_share->index_table_length[i]); + if (ctx->rc == GRN_SUCCESS) { + grn_index_columns[i] = grn_obj_column(ctx, + grn_index_tables[i], + key_info->name.str, + key_info->name.length); + } + } else { + mrn::IndexTableName index_table_name(mapper.table_name(), + key_info->name.str); + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (ctx->rc == GRN_SUCCESS && !grn_index_tables[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } + if (ctx->rc == GRN_SUCCESS) { + grn_index_columns[i] = grn_obj_column(ctx, + grn_index_tables[i], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + if (!grn_index_columns[i] && 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], + field->field_name.str, + field->field_name.length); + } + } + } + mrn_free_share(tmp_share); + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + } + +error: + if (error) { + if (i) { + while (true) { + grn_obj *index_column = grn_index_columns[i]; + if (index_column) { + grn_obj_unlink(ctx, index_column); + } + grn_obj *index_table = grn_index_tables[i]; + if (index_table) { + grn_obj_unlink(ctx, index_table); + } + if (!i) + break; + i--; + } + } + free(key_id); + free(del_key_id); + free(grn_index_columns); + free(grn_index_tables); + key_id = NULL; + del_key_id = NULL; + grn_index_columns = NULL; + grn_index_tables = NULL; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::open(const char *name, + int mode, + uint open_options +#ifdef MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION + , + const dd::Table *table_def +#endif + ) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + if (!(share = mrn_get_share(name, table, &error))) + DBUG_RETURN(error); + thr_lock_data_init(&share->lock,&thr_lock_data,NULL); + + if (bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields, false)) + { + mrn_free_share(share); + share = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + + if (share->wrapper_mode) + { + error = wrapper_open(name, mode, open_options); + } else { + error = storage_open(name, mode, open_options); + } + + if (error) + { + bitmap_free(&multiple_column_key_bitmap); + mrn_free_share(share); + share = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_close() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_HA_CLOSE + error = wrap_handler->ha_close(); +#else + error = wrap_handler->close(); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + delete wrap_handler; + wrap_handler = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info); + wrap_key_info = NULL; + } + base_key_info = NULL; + free_root(&mem_root, MYF(0)); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_close() +{ + MRN_DBUG_ENTER_METHOD(); + grn_obj_unlink(ctx, grn_table); + // TODO: unlink elements + free(grn_columns); + // TODO: unlink elements + free(grn_column_ranges); + DBUG_RETURN(0); +} + +int ha_mroonga::close() +{ + int error = 0; + THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + + clear_indexes(); + + if (share->wrapper_mode) + { + error = wrapper_close(); + } else { + error = storage_close(); + } + + if (error != 0) + { + DBUG_RETURN(error); + } + + if (thd) + { + error = add_wrap_hton(share->table_name, share->hton); + } + bitmap_free(&multiple_column_key_bitmap); + if (share->use_count == 1) { + mrn_free_long_term_share(share->long_term_share); + } + mrn_free_share(share); + share = NULL; + is_clone = false; + + if ( + thd && + thd_sql_command(thd) == SQLCOM_FLUSH + ) { + /* flush tables */ + mrn::Lock lock(&mrn_open_tables_mutex); + if (!mrn_open_tables.records) + { + int tmp_error = mrn_db_manager->clear(); + if (tmp_error) + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_table(const char *name, + handlerton *wrap_handlerton, + const char *table_name) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(wrap_handlerton->drop_table(wrap_handlerton, name)); +} + +int ha_mroonga::generic_delete_table(const char *name, const char *table_name) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = drop_indexes(table_name); + grn_obj *table_obj = grn_ctx_get(ctx, table_name, strlen(table_name)); + if (table_obj) { + grn_obj_remove(ctx, table_obj); + } + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + DBUG_RETURN(error); +} + +int ha_mroonga::delete_table(const char *name) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + THD *thd = ha_thd(); + handlerton *wrap_handlerton = NULL; + mrn::PathMapper mapper(name); + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); + if (slot_data && slot_data->first_wrap_hton) + { + st_mrn_wrap_hton *wrap_hton, *tmp_wrap_hton; + tmp_wrap_hton = NULL; + wrap_hton = slot_data->first_wrap_hton; + while (wrap_hton) + { + if (!strcmp(wrap_hton->path, name)) + { + /* found */ + wrap_handlerton = wrap_hton->hton; + if (tmp_wrap_hton) + tmp_wrap_hton->next = wrap_hton->next; + else + slot_data->first_wrap_hton = wrap_hton->next; + free(wrap_hton); + break; + } + tmp_wrap_hton = wrap_hton; + wrap_hton = wrap_hton->next; + } + } + + if (!wrap_handlerton) { + bool open_table_to_get_wrap_handlerton = true; + if (mapper.is_internal_table_name()) { + open_table_to_get_wrap_handlerton = false; + } + if (open_table_to_get_wrap_handlerton) { + TABLE_LIST table_list; + LEX_CSTRING db_name= { mapper.db_name(), strlen(mapper.db_name()) }; + LEX_CSTRING table_name= { mapper.mysql_table_name(), strlen(mapper.mysql_table_name()) }; + + table_list.init_one_table(&db_name, &table_name, 0, TL_WRITE); + mrn_open_mutex_lock(NULL); + TABLE_SHARE *tmp_table_share = + mrn_create_tmp_table_share(&table_list, name, &error); + error = 0; + mrn_open_mutex_unlock(NULL); + if (tmp_table_share) { + TABLE tmp_table; + tmp_table.s = tmp_table_share; +#ifdef WITH_PARTITION_STORAGE_ENGINE + tmp_table.part_info = NULL; +#endif + MRN_SHARE *tmp_share = mrn_get_share(name, &tmp_table, &error); + if (tmp_share) { + wrap_handlerton = tmp_share->hton; + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + mrn_free_share(tmp_share); + } + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + if (error) { + DBUG_RETURN(error); + } + } + } + } + + if (wrap_handlerton) + { + error = wrapper_delete_table(name, wrap_handlerton, mapper.table_name()); + } + + if (!error) + { + error = generic_delete_table(name, mapper.table_name()); + } + + if (!error) { + error = operations_->clear(name, strlen(name)); + } + + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_set_keys_in_use() +{ + uint i, j; + MRN_DBUG_ENTER_METHOD(); + mrn::AutoIncrementValueLock lock_(table_share); + table_share->keys_in_use.set_prefix(table_share->keys); + share->disable_keys = false; + for (i = 0; i < table_share->keys; i++) { + j = share->wrap_key_nr[i]; + if (j < MAX_KEY) { + if (!share->wrap_table_share->keys_in_use.is_set(j)) { + /* copy bitmap */ + table_share->keys_in_use.clear_bit(i); + share->disable_keys = true; + } + } else { + if (!grn_index_tables || !grn_index_tables[i]) { + /* disabled */ + table_share->keys_in_use.clear_bit(i); + share->disable_keys = true; + } + } + } + table_share->keys_for_keyread.set_prefix(table_share->keys); + table_share->keys_for_keyread.intersect(table_share->keys_in_use); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_set_keys_in_use() +{ + uint i; + MRN_DBUG_ENTER_METHOD(); + mrn::AutoIncrementValueLock lock_(table_share); + table_share->keys_in_use.set_prefix(table_share->keys); + share->disable_keys = false; + for (i = 0; i < table_share->keys; i++) { + if (i == table_share->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + /* disabled */ + table_share->keys_in_use.clear_bit(i); + DBUG_PRINT("info", ("mroonga: key %u disabled", i)); + share->disable_keys = true; + } + } + table_share->keys_for_keyread.set_prefix(table_share->keys); + table_share->keys_for_keyread.intersect(table_share->keys_in_use); + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_info(uint flag) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->info(flag); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (flag & HA_STATUS_ERRKEY) { + errkey = wrap_handler->errkey; + memcpy(dup_ref, wrap_handler->dup_ref, wrap_handler->ref_length); + } + if (flag & HA_STATUS_TIME) { + stats.update_time = wrap_handler->stats.update_time; + } + if (flag & HA_STATUS_CONST) { + stats.max_data_file_length = wrap_handler->stats.max_data_file_length; + stats.create_time = wrap_handler->stats.create_time; + stats.block_size = wrap_handler->stats.block_size; + wrapper_set_keys_in_use(); + } + if (flag & HA_STATUS_VARIABLE) { + stats.data_file_length = wrap_handler->stats.data_file_length; + stats.index_file_length = wrap_handler->stats.index_file_length; + stats.records = wrap_handler->stats.records; + stats.mean_rec_length = wrap_handler->stats.mean_rec_length; + stats.check_time = wrap_handler->stats.check_time; + } + if (flag & HA_STATUS_AUTO) { + stats.auto_increment_value = wrap_handler->stats.auto_increment_value; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_info(uint flag) +{ + MRN_DBUG_ENTER_METHOD(); + mrn_change_encoding(ctx, NULL); + + if (flag & (HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK)) { + errkey = dup_key; + } + + if ((flag & HA_STATUS_AUTO) && table->found_next_number_field) { + THD *thd = ha_thd(); + ulonglong nb_reserved_values; + bool next_number_field_is_null = !table->next_number_field; + mrn::ExternalLock mrn_external_lock(ha_thd(), this, + mrn_lock_type == F_UNLCK ? + F_RDLCK : F_UNLCK); + if (mrn_external_lock.error()) { + DBUG_RETURN(mrn_external_lock.error()); + } + if (next_number_field_is_null) { + table->next_number_field = table->found_next_number_field; + } + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + unsigned long auto_increment_offset, auto_increment_increment; + MRN_THD_GET_AUTOINC(thd, &auto_increment_offset, + &auto_increment_increment); + storage_get_auto_increment(auto_increment_offset, + auto_increment_increment, 1, + &stats.auto_increment_value, + &nb_reserved_values); + } + if (next_number_field_is_null) { + table->next_number_field = NULL; + } + } + + if (flag & HA_STATUS_CONST) { + storage_set_keys_in_use(); + } + + if (flag & HA_STATUS_VARIABLE) { + storage_info_variable(); + } + + DBUG_RETURN(0); +} + +void ha_mroonga::storage_info_variable() +{ + MRN_DBUG_ENTER_METHOD(); + + storage_info_variable_records(); + storage_info_variable_data_file_length(); + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_info_variable_records() +{ + MRN_DBUG_ENTER_METHOD(); + + stats.records = grn_table_size(ctx, grn_table); + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_info_variable_data_file_length() +{ + MRN_DBUG_ENTER_METHOD(); + + stats.data_file_length = 0; + stats.data_file_length += file_size(grn_obj_path(ctx, grn_table)); + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY); + grn_table_columns(ctx, grn_table, NULL, 0, (grn_obj *)columns); + /* grn_id id __attribute__((unused)); */ + grn_id *column_id; + GRN_HASH_EACH(ctx, columns, id, &column_id, NULL, NULL, { + grn_obj *column = grn_ctx_at(ctx, *column_id); + stats.data_file_length += file_size(grn_obj_path(ctx, column)); + grn_obj_unlink(ctx, column); + }); + grn_hash_close(ctx, columns); + + DBUG_VOID_RETURN; +} + +int ha_mroonga::info(uint flag) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_info(flag); + } else { + error = storage_info(flag); + } + DBUG_RETURN(error); +} + +uint ha_mroonga::wrapper_lock_count() const +{ + uint lock_count; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + lock_count = wrap_handler->lock_count(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(lock_count); +} + +uint ha_mroonga::storage_lock_count() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(1); +} + +uint ha_mroonga::lock_count() const +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_lock_count(); + } else { + error = storage_lock_count(); + } + DBUG_RETURN(error); +} + +THR_LOCK_DATA **ha_mroonga::wrapper_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + to = wrap_handler->store_lock(thd, to, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(to); +} + +THR_LOCK_DATA **ha_mroonga::storage_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + if (lock_type != TL_IGNORE && thr_lock_data.type == TL_UNLOCK) { + if (!thd_in_lock_tables(thd)) { + if (lock_type == TL_READ_NO_INSERT) { + lock_type = TL_READ; + } else if (lock_type >= TL_WRITE_CONCURRENT_INSERT && + lock_type <= TL_WRITE && !thd_tablespace_op(thd)) { + lock_type = TL_WRITE_ALLOW_WRITE; + } + } + + thr_lock_data.type = lock_type; + } + *to++ = &thr_lock_data; + DBUG_RETURN(to); +} + +THR_LOCK_DATA **ha_mroonga::store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: lock_type=%s", + mrn_inspect_thr_lock_type(lock_type))); + if (share->wrapper_mode) + to = wrapper_store_lock(thd, to, lock_type); + else + to = storage_store_lock(thd, to, lock_type); + DBUG_RETURN(to); +} + +int ha_mroonga::wrapper_external_lock(THD *thd, int lock_type) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_external_lock(thd, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_external_lock(THD *thd, int lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::external_lock(THD *thd, int lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn_lock_type = lock_type; + if (share->wrapper_mode) + { + error = wrapper_external_lock(thd, lock_type); + } else { + error = storage_external_lock(thd, lock_type); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_init(bool scan) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_rnd_init(scan); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_init(bool scan) +{ + MRN_DBUG_ENTER_METHOD(); + mrn_change_encoding(ctx, NULL); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, 0, -1, 0); + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_init(bool scan) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_init(scan); + } else { + error = storage_rnd_init(scan); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_end() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_rnd_end(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_end() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_end() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_end(); + } else { + error = storage_rnd_end(); + } + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR +int ha_mroonga::wrapper_records(ha_rows *num_rows) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_records(num_rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_records(ha_rows *num_rows) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::records(num_rows); + DBUG_RETURN(error); +} + +int ha_mroonga::records(ha_rows *num_rows) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) { + error = wrapper_records(num_rows); + } else { + error = storage_records(num_rows); + } + DBUG_RETURN(error); +} +#else +ha_rows ha_mroonga::wrapper_records() +{ + ha_rows num_rows; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + num_rows = wrap_handler->records(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(num_rows); +} + +ha_rows ha_mroonga::storage_records() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows num_rows = handler::records(); + DBUG_RETURN(num_rows); +} + +ha_rows ha_mroonga::records() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows num_rows; + if (share->wrapper_mode) { + num_rows = wrapper_records(); + } else { + num_rows = storage_records(); + } + DBUG_RETURN(num_rows); +} +#endif + +int ha_mroonga::wrapper_rnd_next(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_RND_NEXT + error = wrap_handler->ha_rnd_next(buf); +#else + error = wrap_handler->rnd_next(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::rnd_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_next(buf); + } else { + error = storage_rnd_next(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_pos(uchar *buf, uchar *pos) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_HA_RND_POS + error = wrap_handler->ha_rnd_pos(buf, pos); +#else + error = wrap_handler->rnd_pos(buf, pos); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_pos(uchar *buf, uchar *pos) +{ + MRN_DBUG_ENTER_METHOD(); + record_id = *((grn_id*) pos); + storage_store_fields(buf, record_id); + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_pos(uchar *buf, uchar *pos) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_pos(buf, pos); + } else { + error = storage_rnd_pos(buf, pos); + } + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->ref = ref; + wrap_handler->position(record); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + memcpy(ref, &record_id, sizeof(grn_id)); + DBUG_VOID_RETURN; +} + +void ha_mroonga::position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + wrapper_position(record); + else + storage_position(record); + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_extra(enum ha_extra_function operation) +{ + MRN_DBUG_ENTER_METHOD(); + switch (operation) { + case HA_EXTRA_IGNORE_DUP_KEY: + ignoring_duplicated_key = true; + break; + case HA_EXTRA_NO_IGNORE_DUP_KEY: + ignoring_duplicated_key = false; + break; + case HA_EXTRA_WRITE_CAN_REPLACE: + replacing_ = true; + break; + case HA_EXTRA_WRITE_CANNOT_REPLACE: + replacing_ = false; + break; + case HA_EXTRA_INSERT_WITH_UPDATE: + inserting_with_update = true; + break; + case HA_EXTRA_KEYREAD: + ignoring_no_key_columns = true; + break; + case HA_EXTRA_NO_KEYREAD: + ignoring_no_key_columns = false; + break; + default: + break; + } + DBUG_RETURN(0); +} + +int ha_mroonga::wrapper_extra(enum ha_extra_function operation) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->extra(operation); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_extra(enum ha_extra_function operation) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::extra(enum ha_extra_function operation) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", + ("mroonga: this=%p; extra-operation=%s", + this, mrn_inspect_extra_function(operation))); + if (share->wrapper_mode) { + if ((error = wrapper_extra(operation))) + DBUG_RETURN(error); + } else { + if ((error = storage_extra(operation))) + DBUG_RETURN(error); + } + error = generic_extra(operation); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_extra_opt(enum ha_extra_function operation, + ulong cache_size) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->extra_opt(operation, cache_size); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_extra_opt(enum ha_extra_function operation, + ulong cache_size) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::extra_opt(enum ha_extra_function operation, ulong cache_size) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + if ((error = wrapper_extra_opt(operation, cache_size))) + DBUG_RETURN(error); + } else { + if ((error = storage_extra_opt(operation, cache_size))) + DBUG_RETURN(error); + } + error = generic_extra(operation); + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_target_index(KEY *key_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool target_index = + (key_info->algorithm == HA_KEY_ALG_FULLTEXT) || mrn_is_geo_key(key_info); + DBUG_PRINT("info", ("mroonga: %s", target_index ? "true" : "false")); + DBUG_RETURN(target_index); +} + +bool ha_mroonga::wrapper_have_target_index() +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_target_index = false; + + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (wrapper_is_target_index(key_info)) { + have_target_index = true; + break; + } + } + + DBUG_PRINT("info", ("mroonga: %s", have_target_index ? "true" : "false")); + DBUG_RETURN(have_target_index); +} + +int ha_mroonga::wrapper_write_row(const uchar *buf) +{ + int error = 0; + THD *thd = ha_thd(); + + MRN_DBUG_ENTER_METHOD(); + + mrn::Operation operation(operations_, + "write", + table->s->table_name.str, + table->s->table_name.length); + + operation.record_target(record_id); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_write_row(buf); + insert_id_for_cur_row = wrap_handler->insert_id_for_cur_row; + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_write_row_index(buf); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_write_row_index(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + GRN_BULK_REWIND(&key_buffer); + grn_bulk_space(ctx, &key_buffer, table->key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + buf, + &(table->key_info[table_share->primary_key]), + table->key_info[table_share->primary_key].key_length); + + int added; + grn_id record_id; + record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + GRN_TEXT_LEN(&key_buffer), + &added); + if (record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: failed to add a new record into groonga")); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to add a new record into groonga: key=<%.*s>", + (int)GRN_TEXT_LEN(&key_buffer), + GRN_TEXT_VALUE(&key_buffer)); + error = ER_ERROR_ON_WRITE; + push_warning(ha_thd(), MRN_SEVERITY_WARNING, error, + error_message); + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { + Field *field = key_info->key_part[j].field; + + if (field->is_null()) + continue; + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + goto err; + error = generic_store_bulk(field, &new_value_buffer); + if (error) { + my_message(error, + "mroonga: wrapper: " + "failed to get new value for updating index.", + MYF(0)); + goto err; + } + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, j + 1, + NULL, &new_value_buffer); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row(const 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__)); + DBUG_RETURN(error); + } + + mrn::Operation operation(operations_, + "write", + table->s->table_name.str, + table->s->table_name.length); + + THD *thd = ha_thd(); + int i; + int n_columns = table->s->fields; + + if (table->next_number_field && buf == table->record[0]) + { + if ((error = update_auto_increment())) + DBUG_RETURN(error); + } + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + if (field->is_null()) continue; + + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { + 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)); + if (MRN_ABORT_ON_WARNING(thd)) { + DBUG_RETURN(ER_DATA_TOO_LONG); + } + } + } + + uint pkey_nr = table->s->primary_key; + + int added = 0; + { + mrn::Lock lock(&(share->record_mutex), have_unique_index()); + if ((error = storage_write_row_unique_indexes(buf))) + { + DBUG_RETURN(error); + } + unique_indexes_are_processed = true; + + char *pkey; + int pkey_size; + GRN_BULK_REWIND(&key_buffer); + if (pkey_nr == MAX_INDEXES) { + pkey = NULL; + pkey_size = 0; + } else { + KEY *key_info = &(table->key_info[pkey_nr]); + if (KEY_N_KEY_PARTS(key_info) == 1) { + Field *pkey_field = key_info->key_part[0].field; + error = mrn_change_encoding(ctx, pkey_field->charset()); + if (error) { + DBUG_RETURN(error); + } + generic_store_bulk(pkey_field, &key_buffer); + pkey = GRN_TEXT_VALUE(&key_buffer); + pkey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, buf, key_info, key_info->key_length); + grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE); + pkey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(key_info, + key, key_info->key_length, + (uchar *)pkey, (uint *)&pkey_size); + } + } + + 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); + } + + record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if (!added) { + // duplicated error + error = HA_ERR_FOUND_DUPP_KEY; + memcpy(dup_ref, &record_id, sizeof(grn_id)); + dup_key = pkey_nr; + if (!ignoring_duplicated_key) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "duplicated id on insert: update primary key: <%.*s>", + pkey_size, pkey); + } + 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]); + } + } + DBUG_RETURN(error); + } + operation.record_target(record_id); + } + + grn_obj colbuf; + GRN_VOID_INIT(&colbuf); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + + if (field->is_null()) + continue; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + mrn::ColumnName column_name(field->field_name); + +#ifdef MRN_HAVE_SPATIAL + bool is_null_geometry_value = + field->real_type() == MYSQL_TYPE_GEOMETRY && + static_cast(field)->get_length() == 0; + if (is_null_geometry_value) { + continue; + } +#endif + + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { + continue; + } + + error = mrn_change_encoding(ctx, field->charset()); + if (error) { + GRN_OBJ_FIN(ctx, &colbuf); + goto err; + } + error = generic_store_bulk(field, &colbuf); + if (error) { + GRN_OBJ_FIN(ctx, &colbuf); + goto err; + } + + grn_obj *column = grn_columns[i]; + if (is_foreign_key_field(table->s->table_name.str, field->field_name.str)) { + grn_obj value; + GRN_RECORD_INIT(&value, 0, grn_obj_get_range(ctx, column)); + grn_rc cast_rc = grn_obj_cast(ctx, &colbuf, &value, GRN_FALSE); + if (cast_rc != GRN_SUCCESS) { + grn_obj inspected; + GRN_TEXT_INIT(&inspected, 0); + grn_inspect(ctx, &inspected, &colbuf); + error = HA_ERR_NO_REFERENCED_ROW; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "foreign record doesn't exist: <%s>:<%.*s>", + field->field_name.str, + static_cast(GRN_TEXT_LEN(&inspected)), + GRN_TEXT_VALUE(&inspected)); + GRN_OBJ_FIN(ctx, &value); + GRN_OBJ_FIN(ctx, &colbuf); + GRN_OBJ_FIN(ctx, &inspected); + goto err; + } + grn_obj_set_value(ctx, column, record_id, &value, GRN_OBJ_SET); + } else { + if (added && is_grn_zero_column_value(column, &colbuf)) { + // WORKAROUND: groonga can't index newly added '0' value for + // fix size column. So we add non-'0' value first then add + // real '0' value again. It will be removed when groonga + // supports 'null' value. + char *bytes = GRN_BULK_HEAD(&colbuf); + bytes[0] = '\1'; + grn_obj_set_value(ctx, column, record_id, &colbuf, GRN_OBJ_SET); + bytes[0] = '\0'; + } + grn_obj_set_value(ctx, column, record_id, &colbuf, GRN_OBJ_SET); + } + if (ctx->rc) { + GRN_OBJ_FIN(ctx, &colbuf); + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + error = ER_ERROR_ON_WRITE; + goto err; + } + } + GRN_OBJ_FIN(ctx, &colbuf); + + error = storage_write_row_multiple_column_indexes(buf, record_id); + if (error) { + goto err; + } + + // for UDF last_insert_grn_id() + st_mrn_slot_data *slot_data; + slot_data = mrn_get_slot_data(thd, true); + if (slot_data == NULL) { + error = HA_ERR_OUT_OF_MEM; + goto err; + } + slot_data->last_insert_record_id = record_id; + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + if (table->found_next_number_field && + !table->s->next_number_keypart) { + Field_num *field = (Field_num *) table->found_next_number_field; + if (field->unsigned_flag || field->val_int() > 0) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + ulonglong nr = (ulonglong) field->val_int(); + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + if (long_term_share->auto_inc_value <= nr) { + long_term_share->auto_inc_value = nr + 1; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + } + } + } + DBUG_RETURN(0); + +err: + 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); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_multiple_column_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_column) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + mrn_change_encoding(ctx, NULL); + GRN_BULK_REWIND(&key_buffer); + grn_bulk_space(ctx, &key_buffer, key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + buf, + key_info, + key_info->key_length); + GRN_BULK_REWIND(&encoded_key_buffer); + grn_bulk_reserve(ctx, &encoded_key_buffer, MRN_MAX_KEY_SIZE); + uint encoded_key_length; + storage_encode_multiple_column_key(key_info, + (uchar *)(GRN_TEXT_VALUE(&key_buffer)), + key_info->key_length, + (uchar *)(GRN_TEXT_VALUE(&encoded_key_buffer)), + &encoded_key_length); + grn_bulk_space(ctx, &encoded_key_buffer, encoded_key_length); + DBUG_PRINT("info", ("mroonga: key_length=%u", key_info->key_length)); + DBUG_PRINT("info", ("mroonga: encoded_key_length=%u", encoded_key_length)); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, NULL, + &encoded_key_buffer); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_multiple_column_indexes(const uchar *buf, + grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + + if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + continue; + } + + if ((error = storage_write_row_multiple_column_index(buf, + record_id, + key_info, + index_column))) + { + goto err; + } + } + +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_unique_index(const uchar *buf, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *key_id) +{ + char *ukey = NULL; + int error, ukey_size = 0; + MRN_DBUG_ENTER_METHOD(); + GRN_BULK_REWIND(&key_buffer); + if (KEY_N_KEY_PARTS(key_info) == 1) { + Field *ukey_field = key_info->key_part[0].field; + error = mrn_change_encoding(ctx, ukey_field->charset()); + if (error) { + DBUG_RETURN(error); + } + generic_store_bulk(ukey_field, &key_buffer); + ukey = GRN_TEXT_VALUE(&key_buffer); + ukey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, buf, key_info, key_info->key_length); + grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE); + ukey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(key_info, + key, key_info->key_length, + (uchar *)(ukey), (uint *)&ukey_size); + } + + int added; + *key_id = grn_table_add(ctx, index_table, ukey, ukey_size, &added); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if (!added) { + // duplicated error + error = HA_ERR_FOUND_DUPP_KEY; + 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>", + ukey_size, ukey); + } + DBUG_RETURN(error); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_write_row_unique_indexes(const uchar *buf) +{ + int error = 0; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + continue; + } + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + continue; + } + + if ((error = storage_write_row_unique_index(buf, key_info, + index_table, index_column, + &key_id[i]))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + dup_key = i; + } + goto err; + } + } + DBUG_RETURN(0); + +err: + if (i) { + mrn_change_encoding(ctx, NULL); + do { + i--; + + 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]); + } + } while (i); + } + DBUG_RETURN(error); +} + +int ha_mroonga::write_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_write_row(buf); + } else { + error = storage_write_row(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_get_record_id(uchar *data, grn_id *record_id, + const char *context) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_obj key; + GRN_TEXT_INIT(&key, 0); + + mrn_change_encoding(ctx, NULL); + grn_bulk_space(ctx, &key, table->key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), + data, + &(table->key_info[table_share->primary_key]), + table->key_info[table_share->primary_key].key_length); + + *record_id = grn_table_get(ctx, grn_table, + GRN_TEXT_VALUE(&key), GRN_TEXT_LEN(&key)); + if (*record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: %s", context)); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "%s: key=<%.*s>", + context, (int)GRN_TEXT_LEN(&key), GRN_TEXT_VALUE(&key)); + error = ER_ERROR_ON_WRITE; + push_warning(ha_thd(), MRN_SEVERITY_WARNING, error, + error_message); + } + grn_obj_unlink(ctx, &key); + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_update_row(const uchar *old_data, + const uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + THD *thd = ha_thd(); + + mrn::Operation operation(operations_, + "update", + table->s->table_name.str, + table->s->table_name.length); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_update_row(old_data, new_data); + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_update_row_index(old_data, new_data); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_update_row_index(const uchar *old_data, + const uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + KEY *key_info = &(table->key_info[table_share->primary_key]); + GRN_BULK_REWIND(&key_buffer); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + new_data, + key_info, key_info->key_length); + int added; + grn_id new_record_id; + new_record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + table->key_info->key_length, + &added); + if (new_record_id == GRN_ID_NIL) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to get new record ID for updating from groonga: key=<%.*s>", + (int)GRN_TEXT_LEN(&key_buffer), GRN_TEXT_VALUE(&key_buffer)); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + + grn_id old_record_id; + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]); + + error = wrapper_get_record_id((uchar *)old_data, &old_record_id, + "failed to get old record ID " + "for updating from groonga"); + if (error) { + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { + Field *field = key_info->key_part[j].field; + + generic_store_bulk(field, &new_value_buffer); + + field->move_field_offset(ptr_diff); + generic_store_bulk(field, &old_value_buffer); + field->move_field_offset(-ptr_diff); + + grn_rc rc; + if (old_record_id == new_record_id) { + if (added) { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, NULL); + if (!rc) { + rc = grn_column_index_update(ctx, index_column, new_record_id, j + 1, + NULL, &new_value_buffer); + } + } else { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, &new_value_buffer); + } + } else { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, NULL); + if (!rc) { + rc = grn_column_index_update(ctx, index_column, new_record_id, j + 1, + NULL, &new_value_buffer); + } + if (!rc) { + rc = grn_table_delete_by_id(ctx, grn_table, old_record_id); + } + } + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row(const uchar *old_data, + const uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn::Operation operation(operations_, + "update", + table->s->table_name.str, + table->s->table_name.length); + operation.record_target(record_id); + + grn_obj colbuf; + int i; + uint j; + int n_columns = table->s->fields; + THD *thd = ha_thd(); + + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + if (!bitmap_is_set(table->write_set, field->field_index)) + continue; + + if (field->is_null()) + continue; + + { + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { + 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)); + if (MRN_ABORT_ON_WARNING(thd)) { + DBUG_RETURN(ER_DATA_TOO_LONG); + } + } + } + + if (!is_foreign_key_field(table->s->table_name.str, field->field_name.str)) + continue; + + { + grn_obj *column = grn_columns[i]; + grn_obj new_value; + GRN_VOID_INIT(&new_value); + { + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + generic_store_bulk(field, &new_value); + } + grn_obj casted_value; + GRN_RECORD_INIT(&casted_value, 0, grn_obj_get_range(ctx, column)); + grn_rc cast_rc = grn_obj_cast(ctx, &new_value, &casted_value, GRN_FALSE); + GRN_OBJ_FIN(ctx, &casted_value); + if (cast_rc != GRN_SUCCESS) { + grn_obj inspected; + GRN_TEXT_INIT(&inspected, 0); + grn_inspect(ctx, &inspected, &new_value); + GRN_OBJ_FIN(ctx, &new_value); + error = HA_ERR_NO_REFERENCED_ROW; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "foreign record doesn't exist: <%s>:<%.*s>", + field->field_name.str, + static_cast(GRN_TEXT_LEN(&inspected)), + GRN_TEXT_VALUE(&inspected)); + GRN_OBJ_FIN(ctx, &inspected); + DBUG_RETURN(error); + } + GRN_OBJ_FIN(ctx, &new_value); + } + } + + KEY *pkey_info = NULL; + storage_store_fields_for_prep_update(old_data, new_data, record_id); + { + mrn::Lock lock(&(share->record_mutex), have_unique_index()); + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + if ((error = storage_prepare_delete_row_unique_indexes(old_data, + record_id))) { + DBUG_RETURN(error); + } + if ((error = storage_update_row_unique_indexes(new_data))) + { + DBUG_RETURN(error); + } + } + + if (table->s->primary_key != MAX_INDEXES) { + pkey_info = &(table->key_info[table->s->primary_key]); + } + GRN_VOID_INIT(&colbuf); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + if (bitmap_is_set(table->write_set, field->field_index)) { + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + DBUG_PRINT("info", ("mroonga: update column %d(%d)",i,field->field_index)); + + if (field->is_null()) continue; + + mrn::ColumnName column_name(field->field_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name.c_str()) == 0) { + continue; + } + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + goto err; + + bool is_pkey = false; + bool on_duplicate_key_update = + (inserting_with_update && ignoring_duplicated_key); + if (pkey_info && !on_duplicate_key_update) { + for (j = 0; j < KEY_N_KEY_PARTS(pkey_info); j++) { + Field *pkey_field = pkey_info->key_part[j].field; + if (strcmp(pkey_field->field_name.str, column_name.c_str()) == 0) { + is_pkey = true; + break; + } + } + } + + generic_store_bulk(field, &colbuf); + if (is_pkey) { + bool is_multiple_column_index = KEY_N_KEY_PARTS(pkey_info) > 1; + bool is_same_value; + if (is_multiple_column_index) { + is_same_value = false; + } else { + grn_id found_record_id = grn_table_get(ctx, + grn_table, + GRN_BULK_HEAD(&colbuf), + GRN_BULK_VSIZE(&colbuf)); + is_same_value = (record_id == found_record_id); + } + if (!is_same_value && !replacing_) { + char message[MRN_BUFFER_SIZE]; + snprintf(message, MRN_BUFFER_SIZE, + "data truncated for primary key column: <%s>", + column_name.c_str()); + push_warning(thd, MRN_SEVERITY_WARNING, + WARN_DATA_TRUNCATED, message); + } + continue; + } + + grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); + if (ctx->rc) { + grn_obj_unlink(ctx, &colbuf); + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + error = ER_ERROR_ON_WRITE; + goto err; + } + } + } + grn_obj_unlink(ctx, &colbuf); + + if ((error = storage_update_row_index(old_data, new_data))) + { + goto err; + } + + if ((error = storage_delete_row_unique_indexes())) + { + DBUG_RETURN(error); + } + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + if (table->found_next_number_field && + !table->s->next_number_keypart && + new_data == table->record[0]) { + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + Field_num *field = (Field_num *) table->found_next_number_field; + if (field->unsigned_flag || field->val_int() > 0) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + ulonglong nr = (ulonglong) field->val_int(); + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + if (long_term_share->auto_inc_value <= nr) { + long_term_share->auto_inc_value = nr + 1; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + } + } + } + DBUG_RETURN(0); + +err: + for (j = 0; j < table->s->keys; j++) { + if (j == table->s->primary_key) { + continue; + } + KEY *key_info = &table->key_info[j]; + if ((key_info->flags & HA_NOSAME) && key_id[j] != GRN_ID_NIL) { + grn_table_delete_by_id(ctx, grn_index_tables[j], key_id[j]); + } + } + + if (!error && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = 0; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = false; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row_index(const uchar *old_data, + const uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + grn_obj old_key, old_encoded_key, new_key, new_encoded_key; + GRN_TEXT_INIT(&old_key, 0); + GRN_TEXT_INIT(&old_encoded_key, 0); + GRN_TEXT_INIT(&new_key, 0); + GRN_TEXT_INIT(&new_encoded_key, 0); + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + mrn_change_encoding(ctx, NULL); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + + if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + GRN_BULK_REWIND(&old_key); + grn_bulk_space(ctx, &old_key, key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&old_key)), + (uchar *)old_data, + key_info, + key_info->key_length); + GRN_BULK_REWIND(&old_encoded_key); + grn_bulk_reserve(ctx, &old_encoded_key, MRN_MAX_KEY_SIZE); + uint old_encoded_key_length; + storage_encode_multiple_column_key(key_info, + (uchar *)(GRN_TEXT_VALUE(&old_key)), + key_info->key_length, + (uchar *)(GRN_TEXT_VALUE(&old_encoded_key)), + &old_encoded_key_length); + grn_bulk_space(ctx, &old_encoded_key, old_encoded_key_length); + + GRN_BULK_REWIND(&new_key); + grn_bulk_space(ctx, &new_key, key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&new_key)), + (uchar *)new_data, + key_info, + key_info->key_length); + GRN_BULK_REWIND(&new_encoded_key); + grn_bulk_reserve(ctx, &new_encoded_key, MRN_MAX_KEY_SIZE); + uint new_encoded_key_length; + storage_encode_multiple_column_key(key_info, + (uchar *)(GRN_TEXT_VALUE(&new_key)), + key_info->key_length, + (uchar *)(GRN_TEXT_VALUE(&new_encoded_key)), + &new_encoded_key_length); + grn_bulk_space(ctx, &new_encoded_key, new_encoded_key_length); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, + &old_encoded_key, &new_encoded_key); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + grn_obj_unlink(ctx, &old_key); + grn_obj_unlink(ctx, &old_encoded_key); + grn_obj_unlink(ctx, &new_key); + grn_obj_unlink(ctx, &new_encoded_key); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row_unique_indexes(const uchar *new_data) +{ + int error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + + 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, + key_info->key_part[0].field->field_index) + ) { + /* no change */ + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + + if ((error = storage_write_row_unique_index(new_data, key_info, + index_table, index_column, + &key_id[i]))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + if (key_id[i] == del_key_id[i]) { + /* no change */ + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + dup_key = i; + DBUG_PRINT("info", ("mroonga: different key ID: %d record ID: %d,%d", + i, key_id[i], del_key_id[i])); + } + goto err; + } + } + DBUG_RETURN(0); + +err: + if (i) { + mrn_change_encoding(ctx, NULL); + do { + i--; + KEY *key_info = &table->key_info[i]; + if ((key_info->flags & HA_NOSAME) && key_id[i] != GRN_ID_NIL) { + grn_table_delete_by_id(ctx, grn_index_tables[i], key_id[i]); + } + } while (i); + } + DBUG_RETURN(error); +} + +int ha_mroonga::update_row(const uchar *old_data, const uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_update_row(old_data, new_data); + } else { + error = storage_update_row(old_data, new_data); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + THD *thd= ha_thd(); + + mrn::Operation operation(operations_, + "delete", + table->s->table_name.str, + table->s->table_name.length); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_delete_row(buf); + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_delete_row_index(buf); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_row_index(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + grn_id record_id; + error = wrapper_get_record_id((uchar *)buf, &record_id, + "failed to get record ID " + "for deleting from groonga"); + if (error) { + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { + Field *field = key_info->key_part[j].field; + + if (field->is_null()) + continue; + + generic_store_bulk(field, &old_value_buffer); + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, j + 1, + &old_value_buffer, NULL); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + grn_table_delete_by_id(ctx, grn_table, record_id); + if (ctx->rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(0); + } + + mrn::Operation operation(operations_, + "delete", + table->s->table_name.str, + table->s->table_name.length); + operation.record_target(record_id); + + { + grn_id referencing_child_table_id = GRN_ID_NIL; + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY|GRN_HASH_TINY); + grn_table_columns(ctx, grn_table, "", 0, + reinterpret_cast(columns)); + GRN_HASH_EACH_BEGIN(ctx, columns, cursor, id) { + void *key; + grn_hash_cursor_get_key(ctx, cursor, &key); + grn_id column_id = *static_cast(key); + grn_obj *column = grn_ctx_at(ctx, column_id); + if (!column) + continue; + + if (column->header.type != GRN_COLUMN_INDEX) + continue; + + grn_ii_cursor *ii_cursor = + grn_ii_cursor_open(ctx, + reinterpret_cast(column), + record_id, + GRN_ID_NIL, + GRN_ID_MAX, + 0, + 0); + if (!ii_cursor) + continue; + + if (grn_ii_cursor_next(ctx, ii_cursor)) { + referencing_child_table_id = grn_obj_get_range(ctx, column); + } + + grn_ii_cursor_close(ctx, ii_cursor); + + if (referencing_child_table_id != GRN_ID_NIL) + break; + } GRN_HASH_EACH_END(ctx, cursor); + grn_hash_close(ctx, columns); + + if (referencing_child_table_id != GRN_ID_NIL) { + grn_obj *referencing_child_table = + grn_ctx_at(ctx, referencing_child_table_id); + char name[GRN_TABLE_MAX_KEY_SIZE]; + int name_size; + name_size = grn_obj_name(ctx, + referencing_child_table, + name, + GRN_TABLE_MAX_KEY_SIZE); + error = HA_ERR_ROW_IS_REFERENCED; + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, + "one or more child rows exist in <%.*s>", + name_size, + name); + DBUG_RETURN(error); + } + } + + storage_store_fields_for_prep_update(buf, NULL, record_id); + { + mrn::Lock lock(&(share->record_mutex), have_unique_index()); + if ((error = storage_prepare_delete_row_unique_indexes(buf, record_id))) { + DBUG_RETURN(error); + } + mrn_change_encoding(ctx, NULL); + grn_table_delete_by_id(ctx, grn_table, record_id); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if ( + (error = storage_delete_row_index(buf)) || + (error = storage_delete_row_unique_indexes()) + ) { + DBUG_RETURN(error); + } + } + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + DBUG_RETURN(0); +} + +int ha_mroonga::storage_delete_row_index(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + grn_obj key, encoded_key; + GRN_TEXT_INIT(&key, 0); + GRN_TEXT_INIT(&encoded_key, 0); + + mrn::DebugColumnAccess debug_column_access(table, &table->read_set); + uint i; + uint n_keys = table->s->keys; + mrn_change_encoding(ctx, NULL); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + + if (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + GRN_BULK_REWIND(&key); + grn_bulk_space(ctx, &key, key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), + (uchar *)buf, + key_info, + key_info->key_length); + GRN_BULK_REWIND(&encoded_key); + grn_bulk_reserve(ctx, &encoded_key, MRN_MAX_KEY_SIZE); + uint encoded_key_length; + storage_encode_multiple_column_key(key_info, + (uchar *)(GRN_TEXT_VALUE(&key)), + key_info->key_length, + (uchar *)(GRN_TEXT_VALUE(&encoded_key)), + &encoded_key_length); + grn_bulk_space(ctx, &encoded_key, encoded_key_length); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, + &encoded_key, NULL); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + grn_obj_unlink(ctx, &encoded_key); + grn_obj_unlink(ctx, &key); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_row_unique_index(grn_obj *index_table, + grn_id del_key_id) +{ + MRN_DBUG_ENTER_METHOD(); + grn_rc rc = grn_table_delete_by_id(ctx, index_table, del_key_id); + if (rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_delete_row_unique_indexes() +{ + int error = 0, tmp_error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if ((!(key_info->flags & HA_NOSAME)) || del_key_id[i] == GRN_ID_NIL) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if ((tmp_error = storage_delete_row_unique_index(index_table, + del_key_id[i]))) + { + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_prepare_delete_row_unique_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *del_key_id) +{ + const void *ukey = NULL; + uint32 ukey_size = 0; + MRN_DBUG_ENTER_METHOD(); + if (KEY_N_KEY_PARTS(key_info) == 1) { + GRN_BULK_REWIND(&key_buffer); + grn_obj_get_value(ctx, index_column, record_id, &key_buffer); + ukey = GRN_TEXT_VALUE(&key_buffer); + ukey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, (uchar *) buf, key_info, key_info->key_length); + grn_bulk_reserve(ctx, &key_buffer, MRN_MAX_KEY_SIZE); + ukey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(key_info, + key, key_info->key_length, + (uchar *)ukey, (uint *)&ukey_size); + } + *del_key_id = grn_table_get(ctx, index_table, ukey, ukey_size); + DBUG_RETURN(0); +} + +int ha_mroonga::storage_prepare_delete_row_unique_indexes(const uchar *buf, + grn_id record_id) +{ + int error = 0, tmp_error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + del_key_id[i] = GRN_ID_NIL; + continue; + } + + grn_obj *index_column; + if (KEY_N_KEY_PARTS(key_info) == 1) { + Field *field = key_info->key_part[0].field; + mrn_change_encoding(ctx, field->charset()); + index_column = grn_columns[field->field_index]; + } else { + mrn_change_encoding(ctx, NULL); + index_column = grn_index_columns[i]; + } + if ((tmp_error = storage_prepare_delete_row_unique_index(buf, record_id, + key_info, + index_table, + index_column, + &del_key_id[i]))) + { + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_delete_row(buf); + } else { + error = storage_delete_row(buf); + } + DBUG_RETURN(error); +} + +uint ha_mroonga::wrapper_max_supported_key_parts() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(MAX_REF_PARTS); +} + +uint ha_mroonga::storage_max_supported_key_parts() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(MAX_REF_PARTS); +} + +uint ha_mroonga::max_supported_key_parts() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint parts; + 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); +} + +ha_rows ha_mroonga::wrapper_records_in_range(uint key_nr, + const key_range *range_min, + const key_range *range_max, + page_range *pages) +{ + ha_rows row_count; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->s->key_info[key_nr]); + if (mrn_is_geo_key(key_info)) { + row_count = generic_records_in_range_geo(key_nr, range_min, range_max); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + row_count = wrap_handler->records_in_range(key_nr, range_min, range_max, + pages); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::storage_records_in_range(uint key_nr, + const key_range *range_min, + const key_range *range_max, + page_range *pages) +{ + MRN_DBUG_ENTER_METHOD(); + int flags = 0; + uint size_min = 0, size_max = 0; + ha_rows row_count = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + uchar key_max_entity[MRN_MAX_KEY_SIZE]; + KEY *key_info = &(table->s->key_info[key_nr]); + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + if (range_min && range_max && + range_min->length == range_max->length && + memcmp(range_min->key, range_max->key, range_min->length) == 0) { + flags |= GRN_CURSOR_PREFIX; + key_min = key_min_entity; + storage_encode_multiple_column_key(key_info, + range_min->key, range_min->length, + key_min, &size_min); + } else { + key_min = key_min_entity; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + range_min, range_max, + key_min, &size_min, + key_max, &size_max); + } + } else if (mrn_is_geo_key(key_info)) { + mrn_change_encoding(ctx, key_info->key_part->field->charset()); + row_count = generic_records_in_range_geo(key_nr, range_min, range_max); + DBUG_RETURN(row_count); + } else { + Field *field = key_info->key_part[0].field; + const char *column_name = field->field_name.str; + mrn_change_encoding(ctx, field->charset()); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + DBUG_RETURN((ha_rows)1); + } + + if (range_min) { + key_min = key_min_entity; + storage_encode_key(field, range_min->key, key_min, &size_min); + if (size_min == 0) { + DBUG_RETURN(HA_POS_ERROR); + } + } + if (range_max) { + key_max = key_max_entity; + storage_encode_key(field, range_max->key, key_max, &size_max); + if (size_max == 0) { + DBUG_RETURN(HA_POS_ERROR); + } + } + } + + if (range_min) { + DBUG_PRINT("info", ("mroonga: range_min->flag=%u", range_min->flag)); + if (range_min->flag == HA_READ_AFTER_KEY) { + flags |= GRN_CURSOR_GT; + } + } + if (range_max) { + DBUG_PRINT("info", ("mroonga: range_min->flag=%u", range_max->flag)); + if (range_max->flag == HA_READ_BEFORE_KEY) { + flags |= GRN_CURSOR_LT; + } + } + + 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")); + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, + key_max, size_max, + 0, cursor_limit, flags); + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + row_count++; + } + grn_table_cursor_close(ctx, cursor); + } else { + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, cursor_limit, flags); + grn_obj *index_column = grn_index_columns[key_nr]; + grn_ii *ii = reinterpret_cast(index_column); + row_count = grn_ii_estimate_size_for_lexicon_cursor(ctx, ii, cursor); + grn_table_cursor_close(ctx, cursor); + + unsigned int max_n_lexicon_records = + grn_table_size(ctx, grn_index_tables[key_nr]); + if (cursor_limit >= 0 && + static_cast(cursor_limit) < max_n_lexicon_records) { + row_count++; + } + } + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::generic_records_in_range_geo(uint key_nr, + const key_range *range_min, + const key_range *range_max) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows row_count; + int error; + + if (!range_min) { + DBUG_PRINT("info", + ("mroonga: range min is missing for geometry range search")); + DBUG_RETURN(HA_POS_ERROR); + } + if (range_max) { + DBUG_PRINT("info", + ("mroonga: range max is specified for geometry range search")); + DBUG_RETURN(HA_POS_ERROR); + } + error = mrn_change_encoding(ctx, + table->key_info[key_nr].key_part->field->charset()); + if (error) + DBUG_RETURN(error); + if (!(range_min->flag & HA_READ_MBR_CONTAIN)) { + push_warning_unsupported_spatial_index_search(range_min->flag); + row_count = grn_table_size(ctx, grn_table); + DBUG_RETURN(row_count); + } + + geo_store_rectangle(range_min->key); + row_count = grn_geo_estimate_in_rectangle(ctx, + grn_index_columns[key_nr], + &top_left_point, + &bottom_right_point); + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::records_in_range(uint key_nr, const key_range *range_min, + const key_range *range_max, + page_range *pages) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows row_count = 0; + if (share->wrapper_mode) + { + row_count = wrapper_records_in_range(key_nr, range_min, range_max, pages); + } else { + row_count = storage_records_in_range(key_nr, range_min, range_max, pages); + } + DBUG_PRINT("info", ("mroonga: row_count=%" MRN_HA_ROWS_FORMAT, row_count)); + DBUG_RETURN(row_count); +} + +int ha_mroonga::wrapper_index_init(uint idx, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY *key_info = &(table->s->key_info[idx]); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (!mrn_is_geo_key(key_info) && key_info->algorithm != HA_KEY_ALG_FULLTEXT) + { + error = wrap_handler->ha_index_init(share->wrap_key_nr[idx], sorted); + } else { + error = wrap_handler->ha_index_init(share->wrap_primary_key, sorted); + } + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_init(uint idx, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::index_init(uint idx, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: idx=%u", idx)); + active_index = idx; + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_init(idx, sorted); + } else { + error = storage_index_init(idx, sorted); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_end() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_index_or_rnd_end(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_end() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + clear_cursor_geo(); + DBUG_RETURN(0); +} + +int ha_mroonga::index_end() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_end(); + } else { + error = storage_index_end(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + clear_cursor_geo(); + error = generic_geo_open_cursor(key, find_flag); + if (!error) { + error = wrapper_get_next_geo_record(buf); + } + DBUG_RETURN(error); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + error = wrap_handler->ha_index_read_map(buf, key, keypart_map, find_flag); +#else + error = wrap_handler->index_read_map(buf, key, keypart_map, find_flag); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + check_count_skip(keypart_map); + + int error = 0; + + uint key_nr = active_index; + KEY *key_info = &(table->key_info[key_nr]); + int flags = 0; + uint size_min = 0, size_max = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + uchar key_max_entity[MRN_MAX_KEY_SIZE]; + + clear_cursor(); + clear_cursor_geo(); + clear_empty_value_records(); + + switch (find_flag) { + case HA_READ_BEFORE_KEY: + flags |= GRN_CURSOR_LT | GRN_CURSOR_DESCENDING; + break; + case HA_READ_PREFIX_LAST: + flags |= GRN_CURSOR_PREFIX | GRN_CURSOR_DESCENDING; + break; + case HA_READ_PREFIX_LAST_OR_PREV: + flags |= GRN_CURSOR_LE | GRN_CURSOR_DESCENDING; + break; + case HA_READ_AFTER_KEY: + flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_OR_NEXT: + flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_EXACT: + flags |= GRN_CURSOR_LE | GRN_CURSOR_GE; + break; + default: + break; + } + + 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 = + mrn_calculate_key_len(table, active_index, key, keypart_map); + DBUG_PRINT("info", + ("mroonga: multiple column index: " + "search key length=<%u>, " + "multiple column index key length=<%u>", + key_length, key_info->key_length)); + if (key_length == key_info->key_length) { + switch (find_flag) { + case HA_READ_BEFORE_KEY: + case HA_READ_PREFIX_LAST_OR_PREV: + key_max = key_max_entity; + storage_encode_multiple_column_key(key_info, + key, key_length, + key_max, &size_max); + break; + case HA_READ_PREFIX_LAST: + key_min = key_min_entity; + storage_encode_multiple_column_key(key_info, + key, key_length, + key_min, &size_min); + break; + default: + key_min = key_min_entity; + 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; + } + break; + } + } else { + const uchar *prev_key = NULL; + uint prev_key_length = 0; + if ((keypart_map >> 1) > 0) { + prev_key = key; + prev_key_length = + mrn_calculate_key_len(table, active_index, key, keypart_map >> 1); + } + switch (find_flag) { + case HA_READ_BEFORE_KEY: + if (prev_key) { + flags |= GRN_CURSOR_GE; + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + prev_key, prev_key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + } + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + NULL, 0, + key_max, &size_max, + NULL, NULL); + break; + case HA_READ_PREFIX_LAST: + key_min = key_min_entity; + storage_encode_multiple_column_key(key_info, + key, key_length, + key_min, &size_min); + break; + case HA_READ_PREFIX_LAST_OR_PREV: + if (prev_key) { + flags |= GRN_CURSOR_GE; + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + prev_key, prev_key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + } + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + key, key_length, + NULL, NULL, + key_max, &size_max); + break; + case HA_READ_AFTER_KEY: + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + key, key_length, + NULL, NULL, + key_min, &size_min); + if (prev_key) { + flags |= GRN_CURSOR_LE; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + prev_key, prev_key_length, + NULL, NULL, + key_max, &size_max); + } + break; + case HA_READ_KEY_OR_NEXT: + key_min = key_min_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + NULL, 0, + key_min, &size_min, + NULL, NULL); + if (prev_key) { + flags |= GRN_CURSOR_LE; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + NULL, 0, + prev_key, prev_key_length, + NULL, NULL, + key_max, &size_max); + } + break; + case HA_READ_KEY_EXACT: + key_min = key_min_entity; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(key_info, + key, key_length, + key, key_length, + key_min, &size_min, + key_max, &size_max); + default: + break; + } + } + } else if (mrn_is_geo_key(key_info)) { + error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); + if (error) + DBUG_RETURN(error); + error = generic_geo_open_cursor(key, find_flag); + if (!error) { + error = storage_get_next_record(buf); + } + DBUG_RETURN(error); + } else { + Field *field = key_info->key_part[0].field; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + if (find_flag == HA_READ_KEY_EXACT) { + const char *column_name = field->field_name.str; + + key_min = key_min_entity; + key_max = key_min_entity; + storage_encode_key(field, key, key_min, &size_min); + size_max = size_min; + // for _id + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + grn_id found_record_id = *((grn_id *)key_min); + if (grn_table_at(ctx, grn_table, found_record_id) != GRN_ID_NIL) { // found + storage_store_fields(buf, found_record_id); + table->status = 0; + record_id = found_record_id; + DBUG_RETURN(0); + } else { + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + } + } else if (find_flag == HA_READ_BEFORE_KEY || + find_flag == HA_READ_PREFIX_LAST_OR_PREV) { + key_max = key_max_entity; + storage_encode_key(field, key, key_max_entity, &size_max); + } else { + key_min = key_min_entity; + storage_encode_key(field, key, key_min_entity, &size_min); + } + } + + uint pkey_nr = table->s->primary_key; + if (key_nr == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, + key_max, size_max, + 0, -1, flags); + } else { + bool is_empty_value_records_search = false; + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else if (flags == 0 && size_min == 0 && size_max == 0) { + is_empty_value_records_search = true; + DBUG_PRINT("info", + ("mroonga: use table scan for searching empty value records")); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + if (is_empty_value_records_search) { + grn_obj *expression, *expression_variable; + GRN_EXPR_CREATE_FOR_QUERY(ctx, grn_table, + expression, expression_variable); + grn_obj *target_column = + grn_columns[key_info->key_part->field->field_index]; + grn_expr_append_const(ctx, expression, target_column, GRN_OP_GET_VALUE, 1); + grn_obj empty_value; + GRN_TEXT_INIT(&empty_value, 0); + grn_expr_append_obj(ctx, expression, &empty_value, GRN_OP_PUSH, 1); + grn_expr_append_op(ctx, expression, GRN_OP_EQUAL, 2); + + empty_value_records = + grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + grn_table_select(ctx, grn_table, expression, empty_value_records, + GRN_OP_OR); + grn_obj_unlink(ctx, expression); + grn_obj_unlink(ctx, &empty_value); + + empty_value_records_cursor = + grn_table_cursor_open(ctx, empty_value_records, + NULL, 0, NULL, 0, + 0, -1, flags); + } else { + index_table_cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[key_nr], + 0, GRN_ID_MAX, 0); + } + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_read_map(buf, key, keypart_map, find_flag); + } else { + error = storage_index_read_map(buf, key, keypart_map, find_flag); + } + DBUG_PRINT("info", ("mroonga: error=%d", error)); + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP +int ha_mroonga::wrapper_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +# ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_LAST_MAP + error = wrap_handler->ha_index_read_last_map(buf, key, keypart_map); +# else + error = wrap_handler->index_read_last_map(buf, key, keypart_map); +# endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + MRN_DBUG_ENTER_METHOD(); + uint key_nr = active_index; + KEY *key_info = &(table->key_info[key_nr]); + + int flags = GRN_CURSOR_DESCENDING, error; + uint size_min = 0, size_max = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + + clear_cursor(); + + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + flags |= GRN_CURSOR_PREFIX; + uint key_length = + 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, + key_min, &size_min); + } else { + Field *field = key_info->key_part[0].field; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + key_min = key_min_entity; + key_max = key_min_entity; + storage_encode_key(field, key, key_min, &size_min); + size_max = size_min; + } + + uint pkey_nr = table->s->primary_key; + if (key_nr == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, key_max, size_max, + 0, -1, flags); + } else { + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + index_table_cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[key_nr], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_read_last_map(buf, key, keypart_map); + } else { + error = storage_index_read_last_map(buf, key, keypart_map); + } + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::wrapper_index_next(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + error = wrap_handler->ha_index_next(buf); +#else + error = wrap_handler->index_next(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_next(buf); + } else { + error = storage_index_next(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_prev(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + error = wrap_handler->ha_index_prev(buf); +#else + error = wrap_handler->index_prev(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_prev(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_prev(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_prev(buf); + } else { + error = storage_index_prev(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_first(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_FIRST + error = wrap_handler->ha_index_first(buf); +#else + error = wrap_handler->index_first(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_first(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + int flags = GRN_CURSOR_ASCENDING; + uint pkey_nr = table->s->primary_key; + mrn_change_encoding(ctx, NULL); + if (active_index == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } else { + if (KEY_N_KEY_PARTS(&(table->key_info[active_index])) > 1) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", active_index)); + } + index_table_cursor = grn_table_cursor_open(ctx, + grn_index_tables[active_index], + NULL, 0, + NULL, 0, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[active_index], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_first(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_first(buf); + } else { + error = storage_index_first(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_last(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_LAST + error = wrap_handler->ha_index_last(buf); +#else + error = wrap_handler->index_last(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_last(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + int flags = GRN_CURSOR_DESCENDING; + uint pkey_nr = table->s->primary_key; + mrn_change_encoding(ctx, NULL); + if (active_index == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } else { + if (KEY_N_KEY_PARTS(&(table->key_info[active_index])) > 1) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", active_index)); + } + index_table_cursor = grn_table_cursor_open(ctx, + grn_index_tables[active_index], + NULL, 0, + NULL, 0, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[active_index], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_last(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_last(buf); + } else { + error = storage_index_last(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_next_same(uchar *buf, const uchar *key, + uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY *key_info = &(table->s->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME + error = wrap_handler->ha_index_next_same(buf, key, keylen); +#else + error = wrap_handler->index_next_same(buf, key, keylen); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_next_same(uchar *buf, const uchar *key, + uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(count_skip ? NULL : buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_next_same(uchar *buf, const uchar *key, uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_next_same(buf, key, keylen); + } else { + error = storage_index_next_same(buf, key, keylen); + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + int error = 0; + if (sorted_result) { + mrn_ft_info->cursor = grn_table_cursor_open(ctx, sorted_result, + NULL, 0, NULL, 0, + 0, -1, 0); + } else { + mrn_ft_info->cursor = grn_table_cursor_open(ctx, mrn_ft_info->result, + NULL, 0, NULL, 0, + 0, -1, 0); + } + if (ctx->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + } else { + if (sorted_result) { + if (grn_table->header.type == GRN_TABLE_NO_KEY) { + mrn_ft_info->id_accessor = grn_obj_column(ctx, sorted_result, + MRN_COLUMN_NAME_ID, + strlen(MRN_COLUMN_NAME_ID)); + } else { + mrn_ft_info->key_accessor = grn_obj_column(ctx, sorted_result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); + } + } else { + mrn_ft_info->key_accessor = grn_obj_column(ctx, mrn_ft_info->result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + record_id = GRN_ID_NIL; + DBUG_RETURN(error); +} + +int ha_mroonga::ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_ft_init(); + } else { + error = storage_ft_init(); + } + DBUG_RETURN(error); +} + +void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit( + struct st_mrn_ft_info *info, grn_obj *expression) +{ + MRN_DBUG_ENTER_METHOD(); + + Item *where = + 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); + converter.convert(where, expression); + + DBUG_VOID_RETURN; +} + +grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression) +{ + MRN_DBUG_ENTER_METHOD(); + + mrn::QueryParser query_parser(info->ctx, + ha_thd(), + expression, + index_column, + KEY_N_KEY_PARTS(info->key_info), + match_columns); + grn_rc rc = query_parser.parse(key->ptr(), key->length()); + + DBUG_RETURN(rc); +} + +grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_normal_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_rc rc = GRN_SUCCESS; + + grn_obj query; + GRN_TEXT_INIT(&query, GRN_OBJ_DO_SHALLOW_COPY); + GRN_TEXT_SET(info->ctx, &query, key->ptr(), key->length()); + grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); + grn_expr_append_obj(info->ctx, expression, match_columns, GRN_OP_PUSH, 1); + grn_expr_append_const(info->ctx, expression, &query, GRN_OP_PUSH, 1); + grn_expr_append_op(info->ctx, expression, GRN_OP_SIMILAR, 2); + grn_obj_unlink(info->ctx, &query); + + DBUG_RETURN(rc); +} + +struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, + uint key_nr, + String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + struct st_mrn_ft_info *info = new st_mrn_ft_info(); + info->mroonga = this; + info->ctx = ctx; + mrn_change_encoding(info->ctx, + table->key_info[key_nr].key_part->field->charset()); + info->encoding = GRN_CTX_GET_ENCODING(info->ctx); + info->table = grn_table; + info->result = grn_table_create(info->ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + if (!info->result) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "[mroonga][ft-init] failed to create a table " + "to store matched records for one search: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + delete info; + DBUG_RETURN(NULL); + } + + info->score_column = grn_obj_column(info->ctx, info->result, + MRN_COLUMN_NAME_SCORE, + strlen(MRN_COLUMN_NAME_SCORE)); + GRN_TEXT_INIT(&(info->key), 0); + grn_bulk_space(info->ctx, &(info->key), table->key_info->key_length); + GRN_INT32_INIT(&(info->score), 0); + info->active_index = key_nr; + info->key_info = &(table->key_info[key_nr]); + info->primary_key_info = &(table->key_info[table_share->primary_key]); + info->cursor = NULL; + info->id_accessor = NULL; + info->key_accessor = NULL; + + if (key->length() == 0) { + DBUG_RETURN(info); + } + + grn_obj *index_column = grn_index_columns[key_nr]; + grn_obj *match_columns, *match_columns_variable; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->table, match_columns, + match_columns_variable); + + grn_obj *expression, *expression_variable; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->table, + expression, expression_variable); + + grn_rc rc = GRN_SUCCESS; + if (flags & FT_BOOL) { + rc = generic_ft_init_ext_prepare_expression_in_boolean_mode(info, + key, + index_column, + match_columns, + expression); + } else { + rc = generic_ft_init_ext_prepare_expression_in_normal_mode(info, + key, + index_column, + match_columns, + expression); + } + + if (rc == GRN_SUCCESS) { + if (fast_order_limit) { + generic_ft_init_ext_add_conditions_fast_order_limit(info, expression); + } + longlong escalation_threshold = THDVAR(ha_thd(), match_escalation_threshold); + mrn::MatchEscalationThresholdScope scope(info->ctx, escalation_threshold); + grn_table_select(info->ctx, info->table, expression, + info->result, GRN_OP_OR); + } + + grn_obj_unlink(info->ctx, expression); + grn_obj_unlink(info->ctx, match_columns); + + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + check_count_skip(0); + + mrn_change_encoding(ctx, system_charset_info); + grn_operator operation = GRN_OP_OR; + if (!matched_record_keys) { + matched_record_keys = grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + if (!matched_record_keys) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "[mroonga][ft-init] " + "failed to create a table to store all matched records: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + DBUG_RETURN(NULL); + } + } + + grn_table_sort_key *sort_keys = NULL; + int n_sort_keys = 0; + longlong limit = -1; + check_fast_order_limit(&sort_keys, &n_sort_keys, &limit); + + struct st_mrn_ft_info *info = generic_ft_init_ext_select(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } + + grn_rc rc; + rc = grn_table_setoperation(ctx, matched_record_keys, info->result, + matched_record_keys, operation); + if (rc) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to merge matched record keys: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + if (fast_order_limit) { + if (sorted_result) { + grn_obj_close(ctx, sorted_result); + } + sorted_result = grn_table_create(ctx, NULL, + 0, NULL, + GRN_OBJ_TABLE_NO_KEY, NULL, + matched_record_keys); + grn_table_sort(ctx, matched_record_keys, 0, static_cast(limit), + sorted_result, sort_keys, n_sort_keys); + } else if (flags & FT_SORTED) { + grn_table_sort_key score_sort_key; + score_sort_key.key = grn_obj_column(ctx, + matched_record_keys, + MRN_COLUMN_NAME_SCORE, + strlen(MRN_COLUMN_NAME_SCORE)); + score_sort_key.offset = 0; + score_sort_key.flags = GRN_TABLE_SORT_DESC; + if (sorted_result) { + grn_obj_unlink(ctx, sorted_result); + } + sorted_result = grn_table_create(ctx, NULL, + 0, NULL, + GRN_OBJ_TABLE_NO_KEY, NULL, + matched_record_keys); + grn_table_sort(ctx, matched_record_keys, 0, -1, + sorted_result, &score_sort_key, 1); + grn_obj_unlink(ctx, score_sort_key.key); + } + if (sort_keys) { + for (int i = 0; i < n_sort_keys; i++) { + grn_obj_unlink(info->ctx, sort_keys[i].key); + } + my_free(sort_keys); + } + + DBUG_RETURN((FT_INFO *)info); +} + +FT_INFO *ha_mroonga::wrapper_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } + + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; + mrn_ft_info->please = &mrn_wrapper_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_wrapper_ft_vft_ext; +#endif + ++wrap_ft_init_count; + + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::storage_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + if (!info) { + DBUG_RETURN(NULL); + } + + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; + mrn_ft_info->please = &mrn_storage_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_storage_ft_vft_ext; +#endif + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + fulltext_searching = true; + FT_INFO *info; + if (key_nr == NO_SUCH_KEY) { + struct st_mrn_ft_info *mrn_ft_info = new st_mrn_ft_info(); + mrn_ft_info->please = &mrn_no_such_key_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_no_such_key_ft_vft_ext; +#endif + info = (FT_INFO *)mrn_ft_info; + } else { + if (share->wrapper_mode) + { + info = wrapper_ft_init_ext(flags, key_nr, key); + } else { + info = storage_ft_init_ext(flags, key_nr, key); + } + } + DBUG_RETURN(info); +} + +int ha_mroonga::wrapper_ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + if (wrap_ft_init_count) + set_pk_bitmap(); + + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + int error = 0; + do { + grn_id found_record_id; + found_record_id = grn_table_cursor_next(ctx, mrn_ft_info->cursor); + if (found_record_id == GRN_ID_NIL) { + error = HA_ERR_END_OF_FILE; + break; + } + + GRN_BULK_REWIND(&key_buffer); + if (mrn_ft_info->key_accessor) { + grn_obj_get_value(ctx, mrn_ft_info->key_accessor, + found_record_id, &key_buffer); + } else { + void *key; + int key_length; + key_length = grn_table_cursor_get_key(ctx, mrn_ft_info->cursor, &key); + GRN_TEXT_SET(ctx, &key_buffer, key, key_length); + } + error = wrapper_get_record(buf, (const uchar *)GRN_TEXT_VALUE(&key_buffer)); + } while (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + grn_id found_record_id; + found_record_id = grn_table_cursor_next(ctx, mrn_ft_info->cursor); + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + + if (found_record_id == GRN_ID_NIL) { + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + table->status = 0; + + if (count_skip && record_id != GRN_ID_NIL) { + DBUG_RETURN(0); + } + + GRN_BULK_REWIND(&key_buffer); + if (mrn_ft_info->id_accessor) { + grn_obj id_buffer; + GRN_RECORD_INIT(&id_buffer, 0, grn_obj_id(ctx, grn_table)); + grn_obj_get_value(ctx, mrn_ft_info->id_accessor, + found_record_id, &id_buffer); + record_id = GRN_RECORD_VALUE(&id_buffer); + } else if (mrn_ft_info->key_accessor) { + grn_obj_get_value(ctx, mrn_ft_info->key_accessor, + found_record_id, &key_buffer); + record_id = grn_table_get(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + GRN_TEXT_LEN(&key_buffer)); + } else { + void *key; + grn_table_cursor_get_key(ctx, mrn_ft_info->cursor, &key); + if (ctx->rc) { + record_id = GRN_ID_NIL; + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } else { + record_id = *((grn_id *)key); + } + } + storage_store_fields(buf, record_id); + DBUG_RETURN(0); +} + +int ha_mroonga::ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_ft_read(buf); + } else { + error = storage_ft_read(buf); + } + DBUG_RETURN(error); +} + +const Item *ha_mroonga::wrapper_cond_push(const Item *cond) +{ + const Item *reminder_cond; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + reminder_cond = wrap_handler->cond_push(cond); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(reminder_cond); +} + +const Item *ha_mroonga::storage_cond_push(const Item *cond) +{ + MRN_DBUG_ENTER_METHOD(); + const Item *reminder_cond = cond; + if (!pushed_cond) { + mrn::ConditionConverter converter(ctx, grn_table, true); + if (converter.count_match_against(cond) == 1 && + converter.is_convertable(cond)) { + reminder_cond = NULL; + } + } + DBUG_RETURN(reminder_cond); +} + +const Item *ha_mroonga::cond_push(const Item *cond) +{ + MRN_DBUG_ENTER_METHOD(); + const Item *reminder_cond; + if (share->wrapper_mode) + { + reminder_cond = wrapper_cond_push(cond); + } else { + reminder_cond = storage_cond_push(cond); + } + DBUG_RETURN(reminder_cond); +} + +void ha_mroonga::wrapper_cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->cond_pop(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + wrapper_cond_pop(); + else + storage_cond_pop(); + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_get_error_message(int error, String *buf) +{ + bool temporary_error; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + temporary_error = wrap_handler->get_error_message(error, buf); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(temporary_error); +} + +bool ha_mroonga::storage_get_error_message(int error, String *buf) +{ + MRN_DBUG_ENTER_METHOD(); + bool temporary_error = false; + // latest error message + buf->copy(ctx->errbuf, (uint) strlen(ctx->errbuf), system_charset_info); + DBUG_RETURN(temporary_error); +} + +bool ha_mroonga::get_error_message(int error, String *buf) +{ + MRN_DBUG_ENTER_METHOD(); + bool temporary_error; + if (share && share->wrapper_mode) + { + temporary_error = wrapper_get_error_message(error, buf); + } else { + temporary_error = storage_get_error_message(error, buf); + } + DBUG_RETURN(temporary_error); +} + +ulonglong ha_mroonga::file_size(const char *path) +{ + MRN_DBUG_ENTER_METHOD(); + + struct stat file_status; + if (stat(path, &file_status) == 0) { + DBUG_RETURN(file_status.st_size); + } else { + DBUG_RETURN(0); + } +} + +bool ha_mroonga::have_unique_index() +{ + MRN_DBUG_ENTER_METHOD(); + + uint n_keys = table->s->keys; + + for (uint i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + if (key_info->flags & HA_NOSAME) { + DBUG_RETURN(true); + } + } + + DBUG_RETURN(false); +} + +bool ha_mroonga::is_foreign_key_field(const char *table_name, + const char *field_name) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *table = grn_ctx_get(ctx, table_name, -1); + if (!table) { + DBUG_RETURN(false); + } + + mrn::ColumnName column_name(field_name); + grn_obj *column = grn_obj_column(ctx, + table, + column_name.c_str(), + column_name.length()); + if (!column) { + DBUG_RETURN(false); + } + + grn_obj *range = grn_ctx_at(ctx, grn_obj_get_range(ctx, column)); + if (!range) { + grn_obj_unlink(ctx, column); + DBUG_RETURN(false); + } + + if (!mrn::grn::is_table(range)) { + grn_obj_unlink(ctx, column); + DBUG_RETURN(false); + } + + grn_obj *foreign_index_column; + mrn::IndexColumnName index_column_name(table_name, field_name); + foreign_index_column = grn_obj_column(ctx, range, + index_column_name.c_str(), + index_column_name.length()); + if (foreign_index_column) { + grn_obj_unlink(ctx, foreign_index_column); + DBUG_RETURN(true); + } + + grn_obj_unlink(ctx, column); + DBUG_RETURN(false); +} + +void ha_mroonga::push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag) +{ + char search_name[MRN_BUFFER_SIZE]; + if (flag == HA_READ_MBR_INTERSECT) { + strcpy(search_name, "intersect"); + } else if (flag == HA_READ_MBR_WITHIN) { + strcpy(search_name, "within"); + } else if (flag & HA_READ_MBR_DISJOINT) { + strcpy(search_name, "disjoint"); + } else if (flag & HA_READ_MBR_EQUAL) { + strcpy(search_name, "equal"); + } else { + sprintf(search_name, "unknown: %d", flag); + } + push_warning_printf(ha_thd(), + MRN_SEVERITY_WARNING, + ER_UNSUPPORTED_EXTENSION, + "spatial index search " + "except MBRContains aren't supported: <%s>", + search_name); +} + +void ha_mroonga::clear_cursor() +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor) { + grn_obj_unlink(ctx, cursor); + cursor = NULL; + } + if (index_table_cursor) { + grn_table_cursor_close(ctx, index_table_cursor); + index_table_cursor = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_cursor_geo() +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor_geo) { + grn_obj_unlink(ctx, cursor_geo); + cursor_geo = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_empty_value_records() +{ + MRN_DBUG_ENTER_METHOD(); + if (empty_value_records_cursor) { + grn_table_cursor_close(ctx, empty_value_records_cursor); + empty_value_records_cursor = NULL; + } + if (empty_value_records) { + grn_obj_unlink(ctx, empty_value_records); + empty_value_records = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_search_result() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + if (sorted_result) { + grn_obj_unlink(ctx, sorted_result); + sorted_result = NULL; + } + if (matched_record_keys) { + grn_obj_unlink(ctx, matched_record_keys); + matched_record_keys = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_search_result_geo() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor_geo(); + if (grn_source_column_geo) { + grn_obj_unlink(ctx, grn_source_column_geo); + grn_source_column_geo = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_indexes() +{ + MRN_DBUG_ENTER_METHOD(); + uint n_keys = table->s->keys; + uint pkey_nr = table->s->primary_key; + + for (uint i = 0; i < n_keys; i++) { + if (i != pkey_nr) { + if (grn_index_tables) { + grn_obj_unlink(ctx, grn_index_tables[i]); + } + if (grn_index_columns) { + grn_obj_unlink(ctx, grn_index_columns[i]); + } + } + } + + if (grn_index_tables) { + free(grn_index_tables); + grn_index_tables = NULL; + } + + if (grn_index_columns) { + free(grn_index_columns); + grn_index_columns = NULL; + } + + if (key_id) { + free(key_id); + key_id = NULL; + } + + if (del_key_id) { + free(del_key_id); + del_key_id = NULL; + } + + DBUG_VOID_RETURN; +} + +int ha_mroonga::add_wrap_hton(const char *path, handlerton *wrap_handlerton) +{ + MRN_DBUG_ENTER_METHOD(); + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), true); + if (!slot_data) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + st_mrn_wrap_hton *wrap_hton = + (st_mrn_wrap_hton *)malloc(sizeof(st_mrn_wrap_hton)); + if (!wrap_hton) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + wrap_hton->next = NULL; + strcpy(wrap_hton->path, path); + wrap_hton->hton = wrap_handlerton; + if (slot_data->first_wrap_hton) + { + st_mrn_wrap_hton *tmp_wrap_hton = slot_data->first_wrap_hton; + while (tmp_wrap_hton->next) + tmp_wrap_hton = tmp_wrap_hton->next; + tmp_wrap_hton->next = wrap_hton; + } else { + slot_data->first_wrap_hton = wrap_hton; + } + DBUG_RETURN(0); +} + +void ha_mroonga::remove_related_files(const char *base_path) +{ + MRN_DBUG_ENTER_METHOD(); + + const char *base_directory_name = "."; + size_t base_path_length = strlen(base_path); +#ifdef WIN32 + WIN32_FIND_DATA data; + HANDLE finder = FindFirstFile(base_directory_name, &data); + if (finder != INVALID_HANDLE_VALUE) { + do { + if (!(data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL)) { + continue; + } + if (strncmp(data.cFileName, base_path, base_path_length) == 0) { + unlink(data.cFileName); + } + } while (FindNextFile(finder, &data) != 0); + FindClose(finder); + } +#else + DIR *dir = opendir(base_directory_name); + if (dir) { + while (struct dirent *entry = readdir(dir)) { + struct stat file_status; + if (stat(entry->d_name, &file_status) != 0) { + continue; + } + if (!((file_status.st_mode & S_IFMT) == S_IFREG)) { + continue; + } + if (strncmp(entry->d_name, base_path, base_path_length) == 0) { + unlink(entry->d_name); + } + } + closedir(dir); + } +#endif + + DBUG_VOID_RETURN; +} + +void ha_mroonga::remove_grn_obj_force(const char *name) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *obj = grn_ctx_get(ctx, name, strlen(name)); + if (obj) { + grn_obj_remove(ctx, obj); + } else { + grn_obj *db = grn_ctx_db(ctx); + grn_id id = grn_table_get(ctx, db, name, strlen(name)); + if (id) { + char path[MRN_MAX_PATH_SIZE]; + grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); + if (grn_obj_path_by_id(ctx, db, id, path) == GRN_SUCCESS) { + remove_related_files(path); + } + } + } + + DBUG_VOID_RETURN; +} + +int ha_mroonga::drop_index(MRN_SHARE *target_share, uint key_index) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_rc rc = GRN_SUCCESS; + char target_name[GRN_TABLE_MAX_KEY_SIZE]; + int target_name_length; + + KEY *key_info = target_share->table_share->key_info; + if (!target_share->wrapper_mode && target_share->index_table[key_index]) { + const char *table_name = target_share->index_table[key_index]; + snprintf(target_name, GRN_TABLE_MAX_KEY_SIZE, + "%s.%s", table_name, key_info[key_index].name.str); + 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); + } + } else { + mrn::PathMapper mapper(target_share->table_name); + mrn::IndexTableName index_table_name(mapper.table_name(), + key_info[key_index].name.str); + grn_obj *index_table = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_length()); + } + if (index_table) { + target_name_length = grn_obj_name(ctx, index_table, + target_name, GRN_TABLE_MAX_KEY_SIZE); + rc = grn_obj_remove(ctx, index_table); + } else { + target_name_length = 0; + } + } + + if (rc != GRN_SUCCESS) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to drop index: <%.*s>: <%s>", + target_name_length, target_name, + ctx->errbuf); + my_message(ER_ERROR_ON_WRITE, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::drop_indexes_normal(const char *table_name, grn_obj *table) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_hash *columns_raw = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY); + mrn::SmartGrnObj columns(ctx, reinterpret_cast(columns_raw)); + if (!columns.get()) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to allocate columns buffer: <%s>: <%s>", + table_name, ctx->errbuf); + error = HA_ERR_OUT_OF_MEM; + my_message(ER_ERROR_ON_WRITE, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + DBUG_RETURN(error); + } + + grn_table_columns(ctx, table, "", 0, columns.get()); + grn_table_cursor *cursor = grn_table_cursor_open(ctx, + columns.get(), + NULL, 0, + NULL, 0, + 0, -1, + 0); + if (!cursor) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to allocate columns cursor: <%s>: <%s>", + table_name, ctx->errbuf); + error = HA_ERR_OUT_OF_MEM; + my_message(ER_ERROR_ON_WRITE, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + DBUG_RETURN(error); + } + + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + void *key; + grn_table_cursor_get_key(ctx, cursor, &key); + grn_id *id = reinterpret_cast(key); + mrn::SmartGrnObj column(ctx, grn_ctx_at(ctx, *id)); + if (!column.get()) { + continue; + } + + grn_operator index_operators[] = { + GRN_OP_EQUAL, + GRN_OP_MATCH, + GRN_OP_LESS, + GRN_OP_REGEXP + }; + size_t n_index_operators = sizeof(index_operators) / sizeof(grn_operator); + for (size_t i = 0; i < n_index_operators; i++) { + grn_index_datum index_datum; + while (grn_column_find_index_data(ctx, + column.get(), + index_operators[i], + &index_datum, + 1) > 0) { + grn_id index_table_id = index_datum.index->header.domain; + mrn::SmartGrnObj index_table(ctx, grn_ctx_at(ctx, index_table_id)); + char index_table_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_table_name_length; + index_table_name_length = grn_obj_name(ctx, index_table.get(), + index_table_name, + GRN_TABLE_MAX_KEY_SIZE); + if (mrn::IndexTableName::is_custom_name(table_name, + strlen(table_name), + index_table_name, + index_table_name_length)) { + char index_column_name[GRN_TABLE_MAX_KEY_SIZE]; + int index_column_name_length; + index_column_name_length = grn_obj_name(ctx, + index_datum.index, + index_column_name, + GRN_TABLE_MAX_KEY_SIZE); + grn_rc rc = grn_obj_remove(ctx, index_datum.index); + if (rc != GRN_SUCCESS) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to drop index column: <%.*s>: <%s>", + index_column_name_length, index_column_name, + ctx->errbuf); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + } else { + grn_rc rc = grn_obj_remove(ctx, index_table.get()); + if (rc == GRN_SUCCESS) { + index_table.release(); + } else { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to drop index table: <%.*s>: <%s>", + index_table_name_length, index_table_name, + ctx->errbuf); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + } + + if (error != 0) { + break; + } + } + + if (error != 0) { + break; + } + } + + if (error != 0) { + break; + } + } + + grn_table_cursor_close(ctx, cursor); + + DBUG_RETURN(error); +} + +int ha_mroonga::drop_indexes_multiple(const char *table_name, + grn_obj *table, + const char *index_table_name_separator) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + char index_table_name_prefix[GRN_TABLE_MAX_KEY_SIZE]; + snprintf(index_table_name_prefix, GRN_TABLE_MAX_KEY_SIZE, + "%s%s", table_name, index_table_name_separator); + grn_table_cursor *cursor = + grn_table_cursor_open(ctx, + grn_ctx_db(ctx), + index_table_name_prefix, + strlen(index_table_name_prefix), + NULL, 0, + 0, -1, + GRN_CURSOR_PREFIX); + if (!cursor) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to allocate index tables cursor: <%s>: <%s>", + table_name, ctx->errbuf); + error = HA_ERR_OUT_OF_MEM; + my_message(ER_ERROR_ON_WRITE, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + DBUG_RETURN(error); + } + + grn_id table_id = grn_obj_id(ctx, table); + grn_id id; + while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) { + mrn::SmartGrnObj object(ctx, grn_ctx_at(ctx, id)); + if (!object.get()) { + continue; + } + if (!grn_obj_is_table(ctx, object.get())) { + continue; + } + + char multiple_column_index_table_name[GRN_TABLE_MAX_KEY_SIZE]; + int multiple_column_index_table_name_length; + multiple_column_index_table_name_length = + grn_obj_name(ctx, + object.get(), + multiple_column_index_table_name, + GRN_TABLE_MAX_KEY_SIZE); + + char multiple_column_index_name[GRN_TABLE_MAX_KEY_SIZE]; + snprintf(multiple_column_index_name, GRN_TABLE_MAX_KEY_SIZE, + "%.*s.%s", + multiple_column_index_table_name_length, + multiple_column_index_table_name, + INDEX_COLUMN_NAME); + mrn::SmartGrnObj index_column(ctx, multiple_column_index_name); + if (!index_column.get()) { + continue; + } + + if (grn_obj_get_range(ctx, index_column.get()) != table_id) { + continue; + } + + grn_rc rc = grn_obj_remove(ctx, object.get()); + if (rc == GRN_SUCCESS) { + object.release(); + index_column.release(); + } else { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to drop multiple column index table: <%.*s>: <%s>", + multiple_column_index_table_name_length, + multiple_column_index_table_name, + ctx->errbuf); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + break; + } + } + + grn_table_cursor_close(ctx, cursor); + + DBUG_RETURN(error); +} + +int ha_mroonga::drop_indexes(const char *table_name) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + mrn::SmartGrnObj table(ctx, table_name); + if (!table.get()) { + DBUG_RETURN(0); + } + + error = drop_indexes_normal(table_name, table.get()); + if (error == 0) { + error = drop_indexes_multiple(table_name, table.get(), + mrn::IndexTableName::SEPARATOR); + } + if (error == 0) { + error = drop_indexes_multiple(table_name, table.get(), + mrn::IndexTableName::OLD_SEPARATOR); + } + + DBUG_RETURN(error); +} + +bool ha_mroonga::find_column_flags(Field *field, MRN_SHARE *mrn_share, int i, + grn_obj_flags *column_flags) +{ + MRN_DBUG_ENTER_METHOD(); + bool found = false; + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + { + const char *names = field->option_struct->flags; + if (names) { + found = mrn_parse_grn_column_create_flags(ha_thd(), + ctx, + names, + strlen(names), + column_flags); + DBUG_RETURN(found); + } + } +#endif + + if (mrn_share->col_flags[i]) { + found = mrn_parse_grn_column_create_flags(ha_thd(), + ctx, + mrn_share->col_flags[i], + mrn_share->col_flags_length[i], + column_flags); + DBUG_RETURN(found); + } + + DBUG_RETURN(found); +} + +grn_obj *ha_mroonga::find_column_type(Field *field, MRN_SHARE *mrn_share, int i, + int error_code) +{ + MRN_DBUG_ENTER_METHOD(); + + const char *grn_type_name = NULL; +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + grn_type_name = field->option_struct->groonga_type; +#endif + if (!grn_type_name) { + grn_type_name = mrn_share->col_type[i]; + } + + grn_obj *type = NULL; + if (grn_type_name) { + type = grn_ctx_get(ctx, grn_type_name, -1); + if (!type) { + char error_message[MRN_BUFFER_SIZE]; + snprintf(error_message, MRN_BUFFER_SIZE, + "unknown custom Groonga type name for <%s> column: <%s>", + field->field_name.str, grn_type_name); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + my_message(error_code, error_message, MYF(0)); + + DBUG_RETURN(NULL); + } + } else { + grn_builtin_type grn_type_id = mrn_grn_type_from_field(ctx, field, false); + type = grn_ctx_at(ctx, grn_type_id); + } + + DBUG_RETURN(type); +} + +grn_obj *ha_mroonga::find_tokenizer(KEY *key, MRN_SHARE *mrn_share, int i) +{ + MRN_DBUG_ENTER_METHOD(); + grn_obj *tokenizer; + const char *tokenizer_name = NULL; + uint tokenizer_name_length = 0; +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (key->option_struct->tokenizer) { + tokenizer_name = key->option_struct->tokenizer; + tokenizer_name_length = strlen(tokenizer_name); + } +#endif + if (!tokenizer_name) { + tokenizer_name = mrn_share->key_tokenizer[i]; + tokenizer_name_length = mrn_share->key_tokenizer_length[i]; + } + tokenizer = find_tokenizer(tokenizer_name, tokenizer_name_length); + DBUG_RETURN(tokenizer); +} + +grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length) +{ + MRN_DBUG_ENTER_METHOD(); + + if (strncasecmp("off", name, name_length) == 0) { + DBUG_RETURN(NULL); + } + + grn_obj *tokenizer; + mrn_change_encoding(ctx, system_charset_info); + tokenizer = grn_ctx_get(ctx, name, name_length); + if (!tokenizer) { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "specified tokenizer for fulltext index <%.*s> doesn't exist. " + "The default tokenizer for fulltext index <%s> is used instead.", + name_length, name, + MRN_DEFAULT_TOKENIZER); + push_warning(ha_thd(), + MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION, + message); + tokenizer = grn_ctx_get(ctx, + MRN_DEFAULT_TOKENIZER, + strlen(MRN_DEFAULT_TOKENIZER)); + } + if (!tokenizer) { + push_warning(ha_thd(), + MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION, + "couldn't find tokenizer for fulltext index. " + "Bigram tokenizer is used instead."); + tokenizer = grn_ctx_at(ctx, GRN_DB_BIGRAM); + } + DBUG_RETURN(tokenizer); +} + +bool ha_mroonga::have_custom_normalizer(KEY *key) const +{ + MRN_DBUG_ENTER_METHOD(); + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (key->option_struct && key->option_struct->normalizer) { + DBUG_RETURN(true); + } +#endif + + if (key->comment.length > 0) { + mrn::ParametersParser parser(key->comment.str, + key->comment.length); + parser.parse(); + DBUG_RETURN(parser["normalizer"] != NULL); + } + + DBUG_RETURN(false); +} + +grn_obj *ha_mroonga::find_normalizer(KEY *key) +{ + MRN_DBUG_ENTER_METHOD(); + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (key->option_struct->normalizer) { + grn_obj *normalizer = find_normalizer(key, + key->option_struct->normalizer); + DBUG_RETURN(normalizer); + } +#endif + + if (key->comment.length > 0) { + mrn::ParametersParser parser(key->comment.str, + key->comment.length); + parser.parse(); + grn_obj *normalizer = find_normalizer(key, parser["normalizer"]); + DBUG_RETURN(normalizer); + } + + grn_obj *normalizer = find_normalizer(key, NULL); + DBUG_RETURN(normalizer); +} + +grn_obj *ha_mroonga::find_normalizer(KEY *key, const char *name) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *normalizer = NULL; + bool use_normalizer = true; + if (name) { + if (strcmp(name, "none") == 0) { + use_normalizer = false; + } else { + normalizer = grn_ctx_get(ctx, name, -1); + } + } + if (use_normalizer && !normalizer) { + Field *field = key->key_part[0].field; + mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field); + normalizer = field_normalizer.find_grn_normalizer(); + } + + DBUG_RETURN(normalizer); +} + +bool ha_mroonga::find_index_column_flags(KEY *key, grn_column_flags *index_column_flags) +{ + MRN_DBUG_ENTER_METHOD(); + bool found = false; + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + { + const char *names = key->option_struct->flags; + if (names) { + found = mrn_parse_grn_index_column_flags(ha_thd(), + ctx, + names, + strlen(names), + index_column_flags); + DBUG_RETURN(found); + } + } +#endif + + if (key->comment.length > 0) { + mrn::ParametersParser parser(key->comment.str, + key->comment.length); + parser.parse(); + const char *names = parser["flags"]; + if (!names) { + // Deprecated. It's for backward compatibility. + names = parser["index_flags"]; + } + if (names) { + found = mrn_parse_grn_index_column_flags(ha_thd(), + ctx, + names, + strlen(names), + index_column_flags); + } + } + + DBUG_RETURN(found); +} + +bool ha_mroonga::find_token_filters(KEY *key, grn_obj *token_filters) +{ + MRN_DBUG_ENTER_METHOD(); + bool found = false; + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + if (key->option_struct->token_filters) { + found = find_token_filters_fill(token_filters, + key->option_struct->token_filters, + strlen(key->option_struct->token_filters)); + DBUG_RETURN(found); + } +#endif + + if (key->comment.length > 0) { + mrn::ParametersParser parser(key->comment.str, + key->comment.length); + parser.parse(); + const char *names = parser["token_filters"]; + if (names) { + found = find_token_filters_fill(token_filters, names, strlen(names)); + } + } + + DBUG_RETURN(found); +} + +bool ha_mroonga::find_token_filters_put(grn_obj *token_filters, + const char *token_filter_name, + int token_filter_name_length) +{ + grn_obj *token_filter; + + token_filter = grn_ctx_get(ctx, + token_filter_name, + token_filter_name_length); + if (token_filter) { + GRN_PTR_PUT(ctx, token_filters, token_filter); + return true; + } else { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "nonexistent token filter: <%.*s>", + token_filter_name_length, token_filter_name); + push_warning(ha_thd(), + MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION, + message); + return false; + } +} + +bool ha_mroonga::find_token_filters_fill(grn_obj *token_filters, + const char *token_filter_names, + int token_filter_names_length) +{ + const char *start, *current, *end; + const char *name_start, *name_end; + const char *last_name_end; + + start = token_filter_names; + end = start + token_filter_names_length; + current = start; + name_start = NULL; + name_end = NULL; + last_name_end = start; + while (current < end) { + switch (current[0]) { + case ' ' : + if (name_start && !name_end) { + name_end = current; + } + break; + case ',' : + if (!name_start) { + goto break_loop; + } + if (!name_end) { + name_end = current; + } + find_token_filters_put(token_filters, + name_start, + name_end - name_start); + last_name_end = name_end + 1; + name_start = NULL; + name_end = NULL; + break; + default : + if (!name_start) { + name_start = current; + } + break; + } + current++; + } + +break_loop: + if (!name_start) { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "empty token filter name: " + "<%.*s|%.*s|%.*s>", + (int)(last_name_end - start), start, + (int)(current - last_name_end), last_name_end, + (int)(end - current), current); + push_warning(ha_thd(), + MRN_SEVERITY_WARNING, ER_UNSUPPORTED_EXTENSION, + message); + return false; + } + + if (!name_end) { + name_end = current; + } + find_token_filters_put(token_filters, + name_start, + name_end - name_start); + + return true; +} + +int ha_mroonga::wrapper_get_record(uchar *buf, const uchar *key) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (wrap_handler->inited == NONE) { +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP + error = wrap_handler->ha_index_read_idx_map(buf, + share->wrap_primary_key, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#else + error = wrap_handler->index_read_idx_map(buf, + share->wrap_primary_key, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#endif + } else { +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + error = wrap_handler->ha_index_read_map(buf, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#else + error = wrap_handler->index_read_map(buf, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#endif + } + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_get_next_geo_record(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn_change_encoding(ctx, NULL); + do { + GRN_BULK_REWIND(&key_buffer); + grn_id found_record_id; + grn_posting *posting; + posting = grn_geo_cursor_next(ctx, cursor_geo); + if (!posting) { + error = HA_ERR_END_OF_FILE; + clear_cursor_geo(); + break; + } + found_record_id = posting->rid; + grn_table_get_key(ctx, grn_table, found_record_id, + GRN_TEXT_VALUE(&key_buffer), + table->key_info->key_length); + error = wrapper_get_record(buf, (const uchar *)GRN_TEXT_VALUE(&key_buffer)); + } while (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_get_next_record(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor_geo) { + grn_posting *posting; + posting = grn_geo_cursor_next(ctx, cursor_geo); + if (posting) { + record_id = posting->rid; + } else { + record_id = GRN_ID_NIL; + } + } else if (cursor) { + record_id = grn_table_cursor_next(ctx, cursor); + } else if (empty_value_records_cursor) { + grn_id empty_value_record_id; + empty_value_record_id = + grn_table_cursor_next(ctx, empty_value_records_cursor); + if (empty_value_record_id == GRN_ID_NIL) { + record_id = GRN_ID_NIL; + } else { + grn_table_get_key(ctx, empty_value_records, empty_value_record_id, + &record_id, sizeof(grn_id)); + } + } else { + record_id = GRN_ID_NIL; + } + if (ctx->rc) { + int error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: storage_get_next_record: end-of-file")); + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + if (buf) { + if (ignoring_no_key_columns) + storage_store_fields_by_index(buf); + else + storage_store_fields(buf, record_id); + if (cursor_geo && grn_source_column_geo) { + int latitude, longitude; + GRN_GEO_POINT_VALUE(&source_point, latitude, longitude); + double latitude_in_degree = GRN_GEO_MSEC2DEGREE(latitude); + double longitude_in_degree = GRN_GEO_MSEC2DEGREE(longitude); + if (!((bottom_right_latitude_in_degree <= latitude_in_degree && + latitude_in_degree <= top_left_latitude_in_degree) && + (top_left_longitude_in_degree <= longitude_in_degree && + longitude_in_degree <= bottom_right_longitude_in_degree))) { + DBUG_PRINT("info", + ("mroonga: remove not contained geo point: " + "<%g,%g>(<%d,%d>); key: <%g,%g>(<%d,%d>), <%g,%g>(<%d,%d>)", + latitude_in_degree, longitude_in_degree, + latitude, longitude, + top_left_latitude_in_degree, top_left_longitude_in_degree, + GRN_GEO_DEGREE2MSEC(top_left_latitude_in_degree), + GRN_GEO_DEGREE2MSEC(top_left_longitude_in_degree), + bottom_right_latitude_in_degree, + bottom_right_longitude_in_degree, + GRN_GEO_DEGREE2MSEC(bottom_right_latitude_in_degree), + GRN_GEO_DEGREE2MSEC(bottom_right_longitude_in_degree))); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); + } + } + } + table->status = 0; + DBUG_RETURN(0); +} + +void ha_mroonga::geo_store_rectangle(const uchar *rectangle) +{ + MRN_DBUG_ENTER_METHOD(); + + double locations[4]; + for (int i = 0; i < 4; i++) { + uchar reversed_value[8]; + for (int j = 0; j < 8; j++) { + reversed_value[j] = (rectangle + (8 * i))[7 - j]; + } + mi_float8get(locations[i], reversed_value); + } + top_left_longitude_in_degree = locations[0]; + bottom_right_longitude_in_degree = locations[1]; + bottom_right_latitude_in_degree = locations[2]; + top_left_latitude_in_degree = locations[3]; + int top_left_latitude = GRN_GEO_DEGREE2MSEC(top_left_latitude_in_degree); + int top_left_longitude = GRN_GEO_DEGREE2MSEC(top_left_longitude_in_degree); + int bottom_right_latitude = GRN_GEO_DEGREE2MSEC(bottom_right_latitude_in_degree); + int bottom_right_longitude = GRN_GEO_DEGREE2MSEC(bottom_right_longitude_in_degree); + GRN_GEO_POINT_SET(ctx, &top_left_point, + top_left_latitude, top_left_longitude); + GRN_GEO_POINT_SET(ctx, &bottom_right_point, + bottom_right_latitude, bottom_right_longitude); + + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_geo_open_cursor(const uchar *key, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + int flags = 0; + if (find_flag & HA_READ_MBR_CONTAIN) { + grn_obj *index = grn_index_columns[active_index]; + geo_store_rectangle(key); + cursor_geo = grn_geo_cursor_open_in_rectangle(ctx, + index, + &top_left_point, + &bottom_right_point, + 0, -1); + if (cursor_geo) { + if (grn_source_column_geo) { + grn_obj_unlink(ctx, grn_source_column_geo); + } + grn_obj sources; + GRN_OBJ_INIT(&sources, GRN_BULK, 0, GRN_ID_NIL); + grn_obj_get_info(ctx, index, GRN_INFO_SOURCE, &sources); + grn_source_column_geo = grn_ctx_at(ctx, GRN_RECORD_VALUE(&sources)); + grn_obj_unlink(ctx, &sources); + } + } else { + push_warning_unsupported_spatial_index_search(find_flag); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } + if (ctx->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::is_dry_write() +{ + MRN_DBUG_ENTER_METHOD(); + bool dry_write_p = THDVAR(ha_thd(), dry_write); + DBUG_RETURN(dry_write_p); +} + +bool ha_mroonga::is_enable_optimization() +{ + MRN_DBUG_ENTER_METHOD(); + bool enable_optimization_p = THDVAR(ha_thd(), enable_optimization); + DBUG_RETURN(enable_optimization_p); +} + +bool ha_mroonga::should_normalize(Field *field) const +{ + MRN_DBUG_ENTER_METHOD(); + mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field); + bool need_normalize_p = field_normalizer.should_normalize(); + DBUG_RETURN(need_normalize_p); +} + +void ha_mroonga::check_count_skip(key_part_map target_key_part_map) +{ + MRN_DBUG_ENTER_METHOD(); + + if (!is_enable_optimization()) { + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] optimization is disabled"); + count_skip = false; + DBUG_VOID_RETURN; + } + + if (thd_sql_command(ha_thd()) != SQLCOM_SELECT) { + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not SELECT"); + count_skip = false; + DBUG_VOID_RETURN; + } + + if (share->wrapper_mode && + !(wrap_handler->ha_table_flags() & HA_NO_TRANSACTIONS)) { + GRN_LOG(ctx, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] wrapped engine is transactional"); + count_skip = false; + DBUG_VOID_RETURN; + } + + st_select_lex *select_lex = table->pos_in_table_list->select_lex; + KEY *key_info = NULL; + if (active_index != MAX_KEY) { + key_info = &(table->key_info[active_index]); + } + mrn::CountSkipChecker checker(ctx, + table, + select_lex, + key_info, + target_key_part_map, + !share->wrapper_mode); + if (checker.check()) { + count_skip = true; + mrn_count_skip++; + DBUG_VOID_RETURN; + } else { + count_skip = false; + DBUG_VOID_RETURN; + } +} + +bool ha_mroonga::is_grn_zero_column_value(grn_obj *column, grn_obj *value) +{ + MRN_DBUG_ENTER_METHOD(); + + if (column->header.type != GRN_COLUMN_FIX_SIZE) { + DBUG_RETURN(false); + } + + char *bytes = GRN_BULK_HEAD(value); + unsigned int size = GRN_BULK_VSIZE(value); + for (unsigned int i = 0; i < size; ++i) { + if (bytes[i] != '\0') { + DBUG_RETURN(false); + } + } + + DBUG_RETURN(true); +} + +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.str, + key_info->key_part[0].field->field_name.str) == 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) +{ + MRN_DBUG_ENTER_METHOD(); + + if (!is_enable_optimization()) { + DBUG_PRINT("info", ("mroonga: fast order limit: optimization is disabled")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + + TABLE_LIST *table_list = table->pos_in_table_list; + st_select_lex *select_lex = table_list->select_lex; + SELECT_LEX_UNIT *unit = MRN_TABLE_LIST_GET_DERIVED(table_list); + st_select_lex *first_select_lex; + if (unit) + { + first_select_lex = unit->first_select(); + } else { + first_select_lex = select_lex; + } + DBUG_PRINT("info", + ("mroonga: first_select_lex->options=%llu", + first_select_lex ? 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 && + !MRN_SELECT_LEX_GET_HAVING_COND(select_lex) && + select_lex->table_list.elements == 1 && + select_lex->order_list.elements && + select_lex->explicit_limit && + select_lex->select_limit && + select_lex->select_limit->val_int() > 0 + ) { + if (select_lex->offset_limit) { + *limit = select_lex->offset_limit->val_int(); + } else { + *limit = 0; + } + *limit += select_lex->select_limit->val_int(); + if (*limit > (longlong)INT_MAX) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "too long limit: %lld <= %d is required", + *limit, INT_MAX)); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + if (first_select_lex && + (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; + } + 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) { + mrn::ConditionConverter converter(ctx, grn_table, is_storage_mode); + if (!converter.is_convertable(where)) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "not Groonga layer condition search")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + unsigned int n_match_againsts = converter.count_match_against(where); + if (n_match_againsts == 0) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "Groonga layer condition but not fulltext search")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + if (n_match_againsts > 1) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "MATCH AGAINST must be only one")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + } + 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; + order = order->next, i++) { + Item *item = *order->item; + if (item->type() == Item::FIELD_ITEM) + { + Field *field = static_cast(item)->field; + mrn::ColumnName column_name(field->field_name); + + if (should_normalize(field)) + { + DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " + "sort by collated value isn't supported yet.")); + fast_order_limit = false; + my_free(*sort_keys); + *sort_keys = NULL; + *n_sort_keys = 0; + DBUG_VOID_RETURN; + } + + if (is_storage_mode) { + (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys, + column_name.c_str(), + column_name.length()); + } 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, + strlen(MRN_COLUMN_NAME_SCORE)); + } else { + DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " + "sort by computed value isn't supported.")); + fast_order_limit = false; + my_free(*sort_keys); + *sort_keys = NULL; + *n_sort_keys = 0; + DBUG_VOID_RETURN; + } + (*sort_keys)[i].offset = 0; + if (MRN_ORDER_IS_ASC(order)) + { + (*sort_keys)[i].flags = GRN_TABLE_SORT_ASC; + } else { + (*sort_keys)[i].flags = GRN_TABLE_SORT_DESC; + } + (*n_sort_keys)++; + } + DBUG_PRINT("info", ("mroonga: fast_order_limit = true")); + fast_order_limit = true; + mrn_fast_order_limit++; + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("mroonga: fast_order_limit = false")); + fast_order_limit = false; + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_store_bulk_fixed_size_string(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + GRN_TEXT_SET(ctx, buf, field->ptr, field->field_length); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_variable_size_string(Field *field, + grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String value; + field->val_str(NULL, &value); + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + DBUG_PRINT("info", ("mroonga: length=%" 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); +} + +int ha_mroonga::generic_store_bulk_integer(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long value = field->val_int(); + DBUG_PRINT("info", ("mroonga: value=%lld", value)); + uint32 size = field->pack_length(); + DBUG_PRINT("info", ("mroonga: size=%u", size)); + Field_num *field_num = static_cast(field); + bool is_unsigned = field_num->unsigned_flag; + DBUG_PRINT("info", ("mroonga: is_unsigned=%s", is_unsigned ? "true" : "false")); + switch (size) { + case 1: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT8, 0); + GRN_UINT8_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT8, 0); + GRN_INT8_SET(ctx, buf, value); + } + break; + case 2: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT16, 0); + GRN_UINT16_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT16, 0); + GRN_INT16_SET(ctx, buf, value); + } + break; + case 3: + case 4: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT32, 0); + GRN_UINT32_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT32, 0); + GRN_INT32_SET(ctx, buf, value); + } + break; + case 8: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT64, 0); + GRN_UINT64_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT64, 0); + GRN_INT64_SET(ctx, buf, value); + } + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%u>: " + "available sizes: [1, 2, 3, 4, 8]", + size); + push_warning(ha_thd(), MRN_SEVERITY_WARNING, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_unsigned_integer(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long signed_value = field->val_int(); + unsigned long long unsigned_value = *((unsigned long long *)(&signed_value)); + uint32 size = field->pack_length(); + switch (size) { + case 1: + grn_obj_reinit(ctx, buf, GRN_DB_UINT8, 0); + GRN_UINT8_SET(ctx, buf, unsigned_value); + break; + case 2: + grn_obj_reinit(ctx, buf, GRN_DB_UINT16, 0); + GRN_UINT16_SET(ctx, buf, unsigned_value); + break; + case 3: + case 4: + grn_obj_reinit(ctx, buf, GRN_DB_UINT32, 0); + GRN_UINT32_SET(ctx, buf, unsigned_value); + break; + case 8: + grn_obj_reinit(ctx, buf, GRN_DB_UINT64, 0); + GRN_UINT64_SET(ctx, buf, unsigned_value); + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown unsigned integer value size: <%u>: " + "available sizes: [1, 2, 3, 4, 8]", + size); + push_warning(ha_thd(), MRN_SEVERITY_WARNING, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_float(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + double value = field->val_real(); + uint32 size = field->pack_length(); + switch (size) { + case 4: + case 8: + grn_obj_reinit(ctx, buf, GRN_DB_FLOAT, 0); + GRN_FLOAT_SET(ctx, buf, value); + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown float value size: <%u>: " + "available sizes: [4, 8]", + size); + push_warning(ha_thd(), MRN_SEVERITY_WARNING, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +long long int ha_mroonga::get_grn_time_from_timestamp_field(Field_timestamp *field) +{ + MRN_DBUG_ENTER_METHOD(); + long long int grn_time = 0; +#ifdef MRN_TIMESTAMP_USE_TIMEVAL + int warnings = 0; + struct timeval time_value; + if (field->get_timestamp(&time_value, &warnings)) { + // XXX: Should we report warnings or MySQL does? + } else { + DBUG_PRINT("info", ("mroonga: timeval tv_sec=%ld", time_value.tv_sec)); + grn_time = GRN_TIME_PACK(time_value.tv_sec, time_value.tv_usec); + } +#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T) + unsigned long int micro_seconds; + my_time_t seconds = field->get_timestamp(µ_seconds); + DBUG_PRINT("info", ("mroonga: my_time_t seconds=%ld", seconds)); + grn_time = GRN_TIME_PACK(seconds, micro_seconds); +#else + my_bool is_null_value; + long seconds = field->get_timestamp(&is_null_value); + DBUG_PRINT("info", ("mroonga: long seconds=%ld", seconds)); + grn_time = GRN_TIME_PACK(seconds, 0); +#endif + DBUG_RETURN(grn_time); +} + +int ha_mroonga::generic_store_bulk_timestamp(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + Field_timestamp *timestamp_field = (Field_timestamp *)field; + long long int time = get_grn_time_from_timestamp_field(timestamp_field); + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_date(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int date_value = field->val_int(); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = date_value / 10000 % 10000 - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = date_value / 100 % 100 - 1; + date.tm_mday = date_value % 100; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, &truncated); + if (truncated) { + field->set_warning(MRN_SEVERITY_WARNING, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_time(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_time *time_field = (Field_time *)field; + MYSQL_TIME mysql_time; + time_field->get_date(&mysql_time, Time::Options(current_thd)); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(MRN_SEVERITY_WARNING, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_datetime(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_datetime *datetime_field = (Field_datetime *)field; + MYSQL_TIME mysql_time; + datetime_field->get_date(&mysql_time, Time::Options(current_thd)); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_year(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + int year; + if (field->field_length == 2) { + year = static_cast(field->val_int() + 2000); + } else { + year = static_cast(field->val_int()); + } + + DBUG_PRINT("info", ("mroonga: year=%d", year)); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = year - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = 0; + date.tm_mday = 1; + + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +int ha_mroonga::generic_store_bulk_datetime2(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_datetimef *datetimef_field = (Field_datetimef *)field; + MYSQL_TIME mysql_time; + datetimef_field->get_date(&mysql_time, Time::Options(current_thd)); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +int ha_mroonga::generic_store_bulk_time2(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + MYSQL_TIME mysql_time; + field->get_date(&mysql_time, Time::Options(current_thd)); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::generic_store_bulk_new_date(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_newdate *newdate_field = (Field_newdate *)field; + MYSQL_TIME mysql_date; + newdate_field->get_date(&mysql_date, Time::Options(current_thd)); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_date, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_new_decimal(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String value; + Field_new_decimal *new_decimal_field = (Field_new_decimal *)field; + new_decimal_field->val_str(&value, NULL); + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value.ptr(), value.length()); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_blob(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String buffer; + Field_blob *blob = (Field_blob *)field; + String *value = blob->val_str(0, &buffer); + grn_obj_reinit(ctx, buf, GRN_DB_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value->ptr(), value->length()); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; +#ifdef MRN_HAVE_SPATIAL + String buffer; + Field_blob *geometry = (Field_blob *)field; + 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); +} + +#ifdef MRN_HAVE_MYSQL_TYPE_JSON +int ha_mroonga::generic_store_bulk_json(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String buffer; + Field_json *json = static_cast(field); + String *value = json->val_str(&buffer, NULL); + grn_obj_reinit(ctx, buf, GRN_DB_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value->ptr(), value->length()); + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::generic_store_bulk(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + return error; + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + error = generic_store_bulk_integer(field, buf); + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + error = generic_store_bulk_float(field, buf); + break; + case MYSQL_TYPE_NULL: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_TIMESTAMP: + error = generic_store_bulk_timestamp(field, buf); + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + error = generic_store_bulk_integer(field, buf); + break; + case MYSQL_TYPE_DATE: + error = generic_store_bulk_date(field, buf); + break; + case MYSQL_TYPE_TIME: + error = generic_store_bulk_time(field, buf); + break; + case MYSQL_TYPE_DATETIME: + error = generic_store_bulk_datetime(field, buf); + break; + case MYSQL_TYPE_YEAR: + error = generic_store_bulk_year(field, buf); + break; + case MYSQL_TYPE_NEWDATE: + error = generic_store_bulk_new_date(field, buf); + break; + case MYSQL_TYPE_VARCHAR: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_BIT: + error = generic_store_bulk_unsigned_integer(field, buf); + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + error = generic_store_bulk_timestamp(field, buf); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + error = generic_store_bulk_datetime2(field, buf); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + error = generic_store_bulk_time2(field, buf); + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + error = generic_store_bulk_new_decimal(field, buf); + break; + case MYSQL_TYPE_ENUM: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_SET: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + error = generic_store_bulk_blob(field, buf); + break; + case MYSQL_TYPE_VAR_STRING: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_STRING: + error = generic_store_bulk_fixed_size_string(field, buf); + break; + case MYSQL_TYPE_GEOMETRY: + error = generic_store_bulk_geometry(field, buf); + break; +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + error = generic_store_bulk_json(field, buf); + break; +#endif + default: + error = HA_ERR_UNSUPPORTED; + break; + } + DBUG_RETURN(error); +} + +void ha_mroonga::storage_store_field_string(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + field->store(value, value_length, field->charset()); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_integer(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_num *field_num = static_cast(field); + bool is_unsigned = field_num->unsigned_flag; + switch (value_length) { + case 1: + { + if (is_unsigned) { + unsigned char field_value; + field_value = *((unsigned char *)value); + field->store(field_value, is_unsigned); + } else { + signed char field_value; + field_value = *((signed char *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 2: + { + if (is_unsigned) { + unsigned short field_value; + field_value = *((unsigned short *)value); + field->store(field_value, is_unsigned); + } else { + short field_value; + field_value = *((short *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 4: + { + if (is_unsigned) { + unsigned int field_value; + field_value = *((unsigned int *)value); + field->store(field_value, is_unsigned); + } else { + int field_value; + field_value = *((int *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 8: + { + if (is_unsigned) { + unsigned long long int field_value; + field_value = *((unsigned long long int *)value); + DBUG_PRINT("info", ("mroonga: field_value=%llu", field_value)); + field->store(field_value, is_unsigned); + } else { + long long int field_value; + field_value = *((long long int *)value); + field->store(field_value, is_unsigned); + } + break; + } + default: + { + // Why!? + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%d>: " + "available sizes: [1, 2, 4, 8]", + value_length); + push_warning(ha_thd(), MRN_SEVERITY_WARNING, + HA_ERR_UNSUPPORTED, error_message); + storage_store_field_string(field, value, value_length); + break; + } + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_unsigned_integer(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + switch (value_length) { + case 1: + { + unsigned char field_value; + field_value = *((unsigned char *)value); + field->store(field_value, true); + break; + } + case 2: + { + unsigned short field_value; + field_value = *((unsigned short *)value); + field->store(field_value, true); + break; + } + case 4: + { + unsigned int field_value; + field_value = *((unsigned int *)value); + field->store(field_value, true); + break; + } + case 8: + { + unsigned long long int field_value; + field_value = *((unsigned long long int *)value); + DBUG_PRINT("info", ("mroonga: field_value=%llu", field_value)); + field->store(field_value, true); + break; + } + default: + { + // Why!? + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%d>: " + "available sizes: [1, 2, 4, 8]", + value_length); + push_warning(ha_thd(), MRN_SEVERITY_WARNING, + HA_ERR_UNSUPPORTED, error_message); + storage_store_field_string(field, value, value_length); + break; + } + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_float(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + double field_value; + field_value = *((double *)value); + field->store(field_value); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_timestamp(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + Field_timestamp *timestamp_field = (Field_timestamp *)field; +#ifdef MRN_TIMESTAMP_USE_TIMEVAL + struct timeval time_value; + GRN_TIME_UNPACK(time, time_value.tv_sec, time_value.tv_usec); + timestamp_field->store_timestamp(&time_value); +#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T) + long long int sec, usec; + GRN_TIME_UNPACK(time, sec, usec); + timestamp_field->store_TIME(static_cast(sec), + static_cast(usec)); +#else + int32 sec, usec __attribute__((unused)); + GRN_TIME_UNPACK(time, sec, usec); + timestamp_field->store_timestamp(sec); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_date(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + long long int sec, usec __attribute__((unused)); + GRN_TIME_UNPACK(time, sec, usec); + struct tm date; + time_t sec_t = static_cast(sec); + gmtime_r(&sec_t, &date); + long long int date_in_mysql = + (date.tm_year + mrn::TimeConverter::TM_YEAR_BASE) * 10000 + + (date.tm_mon + 1) * 100 + + date.tm_mday; + field->store(date_in_mysql, false); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_time(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_time *time_field = (Field_time *)field; + time_field->store_time(&mysql_time, mysql_time.time_type); +#else + field->store_time(&mysql_time); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_datetime(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_datetime; + memset(&mysql_datetime, 0, sizeof(MYSQL_TIME)); + mysql_datetime.time_type = MYSQL_TIMESTAMP_DATETIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_datetime); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_datetime *datetime_field = (Field_datetime *)field; + datetime_field->store_time(&mysql_datetime, mysql_datetime.time_type); +#else + field->store_time(&mysql_datetime); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_year(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_DATE; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); + DBUG_PRINT("info", ("mroonga: stored %d", mysql_time.year)); + field->store(mysql_time.year, false); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_new_date(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_date; + memset(&mysql_date, 0, sizeof(MYSQL_TIME)); + mysql_date.time_type = MYSQL_TIMESTAMP_DATE; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_date); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_newdate *newdate_field = (Field_newdate *)field; + newdate_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATE); +#else + field->store_time(&mysql_date); +#endif + DBUG_VOID_RETURN; +} + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +void ha_mroonga::storage_store_field_datetime2(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_datetime; + memset(&mysql_datetime, 0, sizeof(MYSQL_TIME)); + mysql_datetime.time_type = MYSQL_TIMESTAMP_DATETIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_datetime); + field->store_time(&mysql_datetime); + DBUG_VOID_RETURN; +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +void ha_mroonga::storage_store_field_time2(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); + field->store_time(&mysql_time); + DBUG_VOID_RETURN; +} +#endif + +void ha_mroonga::storage_store_field_blob(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_blob *blob = (Field_blob *)field; + String *blob_buffer = &blob_buffers[field->field_index]; + blob_buffer->length(0); + blob_buffer->reserve(value_length); + blob_buffer->q_append(value, value_length); + blob->set_ptr((uint32) value_length, (uchar *) blob_buffer->ptr()); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_geometry(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); +#ifdef 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; + latitude = field_value->latitude; + longitude = field_value->longitude; + if (grn_source_column_geo) { + GRN_GEO_POINT_SET(ctx, &source_point, latitude, longitude); + } + memset(wkb, 0, SRID_SIZE); + memset(wkb + SRID_SIZE, Geometry::wkb_ndr, 1); // wkb_ndr is meaningless. + int4store(wkb + SRID_SIZE + 1, Geometry::wkb_point); + double latitude_in_degree, longitude_in_degree; + latitude_in_degree = GRN_GEO_MSEC2DEGREE(latitude); + longitude_in_degree = GRN_GEO_MSEC2DEGREE(longitude); + float8store(wkb + SRID_SIZE + WKB_HEADER_SIZE, + longitude_in_degree); + float8store(wkb + SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE, + latitude_in_degree); + String *geometry_buffer = &blob_buffers[field->field_index]; + geometry_buffer->length(0); + uint wkb_length = sizeof(wkb) / sizeof(*wkb); + Field_blob *geometry= (Field_blob *)field; + geometry_buffer->reserve(wkb_length); + geometry_buffer->q_append((const char *) wkb, wkb_length); + geometry->set_ptr((uint32) wkb_length, (uchar *) geometry_buffer->ptr()); +#endif + DBUG_VOID_RETURN; +} + +#ifdef MRN_HAVE_MYSQL_TYPE_JSON +void ha_mroonga::storage_store_field_json(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_json *json = static_cast(field); + json->store(value, value_length, field->charset()); + DBUG_VOID_RETURN; +} +#endif + +void ha_mroonga::storage_store_field(Field *field, + const char *value, uint value_length) +{ + field->set_notnull(); + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + storage_store_field_integer(field, value, value_length); + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + storage_store_field_float(field, value, value_length); + break; + case MYSQL_TYPE_NULL: + storage_store_field_unsigned_integer(field, value, value_length); + break; + case MYSQL_TYPE_TIMESTAMP: + storage_store_field_timestamp(field, value, value_length); + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + storage_store_field_integer(field, value, value_length); + break; + case MYSQL_TYPE_DATE: + storage_store_field_date(field, value, value_length); + break; + case MYSQL_TYPE_TIME: + storage_store_field_time(field, value, value_length); + break; + case MYSQL_TYPE_DATETIME: + storage_store_field_datetime(field, value, value_length); + break; + case MYSQL_TYPE_YEAR: + storage_store_field_year(field, value, value_length); + break; + case MYSQL_TYPE_NEWDATE: + storage_store_field_new_date(field, value, value_length); + break; + case MYSQL_TYPE_VARCHAR: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_BIT: + storage_store_field_unsigned_integer(field, value, value_length); + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + storage_store_field_timestamp(field, value, value_length); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + storage_store_field_datetime2(field, value, value_length); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + storage_store_field_time2(field, value, value_length); + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + storage_store_field_unsigned_integer(field, value, value_length); + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + storage_store_field_blob(field, value, value_length); + break; + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_GEOMETRY: + storage_store_field_geometry(field, value, value_length); + break; + case MYSQL_TYPE_VARCHAR_COMPRESSED: + case MYSQL_TYPE_BLOB_COMPRESSED: + DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + storage_store_field_json(field, value, value_length); + break; +#endif + } +} + +void ha_mroonga::storage_store_field_column(Field *field, bool is_primary_key, + int nth_column, grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + + if (!grn_columns[nth_column]) { + DBUG_VOID_RETURN; + } + + grn_obj *column = grn_columns[nth_column]; + grn_id range_id = grn_obj_get_range(ctx, column); + grn_obj *range = grn_column_ranges[nth_column]; + grn_obj *value = &new_value_buffer; + + if (mrn::grn::is_table(range)) { + if (mrn::grn::is_vector_column(column)) { + grn_obj_reinit(ctx, value, range_id, GRN_OBJ_VECTOR); + grn_obj_get_value(ctx, column, record_id, value); + + grn_obj unvectored_value; + GRN_TEXT_INIT(&unvectored_value, 0); + int n_ids = GRN_BULK_VSIZE(value) / sizeof(grn_id); + for (int i = 0; i < n_ids; i++) { + grn_id id = GRN_RECORD_VALUE_AT(value, i); + if (i > 0) { + GRN_TEXT_PUTS(ctx, &unvectored_value, mrn_vector_column_delimiter); + } + char key[GRN_TABLE_MAX_KEY_SIZE]; + int key_length; + key_length = grn_table_get_key(ctx, range, id, + &key, GRN_TABLE_MAX_KEY_SIZE); + GRN_TEXT_PUT(ctx, &unvectored_value, key, key_length); + } + storage_store_field(field, + GRN_TEXT_VALUE(&unvectored_value), + GRN_TEXT_LEN(&unvectored_value)); + GRN_OBJ_FIN(ctx, &unvectored_value); + } else { + grn_obj_reinit(ctx, value, range_id, 0); + grn_obj_get_value(ctx, column, record_id, value); + + grn_id id = GRN_RECORD_VALUE(value); + char key[GRN_TABLE_MAX_KEY_SIZE]; + int key_length; + key_length = grn_table_get_key(ctx, range, id, + &key, GRN_TABLE_MAX_KEY_SIZE); + storage_store_field(field, key, key_length); + } + } else { + grn_obj_reinit(ctx, value, range_id, 0); + grn_obj_get_value(ctx, column, record_id, value); + 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; +} + +void ha_mroonga::storage_store_fields(uchar *buf, grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: stored record ID: %d", record_id)); + + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(buf, table->record[0]); + + Field *primary_key_field = NULL; + if (table->s->primary_key != MAX_INDEXES) { + KEY *key_info = &(table->s->key_info[table->s->primary_key]); + if (KEY_N_KEY_PARTS(key_info) == 1) { + primary_key_field = key_info->key_part[0].field; + } + } + + int i; + int n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + + if (bitmap_is_set(table->read_set, field->field_index) || + bitmap_is_set(table->write_set, field->field_index)) { + const char *column_name = field->field_name.str; + + if (ignoring_no_key_columns) { + KEY *key_info = &(table->s->key_info[active_index]); + if (strcmp(key_info->key_part[0].field->field_name.str, column_name)) { + continue; + } + } + + mrn::DebugColumnAccess debug_column_access(table, &table->write_set); + DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index)); + field->move_field_offset(ptr_diff); + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + // for _id column + field->set_notnull(); + field->store((int)record_id); + } else if (primary_key_field && + strcmp(primary_key_field->field_name.str, column_name) == 0) { + // for primary key column + storage_store_field_column(field, true, i, record_id); + } else { + storage_store_field_column(field, false, i, record_id); + } + field->move_field_offset(-ptr_diff); + } + } + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data, + const uchar *new_data, + grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: stored record ID: %d", record_id)); + my_ptrdiff_t ptr_diff_old = PTR_BYTE_DIFF(old_data, table->record[0]); + my_ptrdiff_t ptr_diff_new = 0; +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + if (!written_by_row_based_binlog) { + if (check_written_by_row_based_binlog()) { + written_by_row_based_binlog = 2; + } else { + written_by_row_based_binlog = 1; + } + } + bool need_all_columns = + (new_data && written_by_row_based_binlog == 2); +#endif + if (new_data) { + ptr_diff_new = PTR_BYTE_DIFF(new_data, table->record[0]); + } + int i; + int n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + if ( + !bitmap_is_set(table->read_set, field->field_index) && + !bitmap_is_set(table->write_set, field->field_index) && +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + ( + need_all_columns || +#endif + bitmap_is_set(&multiple_column_key_bitmap, field->field_index) +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + ) +#endif + ) { + mrn::DebugColumnAccess debug_column_access(table, &table->write_set); + DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index)); + grn_obj value; + GRN_OBJ_INIT(&value, GRN_BULK, 0, grn_obj_get_range(ctx, grn_columns[i])); + grn_obj_get_value(ctx, grn_columns[i], record_id, &value); + // old column + field->move_field_offset(ptr_diff_old); + storage_store_field(field, GRN_BULK_HEAD(&value), GRN_BULK_VSIZE(&value)); + field->move_field_offset(-ptr_diff_old); + if (new_data) { + // new column + field->move_field_offset(ptr_diff_new); + storage_store_field(field, GRN_BULK_HEAD(&value), GRN_BULK_VSIZE(&value)); + field->move_field_offset(-ptr_diff_new); + } + GRN_OBJ_FIN(ctx, &value); + } + } + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_fields_by_index(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + uint key_length; + void *key; + KEY *key_info = &table->key_info[active_index]; + if (table->s->primary_key == active_index) + key_length = grn_table_cursor_get_key(ctx, cursor, &key); + else + key_length = grn_table_cursor_get_key(ctx, index_table_cursor, &key); + + if (KEY_N_KEY_PARTS(key_info) == 1) { + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(buf, table->record[0]); + Field *field = key_info->key_part->field; + mrn::DebugColumnAccess debug_column_access(table, &table->write_set); + field->move_field_offset(ptr_diff); + storage_store_field(field, (const char *)key, key_length); + field->move_field_offset(-ptr_diff); + } else { + uchar enc_buf[MAX_KEY_LENGTH]; + uint enc_len; + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + codec.decode(static_cast(key), key_length, enc_buf, &enc_len); + key_restore(buf, enc_buf, key_info, enc_len); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::storage_encode_key_normalize_min_sort_chars(Field *field, + uchar *buf, + uint size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (size == 0) { + DBUG_RETURN(0); + } + if (!field->has_charset()) { + DBUG_RETURN(0); + } + + uint16 raw_min_sort_char = + static_cast(field->sort_charset()->min_sort_char); + if (raw_min_sort_char <= UINT_MAX8) { + uchar min_sort_char = static_cast(raw_min_sort_char); + for (uint i = size - 1; i > 0; --i) { + if (buf[i] != min_sort_char) { + break; + } + buf[i] = '\0'; + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_fixed_size_string(Field *field, + const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + memcpy(buf, key, field->field_length); + *size = field->field_length; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_variable_size_string(Field *field, + const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + *size = uint2korr(key); + memcpy(buf, key + HA_KEY_BLOB_LENGTH, *size); + storage_encode_key_normalize_min_sort_chars(field, buf, *size); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_timestamp(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int time; + MYSQL_TIME mysql_time; +#ifdef MRN_MARIADB_P + if (field->decimals() == 0) { + my_time_t my_time = sint4korr(key); + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, my_time); + mysql_time.second_part = 0; + } else { + Field_timestamp_hires *timestamp_hires_field = + (Field_timestamp_hires *)field; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + TABLE *table_backup = field->table; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + field->table = table; + Temporal::Options opt(TIME_CONV_NONE, current_thd); + timestamp_hires_field->get_date(&mysql_time, opt); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + field->table = table_backup; + } +#else + my_time_t my_time = uint4korr(key); + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, my_time); +#endif + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_time(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long int time; +#ifdef MRN_MARIADB_P + MYSQL_TIME mysql_time; + bool truncated = false; + if (field->decimals() == 0) { + long long int packed_time = sint3korr(key); + mysql_time.neg = false; + if (packed_time < 0) { + mysql_time.neg = true; + packed_time = -packed_time; + } + mysql_time.year = 0; + mysql_time.month = 0; + mysql_time.day = 0; + mysql_time.hour = (int)(packed_time / 10000); + long long int minute_part = packed_time - mysql_time.hour * 10000; + mysql_time.minute = (int)(minute_part / 100); + mysql_time.second = (int)(minute_part % 100); + mysql_time.second_part = 0; + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + } else { + Field_time_hires *time_hires_field = (Field_time_hires *)field; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + Temporal::Options opt(TIME_CONV_NONE, current_thd); + time_hires_field->get_date(&mysql_time, opt); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + } + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } +#else + int mysql_time = (int)sint3korr(key); + int sec = + mysql_time / 10000 * 60 * 60 + + mysql_time / 100 % 100 * 60 + + mysql_time % 60; + int usec = 0; + time = GRN_TIME_PACK(sec, usec); +#endif + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_year(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + int year = (int)key[0]; + + struct tm datetime; + memset(&datetime, 0, sizeof(struct tm)); + datetime.tm_year = year; + datetime.tm_mon = 0; + datetime.tm_mday = 1; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&datetime, usec, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_datetime(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int time; +#ifdef MRN_MARIADB_P + if (field->decimals() > 0) { + Field_datetime_hires *datetime_hires_field = (Field_datetime_hires *)field; + MYSQL_TIME mysql_time; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + Temporal::Options opt(TIME_CONV_NONE, current_thd); + datetime_hires_field->get_date(&mysql_time, opt); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + } else +#endif + { + long long int encoded_datetime = sint8korr(key); + uint32 part1 = (uint32)(encoded_datetime / 1000000LL); + uint32 part2 = (uint32)(encoded_datetime - + (unsigned long long int)part1 * 1000000LL); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = part1 / 10000 - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = part1 / 100 % 100 - 1; + date.tm_mday = part1 % 100; + date.tm_hour = part2 / 10000; + date.tm_min = part2 / 100 % 100; + date.tm_sec = part2 % 100; + int usec = 0; + mrn::TimeConverter time_converter; + time = time_converter.tm_to_grn_time(&date, usec, &truncated); + } + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 +int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_timestampf *timestamp2_field = (Field_timestampf *)field; + struct timeval tm; + my_timestamp_from_binary(&tm, key, timestamp2_field->decimals()); + MYSQL_TIME mysql_time; + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, (my_time_t)tm.tv_sec); + mysql_time.second_part = tm.tv_usec; + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +int ha_mroonga::storage_encode_key_datetime2(Field *field, bool is_null, + const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_datetimef *datetime2_field = (Field_datetimef *)field; + longlong packed_time = is_null ? 0 : + my_datetime_packed_from_binary(key, datetime2_field->decimals()); + MYSQL_TIME mysql_time; + TIME_from_longlong_datetime_packed(&mysql_time, packed_time); + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +int ha_mroonga::storage_encode_key_time2(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_timef *time2_field = (Field_timef *)field; + longlong packed_time = + my_time_packed_from_binary(key, time2_field->decimals()); + MYSQL_TIME mysql_time; + TIME_from_longlong_time_packed(&mysql_time, packed_time); + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::storage_encode_key_enum(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (field->pack_length() == 1) { + uchar value; + value = key[0]; + *size = 1; + memcpy(buf, &value, *size); + } else { + uint16 value; + mrn::value_decoder::decode(&value, key); + *size = 2; + memcpy(buf, &value, *size); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_set(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + Field_set unpacker((uchar *)key, field->field_length, (uchar *)(key - 1), + field->null_bit, field->unireg_check, + &field->field_name, + field->pack_length(), + static_cast(field)->typelib, + static_cast(field)->charset()); + switch (field->pack_length()) { + case 1: + { + int8 signed_value = (int8)(unpacker.val_int()); + uint8 unsigned_value = *((uint8 *)&signed_value); + *size = 1; + memcpy(buf, &unsigned_value, *size); + } + break; + case 2: + { + int16 signed_value = (int16)(unpacker.val_int()); + uint16 unsigned_value = *((uint16 *)&signed_value); + *size = 2; + memcpy(buf, &unsigned_value, *size); + } + break; + case 3: + case 4: + { + int32 signed_value = (int32)(unpacker.val_int()); + uint32 unsigned_value = *((uint32 *)&signed_value); + *size = 4; + memcpy(buf, &unsigned_value, *size); + } + break; + case 8: + default: + { + int64 signed_value = (int64)(unpacker.val_int()); + uint64 unsigned_value = *((uint64 *)&signed_value); + *size = 8; + memcpy(buf, &unsigned_value, *size); + } + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + bool truncated = false; + bool is_null = false; + const uchar *ptr = key; + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + if (field->null_bit) { + is_null = *ptr; + ptr += 1; + } + + switch (field->real_type()) { + case MYSQL_TYPE_BIT: + case MYSQL_TYPE_TINY: + { + memcpy(buf, ptr, 1); + *size = 1; + break; + } + case MYSQL_TYPE_SHORT: + { + memcpy(buf, ptr, 2); + *size = 2; + break; + } + case MYSQL_TYPE_INT24: + { + memcpy(buf, ptr, 3); + buf[3] = 0; + *size = 4; + break; + } + case MYSQL_TYPE_LONG: + { + memcpy(buf, ptr, 4); + *size = 4; + break; + } + case MYSQL_TYPE_TIMESTAMP: + error = storage_encode_key_timestamp(field, ptr, buf, size); + break; + case MYSQL_TYPE_LONGLONG: + { + memcpy(buf, ptr, 8); + *size = 8; + break; + } + case MYSQL_TYPE_FLOAT: + { + float float_value; + double double_value; + mrn::value_decoder::decode(&float_value, ptr); + double_value = float_value; + memcpy(buf, &double_value, 8); + *size = 8; + break; + } + case MYSQL_TYPE_DOUBLE: + { + double val; + mrn::value_decoder::decode(&val, ptr); + memcpy(buf, &val, 8); + *size = 8; + break; + } + case MYSQL_TYPE_TIME: + error = storage_encode_key_time(field, ptr, buf, size); + break; + case MYSQL_TYPE_YEAR: + error = storage_encode_key_year(field, ptr, buf, size); + break; + case MYSQL_TYPE_DATETIME: + error = storage_encode_key_datetime(field, ptr, buf, size); + break; + case MYSQL_TYPE_NEWDATE: + { + uint32 encoded_date = uint3korr(ptr); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = encoded_date / (16 * 32) - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = encoded_date / 32 % 16 - 1; + date.tm_mday = encoded_date % 32; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, + &truncated); + if (truncated) { + if (MRN_ABORT_ON_WARNING(ha_thd())) { + error = MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()); + } + field->set_warning(MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(ha_thd()), + 1); + } + memcpy(buf, &time, 8); + *size = 8; + break; + } +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + error = storage_encode_key_timestamp2(field, ptr, buf, size); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + error = storage_encode_key_datetime2(field, is_null, ptr, buf, size); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + error = storage_encode_key_time2(field, ptr, buf, size); + break; +#endif + case MYSQL_TYPE_STRING: + error = storage_encode_key_fixed_size_string(field, ptr, buf, size); + break; + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_BLOB: + error = storage_encode_key_variable_size_string(field, ptr, buf, size); + break; + case MYSQL_TYPE_ENUM: + error = storage_encode_key_enum(field, ptr, buf, size); + break; + case MYSQL_TYPE_SET: + error = storage_encode_key_set(field, ptr, buf, size); + break; + default: + error = HA_ERR_UNSUPPORTED; + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info, + const uchar *key, + uint key_length, + uchar *buffer, + uint *encoded_length) +{ + MRN_DBUG_ENTER_METHOD(); + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + int error = codec.encode(key, key_length, buffer, encoded_length); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, + const uchar *start, + uint start_size, + const uchar *end, + uint end_size, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + uint encoded_key_size = codec.size(); + if (start) { + memset(min_buffer, 0, encoded_key_size); + error = codec.encode(start, start_size, + min_buffer, min_encoded_size); + // TODO: handle error? + *min_encoded_size = encoded_key_size; + } + if (end) { + memset(max_buffer, 0xff, encoded_key_size); + error = codec.encode(end, end_size, + max_buffer, max_encoded_size); + // TODO: handle error? + *max_encoded_size = encoded_key_size; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, + const key_range *start, + const key_range *end, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size) +{ + MRN_DBUG_ENTER_METHOD(); + + const uchar *start_data = NULL; + uint start_size = 0; + const uchar *end_data = NULL; + uint end_size = 0; + if (start) { + start_data = start->key; + start_size = start->length; + } + if (end) { + end_data = end->key; + end_size = end->length; + } + + int error = storage_encode_multiple_column_key_range(key_info, + start_data, start_size, + end_data, end_size, + min_buffer, + min_encoded_size, + max_buffer, + max_encoded_size); + + DBUG_RETURN(error); +} + +int ha_mroonga::generic_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + 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 iterator(*(select_lex->ftfunc_list)); + Item_func_match *item; + while ((item = iterator++)) { + if (item->ft_handler) { + mrn_generic_ft_clear(item->ft_handler); + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_reset(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + if (alter_key_info_buffer) { + my_free(alter_key_info_buffer); + alter_key_info_buffer = NULL; + } +#else + if (wrap_alter_key_info) { + my_free(wrap_alter_key_info); + wrap_alter_key_info = NULL; + } +#endif + wrap_ft_init_count = 0; + int generic_error = generic_reset(); + if (error == 0) { + error = generic_error; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error; + error = generic_reset(); + DBUG_RETURN(error); +} + +int ha_mroonga::reset() +{ + int error = 0; + THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: this=%p", this)); + clear_empty_value_records(); + clear_search_result(); + clear_search_result_geo(); + if (share->wrapper_mode) + error = wrapper_reset(); + else + error = storage_reset(); + ignoring_no_key_columns = false; + inserting_with_update = false; + ignoring_duplicated_key = false; + fulltext_searching = false; + replacing_ = false; + written_by_row_based_binlog = 0; + mrn_lock_type = F_UNLCK; + mrn_clear_slot_data(thd); + current_ft_item = NULL; + DBUG_RETURN(error); +} + +handler *ha_mroonga::wrapper_clone(const char *name, MEM_ROOT *mem_root) +{ + handler *cloned_handler; + MRN_DBUG_ENTER_METHOD(); + if (!(cloned_handler = get_new_handler(table->s, mem_root, + table->s->db_type()))) + DBUG_RETURN(NULL); + ((ha_mroonga *) cloned_handler)->is_clone = true; + ((ha_mroonga *) cloned_handler)->parent_for_clone = this; + ((ha_mroonga *) cloned_handler)->mem_root_for_clone = mem_root; + if (cloned_handler->ha_open(table, table->s->normalized_path.str, + table->db_stat, HA_OPEN_IGNORE_IF_LOCKED)) + { + delete cloned_handler; + DBUG_RETURN(NULL); + } + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::storage_clone(const char *name, MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + cloned_handler = handler::clone(name, mem_root); + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::clone(const char *name, MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + if (share->wrapper_mode) + { + cloned_handler = wrapper_clone(name, mem_root); + } else { + cloned_handler = storage_clone(name, mem_root); + } + DBUG_RETURN(cloned_handler); +} + +uint8 ha_mroonga::wrapper_table_cache_type() +{ + uint8 res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->table_cache_type(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +uint8 ha_mroonga::storage_table_cache_type() +{ + MRN_DBUG_ENTER_METHOD(); + uint8 type = handler::table_cache_type(); + DBUG_RETURN(type); +} + +uint8 ha_mroonga::table_cache_type() +{ + MRN_DBUG_ENTER_METHOD(); + uint8 type; + if (share->wrapper_mode) + { + type = wrapper_table_cache_type(); + } else { + type = storage_table_cache_type(); + } + DBUG_RETURN(type); +} + +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ +ha_rows ha_mroonga::wrapper_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + KEY *key_info = &(table->key_info[keyno]); + if (mrn_is_geo_key(key_info)) { + rows = handler::multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, flags, cost); + DBUG_RETURN(rows); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + rows = wrap_handler->multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, flags, + cost); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::storage_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::multi_range_read_info_const(keyno, seq, + seq_init_param, + n_ranges, bufsz, flags, + cost); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, + flags, cost); + } else { + rows = storage_multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, + flags, cost); + } + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::wrapper_multi_range_read_info(uint keyno, uint n_ranges, + uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + KEY *key_info = &(table->key_info[keyno]); + if (mrn_is_geo_key(key_info)) { + rows = handler::multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + DBUG_RETURN(rows); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + rows = wrap_handler->multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::storage_multi_range_read_info(uint keyno, uint n_ranges, + uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + } else { + rows = storage_multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + } + DBUG_RETURN(rows); +} + +int ha_mroonga::wrapper_multi_range_read_init(RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = handler::multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_multi_range_read_init(RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + DBUG_RETURN(error); +} + +int ha_mroonga::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + } else { + error = storage_multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = handler::multi_range_read_next(range_info); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->multi_range_read_next(range_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::multi_range_read_next(range_info); + DBUG_RETURN(error); +} + +int ha_mroonga::multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_multi_range_read_next(range_info); + } else { + error = storage_multi_range_read_next(range_info); + } + DBUG_RETURN(error); +} +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ +int ha_mroonga::wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = handler::read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + DBUG_RETURN(error); +} + +int ha_mroonga::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + } else { + error = storage_read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[active_index]); + if (mrn_is_geo_key(key_info)) { + error = handler::read_multi_range_next(found_range_p); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_multi_range_next(found_range_p); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::read_multi_range_next(found_range_p); + DBUG_RETURN(error); +} + +int ha_mroonga::read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_multi_range_next(found_range_p); + } else { + error = storage_read_multi_range_next(found_range_p); + } + DBUG_RETURN(error); +} +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::wrapper_start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::wrapper_start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + wrap_handler->ha_start_bulk_insert(rows, flags); +#else + wrap_handler->ha_start_bulk_insert(rows); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::storage_start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::storage_start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) { +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + wrapper_start_bulk_insert(rows, flags); +#else + wrapper_start_bulk_insert(rows); +#endif + } else { +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + storage_start_bulk_insert(rows, flags); +#else + storage_start_bulk_insert(rows); +#endif + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_end_bulk_insert() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_end_bulk_insert(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_end_bulk_insert() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::end_bulk_insert() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_end_bulk_insert(); + } else { + error = storage_end_bulk_insert(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_delete_all_rows(grn_obj *target_grn_table, + const char *function_name) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + if (is_dry_write()) { + DBUG_PRINT("info", + ("mroonga: dry write: %s::%s", MRN_CLASS_NAME, function_name)); + DBUG_RETURN(error); + } + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, target_grn_table, + NULL, 0, + NULL, 0, + 0, -1, + 0); + if (cursor) { + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + grn_table_cursor_delete(ctx, cursor); + } + grn_table_cursor_close(ctx, cursor); + } else { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_all_rows() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_delete_all_rows(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (error) { + DBUG_RETURN(error); + } + + if (!wrapper_have_target_index()) { + DBUG_RETURN(error); + } + + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + error = generic_delete_all_rows(grn_index_tables[i], __FUNCTION__); + if (error) { + break; + } + } + + int grn_table_error; + grn_table_error = generic_delete_all_rows(grn_table, __FUNCTION__); + if (!error) { + error = grn_table_error; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_all_rows() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_delete_all_rows(grn_table, __FUNCTION__); + if (!error) { + uint n_keys = table->s->keys; + for (uint i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + continue; + } + + error = generic_delete_all_rows(index_table, __FUNCTION__); + if (error) { + break; + } + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::delete_all_rows() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_delete_all_rows(); + } else { + error = storage_delete_all_rows(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_truncate() +{ + int error = 0; + MRN_SHARE *tmp_share; + MRN_DBUG_ENTER_METHOD(); + + if (!(tmp_share = mrn_get_share(table->s->table_name.str, table, &error))) + DBUG_RETURN(error); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = parse_engine_table_options(ha_thd(), tmp_share->hton, table->s) + ? MRN_GET_ERROR_NUMBER + : wrap_handler->ha_truncate(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + mrn_free_share(tmp_share); + + if (!error && wrapper_have_target_index()) { + error = wrapper_truncate_index(); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_truncate_index() +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + if (is_dry_write()) { + DBUG_PRINT("info", + ("mroonga: dry write: %s::%s", MRN_CLASS_NAME, __FUNCTION__)); + DBUG_RETURN(error); + } + + grn_rc rc; + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY *key_info = &(table->key_info[i]); + + if (!(wrapper_is_target_index(key_info))) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + rc = grn_table_truncate(ctx, grn_index_tables[i]); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + rc = grn_table_truncate(ctx, grn_table); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_truncate() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + grn_rc rc; + rc = grn_table_truncate(ctx, grn_table); + if (rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + error = storage_truncate_index(); + + if (!error && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = 0; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = false; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_truncate_index() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_rc rc; + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &(table->key_info[i]); + + if ( + !(key_info->flags & HA_NOSAME) && + (KEY_N_KEY_PARTS(key_info) == 1 || (key_info->flags & HA_FULLTEXT)) + ) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + rc = grn_table_truncate(ctx, grn_index_tables[i]); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + DBUG_RETURN(error); +} + +int ha_mroonga::truncate() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_truncate(); + } else { + error = storage_truncate(); + } + if (!error) { + operations_->clear(table->s->table_name.str, + table->s->table_name.length); + } + DBUG_RETURN(error); +} + +double ha_mroonga::wrapper_scan_time() +{ + double res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->scan_time(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +double ha_mroonga::storage_scan_time() +{ + MRN_DBUG_ENTER_METHOD(); + double time = handler::scan_time(); + DBUG_RETURN(time); +} + +double ha_mroonga::scan_time() +{ + MRN_DBUG_ENTER_METHOD(); + double time; + if (share->wrapper_mode) + { + time = wrapper_scan_time(); + } else { + time = storage_scan_time(); + } + DBUG_RETURN(time); +} + +double ha_mroonga::wrapper_read_time(uint index, uint ranges, ha_rows rows) +{ + double res; + MRN_DBUG_ENTER_METHOD(); + if (index < MAX_KEY) { + KEY *key_info = &(table->key_info[index]); + if (mrn_is_geo_key(key_info)) { + res = handler::read_time(index, ranges, rows); + DBUG_RETURN(res); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->read_time(share->wrap_key_nr[index], ranges, rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->read_time(index, ranges, rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +double ha_mroonga::storage_read_time(uint index, uint ranges, ha_rows rows) +{ + MRN_DBUG_ENTER_METHOD(); + double time = handler::read_time(index, ranges, rows); + DBUG_RETURN(time); +} + +double ha_mroonga::read_time(uint index, uint ranges, ha_rows rows) +{ + MRN_DBUG_ENTER_METHOD(); + double time; + if (share->wrapper_mode) + { + time = wrapper_read_time(index, ranges, rows); + } else { + time = storage_read_time(index, ranges, rows); + } + DBUG_RETURN(time); +} + +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING +const key_map *ha_mroonga::wrapper_keys_to_use_for_scanning() +{ + const key_map *res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->keys_to_use_for_scanning(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +const key_map *ha_mroonga::storage_keys_to_use_for_scanning() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(&key_map_full); +} + +const key_map *ha_mroonga::keys_to_use_for_scanning() +{ + MRN_DBUG_ENTER_METHOD(); + const key_map *key_map; + if (share->wrapper_mode) + { + key_map = wrapper_keys_to_use_for_scanning(); + } else { + key_map = storage_keys_to_use_for_scanning(); + } + DBUG_RETURN(key_map); +} +#endif + +ha_rows ha_mroonga::wrapper_estimate_rows_upper_bound() +{ + ha_rows res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->estimate_rows_upper_bound(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +ha_rows ha_mroonga::storage_estimate_rows_upper_bound() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::estimate_rows_upper_bound(); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::estimate_rows_upper_bound() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_estimate_rows_upper_bound(); + } else { + rows = storage_estimate_rows_upper_bound(); + } + DBUG_RETURN(rows); +} + +void ha_mroonga::wrapper_update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->update_create_info(create_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + handler::update_create_info(create_info); + if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + create_info->auto_increment_value = long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + if (!create_info->connect_string.str) + { + create_info->connect_string.str = table->s->connect_string.str; + create_info->connect_string.length = table->s->connect_string.length; + } + if (share->wrapper_mode) + wrapper_update_create_info(create_info); + else + storage_update_create_info(create_info); + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), true); + if (slot_data) { + slot_data->alter_create_info = create_info; + if (slot_data->alter_connect_string) { + my_free(slot_data->alter_connect_string); + slot_data->alter_connect_string = NULL; + } + if (create_info->connect_string.str) { + slot_data->alter_connect_string = + 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); + slot_data->alter_comment = NULL; + } + if (create_info->comment.str) { + slot_data->alter_comment = + 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; + } + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error = 0; + handler *hnd; + MRN_DBUG_ENTER_METHOD(); + + hnd = get_new_handler(tmp_share->table_share, + current_thd->mem_root, + tmp_share->hton); + if (!hnd) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + + if ((error = hnd->ha_rename_table(from, to))) + { + delete hnd; + DBUG_RETURN(error); + } + + error = wrapper_rename_index(from, to, tmp_share, + from_table_name, to_table_name); + + delete hnd; + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rename_index(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + grn_rc rc; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(from); + if (error) + DBUG_RETURN(error); + + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + const char *mysql_index_name = tmp_table_share->key_info[i].name.str; + mrn::IndexTableName from_index_table_name(from_table_name, mysql_index_name); + mrn::IndexTableName to_index_table_name(to_table_name, mysql_index_name); + grn_obj *index_table; + index_table = grn_ctx_get(ctx, + from_index_table_name.c_str(), + from_index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + from_index_table_name.old_c_str(), + from_index_table_name.old_length()); + } + if (index_table) { + rc = grn_table_rename(ctx, index_table, + to_index_table_name.c_str(), + to_index_table_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + } + + grn_obj *table = grn_ctx_get(ctx, from_table_name, strlen(from_table_name)); + if (ctx->rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + rc = grn_table_rename(ctx, table, to_table_name, + strlen(to_table_name)); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + grn_rc rc; + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + MRN_LONG_TERM_SHARE *from_long_term_share = tmp_share->long_term_share, + *to_long_term_share; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(from); + if (error) + DBUG_RETURN(error); + + if (!(to_long_term_share = mrn_get_long_term_share(to, strlen(to), &error))) + DBUG_RETURN(error); + to_long_term_share->auto_inc_value = from_long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: to_auto_inc_value=%llu", + to_long_term_share->auto_inc_value)); + to_long_term_share->auto_inc_inited = from_long_term_share->auto_inc_inited; + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + const char *mysql_index_name = tmp_table_share->key_info[i].name.str; + mrn::IndexTableName from_index_table_name(from_table_name, + mysql_index_name); + mrn::IndexTableName to_index_table_name(to_table_name, + mysql_index_name); + grn_obj *index_table; + index_table = grn_ctx_get(ctx, + from_index_table_name.c_str(), + from_index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + from_index_table_name.old_c_str(), + from_index_table_name.old_length()); + } + if (index_table) { + rc = grn_table_rename(ctx, index_table, + to_index_table_name.c_str(), + to_index_table_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + } + } +#ifdef MRN_SUPPORT_FOREIGN_KEYS + error = storage_rename_foreign_key(tmp_share, from_table_name, to_table_name); + if (error) { + goto error_end; + } +#endif + { + grn_obj *table_obj = grn_ctx_get(ctx, from_table_name, strlen(from_table_name)); + if (ctx->rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + rc = grn_table_rename(ctx, table_obj, to_table_name, + strlen(to_table_name)); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + } + DBUG_RETURN(0); + +error_end: + mrn_free_long_term_share(to_long_term_share); + DBUG_RETURN(error); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +int ha_mroonga::storage_rename_foreign_key(MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + uint i; + grn_obj *column, *ref_column; + grn_rc rc; + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + uint n_columns = tmp_table_share->fields; + MRN_DBUG_ENTER_METHOD(); + for (i = 0; i < n_columns; ++i) { + Field *field = tmp_table_share->field[i]; + + if (!is_foreign_key_field(from_table_name, field->field_name.str)) { + continue; + } + + grn_obj *grn_from_table = grn_ctx_get(ctx, from_table_name, -1); + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_from_table, + column_name.c_str(), + column_name.length()); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + mrn::IndexColumnName from_index_column_name(from_table_name, + column_name.c_str()); + ref_column = grn_obj_column(ctx, ref_table, + from_index_column_name.c_str(), + from_index_column_name.length()); + if (!ref_column) { + continue; + } + mrn::IndexColumnName to_index_column_name(to_table_name, + column_name.c_str()); + rc = grn_column_rename(ctx, ref_column, + to_index_column_name.c_str(), + to_index_column_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + DBUG_RETURN(0); +} +#endif + +int ha_mroonga::rename_table(const char *from, const char *to) +{ + int error = 0; + TABLE_LIST table_list; + TABLE_SHARE *tmp_table_share; + TABLE tmp_table; + MRN_SHARE *tmp_share; + MRN_DBUG_ENTER_METHOD(); + mrn::PathMapper to_mapper(to); + mrn::PathMapper from_mapper(from); + if (strcmp(from_mapper.db_name(), to_mapper.db_name())) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + + LEX_CSTRING db_name= { from_mapper.db_name(), strlen(from_mapper.db_name()) }; + LEX_CSTRING table_name= { from_mapper.mysql_table_name(), + strlen(from_mapper.mysql_table_name()) }; + table_list.init_one_table(&db_name, &table_name, 0,TL_WRITE); + mrn_open_mutex_lock(NULL); + tmp_table_share = mrn_create_tmp_table_share(&table_list, from, &error); + mrn_open_mutex_unlock(NULL); + if (!tmp_table_share) { + DBUG_RETURN(error); + } + tmp_table.s = tmp_table_share; +#ifdef WITH_PARTITION_STORAGE_ENGINE + tmp_table.part_info = NULL; +#endif + if (!(tmp_share = mrn_get_share(from, &tmp_table, &error))) + { + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + DBUG_RETURN(error); + } + + if (tmp_share->wrapper_mode) + { + error = wrapper_rename_table(from, to, tmp_share, + from_mapper.table_name(), + to_mapper.table_name()); + } else { + error = storage_rename_table(from, to, tmp_share, + from_mapper.table_name(), + to_mapper.table_name()); + } + + if (!error && to_mapper.table_name()[0] == '#') { + error = add_wrap_hton(to, tmp_share->hton); + } else if (error && from_mapper.table_name()[0] == '#') { + add_wrap_hton(from, tmp_share->hton); + } + if (!error) { + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + } + mrn_free_share(tmp_share); + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_crashed() const +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->is_crashed(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_is_crashed() const +{ + MRN_DBUG_ENTER_METHOD(); + mrn::DatabaseRepairer repairer(ctx, ha_thd()); + bool crashed = repairer.is_crashed(); + DBUG_RETURN(crashed); +} + +bool ha_mroonga::is_crashed() const +{ + MRN_DBUG_ENTER_METHOD(); + bool crashed; + if (share->wrapper_mode) + { + crashed = wrapper_is_crashed(); + } else { + crashed = storage_is_crashed(); + } + DBUG_RETURN(crashed); +} + +bool ha_mroonga::wrapper_auto_repair(int error) const +{ + bool 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 + repaired = wrap_handler->auto_repair(error); +#else + repaired = wrap_handler->auto_repair(); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(repaired); +} + +bool ha_mroonga::storage_auto_repair(int error) const +{ + MRN_DBUG_ENTER_METHOD(); + bool repaired; +#ifdef MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR + repaired = handler::auto_repair(error); +#else + repaired = handler::auto_repair(); +#endif + DBUG_RETURN(repaired); +} + +bool ha_mroonga::auto_repair(int error) const +{ + MRN_DBUG_ENTER_METHOD(); + 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) + { + repaired = wrapper_auto_repair(error); + } else { + repaired = storage_auto_repair(error); + } + DBUG_RETURN(repaired); +} + +bool ha_mroonga::auto_repair() const +{ + MRN_DBUG_ENTER_METHOD(); + 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.str); + 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.str); + grn_obj *index_table = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (!index_table) { + index_table = grn_ctx_get(ctx, + index_table_name.old_c_str(), + index_table_name.old_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_mroonga(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + for (i = 0; i < table_share->keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + continue; + } + + int sub_error = generic_disable_index(i, key_info); + if (error != 0 && sub_error != 0) { + error = sub_error; + } + } + } else { + error = HA_ERR_WRONG_COMMAND; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_disable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_disable_indexes(mode); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error == HA_ERR_WRONG_COMMAND) { + error = 0; + } + if (!error) { + error = wrapper_disable_indexes_mroonga(mode); + } + DBUG_RETURN(error); +} + +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; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE && + (key_info[i].flags & HA_NOSAME)) { + continue; + } + + int sub_error = generic_disable_index(i, key_info); + if (error != 0 && sub_error != 0) { + error = sub_error; + } + } + } else { + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + DBUG_RETURN(error); +} + +int ha_mroonga::disable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + error = wrapper_disable_indexes(mode); + } else { + error = storage_disable_indexes(mode); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_enable_indexes_mroonga(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i, j; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_columns[i]) { + break; + } + } + if (i == table_share->keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + DBUG_RETURN(0); + } + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *key_info = table_share->key_info; + uint n_keys = table_share->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + mrn::PathMapper mapper(share->table_name); + for (i = 0, j = 0; i < n_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + j++; + continue; + } + + if ((error = mrn_add_index_param(share, &key_info[i], i))) + { + break; + } + index_tables[i] = NULL; + index_columns[i] = NULL; + if (!grn_index_columns[i]) { + if ( + (key_info[i].flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } else if ( + mrn_is_geo_key(&key_info[i]) && + (error = wrapper_create_index_geo(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } + grn_index_columns[i] = index_columns[i]; + } + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + if (!error && i > j) + { + error = wrapper_fill_indexes(ha_thd(), table->key_info, index_columns, + n_keys); + } + bitmap_set_all(table->read_set); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + } else { + error = HA_ERR_WRONG_COMMAND; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_enable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + int mroonga_error = wrapper_enable_indexes_mroonga(mode); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_enable_indexes(mode); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error == HA_ERR_WRONG_COMMAND) { + error = mroonga_error; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_enable_indexes(uint mode) +{ + int error = 0; + uint n_keys = table_share->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); + bool have_multiple_column_index = false; + bool skip_unique_key = (mode == HA_KEY_SWITCH_NONUNIQ_SAVE); + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (!grn_index_columns[i]) { + break; + } + } + if (i == table_share->keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(0); + } + KEY *key_info = table->key_info; + bitmap_clear_all(table->read_set); + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) { + continue; + } + + if ((error = mrn_add_index_param(share, &key_info[i], i))) + { + break; + } + index_tables[i] = NULL; + if (!grn_index_columns[i]) { + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + share, &key_info[i], index_tables, + index_columns, i))) + { + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } + grn_index_tables[i] = index_tables[i]; + grn_index_columns[i] = index_columns[i]; + } else { + index_columns[i] = NULL; + } + } + if (!error && have_multiple_column_index) + { + error = storage_add_index_multiple_columns(key_info, n_keys, + index_tables, + index_columns, + skip_unique_key); + } + bitmap_set_all(table->read_set); + } else { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} + +int ha_mroonga::enable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + share->disable_keys = false; + if (share->wrapper_mode) + { + error = wrapper_enable_indexes(mode); + } else { + error = storage_enable_indexes(mode); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_check(THD* thd, HA_CHECK_OPT* check_opt) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_check(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_check(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + mrn::DatabaseRepairer repairer(ctx, thd); + if (repairer.is_corrupt()) { + DBUG_RETURN(HA_ADMIN_CORRUPT); + } else { + DBUG_RETURN(HA_ADMIN_OK); + } +} + +int ha_mroonga::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_check(thd, check_opt); + } else { + error = storage_check(thd, check_opt); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_fill_indexes(THD *thd, KEY *key_info, + grn_obj **index_columns, uint n_keys) +{ + int error = 0; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *tmp_key_info; +#ifdef MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK + int wrapper_lock_type_backup = wrap_handler->get_lock_type(); +#endif + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: n_keys=%u", n_keys)); + + grn_bool need_lock = true; + if (mrn_lock_type != F_UNLCK) { + need_lock = false; + } +#ifdef MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK + if (wrapper_lock_type_backup != F_UNLCK) { + need_lock = false; + } +#endif + if (need_lock) { + error = wrapper_external_lock(thd, F_WRLCK); + } + if (!error) { + if ( + !(error = wrapper_start_stmt(thd, thr_lock_data.type)) && + !(error = wrapper_rnd_init(true)) + ) { + grn_obj key; + GRN_TEXT_INIT(&key, 0); + grn_bulk_space(ctx, &key, p_key_info->key_length); + while (!(error = wrapper_rnd_next(table->record[0]))) + { + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), table->record[0], + p_key_info, p_key_info->key_length); + int added; + grn_id record_id; + mrn_change_encoding(ctx, NULL); + record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key), p_key_info->key_length, + &added); + if (record_id == GRN_ID_NIL) + { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to add a new record into groonga: key=<%.*s>", + (int) p_key_info->key_length, GRN_TEXT_VALUE(&key)); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + } + if (error) + break; + + uint k; + for (k = 0; k < n_keys; k++) { + tmp_key_info = &key_info[k]; + if (!(tmp_key_info->flags & HA_FULLTEXT) && + !mrn_is_geo_key(tmp_key_info)) { + continue; + } + if (!index_columns[k]) { + continue; + } + DBUG_PRINT("info", ("mroonga: key_num=%u", k)); + + uint l; + for (l = 0; l < KEY_N_KEY_PARTS(tmp_key_info); l++) { + Field *field = tmp_key_info->key_part[l].field; + + if (field->is_null()) + continue; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + break; + + error = generic_store_bulk(field, &new_value_buffer); + if (error) { + my_message(error, + "mroonga: wrapper: " + "failed to get new value for updating index.", + MYF(0)); + break; + } + + grn_obj *index_column = index_columns[k]; + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, l + 1, + NULL, &new_value_buffer); + grn_obj_unlink(ctx, index_column); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + break; + } + } + if (error) + break; + } + if (error) + break; + } + grn_obj_unlink(ctx, &key); + if (error != HA_ERR_END_OF_FILE) + wrapper_rnd_end(); + else + error = wrapper_rnd_end(); + } + if (need_lock) { + wrapper_external_lock(thd, F_UNLCK); + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_recreate_indexes(THD *thd) +{ + int error; + uint i, n_keys = table_share->keys; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *key_info = table->key_info; + MRN_DBUG_ENTER_METHOD(); + mrn::PathMapper mapper(table_share->normalized_path.str); + bitmap_clear_all(table->read_set); + clear_indexes(); + remove_grn_obj_force(mapper.table_name()); + grn_table = NULL; + mrn_set_bitmap_by_key(table->read_set, p_key_info); + for (i = 0; i < n_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[i])) { + continue; + } + mrn::IndexTableName index_table_name(mapper.table_name(), + table_share->key_info[i].name.str); + 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()); + + char index_column_full_old_name[MRN_MAX_PATH_SIZE]; + snprintf(index_column_full_old_name, MRN_MAX_PATH_SIZE, + "%s.%s", index_table_name.old_c_str(), INDEX_COLUMN_NAME); + remove_grn_obj_force(index_column_full_old_name); + remove_grn_obj_force(index_table_name.old_c_str()); + + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + error = wrapper_create_index(table_share->normalized_path.str, table, share); + if (error) + DBUG_RETURN(error); + error = wrapper_open_indexes(table_share->normalized_path.str); + if (error) + DBUG_RETURN(error); + error = wrapper_fill_indexes(thd, key_info, grn_index_columns, n_keys); + bitmap_set_all(table->read_set); + DBUG_RETURN(error); +} + +int ha_mroonga::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.str); + 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()); + + char index_column_full_old_name[MRN_MAX_PATH_SIZE]; + snprintf(index_column_full_old_name, MRN_MAX_PATH_SIZE, + "%s.%s", index_table_name.old_c_str(), INDEX_COLUMN_NAME); + remove_grn_obj_force(index_column_full_old_name); + remove_grn_obj_force(index_table_name.old_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; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_repair(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error && error != HA_ADMIN_NOT_IMPLEMENTED) + DBUG_RETURN(error); + error = wrapper_recreate_indexes(thd); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_recreate_indexes(thd); + DBUG_RETURN(error); +} + +int ha_mroonga::repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + share->disable_keys = false; + if (share->wrapper_mode) + { + error = wrapper_repair(thd, check_opt); + } else { + error = storage_repair(thd, check_opt); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_check_and_repair(THD *thd) +{ + 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); + 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(is_error_or_not_supported); +} + +bool ha_mroonga::storage_check_and_repair(THD *thd) +{ + MRN_DBUG_ENTER_METHOD(); + 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(); + bool is_error_or_not_supported; + if (share->wrapper_mode) + { + is_error_or_not_supported = wrapper_check_and_repair(thd); + } else { + is_error_or_not_supported = storage_check_and_repair(thd); + } + DBUG_RETURN(is_error_or_not_supported); +} + +int ha_mroonga::wrapper_analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_analyze(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_analyze(thd, check_opt); + } else { + error = storage_analyze(thd, check_opt); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_TRY_ALTER); +} + +int ha_mroonga::storage_optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_optimize(thd, check_opt); + } else { + error = storage_optimize(thd, check_opt); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_fatal_error(int error_num, uint flags) +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#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); +} + +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); +} + +bool ha_mroonga::is_fatal_error(int error_num, uint flags) +{ + MRN_DBUG_ENTER_METHOD(); + bool is_fatal_error; + if (share->wrapper_mode) + { + is_fatal_error = wrapper_is_fatal_error(error_num, flags); + } else { + is_fatal_error = storage_is_fatal_error(error_num, flags); + } + DBUG_RETURN(is_fatal_error); +} + +bool ha_mroonga::wrapper_check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->check_if_incompatible_data(create_info, table_changes); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + MRN_DBUG_ENTER_METHOD(); + uint n = table_share->fields; + for (uint i = 0; i < n; i++) { + Field *field = table->field[i]; + if (field->flags & FIELD_IS_RENAMED) { + DBUG_RETURN(COMPATIBLE_DATA_NO); + } + } + DBUG_RETURN(COMPATIBLE_DATA_YES); +} + +bool ha_mroonga::check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if ( + create_info->comment.str != table_share->comment.str || + create_info->connect_string.str != table_share->connect_string.str + ) { + DBUG_RETURN(COMPATIBLE_DATA_NO); + } + if (share->wrapper_mode) + { + res = wrapper_check_if_incompatible_data(create_info, table_changes); + } else { + res = storage_check_if_incompatible_data(create_info, table_changes); + } + DBUG_RETURN(res); +} + +int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info, + uint num_of_keys, + grn_obj **index_tables, + grn_obj **index_columns, + bool skip_unique_key) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (!(error = storage_rnd_init(true))) + { + while (!(error = storage_rnd_next(table->record[0]))) + { + for (uint i = 0; i < num_of_keys; i++) { + KEY *current_key_info = key_info + i; + if ( + KEY_N_KEY_PARTS(current_key_info) == 1 || + (current_key_info->flags & HA_FULLTEXT) + ) { + continue; + } + if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) { + continue; + } + if (!index_columns[i]) { + continue; + } + + /* fix key_info.key_length */ + for (uint j = 0; j < KEY_N_KEY_PARTS(current_key_info); j++) { + if ( + !current_key_info->key_part[j].null_bit && + current_key_info->key_part[j].field->null_bit + ) { + current_key_info->key_length++; + current_key_info->key_part[j].null_bit = + current_key_info->key_part[j].field->null_bit; + } + } + if (key_info[i].flags & HA_NOSAME) { + grn_id key_id; + if ((error = storage_write_row_unique_index(table->record[0], + current_key_info, + index_tables[i], + index_columns[i], + &key_id))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + error = HA_ERR_FOUND_DUPP_UNIQUE; + } + break; + } + } + if ((error = storage_write_row_multiple_column_index(table->record[0], + record_id, + current_key_info, + index_columns[i]))) + { + break; + } + } + if (error) + break; + } + if (error != HA_ERR_END_OF_FILE) { + storage_rnd_end(); + } else { + error = storage_rnd_end(); + } + } + + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER +bool ha_mroonga::wrapper_is_comment_changed(TABLE *table1, TABLE *table2) +{ + MRN_DBUG_ENTER_METHOD(); + + if (table1->s->comment.length != table2->s->comment.length) { + DBUG_RETURN(true); + } + + if (strncmp(table1->s->comment.str, + table2->s->comment.str, + table1->s->comment.length) == 0) { + DBUG_RETURN(false); + } else { + DBUG_RETURN(true); + } +} + +enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + uint n_keys; + uint i; + enum_alter_inplace_result result_mroonga = HA_ALTER_INPLACE_NO_LOCK; + DBUG_PRINT("info", + ("mroonga: handler_flags=%lu", + static_cast(ha_alter_info->handler_flags))); + + if (wrapper_is_comment_changed(table, altered_table)) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + if ( + (ha_alter_info->handler_flags & ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX) && + (ha_alter_info->handler_flags & + ( + ALTER_ADD_COLUMN | + ALTER_DROP_COLUMN | + MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE | + MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER | + ALTER_COLUMN_NULLABLE | + ALTER_COLUMN_NOT_NULLABLE | + ALTER_COLUMN_STORAGE_TYPE | + ALTER_ADD_STORED_GENERATED_COLUMN | + ALTER_COLUMN_COLUMN_FORMAT + ) + ) + ) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + if (ha_alter_info->handler_flags & ALTER_RENAME) + { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + + DBUG_ASSERT(ha_alter_info->key_count == altered_table->s->keys); + alter_key_count = 0; + alter_index_drop_count = 0; + alter_index_add_count = 0; + alter_handler_flags = ha_alter_info->handler_flags; + if (!(alter_key_info_buffer = (KEY *) + 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, + &wrap_altered_table, sizeof(TABLE), + &wrap_altered_table_key_info, sizeof(KEY) * altered_table->s->keys, + &wrap_altered_table_share, sizeof(TABLE_SHARE), + &wrap_altered_table_share_key_info, sizeof(KEY) * altered_table->s->keys, + NullS)) + ) { + DBUG_RETURN(HA_ALTER_ERROR); + } + *wrap_altered_table= *altered_table; + *wrap_altered_table_share= *altered_table->s; + mrn_init_sql_alloc(ha_thd(), &(wrap_altered_table_share->mem_root)); + + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = ha_alter_info->index_drop_buffer[i]; + if (key->flags & HA_FULLTEXT || mrn_is_geo_key(key)) { + result_mroonga = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; + } else { + memcpy(&alter_index_drop_buffer[alter_index_drop_count], + ha_alter_info->index_drop_buffer[i], sizeof(KEY)); + ++alter_index_drop_count; + } + } + if (!alter_index_drop_count) { + alter_handler_flags &= ~ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX; + } + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = + &altered_table->key_info[ha_alter_info->index_add_buffer[i]]; + if (key->flags & HA_FULLTEXT || mrn_is_geo_key(key)) { + result_mroonga = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; + } else { + alter_index_add_buffer[alter_index_add_count] = + ha_alter_info->index_add_buffer[i]; + ++alter_index_add_count; + } + } + if (!alter_index_add_count) { + alter_handler_flags &= ~ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX; + } + uint add_index_pos = 0; + n_keys = ha_alter_info->key_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = &altered_table->key_info[i]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + memcpy(&alter_key_info_buffer[alter_key_count], + &ha_alter_info->key_info_buffer[i], sizeof(KEY)); + memcpy(&wrap_altered_table_key_info[alter_key_count], + &altered_table->key_info[i], sizeof(KEY)); + memcpy(&wrap_altered_table_share_key_info[alter_key_count], + &altered_table->s->key_info[i], sizeof(KEY)); + if (add_index_pos < alter_index_add_count && + alter_index_add_buffer[add_index_pos] == i) { + alter_index_add_buffer[add_index_pos] = alter_key_count; + ++add_index_pos; + } + ++alter_key_count; + } + } + wrap_altered_table->key_info = wrap_altered_table_key_info; + wrap_altered_table_share->key_info = wrap_altered_table_share_key_info; + wrap_altered_table_share->keys = alter_key_count; + wrap_altered_table->s = wrap_altered_table_share; + + if (!alter_handler_flags) { + DBUG_RETURN(result_mroonga); + } + enum_alter_inplace_result result; + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->check_if_supported_inplace_alter(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (result_mroonga > result) + DBUG_RETURN(result); + DBUG_RETURN(result_mroonga); +} + +enum_alter_inplace_result ha_mroonga::storage_check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + alter_table_operations explicitly_unsupported_flags = + ALTER_ADD_FOREIGN_KEY | + ALTER_DROP_FOREIGN_KEY; + alter_table_operations supported_flags = + ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX | + ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX | + ALTER_ADD_UNIQUE_INDEX | + ALTER_DROP_UNIQUE_INDEX | + MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN | + MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN | + ALTER_DROP_COLUMN | + ALTER_COLUMN_NAME; + if (ha_alter_info->handler_flags & explicitly_unsupported_flags) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } else if (ha_alter_info->handler_flags & supported_flags) { + DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK); + } else { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } +} + +enum_alter_inplace_result ha_mroonga::check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + enum_alter_inplace_result result; + if (share->wrapper_mode) { + result = wrapper_check_if_supported_inplace_alter(altered_table, + ha_alter_info); + } else { + result = storage_check_if_supported_inplace_alter(altered_table, + ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + bool result; + MRN_DBUG_ENTER_METHOD(); + if (!alter_handler_flags) { + DBUG_RETURN(false); + } + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + int error = 0; + MRN_SHARE *tmp_share; + tmp_share = mrn_get_share(altered_table->s->table_name.str, + altered_table, + &error); + if (error != 0) { + DBUG_RETURN(true); + } + + if (parse_engine_table_options(ha_thd(), + tmp_share->hton, + wrap_altered_table->s)) { + mrn_free_share(tmp_share); + DBUG_RETURN(true); + } +#endif + + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_prepare_inplace_alter_table(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + mrn_free_share(tmp_share); +#endif + + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(false); +} + +bool ha_mroonga::prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_prepare_inplace_alter_table(altered_table, ha_alter_info); + } else { + result = storage_prepare_inplace_alter_table(altered_table, ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + int error; + bool result = false; + uint n_keys; + uint i, j = 0; + KEY *key_info = table_share->key_info; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(true); + + DBUG_PRINT("info", ("mroonga: table_name=%s", share->table_name)); + mrn::PathMapper mapper(share->table_name); + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = ha_alter_info->index_drop_buffer[i]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + while (strcmp(key_info[j].name.str, key->name.str)) { + ++j; + } + DBUG_PRINT("info", ("mroonga: key_name=%s", key->name.str)); + error = drop_index(share, j); + if (error) + DBUG_RETURN(true); + grn_index_tables[j] = NULL; + grn_index_columns[j] = NULL; + } + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, + ha_alter_info->key_count); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, + ha_alter_info->key_count); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **key_tokenizer; + uint *key_tokenizer_length; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + bool need_fill_index = false; + memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + memset(index_columns, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + tmp_table_share.keys = ha_alter_info->key_count; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &key_tokenizer, sizeof(char *) * (tmp_table_share.keys), + &key_tokenizer_length, sizeof(uint) * (tmp_table_share.keys), + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(true); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = NULL; + tmp_share->index_table_length = NULL; + tmp_share->key_tokenizer = key_tokenizer; + tmp_share->key_tokenizer_length = key_tokenizer_length; + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = &altered_table->key_info[key_pos]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + if (share->disable_keys) { + continue; + } + if ((error = mrn_add_index_param(tmp_share, key, key_pos))) + { + break; + } + DBUG_PRINT("info", ("mroonga: add key pos=%u", key_pos)); + if ( + (key->flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + key_pos, + key, index_tables, NULL, + tmp_share)) + ) { + break; + } else if ( + mrn_is_geo_key(key) && + (error = wrapper_create_index_geo(mapper.table_name(), + key_pos, key, + index_tables, NULL, tmp_share)) + ) { + break; + } + mrn_set_bitmap_by_key(table->read_set, key); + index_columns[key_pos] = grn_obj_column(ctx, + index_tables[key_pos], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + need_fill_index = true; + } + if (!error && need_fill_index) { + mrn::FieldTableChanger changer(altered_table, table); + error = wrapper_fill_indexes(ha_thd(), altered_table->key_info, + index_columns, ha_alter_info->key_count); + } + bitmap_set_all(table->read_set); + + if (!error && alter_handler_flags) { +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS + { + MRN_SHARE *alter_tmp_share; + alter_tmp_share = mrn_get_share(altered_table->s->table_name.str, + altered_table, + &error); + if (alter_tmp_share) { + if (parse_engine_table_options(ha_thd(), + alter_tmp_share->hton, + wrap_altered_table->s)) { + error = MRN_GET_ERROR_NUMBER; + } + mrn_free_share(alter_tmp_share); + } + } +#endif + if (!error) { + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_inplace_alter_table(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + } + + if (result || error) + { + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = &altered_table->key_info[key_pos]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + if (share->disable_keys) { + continue; + } + if (index_tables[key_pos]) + { + grn_obj_remove(ctx, index_tables[key_pos]); + } + } + result = true; + } + mrn_free_share_alloc(tmp_share); + my_free(tmp_share); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_inplace_alter_table_add_index( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, + ha_alter_info->key_count); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, + ha_alter_info->key_count); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_tokenizer, **col_flags, **col_type; + uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length; + bool have_multiple_column_index = false; + memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + memset(index_columns, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + tmp_table_share.keys = ha_alter_info->key_count; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + 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, + &key_tokenizer, sizeof(char *) * tmp_table_share.keys, + &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(true); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_tokenizer = key_tokenizer; + tmp_share->key_tokenizer_length = key_tokenizer_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + bitmap_clear_all(table->read_set); + if (table_share->primary_key != MAX_KEY) { + KEY *p_key_info = &table->key_info[table_share->primary_key]; + mrn_set_bitmap_by_key(table->read_set, p_key_info); + } + int error = 0; + uint n_keys = ha_alter_info->index_add_count; + for (uint i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = &altered_table->key_info[key_pos]; + if (share->disable_keys && !(key->flags & HA_NOSAME)) { + continue; // key is disabled + } + if ((error = mrn_add_index_param(tmp_share, key, key_pos))) + { + break; + } + DBUG_PRINT("info", ("mroonga: add key pos=%u", key_pos)); + mrn::PathMapper mapper(share->table_name); + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + tmp_share, key, index_tables, + index_columns, key_pos))) + { + break; + } + if ( + KEY_N_KEY_PARTS(key) == 1 && + (key->flags & HA_NOSAME) && + grn_table_size(ctx, grn_table) != + grn_table_size(ctx, index_tables[key_pos]) + ) { + error = HA_ERR_FOUND_DUPP_UNIQUE; + my_printf_error(ER_DUP_UNIQUE, ER(ER_DUP_UNIQUE), MYF(0), + table_share->table_name); + ++i; + break; + } + if ( + KEY_N_KEY_PARTS(key) != 1 && + !(key->flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, key); + have_multiple_column_index = true; + } + } + if (!error && have_multiple_column_index) { + mrn::FieldTableChanger changer(altered_table, table); + error = storage_add_index_multiple_columns(altered_table->key_info, + 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)); + } + } + bitmap_set_all(table->read_set); + + bool have_error = false; + if (error) + { + n_keys = ha_alter_info->index_add_count; + for (uint i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = + &altered_table->key_info[key_pos]; + if (share->disable_keys && !(key->flags & HA_NOSAME)) { + continue; + } + if (index_tables[key_pos]) + { + grn_obj_remove(ctx, index_columns[key_pos]); + grn_obj_remove(ctx, index_tables[key_pos]); + } + } + have_error = true; + } + mrn_free_share_alloc(tmp_share); + my_free(tmp_share); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_drop_index( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + uint n_keys; + uint i, j = 0; + KEY *key_info = table_share->key_info; + mrn::PathMapper mapper(share->table_name); + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + KEY *key = ha_alter_info->index_drop_buffer[i]; + while (strcmp(key_info[j].name.str, key->name.str) != 0) { + ++j; + } + int error = drop_index(share, j); + if (error != 0) + DBUG_RETURN(true); + grn_index_tables[j] = NULL; + grn_index_columns[j] = NULL; + } + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_add_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_tokenizer, **col_flags, **col_type; + uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length; + tmp_table_share.keys = 0; + tmp_table_share.fields = altered_table->s->fields; + 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, + &index_table_length, sizeof(uint) * tmp_table_share.keys, + &key_tokenizer, sizeof(char *) * tmp_table_share.keys, + &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS); + if (!tmp_share) { + have_error = true; + DBUG_RETURN(have_error); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_tokenizer = key_tokenizer; + tmp_share->key_tokenizer_length = key_tokenizer_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + List_iterator_fast create_fields(alter_info->create_list); + for (uint i = 0; Create_field *create_field = create_fields++; i++) { + if (create_field->field) { + continue; + } + + Field *field = altered_table->s->field[i]; + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field)) { + continue; + } +#endif + + mrn::ColumnName column_name(field->field_name); + int error = mrn_add_column_param(tmp_share, field, i); + if (error) { + have_error = true; + break; + } + + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + if (!find_column_flags(field, tmp_share, i, &col_flags)) { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + + grn_obj *col_type; + { + int column_type_error_code = ER_WRONG_FIELD_SPEC; + col_type = find_column_type(field, tmp_share, i, column_type_error_code); + if (!col_type) { + error = column_type_error_code; + have_error = true; + break; + } + } + char *col_path = NULL; // we don't specify path + + grn_obj *column_obj = + grn_column_create(ctx, table_obj, + column_name.c_str(), + column_name.length(), + col_path, col_flags, col_type); + if (ctx->rc) { + error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + break; + } + +#ifdef MRN_SUPPORT_GENERATED_COLUMNS + if (MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field)) { +# ifndef MRN_MARIADB_P + MY_BITMAP generated_column_bitmap; + if (bitmap_init(&generated_column_bitmap, NULL, + altered_table->s->fields, false)) { + error = HA_ERR_OUT_OF_MEM; + my_message(ER_OUTOFMEMORY, + "mroonga: storage: " + "failed to allocate memory for getting generated value", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + mrn::SmartBitmap smart_generated_column_bitmap(&generated_column_bitmap); + bitmap_set_bit(&generated_column_bitmap, field->field_index); +# endif + + mrn::FieldTableChanger changer(altered_table, table); + + error = storage_rnd_init(true); + if (error) { + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + + Field *altered_field = altered_table->field[i]; + grn_obj new_value; + GRN_VOID_INIT(&new_value); + mrn::SmartGrnObj smart_new_value(ctx, &new_value); + while (!have_error) { + int next_error = storage_rnd_next(table->record[0]); + if (next_error == HA_ERR_END_OF_FILE) { + break; + } else if (next_error != 0) { + error = next_error; + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + +# ifdef MRN_MARIADB_P + MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(altered_table, altered_field); +# else + if (update_generated_write_fields(&generated_column_bitmap, altered_table)) { + error = ER_ERROR_ON_WRITE; + my_message(error, + "mroonga: storage: " + "failed to update generated value for updating column", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } +# endif + + error = mrn_change_encoding(ctx, altered_field->charset()); + if (error) { + my_message(error, + "mroonga: storage: " + "failed to change encoding to store generated value", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + error = generic_store_bulk(altered_field, &new_value); + if (error) { + my_message(error, + "mroonga: storage: " + "failed to get generated value for updating column", + MYF(0)); + have_error = true; + grn_obj_remove(ctx, column_obj); + break; + } + + grn_obj_set_value(ctx, column_obj, record_id, &new_value, GRN_OBJ_SET); + if (ctx->rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + break; + } + } + + int end_error = storage_rnd_end(); + if (end_error != 0 && error == 0) { + error = end_error; + grn_obj_remove(ctx, column_obj); + break; + } + } +#endif + } + + grn_obj_unlink(ctx, table_obj); + + mrn_free_share_alloc(tmp_share); + my_free(tmp_share); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_drop_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + + uint n_fields = table->s->fields; + for (uint i = 0; i < n_fields; i++) { + Field *field = table->field[i]; + + bool dropped = true; + List_iterator_fast create_fields(alter_info->create_list); + while (Create_field *create_field = create_fields++) { + if (create_field->field == field) { + dropped = false; + break; + } + } + if (!dropped) { + continue; + } + + const char *column_name = field->field_name.str; + int column_name_size = field->field_name.length; + + grn_obj *column_obj; + column_obj = grn_obj_column(ctx, table_obj, column_name, column_name_size); + if (column_obj) { + grn_obj_remove(ctx, column_obj); + } + if (ctx->rc) { + int error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + break; + } + } + grn_obj_unlink(ctx, table_obj); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_rename_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + uint n_fields = table->s->fields; + for (uint i = 0; i < n_fields; i++) { + Field *field = table->field[i]; + + if (!(field->flags & FIELD_IS_RENAMED)) { + continue; + } + + LEX_CSTRING new_name; + new_name.str= 0; + List_iterator_fast create_fields(alter_info->create_list); + while (Create_field *create_field = create_fields++) { + if (create_field->field == field) { + new_name = create_field->field_name; + break; + } + } + + if (!new_name.str) { + continue; + } + + const char *old_name = field->field_name.str; + grn_obj *column_obj; + column_obj = grn_obj_column(ctx, table_obj, old_name, + field->field_name.length); + if (column_obj) { + grn_column_rename(ctx, column_obj, new_name.str, new_name.length); + if (ctx->rc) { + int error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + } + grn_obj_unlink(ctx, column_obj); + } + + if (have_error) { + break; + } + } + grn_obj_unlink(ctx, table_obj); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + int error = mrn_change_encoding(ctx, system_charset_info); + if (error) { + have_error = true; + } + + alter_table_operations drop_index_related_flags = + ALTER_DROP_INDEX | + ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX | + ALTER_DROP_UNIQUE_INDEX | + ALTER_DROP_PK_INDEX; + if (!have_error && + (ha_alter_info->handler_flags & drop_index_related_flags)) { + have_error = storage_inplace_alter_table_drop_index(altered_table, + ha_alter_info); + } + + alter_table_operations add_column_related_flags = + ALTER_ADD_COLUMN; + if (!have_error && + (ha_alter_info->handler_flags & add_column_related_flags)) { + have_error = storage_inplace_alter_table_add_column(altered_table, ha_alter_info); + } + + alter_table_operations drop_column_related_flags = ALTER_DROP_COLUMN; + if (!have_error && + (ha_alter_info->handler_flags & drop_column_related_flags)) { + have_error = storage_inplace_alter_table_drop_column(altered_table, ha_alter_info); + } + + alter_table_operations rename_column_related_flags = ALTER_COLUMN_NAME; + if (!have_error && + (ha_alter_info->handler_flags & rename_column_related_flags)) { + have_error = storage_inplace_alter_table_rename_column(altered_table, ha_alter_info); + } + + alter_table_operations add_index_related_flags = + ALTER_ADD_INDEX | + ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX | + ALTER_ADD_UNIQUE_INDEX | + ALTER_ADD_PK_INDEX; + if (!have_error && + (ha_alter_info->handler_flags & add_index_related_flags)) { + have_error = storage_inplace_alter_table_add_index(altered_table, + ha_alter_info); + } + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_inplace_alter_table(altered_table, ha_alter_info); + } else { + result = storage_inplace_alter_table(altered_table, ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + bool result; + MRN_DBUG_ENTER_METHOD(); + if (!alter_handler_flags) { + free_root(&(wrap_altered_table_share->mem_root), MYF(0)); + my_free(alter_key_info_buffer); + alter_key_info_buffer = NULL; + DBUG_RETURN(false); + } + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_commit_inplace_alter_table(wrap_altered_table, + ha_alter_info, + commit); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + free_root(&(wrap_altered_table_share->mem_root), MYF(0)); + my_free(alter_key_info_buffer); + alter_key_info_buffer = NULL; + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(false); +} + +bool ha_mroonga::commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_commit_inplace_alter_table(altered_table, ha_alter_info, + commit); + } else { + result = storage_commit_inplace_alter_table(altered_table, ha_alter_info, + commit); + } + DBUG_RETURN(result); +} +#else +alter_table_operations ha_mroonga::wrapper_alter_table_flags(alter_table_operations flags) +{ + alter_table_operations res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->alter_table_flags(flags); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +alter_table_operations ha_mroonga::storage_alter_table_flags(alter_table_operations flags) +{ + MRN_DBUG_ENTER_METHOD(); + alter_table_operations res = handler::alter_table_flags(flags); + DBUG_RETURN(res); +} + +alter_table_operations ha_mroonga::alter_table_flags(alter_table_operations flags) +{ + MRN_DBUG_ENTER_METHOD(); + alter_table_operations res; + if (share->wrapper_mode) + { + res = wrapper_alter_table_flags(flags); + } else { + res = storage_alter_table_flags(flags); + } + DBUG_RETURN(res); +} + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +#else +int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +#endif +{ + int error = 0; + uint i, j, k; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, num_of_keys + n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, num_of_keys + n_keys); + THD *thd = ha_thd(); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **key_tokenizer; + uint *key_tokenizer_length; + MRN_DBUG_ENTER_METHOD(); + 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); + } + KEY *p_key_info = &table->key_info[table_share->primary_key], *tmp_key_info; + tmp_table_share.keys = n_keys + num_of_keys; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &key_tokenizer, sizeof(char *) * (n_keys + num_of_keys), + &key_tokenizer_length, sizeof(uint) * (n_keys + num_of_keys), + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = NULL; + tmp_share->index_table_length = NULL; + tmp_share->key_tokenizer = key_tokenizer; + tmp_share->key_tokenizer_length = key_tokenizer_length; + tmp_share->col_flags = NULL; + tmp_share->col_type = NULL; +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + hnd_add_index = NULL; +#endif + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + mrn::PathMapper mapper(share->table_name); + for (i = 0, j = 0; i < num_of_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[i])) { + wrap_alter_key_info[j] = key_info[i]; + j++; + continue; + } + if (share->disable_keys) { + continue; + } + if ((error = mrn_add_index_param(tmp_share, &key_info[i], i + n_keys))) + { + break; + } + index_tables[i + n_keys] = NULL; + if ( + (key_info[i].flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + i + n_keys, + &key_info[i], index_tables, NULL, + tmp_share)) + ) { + break; + } else if ( + mrn_is_geo_key(&key_info[i]) && + (error = wrapper_create_index_geo(mapper.table_name(), + i + n_keys, &key_info[i], + index_tables, NULL, tmp_share)) + ) { + break; + } + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + if (!error && i > j && !share->disable_keys) { + for (k = 0; k < num_of_keys; k++) { + tmp_key_info = &key_info[k]; + if (!(tmp_key_info->flags & HA_FULLTEXT) && + !mrn_is_geo_key(tmp_key_info)) { + continue; + } + index_columns[k + n_keys] = grn_obj_column(ctx, + index_tables[k + n_keys], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + } + error = wrapper_fill_indexes(thd, key_info, &index_columns[n_keys], + num_of_keys); + } + bitmap_set_all(table->read_set); + + if (!error && j) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + error = wrap_handler->add_index(table_arg, wrap_alter_key_info, j, + &hnd_add_index); +#else + error = wrap_handler->add_index(table_arg, wrap_alter_key_info, j); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + if (error) + { + for (k = 0; k < i; k++) { + if (!(key_info[k].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[k])) + { + continue; + } + if (index_tables[k + n_keys]) + { + grn_obj_remove(ctx, index_tables[k + n_keys]); + } + } + } +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + else { + *add = new handler_add_index(table_arg, key_info, num_of_keys); + } +#endif + mrn_free_share_alloc(tmp_share); + my_free(tmp_share); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +#else +int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +#endif +{ + int error = 0; + uint i; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, num_of_keys + n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, num_of_keys + n_keys); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_tokenizer, **col_flags, **col_type; + uint *index_table_length, *key_tokenizer_length, *col_flags_length, *col_type_length; + bool have_multiple_column_index = false; + + MRN_DBUG_ENTER_METHOD(); + tmp_table_share.keys = n_keys + num_of_keys; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + 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, + &key_tokenizer, sizeof(char *) * tmp_table_share.keys, + &key_tokenizer_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_tokenizer = key_tokenizer; + tmp_share->key_tokenizer_length = key_tokenizer_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + bitmap_clear_all(table->read_set); + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < num_of_keys; i++) { + if (share->disable_keys && !(key_info[i].flags & HA_NOSAME)) { + continue; // key is disabled + } + index_tables[i + n_keys] = NULL; + index_columns[i + n_keys] = NULL; + if ((error = mrn_add_index_param(tmp_share, &key_info[i], i + n_keys))) + { + break; + } + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + tmp_share, &key_info[i], index_tables, + index_columns, i + n_keys))) + { + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) == 1 && + (key_info[i].flags & HA_NOSAME) && + grn_table_size(ctx, grn_table) != + grn_table_size(ctx, index_tables[i + n_keys]) + ) { + error = HA_ERR_FOUND_DUPP_UNIQUE; + i++; + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } + } + if (!error && have_multiple_column_index) + { + error = storage_add_index_multiple_columns(key_info, num_of_keys, + index_tables + n_keys, + index_columns + n_keys, false); + } + bitmap_set_all(table->read_set); + if (error) + { + for (uint j = 0; j < i; j++) { + if (index_tables[j + n_keys]) + { + grn_obj_remove(ctx, index_columns[j + n_keys]); + grn_obj_remove(ctx, index_tables[j + n_keys]); + } + } + } +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + else { + *add = new handler_add_index(table_arg, key_info, num_of_keys); + } +#endif + mrn_free_share_alloc(tmp_share); + my_free(tmp_share); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_add_index(table_arg, key_info, num_of_keys, add); + } else { + error = storage_add_index(table_arg, key_info, num_of_keys, add); + } + DBUG_RETURN(error); +} +#else +int ha_mroonga::add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_add_index(table_arg, key_info, num_of_keys); + } else { + error = storage_add_index(table_arg, key_info, num_of_keys); + } + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::wrapper_final_add_index(handler_add_index *add, bool commit) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (hnd_add_index) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->final_add_index(hnd_add_index, commit); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + if (add) + { + delete add; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_final_add_index(handler_add_index *add, bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + if (add) + { + delete add; + } + DBUG_RETURN(0); +} + +int ha_mroonga::final_add_index(handler_add_index *add, bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_final_add_index(add, commit); + } else { + error = storage_final_add_index(add, commit); + } + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::wrapper_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + int res = 0; + uint i, j; + KEY *key_info = table_share->key_info; + MRN_DBUG_ENTER_METHOD(); + res = mrn_change_encoding(ctx, system_charset_info); + if (res) + DBUG_RETURN(res); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(uint, wrap_key_num, num_of_keys); + for (i = 0, j = 0; i < num_of_keys; i++) { + uint key_index = key_num[i]; + if (!(key_info[key_index].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[key_index])) { + wrap_key_num[j] = share->wrap_key_nr[key_index]; + j++; + continue; + } + + res = drop_index(share, key_index); + if (res) + DBUG_RETURN(res); + grn_index_tables[key_index] = NULL; + grn_index_columns[key_index] = NULL; + } + if (j) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->prepare_drop_index(table_arg, wrap_key_num, j); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(wrap_key_num); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + int error; + uint i; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + for (i = 0; i < num_of_keys; i++) { + uint key_index = key_num[i]; + error = drop_index(share, key_index); + if (error) + break; + grn_index_tables[key_index] = NULL; + grn_index_columns[key_index] = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_prepare_drop_index(table_arg, key_num, num_of_keys); + } else { + res = storage_prepare_drop_index(table_arg, key_num, num_of_keys); + } + DBUG_RETURN(res); +} + +int ha_mroonga::wrapper_final_drop_index(TABLE *table_arg) +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->final_drop_index(table_arg); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_final_drop_index(TABLE *table_arg) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::final_drop_index(TABLE *table_arg) +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + if (share->wrapper_mode) + { + res = wrapper_final_drop_index(table_arg); + } else { + res = storage_final_drop_index(table_arg); + } + DBUG_RETURN(res); +} +#endif + +int ha_mroonga::wrapper_update_auto_increment() +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->update_auto_increment(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_update_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::update_auto_increment(); + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + table->next_number_field->val_int())); + DBUG_RETURN(res); +} + +int ha_mroonga::update_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_update_auto_increment(); + } else { + res = storage_update_auto_increment(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->set_next_insert_id(id); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + handler::set_next_insert_id(id); + DBUG_VOID_RETURN; +} + +void ha_mroonga::set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_set_next_insert_id(id); + } else { + storage_set_next_insert_id(id); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_get_auto_increment(ulonglong offset, + ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_get_auto_increment(ulonglong offset, + ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + if (table->found_next_number_field && + !table->s->next_number_keypart) { + if (long_term_share->auto_inc_inited) { + *first_value = long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: *first_value(auto_inc_value)=%llu", + *first_value)); + *nb_reserved_values = UINT_MAX64; + } else { + handler::get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + long_term_share->auto_inc_value = *first_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + } + } else { + handler::get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + } else { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + storage_get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + long_term_share->auto_inc_value += nb_desired_values * increment; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->restore_auto_increment(prev_insert_id); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + handler::restore_auto_increment(prev_insert_id); + DBUG_VOID_RETURN; +} + +void ha_mroonga::restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_restore_auto_increment(prev_insert_id); + } else { + storage_restore_auto_increment(prev_insert_id); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->ha_release_auto_increment(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_release_auto_increment(); + } else { + storage_release_auto_increment(); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + int error = wrap_handler->ha_check_for_upgrade(check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < table->s->fields; ++i) { + grn_obj *column = grn_columns[i]; + if (!column) { + continue; + } + Field *field = table->field[i]; + grn_id column_range = grn_obj_get_range(ctx, column); + switch (field->real_type()) { + case MYSQL_TYPE_ENUM: + if (column_range != GRN_DB_UINT16) { + DBUG_RETURN(HA_ADMIN_NEEDS_ALTER); + } + break; + case MYSQL_TYPE_SET: + if (column_range != GRN_DB_UINT64) { + DBUG_RETURN(HA_ADMIN_NEEDS_ALTER); + } + break; + default: + break; + } + } + DBUG_RETURN(HA_ADMIN_OK); +} + +int ha_mroonga::check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) { + error = wrapper_check_for_upgrade(check_opt); + } else { + error = storage_check_for_upgrade(check_opt); + } + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT +int ha_mroonga::wrapper_reset_auto_increment(ulonglong value) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->ha_reset_auto_increment(value); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_reset_auto_increment(ulonglong value) +{ + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + DBUG_RETURN(0); +} + +int ha_mroonga::reset_auto_increment(ulonglong value) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_reset_auto_increment(value); + } else { + res = storage_reset_auto_increment(value); + } + DBUG_RETURN(res); +} +#endif + +void ha_mroonga::set_pk_bitmap() +{ + MRN_DBUG_ENTER_METHOD(); + KEY *key_info = &(table->key_info[table_share->primary_key]); + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(key_info); j++) { + Field *field = key_info->key_part[j].field; + bitmap_set_bit(table->read_set, field->field_index); + } + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->was_semi_consistent_read(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + res = handler::was_semi_consistent_read(); + DBUG_RETURN(res); +} + +bool ha_mroonga::was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + res = wrapper_was_semi_consistent_read(); + } else { + res = storage_was_semi_consistent_read(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->try_semi_consistent_read(yes); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + handler::try_semi_consistent_read(yes); + DBUG_VOID_RETURN; +} + +void ha_mroonga::try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_try_semi_consistent_read(yes); + } else { + storage_try_semi_consistent_read(yes); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->unlock_row(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + handler::unlock_row(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_unlock_row(); + } else { + storage_unlock_row(); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->start_stmt(thd, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + res = handler::start_stmt(thd, lock_type); + DBUG_RETURN(res); +} + +int ha_mroonga::start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + res = wrapper_start_stmt(thd, lock_type); + } else { + res = storage_start_stmt(thd, lock_type); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_change_table_ptr(TABLE *table_arg, + TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->change_table_ptr(table_arg, share->wrap_table_share); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_change_table_ptr(TABLE *table_arg, + TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + handler::change_table_ptr(table_arg, share_arg); + if (share && share->wrapper_mode) + { + wrapper_change_table_ptr(table_arg, share_arg); + } else { + storage_change_table_ptr(table_arg, share_arg); + } + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->is_fk_defined_on_table_or_index(index); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res = handler::is_fk_defined_on_table_or_index(index); + DBUG_RETURN(res); +} + +bool ha_mroonga::is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if (share->wrapper_mode) + { + res = wrapper_is_fk_defined_on_table_or_index(index); + } else { + res = storage_is_fk_defined_on_table_or_index(index); + } + DBUG_RETURN(res); +} + +char *ha_mroonga::wrapper_get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_foreign_key_create_info(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +char *ha_mroonga::storage_get_foreign_key_create_info() +{ + int error; + uint i; + grn_obj *column; + uint n_columns = table_share->fields; + char create_info_buff[2048], *create_info; + String create_info_str(create_info_buff, sizeof(create_info_buff), + system_charset_info); + MRN_DBUG_ENTER_METHOD(); + create_info_str.length(0); + for (i = 0; i < n_columns; ++i) { + Field *field = table_share->field[i]; + + if (!is_foreign_key_field(table_share->table_name.str, + field->field_name.str)) { + continue; + } + + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + char ref_table_buff[NAME_LEN + 1]; + int ref_table_name_length = grn_obj_name(ctx, ref_table, ref_table_buff, + NAME_LEN); + ref_table_buff[ref_table_name_length] = '\0'; + + if (create_info_str.reserve(15)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(",\n CONSTRAINT ", 15); + append_identifier(ha_thd(), + &create_info_str, + column_name.c_str(), + column_name.length()); + if (create_info_str.reserve(14)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(" FOREIGN KEY (", 14); + append_identifier(ha_thd(), + &create_info_str, + column_name.c_str(), + column_name.length()); + if (create_info_str.reserve(13)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(") REFERENCES ", 13); + append_identifier(ha_thd(), &create_info_str, table_share->db.str, + table_share->db.length); + if (create_info_str.reserve(1)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(".", 1); + append_identifier(ha_thd(), &create_info_str, ref_table_buff, + ref_table_name_length); + if (create_info_str.reserve(2)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(" (", 2); + + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table_share->db.str, ref_table_buff, "", 0); + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); + + LEX_CSTRING table_name= { ref_table_buff, (size_t) ref_table_name_length }; + table_list.init_one_table(&table_share->db, &table_name, 0, TL_WRITE); + mrn_open_mutex_lock(table_share); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table_share); + if (!tmp_ref_table_share) { + DBUG_RETURN(NULL); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + Field *ref_field = &ref_key_info->key_part->field[0]; + append_identifier(ha_thd(), &create_info_str, ref_field->field_name.str, + ref_field->field_name.length); + mrn_open_mutex_lock(table_share); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table_share); + if (create_info_str.reserve(39)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(") ON DELETE RESTRICT ON UPDATE RESTRICT", 39); + } + if (!(create_info = (char *) 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()); + create_info[create_info_str.length()] = '\0'; + DBUG_RETURN(create_info); +} +#else +char *ha_mroonga::storage_get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res = handler::get_foreign_key_create_info(); + DBUG_RETURN(res); +} +#endif + +char *ha_mroonga::get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + if (share->wrapper_mode) + { + res = wrapper_get_foreign_key_create_info(); + } else { + res = storage_get_foreign_key_create_info(); + } + DBUG_RETURN(res); +} + +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME +char *ha_mroonga::wrapper_get_tablespace_name(THD *thd, char *name, + uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_tablespace_name(thd, name, name_len); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +char *ha_mroonga::storage_get_tablespace_name(THD *thd, char *name, + uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res = handler::get_tablespace_name(thd, name, name_len); + DBUG_RETURN(res); +} + +char *ha_mroonga::get_tablespace_name(THD *thd, char *name, uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + if (share->wrapper_mode) + { + res = wrapper_get_tablespace_name(thd, name, name_len); + } else { + res = storage_get_tablespace_name(thd, name, name_len); + } + DBUG_RETURN(res); +} +#endif + +bool ha_mroonga::wrapper_can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->can_switch_engines(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res = handler::can_switch_engines(); + DBUG_RETURN(res); +} + +bool ha_mroonga::can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if (share->wrapper_mode) + { + res = wrapper_can_switch_engines(); + } else { + res = storage_can_switch_engines(); + } + DBUG_RETURN(res); +} + +int ha_mroonga::wrapper_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_foreign_key_list(thd, f_key_list); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +int ha_mroonga::storage_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + int error; + uint i; + grn_obj *column; + uint n_columns = table_share->fields; + MRN_DBUG_ENTER_METHOD(); + for (i = 0; i < n_columns; ++i) { + Field *field = table_share->field[i]; + + if (!is_foreign_key_field(table_share->table_name.str, + field->field_name.str)) { + continue; + } + + mrn::ColumnName column_name(field->field_name); + column = grn_obj_column(ctx, + grn_table, + column_name.c_str(), + column_name.length()); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + FOREIGN_KEY_INFO f_key_info; + f_key_info.foreign_id = thd_make_lex_string(thd, + NULL, + column_name.c_str(), + column_name.length(), + TRUE); + f_key_info.foreign_db = thd_make_lex_string(thd, NULL, + table_share->db.str, + table_share->db.length, + TRUE); + f_key_info.foreign_table = thd_make_lex_string(thd, NULL, + table_share->table_name.str, + table_share->table_name.length, + TRUE); + f_key_info.referenced_db = f_key_info.foreign_db; + + char ref_table_buff[NAME_LEN + 1]; + int ref_table_name_length = grn_obj_name(ctx, ref_table, ref_table_buff, + NAME_LEN); + ref_table_buff[ref_table_name_length] = '\0'; + DBUG_PRINT("info", ("mroonga: ref_table_buff=%s", ref_table_buff)); + DBUG_PRINT("info", ("mroonga: ref_table_name_length=%d", ref_table_name_length)); + f_key_info.referenced_table = thd_make_lex_string(thd, NULL, + ref_table_buff, + ref_table_name_length, + TRUE); + f_key_info.update_method = FK_OPTION_RESTRICT; + f_key_info.delete_method = FK_OPTION_RESTRICT; + f_key_info.referenced_key_name = thd_make_lex_string(thd, NULL, "PRIMARY", + 7, TRUE); + LEX_CSTRING *field_name = thd_make_lex_string(thd, + NULL, + column_name.c_str(), + column_name.length(), + TRUE); + f_key_info.foreign_fields.push_back(field_name); + + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table_share->db.str, ref_table_buff, "", 0); + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); + + LEX_CSTRING table_name= { ref_table_buff, (size_t) ref_table_name_length }; + table_list.init_one_table(&table_share->db, &table_name, 0, TL_WRITE); + mrn_open_mutex_lock(table_share); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table_share); + if (!tmp_ref_table_share) { + DBUG_RETURN(error); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + Field *ref_field = &ref_key_info->key_part->field[0]; + LEX_CSTRING *ref_col_name = thd_make_lex_string(thd, NULL, + ref_field->field_name.str, + ref_field->field_name.length, + TRUE); + f_key_info.referenced_fields.push_back(ref_col_name); + mrn_open_mutex_lock(table_share); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table_share); + FOREIGN_KEY_INFO *p_f_key_info = + (FOREIGN_KEY_INFO *) thd_memdup(thd, &f_key_info, + sizeof(FOREIGN_KEY_INFO)); + if (!p_f_key_info) { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + f_key_list->push_back(p_f_key_info); + } + DBUG_RETURN(0); +} +#else +int ha_mroonga::storage_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::get_foreign_key_list(thd, f_key_list); + DBUG_RETURN(res); +} +#endif + +int ha_mroonga::get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_get_foreign_key_list(thd, f_key_list); + } else { + res = storage_get_foreign_key_list(thd, f_key_list); + } + DBUG_RETURN(res); +} + +int ha_mroonga::wrapper_get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_parent_foreign_key_list(thd, f_key_list); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::get_parent_foreign_key_list(thd, f_key_list); + DBUG_RETURN(res); +} + +int ha_mroonga::get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_get_parent_foreign_key_list(thd, f_key_list); + } else { + res = storage_get_parent_foreign_key_list(thd, f_key_list); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->referenced_by_foreign_key(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res = handler::referenced_by_foreign_key(); + DBUG_RETURN(res); +} + +uint ha_mroonga::referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + if (share->wrapper_mode) + { + res = wrapper_referenced_by_foreign_key(); + } else { + res = storage_referenced_by_foreign_key(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->init_table_handle_for_HANDLER(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + handler::init_table_handle_for_HANDLER(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_init_table_handle_for_HANDLER(); + } else { + storage_init_table_handle_for_HANDLER(); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->free_foreign_key_create_info(str); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +void ha_mroonga::storage_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + my_free(str); + DBUG_VOID_RETURN; +} +#else +void ha_mroonga::storage_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + handler::free_foreign_key_create_info(str); + DBUG_VOID_RETURN; +} +#endif + +void ha_mroonga::free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_free_foreign_key_create_info(str); + } else { + storage_free_foreign_key_create_info(str); + } + DBUG_VOID_RETURN; +} + +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS +bool ha_mroonga::check_written_by_row_based_binlog() +{ + MRN_DBUG_ENTER_METHOD(); + THD *thd = ha_thd(); + + int current_stmt_binlog_row; +#ifdef MRN_ROW_BASED_CHECK_IS_METHOD + current_stmt_binlog_row = thd->is_current_stmt_binlog_format_row(); +#else + current_stmt_binlog_row = thd->current_stmt_binlog_row_based; +#endif + if (!current_stmt_binlog_row) { + DBUG_RETURN(false); + } + + if (table->s->tmp_table != NO_TMP_TABLE) { + DBUG_RETURN(false); + } + + if (!mrn_binlog_filter->db_ok(table->s->db.str)) { + DBUG_RETURN(false); + } + + if (!thd_test_options(thd, OPTION_BIN_LOG)) { + DBUG_RETURN(false); + } + + if (!mysql_bin_log.is_open()) { + DBUG_RETURN(false); + } + + DBUG_RETURN(true); +} +#endif + +#ifdef MRN_HAVE_HA_REBIND_PSI +void ha_mroonga::wrapper_unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->unbind_psi(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + handler::unbind_psi(); + if (share->wrapper_mode) + { + wrapper_unbind_psi(); + } else { + storage_unbind_psi(); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_rebind() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->rebind_psi(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_rebind() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::rebind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + handler::rebind_psi(); + if (share->wrapper_mode) + { + wrapper_rebind(); + } else { + storage_rebind(); + } + DBUG_VOID_RETURN; +} +#endif + +my_bool ha_mroonga::wrapper_register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +my_bool ha_mroonga::storage_register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res = handler::register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + DBUG_RETURN(res); +} + +my_bool ha_mroonga::register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res; + if (share->wrapper_mode) + { + res = wrapper_register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + } else { + res = storage_register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + } + DBUG_RETURN(res); +} + +#ifdef __cplusplus +} +#endif + +namespace mrn { + namespace variables { + ulonglong get_boolean_mode_syntax_flags(THD *thd) { + ulonglong flags = BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT; +#ifdef MRN_SUPPORT_THDVAR_SET + flags = THDVAR(thd, boolean_mode_syntax_flags); +#endif + return flags; + } + + ActionOnError get_action_on_fulltext_query_error(THD *thd) { + ulong action = THDVAR(thd, action_on_fulltext_query_error); + return static_cast(action); + } + } +} diff --git a/storage/mroonga/ha_mroonga.def b/storage/mroonga/ha_mroonga.def new file mode 100644 index 00000000..7f8394fe --- /dev/null +++ b/storage/mroonga/ha_mroonga.def @@ -0,0 +1,18 @@ +LIBRARY ha_mroonga +VERSION 1.0 +EXPORTS + last_insert_grn_id + last_insert_grn_id_init + last_insert_grn_id_deinit + mroonga_snippet + mroonga_snippet_init + mroonga_snippet_deinit + mroonga_command + mroonga_command_init + mroonga_command_deinit + mroonga_escape + mroonga_escape_init + mroonga_escape_deinit + mroonga_normalize + mroonga_normalize_init + mroonga_normalize_deinit diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp new file mode 100644 index 00000000..66767899 --- /dev/null +++ b/storage/mroonga/ha_mroonga.hpp @@ -0,0 +1,1309 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef HA_MROONGA_HPP_ +#define HA_MROONGA_HPP_ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "mrn_mysql_compat.h" +#include +#include + +#if __cplusplus >= 201402 +# define mrn_override override +#else +# define mrn_override +#endif + +#if (MYSQL_VERSION_ID >= 50514 && MYSQL_VERSION_ID < 50600) +# define MRN_HANDLER_HAVE_FINAL_ADD_INDEX 1 +#endif + +#if (MYSQL_VERSION_ID >= 50603) || defined(MRN_MARIADB_P) +# define MRN_HANDLER_HAVE_HA_RND_NEXT 1 +# define MRN_HANDLER_HAVE_HA_RND_POS 1 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_MAP 1 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP 1 +# define MRN_HANDLER_HAVE_HA_INDEX_NEXT 1 +# define MRN_HANDLER_HAVE_HA_INDEX_PREV 1 +# define MRN_HANDLER_HAVE_HA_INDEX_FIRST 1 +# define MRN_HANDLER_HAVE_HA_INDEX_LAST 1 +# define MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME 1 +#endif + +#if (MYSQL_VERSION_ID >= 50604) || defined(MRN_MARIADB_P) +# define MRN_HANDLER_HAVE_HA_CLOSE 1 +# define MRN_HANDLER_HAVE_MULTI_RANGE_READ 1 +#endif + +#if (MYSQL_VERSION_ID >= 50607) +# define MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER 1 +# define MRN_HANDLER_HAVE_HA_PREPARE_INPLACE_ALTER_TABLE 1 +# define MRN_HANDLER_HAVE_HA_INPLACE_ALTER_TABLE 1 +# define MRN_HANDLER_HAVE_HA_COMMIT_INPLACE_ALTER_TABLE 1 +# define MRN_SUPPORT_FOREIGN_KEYS 1 +#endif + +#ifndef MRN_MARIADB_P +# define MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP +# if MYSQL_VERSION_ID >= 50611 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_LAST_MAP +# endif +#endif + +#ifdef MRN_MARIADB_P +# define MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS +#endif + +#if MYSQL_VERSION_ID < 50600 +# define MRN_HANDLER_HAVE_GET_TABLESPACE_NAME +#endif + +#if MYSQL_VERSION_ID >= 50607 +# define MRN_HANDLER_HAVE_SET_HA_SHARE_REF +#endif + +#if MYSQL_VERSION_ID >= 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" +#endif + +#ifdef MRN_MARIADB_P +# define MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR +#endif + +#ifdef MRN_MARIADB_P +# define MRN_HAVE_HA_EXTRA_DETACH_CHILD +# define MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +#define MRN_HAVE_HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW +#define MRN_HAVE_HA_EXTRA_BEGIN_ALTER_COPY +#define MRN_HAVE_HA_EXTRA_END_ALTER_COPY +#define MRN_HAVE_HA_EXTRA_NO_AUTOINC_LOCKING +#endif + +#if MYSQL_VERSION_ID >= 50607 && \ + (!defined(MRN_MARIADB_P) || MYSQL_VERSION_ID < 100008) +# define MRN_HAVE_HA_EXTRA_EXPORT +#endif + +#if MYSQL_VERSION_ID >= 50617 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_HA_EXTRA_SECONDARY_SORT_ROWID +#endif + +#if MYSQL_VERSION_ID >= 50604 && !defined(MRN_MARIADB_P) +# define MRN_TIMESTAMP_USE_TIMEVAL +#elif defined(MRN_MARIADB_P) +# define MRN_TIMESTAMP_USE_MY_TIME_T +#else +# define MRN_TIMESTAMP_USE_LONG +#endif + +#if MYSQL_VERSION_ID < 50600 && !defined(MRN_MARIADB_P) +# define MRN_FIELD_STORE_TIME_NEED_TYPE +#endif + +#if MYSQL_VERSION_ID < 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 + +#ifdef MRN_MARIADB_P +# define MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR +#endif + +#if MYSQL_VERSION_ID >= 50604 +# define MRN_JOIN_TAB_HAVE_CONDITION +#endif + +#if MYSQL_VERSION_ID < 50600 +# define MRN_RBR_UPDATE_NEED_ALL_COLUMNS +#endif + +#if MYSQL_VERSION_ID >= 50500 +# define MRN_ROW_BASED_CHECK_IS_METHOD +#endif + +#if MYSQL_VERSION_ID >= 50600 +# define MRN_HAVE_HA_REBIND_PSI +#endif + +#if MYSQL_VERSION_ID >= 50612 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_POINT_XY +#endif + +#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000) +# define MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +#endif + +#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100010) +# define MRN_HAVE_TDC_LOCK_TABLE_SHARE +# if MYSQL_VERSION_ID >= 100100 +# define MRN_TABLE_SHARE_TDC_IS_POINTER +# endif +#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 +# 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 + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50709) || \ + (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100203) +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE \ + ALTER_STORED_COLUMN_TYPE +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER \ + ALTER_STORED_COLUMN_ORDER +#else +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_TYPE \ + Alter_inplace_info::ALTER_COLUMN_TYPE +# define MRN_ALTER_INPLACE_INFO_ALTER_STORED_COLUMN_ORDER \ + Alter_inplace_info::ALTER_COLUMN_ORDER +#endif + +#if MYSQL_VERSION_ID >= 50700 && !defined(MRN_MARIADB_P) +# define MRN_HANDLER_RECORDS_RETURN_ERROR +#endif + +#if MYSQL_VERSION_ID < 80002 || defined(MRN_MARIADB_P) +# define MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_ST_MYSQL_PLUGIN_HAVE_CHECK_UNINSTALL +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION +# define MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define MRN_HANDLERTON_CREATE_HAVE_PARTITIONED +#endif + +#if defined(HAVE_PSI_INTERFACE) && \ + (MYSQL_VERSION_ID < 80002 || defined(MRN_MARIADB_P)) +# define MRN_HAVE_PSI_SERVER +#endif + +class ha_mroonga; + +/* structs */ +struct st_mrn_ft_info +{ + struct _ft_vft *please; +#ifdef HA_CAN_FULLTEXT_EXT + struct _ft_vft_ext *could_you; +#endif + grn_ctx *ctx; + grn_encoding encoding; + grn_obj *table; + grn_obj *result; + grn_obj *score_column; + grn_obj key; + grn_obj score; + uint active_index; + KEY *key_info; + KEY *primary_key_info; + grn_obj *cursor; + grn_obj *id_accessor; + grn_obj *key_accessor; + ha_mroonga *mroonga; +}; + +#ifdef MRN_SUPPORT_CUSTOM_OPTIONS +struct ha_field_option_struct +{ + const char *groonga_type; + const char *flags; +}; + +struct ha_index_option_struct +{ + const char *tokenizer; + const char *normalizer; + const char *token_filters; + const char *flags; +}; +#endif + +/* handler class */ +class ha_mroonga: public handler +{ +public: + handler *wrap_handler; + bool is_clone; + ha_mroonga *parent_for_clone; + MEM_ROOT *mem_root_for_clone; + grn_obj key_buffer; + grn_id record_id; + grn_id *key_id; + grn_id *del_key_id; + MY_BITMAP multiple_column_key_bitmap; + +private: + THR_LOCK_DATA thr_lock_data; + + // for wrapper mode (TODO: need to be confirmed) + uint wrap_ft_init_count; + MRN_SHARE *share; + KEY *wrap_key_info; + KEY *base_key_info; + key_part_map pk_keypart_map; + MEM_ROOT mem_root; + /// for create table and alter table + mutable bool analyzed_for_create; + mutable TABLE table_for_create; + mutable MRN_SHARE share_for_create; + mutable TABLE_SHARE table_share_for_create; + mutable MEM_ROOT mem_root_for_create; + mutable handler *wrap_handler_for_create; +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + handler_add_index *hnd_add_index; +#endif +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + alter_table_operations alter_handler_flags; + KEY *alter_key_info_buffer; + uint alter_key_count; + uint alter_index_drop_count; + KEY *alter_index_drop_buffer; + uint alter_index_add_count; + uint *alter_index_add_buffer; + TABLE *wrap_altered_table; + KEY *wrap_altered_table_key_info; + TABLE_SHARE *wrap_altered_table_share; + KEY *wrap_altered_table_share_key_info; +#else + KEY *wrap_alter_key_info; +#endif + int mrn_lock_type; + + // for groonga objects + grn_ctx ctx_entity_; + grn_ctx *ctx; + grn_obj *grn_table; + grn_obj **grn_columns; + grn_obj **grn_column_ranges; + grn_obj **grn_index_tables; + grn_obj **grn_index_columns; + + // buffers + grn_obj encoded_key_buffer; + grn_obj old_value_buffer; + grn_obj new_value_buffer; + grn_obj top_left_point; + grn_obj bottom_right_point; + grn_obj source_point; + double top_left_longitude_in_degree; + double bottom_right_longitude_in_degree; + double bottom_right_latitude_in_degree; + double top_left_latitude_in_degree; + + // for search + grn_obj *grn_source_column_geo; + grn_obj *cursor_geo; + grn_table_cursor *cursor; + grn_table_cursor *index_table_cursor; + grn_obj *empty_value_records; + grn_table_cursor *empty_value_records_cursor; + grn_obj *sorted_result; + grn_obj *matched_record_keys; + String *blob_buffers; + + // for error report + uint dup_key; + + // for optimization + bool count_skip; + bool fast_order_limit; + bool fast_order_limit_with_index; + + // for context + bool ignoring_duplicated_key; + bool inserting_with_update; + bool fulltext_searching; + bool ignoring_no_key_columns; + bool replacing_; + uint written_by_row_based_binlog; + + // for ft in where clause test + Item_func_match *current_ft_item; + + mrn::Operations *operations_; + +public: + ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg); + ~ha_mroonga(); + const char *table_type() const; // required + const char *index_type(uint inx) mrn_override; + const char **bas_ext() const; // required + + ulonglong table_flags() const mrn_override; // required + ulong index_flags(uint idx, uint part, bool all_parts) const mrn_override; // required + + // required + int create(const char *name, TABLE *form, HA_CREATE_INFO *info +#ifdef MRN_HANDLER_CREATE_HAVE_TABLE_DEFINITION + , + dd::Table *table_def +#endif + ) mrn_override; + // required + int open(const char *name, int mode, uint open_options +#ifdef MRN_HANDLER_OPEN_HAVE_TABLE_DEFINITION + , + const dd::Table *table_def +#endif + ) mrn_override; +#ifndef MRN_HANDLER_HAVE_HA_CLOSE + int close(); // required +#endif + int info(uint flag) mrn_override; // required + + uint lock_count() const mrn_override; + THR_LOCK_DATA **store_lock(THD *thd, // required + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) mrn_override; + int external_lock(THD *thd, int lock_type) mrn_override; + + int rnd_init(bool scan) mrn_override; // required + int rnd_end() mrn_override; +#ifndef MRN_HANDLER_HAVE_HA_RND_NEXT + int rnd_next(uchar *buf); // required +#endif +#ifndef MRN_HANDLER_HAVE_HA_RND_POS + int rnd_pos(uchar *buf, uchar *pos); // required +#endif + void position(const uchar *record) mrn_override; // required + int extra(enum ha_extra_function operation) mrn_override; + int extra_opt(enum ha_extra_function operation, ulong cache_size) mrn_override; + + int delete_table(const char *name) mrn_override; + int write_row(const uchar *buf) mrn_override; + int update_row(const uchar *old_data, const uchar *new_data) mrn_override; + int delete_row(const uchar *buf) mrn_override; + + uint max_supported_record_length() const mrn_override; + uint max_supported_keys() const mrn_override; + uint max_supported_key_parts() const mrn_override; + uint max_supported_key_length() const mrn_override; + uint max_supported_key_part_length() const mrn_override; + + ha_rows records_in_range(uint inx, const key_range *min_key, + const key_range *max_key, page_range *pages) mrn_override; + int index_init(uint idx, bool sorted) mrn_override; + int index_end() mrn_override; +#ifndef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + int index_read_map(uchar * buf, const uchar * key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); +#endif +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP + int index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_NEXT + int index_next(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_PREV + int index_prev(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_FIRST + int index_first(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_LAST + int index_last(uchar *buf); +#endif + int index_next_same(uchar *buf, const uchar *key, uint keylen) mrn_override; + + int ft_init() mrn_override; + FT_INFO *ft_init_ext(uint flags, uint inx, String *key) mrn_override; + int ft_read(uchar *buf) mrn_override; + + const Item *cond_push(const Item *cond) mrn_override; + void cond_pop() mrn_override; + + bool get_error_message(int error, String *buf) mrn_override; + + int reset() mrn_override; + + handler *clone(const char *name, MEM_ROOT *mem_root) mrn_override; + uint8 table_cache_type() mrn_override; +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, Cost_estimate *cost) mrn_override; + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, Cost_estimate *cost) mrn_override; + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) mrn_override; + int multi_range_read_next(range_id_t *range_info) mrn_override; +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + void start_bulk_insert(ha_rows rows, uint flags) mrn_override; +#else + void start_bulk_insert(ha_rows rows); +#endif + int end_bulk_insert() mrn_override; + int delete_all_rows() mrn_override; + int truncate() mrn_override; + double scan_time() mrn_override; + double read_time(uint index, uint ranges, ha_rows rows) mrn_override; +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING + const key_map *keys_to_use_for_scanning() mrn_override; +#endif + ha_rows estimate_rows_upper_bound() mrn_override; + void update_create_info(HA_CREATE_INFO* create_info) mrn_override; + int rename_table(const char *from, const char *to) mrn_override; + bool is_crashed() const mrn_override; + bool auto_repair(int error) const mrn_override; + bool auto_repair() const; + int disable_indexes(uint mode) mrn_override; + int enable_indexes(uint mode) mrn_override; + int check(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; + int repair(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; + bool check_and_repair(THD *thd) mrn_override; + int analyze(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; + int optimize(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; + bool is_fatal_error(int error_num, uint flags=0) mrn_override; + bool check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes) mrn_override; +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + enum_alter_inplace_result + check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info) mrn_override; +#else + alter_table_operations alter_table_flags(alter_table_operations flags); +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); + int final_add_index(handler_add_index *add, bool commit); +# else + int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); +# endif + int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys); + int final_drop_index(TABLE *table_arg); +#endif + int update_auto_increment(); + void set_next_insert_id(ulonglong id); + void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, + ulonglong *first_value, ulonglong *nb_reserved_values) mrn_override; + void restore_auto_increment(ulonglong prev_insert_id) mrn_override; + void release_auto_increment() mrn_override; + int check_for_upgrade(HA_CHECK_OPT *check_opt) mrn_override; +#ifdef MRN_HANDLER_HAVE_RESET_AUTO_INCREMENT + int reset_auto_increment(ulonglong value) mrn_override; +#endif + bool was_semi_consistent_read() mrn_override; + void try_semi_consistent_read(bool yes) mrn_override; + void unlock_row() mrn_override; + int start_stmt(THD *thd, thr_lock_type lock_type) mrn_override; + +protected: +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR + int records(ha_rows *num_rows); +#else + ha_rows records() mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_RND_NEXT + int rnd_next(uchar *buf) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_RND_POS + int rnd_pos(uchar *buf, uchar *pos) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + int index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + int index_next(uchar *buf) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_PREV + int index_prev(uchar *buf) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_FIRST + int index_first(uchar *buf) mrn_override; +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_LAST + int index_last(uchar *buf) mrn_override; +#endif + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg) mrn_override; + bool is_fk_defined_on_table_or_index(uint index) mrn_override; + char *get_foreign_key_create_info() mrn_override; +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME + char *get_tablespace_name(THD *thd, char *name, uint name_len); +#endif + bool can_switch_engines() mrn_override; + int get_foreign_key_list(THD *thd, List *f_key_list) mrn_override; + int get_parent_foreign_key_list(THD *thd, List *f_key_list) mrn_override; + uint referenced_by_foreign_key() mrn_override; + void init_table_handle_for_HANDLER() mrn_override; + void free_foreign_key_create_info(char* str) mrn_override; +#ifdef MRN_HAVE_HA_REBIND_PSI + void unbind_psi() mrn_override; + void rebind_psi() mrn_override; +#endif + my_bool register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback *engine_callback, + ulonglong *engine_data) mrn_override; +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + bool prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info) mrn_override; + bool inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info) mrn_override; + bool commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) mrn_override; +#endif + +private: + void mkdir_p(const char *directory); + ulonglong file_size(const char *path); + + bool have_unique_index(); + + bool is_foreign_key_field(const char *table_name, + const char *field_name); + + void push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag); + void clear_cursor(); + void clear_cursor_geo(); + void clear_empty_value_records(); + void clear_search_result(); + void clear_search_result_geo(); + void clear_indexes(); + int add_wrap_hton(const char *path, handlerton *wrap_handlerton); + void remove_related_files(const char *base_path); + void remove_grn_obj_force(const char *name); + int drop_index(MRN_SHARE *target_share, uint key_index); + int drop_indexes_normal(const char *table_name, grn_obj *table); + int drop_indexes_multiple(const char *table_name, grn_obj *table, + const char *index_table_name_separator); + int drop_indexes(const char *table_name); + bool find_column_flags(Field *field, MRN_SHARE *mrn_share, int i, + grn_obj_flags *column_flags); + grn_obj *find_column_type(Field *field, MRN_SHARE *mrn_share, int i, + int error_code); + grn_obj *find_tokenizer(KEY *key, MRN_SHARE *mrn_share, int i); + grn_obj *find_tokenizer(const char *name, int name_length); + bool have_custom_normalizer(KEY *key) const; + grn_obj *find_normalizer(KEY *key); + grn_obj *find_normalizer(KEY *key, const char *name); + bool find_index_column_flags(KEY *key, grn_column_flags *index_column_flags); + bool find_token_filters(KEY *key, grn_obj *token_filters); + bool find_token_filters_put(grn_obj *token_filters, + const char *token_filter_name, + int token_filter_name_length); + bool find_token_filters_fill(grn_obj *token_filters, + const char *token_filter_names, + int token_filter_name_length); + int wrapper_get_record(uchar *buf, const uchar *key); + int wrapper_get_next_geo_record(uchar *buf); + int storage_get_next_record(uchar *buf); + void geo_store_rectangle(const uchar *rectangle); + int generic_geo_open_cursor(const uchar *key, enum ha_rkey_function find_flag); + +#ifdef MRN_HANDLER_HAVE_HA_CLOSE + int close() mrn_override; +#endif + bool is_dry_write(); + bool is_enable_optimization(); + bool should_normalize(Field *field) const; + void check_count_skip(key_part_map target_key_part_map); + 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); + + long long int get_grn_time_from_timestamp_field(Field_timestamp *field); + + int generic_store_bulk_fixed_size_string(Field *field, grn_obj *buf); + int generic_store_bulk_variable_size_string(Field *field, grn_obj *buf); + int generic_store_bulk_integer(Field *field, grn_obj *buf); + int generic_store_bulk_unsigned_integer(Field *field, grn_obj *buf); + int generic_store_bulk_float(Field *field, grn_obj *buf); + int generic_store_bulk_timestamp(Field *field, grn_obj *buf); + int generic_store_bulk_date(Field *field, grn_obj *buf); + int generic_store_bulk_time(Field *field, grn_obj *buf); + int generic_store_bulk_datetime(Field *field, grn_obj *buf); + int generic_store_bulk_year(Field *field, grn_obj *buf); + int generic_store_bulk_new_date(Field *field, grn_obj *buf); +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + int generic_store_bulk_datetime2(Field *field, grn_obj *buf); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + int generic_store_bulk_time2(Field *field, grn_obj *buf); +#endif + int generic_store_bulk_new_decimal(Field *field, grn_obj *buf); + int generic_store_bulk_blob(Field *field, grn_obj *buf); + int generic_store_bulk_geometry(Field *field, grn_obj *buf); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + int generic_store_bulk_json(Field *field, grn_obj *buf); +#endif + int generic_store_bulk(Field *field, grn_obj *buf); + + void storage_store_field_string(Field *field, + const char *value, uint value_length); + void storage_store_field_integer(Field *field, + const char *value, uint value_length); + void storage_store_field_unsigned_integer(Field *field, + const char *value, + uint value_length); + void storage_store_field_float(Field *field, + const char *value, uint value_length); + void storage_store_field_timestamp(Field *field, + const char *value, uint value_length); + void storage_store_field_date(Field *field, + const char *value, uint value_length); + void storage_store_field_time(Field *field, + const char *value, uint value_length); + void storage_store_field_datetime(Field *field, + const char *value, uint value_length); + void storage_store_field_year(Field *field, + const char *value, uint value_length); + void storage_store_field_new_date(Field *field, + const char *value, uint value_length); +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + void storage_store_field_datetime2(Field *field, + const char *value, uint value_length); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + void storage_store_field_time2(Field *field, + const char *value, uint value_length); +#endif + void storage_store_field_blob(Field *field, + const char *value, uint value_length); + void storage_store_field_geometry(Field *field, + const char *value, uint value_length); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + void storage_store_field_json(Field *field, + const char *value, uint value_length); +#endif + void storage_store_field(Field *field, const char *value, uint value_length); + 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, + const uchar *new_data, + grn_id record_id); + void storage_store_fields_by_index(uchar *buf); + + int storage_encode_key_normalize_min_sort_chars(Field *field, + uchar *buf, + uint size); + int storage_encode_key_fixed_size_string(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_variable_size_string(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_timestamp(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_time(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_year(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_datetime(Field *field, const uchar *key, + uchar *buf, uint *size); +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + int storage_encode_key_timestamp2(Field *field, const uchar *key, + uchar *buf, uint *size); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + int storage_encode_key_datetime2(Field *field, bool is_null, const uchar *key, + uchar *buf, uint *size); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + int storage_encode_key_time2(Field *field, const uchar *key, + uchar *buf, uint *size); +#endif + int storage_encode_key_enum(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_set(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key(Field *field, const uchar *key, uchar *buf, uint *size); + int storage_encode_multiple_column_key(KEY *key_info, + const uchar *key, uint key_length, + uchar *buffer, uint *encoded_length); + int storage_encode_multiple_column_key_range(KEY *key_info, + const uchar *start, + uint start_size, + const uchar *end, + uint end_size, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size); + int storage_encode_multiple_column_key_range(KEY *key_info, + const key_range *start, + const key_range *end, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size); + + void set_pk_bitmap(); + int create_share_for_create() const; + int wrapper_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share); + int storage_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share); + int wrapper_create_index_fulltext_validate(KEY *key_info); + int wrapper_create_index_fulltext(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share); + int wrapper_create_index_geo(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share); + int wrapper_create_index(const char *name, TABLE *table, MRN_SHARE *tmp_share); + int storage_create_validate_pseudo_column(TABLE *table); +#ifdef MRN_SUPPORT_FOREIGN_KEYS + bool storage_create_foreign_key(TABLE *table, const char *grn_table_name, + Field *field, grn_obj *table_obj, int &error); +#endif + int storage_create_validate_index(TABLE *table); + int storage_create_index_table(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + uint i); + int storage_create_index(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + grn_obj **index_columns, uint i); + int storage_create_indexes(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share); + int close_databases(); + int ensure_database_open(const char *name, mrn::Database **db=NULL); + int ensure_database_remove(const char *name); + int wrapper_delete_table(const char *name, handlerton *wrap_handlerton, + const char *table_name); + int generic_delete_table(const char *name, const char *table_name); + int wrapper_open(const char *name, int mode, uint open_options); + int wrapper_open_indexes(const char *name); + int storage_reindex(); + int storage_open(const char *name, int mode, uint open_options); + int open_table(const char *name); + int storage_open_columns(void); + void storage_close_columns(void); + int storage_open_indexes(const char *name); + void wrapper_overwrite_index_bits(); + int wrapper_close(); + int storage_close(); + int generic_extra(enum ha_extra_function operation); + int wrapper_extra(enum ha_extra_function operation); + int storage_extra(enum ha_extra_function operation); + int wrapper_extra_opt(enum ha_extra_function operation, ulong cache_size); + int storage_extra_opt(enum ha_extra_function operation, ulong cache_size); + int generic_reset(); + int wrapper_reset(); + int storage_reset(); + uint wrapper_lock_count() const; + uint storage_lock_count() const; + THR_LOCK_DATA **wrapper_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + THR_LOCK_DATA **storage_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + int wrapper_external_lock(THD *thd, int lock_type); + int storage_external_lock(THD *thd, int lock_type); +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + void wrapper_start_bulk_insert(ha_rows rows, uint flags); + void storage_start_bulk_insert(ha_rows rows, uint flags); +#else + void wrapper_start_bulk_insert(ha_rows rows); + void storage_start_bulk_insert(ha_rows rows); +#endif + int wrapper_end_bulk_insert(); + int storage_end_bulk_insert(); + bool wrapper_is_target_index(KEY *key_info); + bool wrapper_have_target_index(); + int wrapper_write_row(const uchar *buf); + int wrapper_write_row_index(const uchar *buf); + int storage_write_row(const uchar *buf); + int storage_write_row_multiple_column_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_column); + int storage_write_row_multiple_column_indexes(const uchar *buf, grn_id record_id); + int storage_write_row_unique_index(const uchar *buf, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *key_id); + int storage_write_row_unique_indexes(const uchar *buf); + int wrapper_get_record_id(uchar *data, grn_id *record_id, + const char *context); + int wrapper_update_row(const uchar *old_data, const uchar *new_data); + int wrapper_update_row_index(const uchar *old_data, + const uchar *new_data); + int storage_update_row(const uchar *old_data, const uchar *new_data); + int storage_update_row_index(const uchar *old_data, + const uchar *new_data); + int storage_update_row_unique_indexes(const uchar *new_data); + int wrapper_delete_row(const uchar *buf); + int wrapper_delete_row_index(const uchar *buf); + int storage_delete_row(const uchar *buf); + int storage_delete_row_index(const uchar *buf); + int storage_delete_row_unique_index(grn_obj *index_table, grn_id del_key_id); + int storage_delete_row_unique_indexes(); + int storage_prepare_delete_row_unique_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *del_key_id); + int storage_prepare_delete_row_unique_indexes(const uchar *buf, + grn_id record_id); + uint wrapper_max_supported_record_length() const; + uint storage_max_supported_record_length() const; + uint wrapper_max_supported_keys() const; + uint storage_max_supported_keys() const; + uint wrapper_max_supported_key_parts() 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; + uint storage_max_supported_key_part_length() const; + ulonglong wrapper_table_flags() const; + ulonglong storage_table_flags() const; + ulong wrapper_index_flags(uint idx, uint part, bool all_parts) const; + ulong storage_index_flags(uint idx, uint part, bool all_parts) const; + int wrapper_info(uint flag); + int storage_info(uint flag); + void storage_info_variable(); + void storage_info_variable_records(); + void storage_info_variable_data_file_length(); +#ifdef MRN_HANDLER_RECORDS_RETURN_ERROR + int wrapper_records(ha_rows *num_rows); + int storage_records(ha_rows *num_rows); +#else + ha_rows wrapper_records(); + ha_rows storage_records(); +#endif + int wrapper_rnd_init(bool scan); + int storage_rnd_init(bool scan); + int wrapper_rnd_end(); + int storage_rnd_end(); + int wrapper_rnd_next(uchar *buf); + int storage_rnd_next(uchar *buf); + int wrapper_rnd_pos(uchar *buf, uchar *pos); + int storage_rnd_pos(uchar *buf, uchar *pos); + void wrapper_position(const uchar *record); + void storage_position(const uchar *record); + ha_rows wrapper_records_in_range(uint key_nr, const key_range *range_min, + const key_range *range_max, + page_range *pages); + ha_rows storage_records_in_range(uint key_nr, const key_range *range_min, + const key_range *range_max, + page_range *pages); + ha_rows generic_records_in_range_geo(uint key_nr, const key_range *range_min, + const key_range *range_max); + int wrapper_index_init(uint idx, bool sorted); + int storage_index_init(uint idx, bool sorted); + int wrapper_index_end(); + int storage_index_end(); + int wrapper_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); + int storage_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP + int wrapper_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); + int storage_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); +#endif + int wrapper_index_next(uchar *buf); + int storage_index_next(uchar *buf); + int wrapper_index_prev(uchar *buf); + int storage_index_prev(uchar *buf); + int wrapper_index_first(uchar *buf); + int storage_index_first(uchar *buf); + int wrapper_index_last(uchar *buf); + int storage_index_last(uchar *buf); + int wrapper_index_next_same(uchar *buf, const uchar *key, uint keylen); + int storage_index_next_same(uchar *buf, const uchar *key, uint keylen); + int generic_ft_init(); + int wrapper_ft_init(); + int storage_ft_init(); + FT_INFO *wrapper_ft_init_ext(uint flags, uint key_nr, String *key); + FT_INFO *storage_ft_init_ext(uint flags, uint key_nr, String *key); + void generic_ft_init_ext_add_conditions_fast_order_limit( + struct st_mrn_ft_info *info, grn_obj *expression); + grn_rc generic_ft_init_ext_prepare_expression_in_boolean_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression); + grn_rc generic_ft_init_ext_prepare_expression_in_normal_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression); + struct st_mrn_ft_info *generic_ft_init_ext_select(uint flags, + uint key_nr, + String *key); + FT_INFO *generic_ft_init_ext(uint flags, uint key_nr, String *key); + int wrapper_ft_read(uchar *buf); + int storage_ft_read(uchar *buf); + const Item *wrapper_cond_push(const Item *cond); + const Item *storage_cond_push(const Item *cond); + void wrapper_cond_pop(); + void storage_cond_pop(); + bool wrapper_get_error_message(int error, String *buf); + bool storage_get_error_message(int error, String *buf); + handler *wrapper_clone(const char *name, MEM_ROOT *mem_root); + handler *storage_clone(const char *name, MEM_ROOT *mem_root); + uint8 wrapper_table_cache_type(); + uint8 storage_table_cache_type(); +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ + ha_rows wrapper_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost); + ha_rows storage_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost); + ha_rows wrapper_multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost); + ha_rows storage_multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost); + int wrapper_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + int storage_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + int wrapper_multi_range_read_next(range_id_t *range_info); + int storage_multi_range_read_next(range_id_t *range_info); +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int storage_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int wrapper_read_multi_range_next(KEY_MULTI_RANGE **found_range_p); + int storage_read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int generic_delete_all_rows(grn_obj *target_grn_table, + const char *function_name); + int wrapper_delete_all_rows(); + int storage_delete_all_rows(); + int wrapper_truncate(); + int wrapper_truncate_index(); + int storage_truncate(); + int storage_truncate_index(); + double wrapper_scan_time(); + double storage_scan_time(); + double wrapper_read_time(uint index, uint ranges, ha_rows rows); + double storage_read_time(uint index, uint ranges, ha_rows rows); +#ifdef MRN_HANDLER_HAVE_KEYS_TO_USE_FOR_SCANNING + const key_map *wrapper_keys_to_use_for_scanning(); + const key_map *storage_keys_to_use_for_scanning(); +#endif + ha_rows wrapper_estimate_rows_upper_bound(); + ha_rows storage_estimate_rows_upper_bound(); + void wrapper_update_create_info(HA_CREATE_INFO* create_info); + void storage_update_create_info(HA_CREATE_INFO* create_info); + int wrapper_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); + int wrapper_rename_index(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); + int storage_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); +#ifdef MRN_SUPPORT_FOREIGN_KEYS + int storage_rename_foreign_key(MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); +#endif + bool wrapper_is_crashed() const; + bool storage_is_crashed() const; + bool wrapper_auto_repair(int error) const; + bool storage_auto_repair(int error) const; + int generic_disable_index(int i, KEY *key_info); + int wrapper_disable_indexes_mroonga(uint mode); + int wrapper_disable_indexes(uint mode); + int storage_disable_indexes(uint mode); + int wrapper_enable_indexes_mroonga(uint mode); + int wrapper_enable_indexes(uint mode); + int storage_enable_indexes(uint mode); + int wrapper_check(THD* thd, HA_CHECK_OPT* check_opt); + int storage_check(THD* thd, HA_CHECK_OPT* check_opt); + int wrapper_fill_indexes(THD *thd, KEY *key_info, + grn_obj **index_columns, uint n_keys); + int wrapper_recreate_indexes(THD *thd); + int 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); + bool storage_check_and_repair(THD *thd); + int wrapper_analyze(THD* thd, HA_CHECK_OPT* check_opt); + int storage_analyze(THD* thd, HA_CHECK_OPT* check_opt); + int wrapper_optimize(THD* thd, HA_CHECK_OPT* check_opt); + int storage_optimize(THD* thd, HA_CHECK_OPT* check_opt); + bool wrapper_is_fatal_error(int error_num, uint flags); + bool storage_is_fatal_error(int error_num, uint flags); + bool wrapper_is_comment_changed(TABLE *table1, TABLE *table2); + bool wrapper_check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); + bool storage_check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); + int storage_add_index_multiple_columns(KEY *key_info, uint num_of_keys, + grn_obj **index_tables, + grn_obj **index_columns, + bool skip_unique_key); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + enum_alter_inplace_result + wrapper_check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + enum_alter_inplace_result + storage_check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_add_index(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_drop_index(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_add_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_drop_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_rename_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit); + bool storage_commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit); +#else + alter_table_operations wrapper_alter_table_flags(alter_table_operations flags); + alter_table_operations storage_alter_table_flags(alter_table_operations flags); +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int wrapper_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); + int storage_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); +# else + int wrapper_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); + int storage_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); +# endif +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int wrapper_final_add_index(handler_add_index *add, bool commit); + int storage_final_add_index(handler_add_index *add, bool commit); +# endif + int wrapper_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys); + int storage_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys); + int wrapper_final_drop_index(TABLE *table_arg); + int storage_final_drop_index(TABLE *table_arg); +#endif + int wrapper_update_auto_increment(); + int storage_update_auto_increment(); + void wrapper_set_next_insert_id(ulonglong id); + void storage_set_next_insert_id(ulonglong id); + void wrapper_get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values); + void storage_get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values); + void wrapper_restore_auto_increment(ulonglong prev_insert_id); + void storage_restore_auto_increment(ulonglong prev_insert_id); + void wrapper_release_auto_increment(); + void storage_release_auto_increment(); + int wrapper_check_for_upgrade(HA_CHECK_OPT *check_opt); + int storage_check_for_upgrade(HA_CHECK_OPT *check_opt); +#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); + void storage_try_semi_consistent_read(bool yes); + void wrapper_unlock_row(); + void storage_unlock_row(); + int wrapper_start_stmt(THD *thd, thr_lock_type lock_type); + int storage_start_stmt(THD *thd, thr_lock_type lock_type); + void wrapper_change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg); + void storage_change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg); + bool wrapper_is_fk_defined_on_table_or_index(uint index); + bool storage_is_fk_defined_on_table_or_index(uint index); + char *wrapper_get_foreign_key_create_info(); + char *storage_get_foreign_key_create_info(); +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME + char *wrapper_get_tablespace_name(THD *thd, char *name, uint name_len); + char *storage_get_tablespace_name(THD *thd, char *name, uint name_len); +#endif + bool wrapper_can_switch_engines(); + bool storage_can_switch_engines(); + int wrapper_get_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_foreign_key_list(THD *thd, List *f_key_list); + int wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_parent_foreign_key_list(THD *thd, List *f_key_list); + uint wrapper_referenced_by_foreign_key(); + uint storage_referenced_by_foreign_key(); + void wrapper_init_table_handle_for_HANDLER(); + void storage_init_table_handle_for_HANDLER(); + void wrapper_free_foreign_key_create_info(char* str); + void storage_free_foreign_key_create_info(char* str); + void wrapper_set_keys_in_use(); + void storage_set_keys_in_use(); +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + bool check_written_by_row_based_binlog(); +#endif +#ifdef MRN_HAVE_HA_REBIND_PSI + void wrapper_unbind_psi(); + void storage_unbind_psi(); + void wrapper_rebind(); + void storage_rebind(); +#endif + my_bool wrapper_register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data); + my_bool storage_register_query_cache_table(THD *thd, + const char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data); +}; + +#ifdef __cplusplus +} +#endif + +#endif /* HA_MROONGA_HPP_ */ diff --git a/storage/mroonga/lib/Makefile.am b/storage/mroonga/lib/Makefile.am new file mode 100644 index 00000000..300131db --- /dev/null +++ b/storage/mroonga/lib/Makefile.am @@ -0,0 +1,23 @@ +AM_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + $(MYSQL_INCLUDES) \ + $(GROONGA_CFLAGS) \ + $(MYSQL_VERSION_CFLAGS) + +libmrn_need_mysql_la_CXXFLAGS = $(AM_CXXFLAGS) $(MYSQL_CFLAGS) + +if WITH_LIBMYSQLSERVICES_COMPAT +LIBMYSQLSERVICES_COMPAT = libmysqlservices.la +endif + +noinst_LTLIBRARIES = \ + $(LIBMYSQLSERVICES_COMPAT) \ + libmrn_no_mysql.la \ + libmrn_need_mysql.la + +include libmrn_no_mysql_sources.am +include libmrn_need_mysql_sources.am +if WITH_LIBMYSQLSERVICES_COMPAT +include libmysqlservices_compat_sources.am +endif diff --git a/storage/mroonga/lib/libmrn_need_mysql_sources.am b/storage/mroonga/lib/libmrn_need_mysql_sources.am new file mode 100644 index 00000000..e8c03c63 --- /dev/null +++ b/storage/mroonga/lib/libmrn_need_mysql_sources.am @@ -0,0 +1,50 @@ +libmrn_need_mysql_la_SOURCES = \ + mrn_index_table_name.cpp \ + mrn_index_table_name.hpp \ + mrn_index_column_name.cpp \ + mrn_index_column_name.hpp \ + mrn_debug_column_access.cpp \ + mrn_debug_column_access.hpp \ + mrn_auto_increment_value_lock.cpp \ + mrn_auto_increment_value_lock.hpp \ + mrn_external_lock.cpp \ + mrn_external_lock.hpp \ + mrn_multiple_column_key_codec.cpp \ + mrn_multiple_column_key_codec.hpp \ + mrn_field_normalizer.cpp \ + mrn_field_normalizer.hpp \ + mrn_encoding.cpp \ + mrn_encoding.hpp \ + mrn_parameters_parser.cpp \ + mrn_parameters_parser.hpp \ + mrn_lock.cpp \ + mrn_lock.hpp \ + mrn_condition_converter.cpp \ + mrn_condition_converter.hpp \ + mrn_time_converter.cpp \ + mrn_time_converter.hpp \ + mrn_database_manager.cpp \ + mrn_database_manager.hpp \ + mrn_value_decoder.cpp \ + mrn_value_decoder.hpp \ + mrn_database_repairer.cpp \ + mrn_database_repairer.hpp \ + mrn_context_pool.cpp \ + mrn_context_pool.hpp \ + mrn_operations.cpp \ + mrn_operations.hpp \ + mrn_operation.cpp \ + mrn_operation.hpp \ + mrn_database.cpp \ + mrn_database.hpp \ + mrn_column_name.cpp \ + mrn_column_name.hpp \ + mrn_count_skip_checker.cpp \ + mrn_count_skip_checker.hpp \ + mrn_query_parser.cpp \ + mrn_query_parser.hpp \ + mrn_current_thread.hpp \ + mrn_smart_bitmap.cpp \ + mrn_smart_bitmap.hpp \ + mrn_table_fields_offset_mover.cpp \ + mrn_table_fields_offset_mover.hpp diff --git a/storage/mroonga/lib/libmrn_no_mysql_sources.am b/storage/mroonga/lib/libmrn_no_mysql_sources.am new file mode 100644 index 00000000..fd2d942d --- /dev/null +++ b/storage/mroonga/lib/libmrn_no_mysql_sources.am @@ -0,0 +1,9 @@ +libmrn_no_mysql_la_SOURCES = \ + mrn_match_escalation_threshold_scope.cpp \ + mrn_match_escalation_threshold_scope.hpp \ + mrn_path_mapper.cpp \ + mrn_path_mapper.hpp \ + mrn_windows.hpp \ + mrn_smart_grn_obj.cpp \ + mrn_smart_grn_obj.hpp \ + mrn_grn.hpp diff --git a/storage/mroonga/lib/libmysqlservices_compat_sources.am b/storage/mroonga/lib/libmysqlservices_compat_sources.am new file mode 100644 index 00000000..bb0712a4 --- /dev/null +++ b/storage/mroonga/lib/libmysqlservices_compat_sources.am @@ -0,0 +1,2 @@ +libmysqlservices_la_SOURCES = \ + mrn_mysqlservices.cpp diff --git a/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp b/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp new file mode 100644 index 00000000..4baef101 --- /dev/null +++ b/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_auto_increment_value_lock.hpp" + +#if MYSQL_VERSION_ID >= 50500 +# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->LOCK_ha_data)) +#else +# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->mutex)) +#endif + +namespace mrn { + AutoIncrementValueLock::AutoIncrementValueLock(TABLE_SHARE *table_share) + : table_share_(table_share), + need_lock_(table_share_->tmp_table == NO_TMP_TABLE) { + if (need_lock_) { + mysql_mutex_lock(AUTO_INCREMENT_VALUE_MUTEX(table_share_)); + } + } + + AutoIncrementValueLock::~AutoIncrementValueLock() { + if (need_lock_) { + mysql_mutex_unlock(AUTO_INCREMENT_VALUE_MUTEX(table_share_)); + } + } +} diff --git a/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp b/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp new file mode 100644 index 00000000..ed2f9f3c --- /dev/null +++ b/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ +#define MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ + +#include +#include + +namespace mrn { + class AutoIncrementValueLock { + TABLE_SHARE *table_share_; + bool need_lock_; + public: + AutoIncrementValueLock(TABLE_SHARE *table_share); + ~AutoIncrementValueLock(); + }; +} + +#endif // MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ diff --git a/storage/mroonga/lib/mrn_column_name.cpp b/storage/mroonga/lib/mrn_column_name.cpp new file mode 100644 index 00000000..173553dd --- /dev/null +++ b/storage/mroonga/lib/mrn_column_name.cpp @@ -0,0 +1,69 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include +#include + +#include "mrn_column_name.hpp" + +#include + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::ColumnName" + +namespace mrn { + ColumnName::ColumnName(const char *mysql_name) + : mysql_name_(mysql_name) { + encode(mysql_name, strlen(mysql_name)); + } + + ColumnName::ColumnName(const LEX_CSTRING &mysql_name) + : mysql_name_(mysql_name.str) { + encode(mysql_name.str, mysql_name.length); + } + + const char *ColumnName::mysql_name() { + return mysql_name_; + } + + const char *ColumnName::c_str() { + return name_; + } + + size_t ColumnName::length() { + return length_; + } + + void ColumnName::encode(const char *mysql_name, + size_t mysql_name_length) { + MRN_DBUG_ENTER_METHOD(); + uint errors; + length_ = mrn_strconvert(system_charset_info, + mysql_name, + mysql_name_length, + &my_charset_filename, + name_, + MRN_MAX_PATH_SIZE, + &errors); + name_[length_] = '\0'; + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_column_name.hpp b/storage/mroonga/lib/mrn_column_name.hpp new file mode 100644 index 00000000..abd4bf54 --- /dev/null +++ b/storage/mroonga/lib/mrn_column_name.hpp @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#pragma once + +#include + +namespace mrn { + class ColumnName { + public: + ColumnName(const char *mysql_name); + ColumnName(const LEX_CSTRING &mysql_name); + const char *mysql_name(); + const char *c_str(); + size_t length(); + private: + const char *mysql_name_; + char name_[MRN_MAX_PATH_SIZE]; + size_t length_; + + void encode(const char *mysql_name, size_t mysql_name_length); + }; +} diff --git a/storage/mroonga/lib/mrn_condition_converter.cpp b/storage/mroonga/lib/mrn_condition_converter.cpp new file mode 100644 index 00000000..761dfc72 --- /dev/null +++ b/storage/mroonga/lib/mrn_condition_converter.cpp @@ -0,0 +1,637 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_condition_converter.hpp" +#include "mrn_time_converter.hpp" +#include "mrn_smart_grn_obj.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::ConditionConverter" + +#ifdef MRN_ITEM_HAVE_ITEM_NAME +# define MRN_ITEM_FIELD_GET_NAME(item) ((item)->item_name.ptr()) +# define MRN_ITEM_FIELD_GET_NAME_LENGTH(item) ((item)->item_name.length()) +#else +# define MRN_ITEM_FIELD_GET_NAME(item) ((item)->name.str) +# define MRN_ITEM_FIELD_GET_NAME_LENGTH(item) ((item)->name.length) +#endif + +namespace mrn { + ConditionConverter::ConditionConverter(grn_ctx *ctx, grn_obj *table, + bool is_storage_mode) + : ctx_(ctx), + table_(table), + is_storage_mode_(is_storage_mode) { + GRN_TEXT_INIT(&column_name_, 0); + GRN_VOID_INIT(&value_); + } + + ConditionConverter::~ConditionConverter() { + grn_obj_unlink(ctx_, &column_name_); + grn_obj_unlink(ctx_, &value_); + } + + bool ConditionConverter::is_convertable(const Item *item) { + MRN_DBUG_ENTER_METHOD(); + + if (!item) { + DBUG_RETURN(false); + } + + switch (item->type()) { + case Item::COND_ITEM: + { + const Item_cond *cond_item = reinterpret_cast(item); + bool convertable = is_convertable(cond_item); + DBUG_RETURN(convertable); + } + break; + case Item::FUNC_ITEM: + { + const Item_func *func_item = reinterpret_cast(item); + bool convertable = is_convertable(func_item); + DBUG_RETURN(convertable); + } + break; + default: + DBUG_RETURN(false); + break; + } + + DBUG_RETURN(false); + } + + bool ConditionConverter::is_convertable(const Item_cond *cond_item) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + + if (cond_item->functype() != Item_func::COND_AND_FUNC) { + DBUG_RETURN(false); + } + + List *argument_list = + const_cast(cond_item)->argument_list(); + List_iterator iterator(*argument_list); + const Item *sub_item; + while ((sub_item = iterator++)) { + if (!is_convertable(sub_item)) { + DBUG_RETURN(false); + } + } + + DBUG_RETURN(true); + } + + bool ConditionConverter::is_convertable(const Item_func *func_item) { + MRN_DBUG_ENTER_METHOD(); + + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GE_FUNC: + case Item_func::GT_FUNC: + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + Item *right_item = arguments[1]; + if (left_item->type() != Item::FIELD_ITEM) { + DBUG_RETURN(false); + } + if (!right_item->basic_const_item()) { + DBUG_RETURN(false); + } + + bool convertable = + is_convertable_binary_operation(static_cast(left_item), + right_item, + func_item->functype()); + DBUG_RETURN(convertable); + } + break; + case Item_func::FT_FUNC: + DBUG_RETURN(true); + break; + case Item_func::BETWEEN: + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + { + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + Item *min_item = arguments[1]; + Item *max_item = arguments[2]; + if (target_item->type() != Item::FIELD_ITEM) { + DBUG_RETURN(false); + } + if (!min_item->basic_const_item()) { + DBUG_RETURN(false); + } + if (!max_item->basic_const_item()) { + DBUG_RETURN(false); + } + + bool convertable = + is_convertable_between(static_cast(target_item), + min_item, + max_item); + DBUG_RETURN(convertable); + } + default: + DBUG_RETURN(false); + break; + } + + DBUG_RETURN(true); + } + + bool ConditionConverter::is_convertable_binary_operation( + const Item_field *field_item, + Item *value_item, + Item_func::Functype func_type) { + MRN_DBUG_ENTER_METHOD(); + + bool convertable = false; + + enum_field_types field_type = field_item->field->real_type(); + NormalizedType normalized_type = normalize_field_type(field_type); + switch (normalized_type) { + case STRING_TYPE: + if (value_item->is_of_type(Item::CONST_ITEM, STRING_RESULT) && + func_type == Item_func::EQ_FUNC) { + convertable = have_index(field_item, GRN_OP_EQUAL); + } + break; + case INT_TYPE: + if (field_type == MYSQL_TYPE_ENUM) { + convertable = value_item->is_of_type(Item::CONST_ITEM, STRING_RESULT) || + value_item->is_of_type(Item::CONST_ITEM, INT_RESULT); + } else { + convertable = value_item->is_of_type(Item::CONST_ITEM, INT_RESULT); + } + break; + case TIME_TYPE: + if (is_valid_time_value(field_item, value_item)) { + convertable = have_index(field_item, func_type); + } + break; + case UNSUPPORTED_TYPE: + break; + } + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::is_convertable_between(const Item_field *field_item, + Item *min_item, + Item *max_item) { + MRN_DBUG_ENTER_METHOD(); + + bool convertable = false; + + enum_field_types field_type = field_item->field->type(); + NormalizedType normalized_type = normalize_field_type(field_type); + switch (normalized_type) { + case STRING_TYPE: + if (min_item->is_of_type(Item::CONST_ITEM, STRING_RESULT) && + max_item->is_of_type(Item::CONST_ITEM, STRING_RESULT)) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case INT_TYPE: + if (min_item->is_of_type(Item::CONST_ITEM, INT_RESULT) && + max_item->is_of_type(Item::CONST_ITEM, INT_RESULT)) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case TIME_TYPE: + if (is_valid_time_value(field_item, min_item) && + is_valid_time_value(field_item, max_item)) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case UNSUPPORTED_TYPE: + break; + } + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::is_valid_time_value(const Item_field *field_item, + Item *value_item) { + MRN_DBUG_ENTER_METHOD(); + + MYSQL_TIME mysql_time; + bool error = get_time_value(field_item, value_item, &mysql_time); + + DBUG_RETURN(!error); + } + + bool ConditionConverter::get_time_value(const Item_field *field_item, + Item *value_item, + MYSQL_TIME *mysql_time) { + MRN_DBUG_ENTER_METHOD(); + + bool error; + Item *real_value_item = value_item->real_item(); + switch (field_item->field->type()) { + case MYSQL_TYPE_TIME: + { + THD *thd= current_thd; + error= real_value_item->get_date(thd, mysql_time, Time::Options(thd)); + break; + } + case MYSQL_TYPE_YEAR: + mysql_time->year = static_cast(value_item->val_int()); + mysql_time->month = 1; + mysql_time->day = 1; + mysql_time->hour = 0; + mysql_time->hour = 0; + mysql_time->minute = 0; + mysql_time->second_part = 0; + mysql_time->neg = false; + mysql_time->time_type = MYSQL_TIMESTAMP_DATE; + error = false; + break; + default: + { + THD *thd= current_thd; + Datetime::Options opt(TIME_FUZZY_DATES, thd); + error = real_value_item->get_date(thd, mysql_time, opt); + break; + } + } + + DBUG_RETURN(error); + } + + ConditionConverter::NormalizedType + ConditionConverter::normalize_field_type(enum_field_types field_type) { + MRN_DBUG_ENTER_METHOD(); + + NormalizedType type = UNSUPPORTED_TYPE; + + switch (field_type) { + case MYSQL_TYPE_DECIMAL: + type = STRING_TYPE; + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + type = INT_TYPE; + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + type = UNSUPPORTED_TYPE; + break; + case MYSQL_TYPE_NULL: + type = UNSUPPORTED_TYPE; + break; + case MYSQL_TYPE_TIMESTAMP: + type = TIME_TYPE; + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + type = INT_TYPE; + break; + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_TIME: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_YEAR: + case MYSQL_TYPE_NEWDATE: + type = TIME_TYPE; + break; + case MYSQL_TYPE_VARCHAR: + type = STRING_TYPE; + break; + case MYSQL_TYPE_BIT: + type = INT_TYPE; + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + type = TIME_TYPE; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + type = TIME_TYPE; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + type = TIME_TYPE; + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + type = STRING_TYPE; + break; + case MYSQL_TYPE_ENUM: + type = INT_TYPE; + break; + case MYSQL_TYPE_SET: + type = INT_TYPE; + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + type = STRING_TYPE; + break; + case MYSQL_TYPE_GEOMETRY: + type = UNSUPPORTED_TYPE; + break; + case MYSQL_TYPE_VARCHAR_COMPRESSED: + case MYSQL_TYPE_BLOB_COMPRESSED: + DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + type = STRING_TYPE; + break; +#endif + } + + DBUG_RETURN(type); + } + + bool ConditionConverter::have_index(const Item_field *field_item, + grn_operator _operator) { + MRN_DBUG_ENTER_METHOD(); + + grn_obj *column; + column = grn_obj_column(ctx_, table_, + MRN_ITEM_FIELD_GET_NAME(field_item), + MRN_ITEM_FIELD_GET_NAME_LENGTH(field_item)); + if (!column) { + DBUG_RETURN(false); + } + mrn::SmartGrnObj smart_column(ctx_, column); + + int n_indexes = grn_column_index(ctx_, column, _operator, NULL, 0, NULL); + bool convertable = (n_indexes > 0); + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::have_index(const Item_field *field_item, + Item_func::Functype func_type) { + MRN_DBUG_ENTER_METHOD(); + + bool have = false; + switch (func_type) { + case Item_func::EQ_FUNC: + have = have_index(field_item, GRN_OP_EQUAL); + break; + case Item_func::LT_FUNC: + have = have_index(field_item, GRN_OP_LESS); + break; + case Item_func::LE_FUNC: + have = have_index(field_item, GRN_OP_LESS_EQUAL); + break; + case Item_func::GE_FUNC: + have = have_index(field_item, GRN_OP_GREATER_EQUAL); + break; + case Item_func::GT_FUNC: + have = have_index(field_item, GRN_OP_GREATER); + break; + default: + break; + } + + DBUG_RETURN(have); + } + + unsigned int ConditionConverter::count_match_against(const Item *item) { + MRN_DBUG_ENTER_METHOD(); + + if (!item) { + DBUG_RETURN(0); + } + + switch (item->type()) { + case Item::COND_ITEM: + if (is_storage_mode_) { + Item_cond *cond_item = (Item_cond *)item; + if (cond_item->functype() == Item_func::COND_AND_FUNC) { + unsigned int n_match_againsts = 0; + List_iterator iterator(*((cond_item)->argument_list())); + const Item *sub_item; + while ((sub_item = iterator++)) { + n_match_againsts += count_match_against(sub_item); + } + DBUG_RETURN(n_match_againsts); + } + } + break; + case Item::FUNC_ITEM: + { + const Item_func *func_item = (const Item_func *)item; + switch (func_item->functype()) { + case Item_func::FT_FUNC: + DBUG_RETURN(1); + break; + default: + break; + } + } + break; + default: + break; + } + + DBUG_RETURN(0); + } + + void ConditionConverter::convert(const Item *where, grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + if (!where || where->type() != Item::COND_ITEM) { + DBUG_VOID_RETURN; + } + + Item_cond *cond_item = (Item_cond *)where; + List_iterator iterator(*((cond_item)->argument_list())); + const Item *sub_item; + while ((sub_item = iterator++)) { + switch (sub_item->type()) { + case Item::FUNC_ITEM: + { + const Item_func *func_item = (const Item_func *)sub_item; + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_EQUAL); + break; + case Item_func::LT_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_LESS); + break; + case Item_func::LE_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_LESS_EQUAL); + break; + case Item_func::GE_FUNC: + convert_binary_operation(func_item, expression, + GRN_OP_GREATER_EQUAL); + break; + case Item_func::GT_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_GREATER); + break; + case Item_func::BETWEEN: + convert_between(func_item, expression); + break; + default: + break; + } + } + break; + default: + break; + } + } + + DBUG_VOID_RETURN; + } + + void ConditionConverter::convert_binary_operation(const Item_func *func_item, + grn_obj *expression, + grn_operator _operator) { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + Item *right_item = arguments[1]; + if (left_item->type() == Item::FIELD_ITEM) { + const Item_field *field_item = static_cast(left_item); + append_field_value(field_item, expression); + append_const_item(field_item, right_item, expression); + grn_expr_append_op(ctx_, expression, _operator, 2); + grn_expr_append_op(ctx_, expression, GRN_OP_AND, 2); + } + } + + void ConditionConverter::convert_between(const Item_func *func_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + Item *min_item = arguments[1]; + Item *max_item = arguments[2]; + + grn_obj *between_func = grn_ctx_get(ctx_, "between", strlen("between")); + grn_expr_append_obj(ctx_, expression, between_func, GRN_OP_PUSH, 1); + + const Item_field *field_item = static_cast(target_item); + append_field_value(field_item, expression); + + grn_obj include; + mrn::SmartGrnObj smart_include(ctx_, &include); + GRN_TEXT_INIT(&include, 0); + GRN_TEXT_PUTS(ctx_, &include, "include"); + append_const_item(field_item, min_item, expression); + grn_expr_append_const(ctx_, expression, &include, GRN_OP_PUSH, 1); + append_const_item(field_item, max_item, expression); + grn_expr_append_const(ctx_, expression, &include, GRN_OP_PUSH, 1); + + grn_expr_append_op(ctx_, expression, GRN_OP_CALL, 5); + + grn_expr_append_op(ctx_, expression, GRN_OP_AND, 2); + + DBUG_VOID_RETURN; + } + + void ConditionConverter::append_field_value(const Item_field *field_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + GRN_BULK_REWIND(&column_name_); + GRN_TEXT_PUT(ctx_, &column_name_, + MRN_ITEM_FIELD_GET_NAME(field_item), + MRN_ITEM_FIELD_GET_NAME_LENGTH(field_item)); + grn_expr_append_const(ctx_, expression, &column_name_, + GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, expression, GRN_OP_GET_VALUE, 1); + + DBUG_VOID_RETURN; + } + + void ConditionConverter::append_const_item(const Item_field *field_item, + Item *const_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + enum_field_types field_type = field_item->field->real_type(); + NormalizedType normalized_type = normalize_field_type(field_type); + + switch (normalized_type) { + case STRING_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_TEXT, 0); + { + String *string; + string = const_item->val_str(NULL); + GRN_TEXT_SET(ctx_, &value_, string->ptr(), string->length()); + } + break; + case INT_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_INT64, 0); + if (field_type == MYSQL_TYPE_ENUM) { + if (const_item->is_of_type(Item::CONST_ITEM, STRING_RESULT)) { + String *string; + string = const_item->val_str(NULL); + Field_enum *enum_field = static_cast(field_item->field); + int enum_value = find_type(string->c_ptr(), + enum_field->typelib, + FIND_TYPE_BASIC); + GRN_INT64_SET(ctx_, &value_, enum_value); + } else { + GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + } + } else { + GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + } + break; + case TIME_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_TIME, 0); + { + MYSQL_TIME mysql_time; + get_time_value(field_item, const_item, &mysql_time); + bool truncated = false; + TimeConverter time_converter; + long long int time = + time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + GRN_TIME_SET(ctx_, &value_, time); + } + break; + case UNSUPPORTED_TYPE: + // Should not be occurred. + DBUG_PRINT("error", + ("mroonga: append_const_item: unsupported type: <%d> " + "This case should not be occurred.", + field_type)); + grn_obj_reinit(ctx_, &value_, GRN_DB_VOID, 0); + break; + } + grn_expr_append_const(ctx_, expression, &value_, GRN_OP_PUSH, 1); + + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_condition_converter.hpp b/storage/mroonga/lib/mrn_condition_converter.hpp new file mode 100644 index 00000000..bf10001d --- /dev/null +++ b/storage/mroonga/lib/mrn_condition_converter.hpp @@ -0,0 +1,85 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_CONDITION_CONVERTER_HPP_ +#define MRN_CONDITION_CONVERTER_HPP_ + +#include + +#include + +#include + +namespace mrn { + class ConditionConverter { + public: + ConditionConverter(grn_ctx *ctx, grn_obj *table, bool is_storage_mode); + ~ConditionConverter(); + + bool is_convertable(const Item *item); + unsigned int count_match_against(const Item *item); + // caller must check "where" can be convertable by + // is_convertable(). This method doesn't validate "where". + void convert(const Item *where, grn_obj *expression); + + private: + enum NormalizedType { + STRING_TYPE, + INT_TYPE, + TIME_TYPE, + UNSUPPORTED_TYPE, + }; + + grn_ctx *ctx_; + grn_obj *table_; + bool is_storage_mode_; + grn_obj column_name_; + grn_obj value_; + + bool is_convertable(const Item_cond *cond_item); + bool is_convertable(const Item_func *func_item); + bool is_convertable_binary_operation(const Item_field *field_item, + Item *value_item, + Item_func::Functype func_type); + bool is_convertable_between(const Item_field *field_item, + Item *min_item, + Item *max_item); + bool is_valid_time_value(const Item_field *field_item, + Item *value_item); + bool get_time_value(const Item_field *field_item, + Item *value_item, + MYSQL_TIME *mysql_time); + bool have_index(const Item_field *field_item, grn_operator _operator); + bool have_index(const Item_field *field_item, Item_func::Functype func_type); + + NormalizedType normalize_field_type(enum_field_types field_type); + + void convert_binary_operation(const Item_func *func_item, + grn_obj *expression, + grn_operator _operator); + void convert_between(const Item_func *func_item, grn_obj *expression); + void append_field_value(const Item_field *field_item, + grn_obj *expression); + void append_const_item(const Item_field *field_item, + Item *const_item, + grn_obj *expression); + }; +} + +#endif /* MRN_CONDITION_CONVERTER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_context_pool.cpp b/storage/mroonga/lib/mrn_context_pool.cpp new file mode 100644 index 00000000..bbc239da --- /dev/null +++ b/storage/mroonga/lib/mrn_context_pool.cpp @@ -0,0 +1,120 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_context_pool.hpp" +#include "mrn_lock.hpp" + +#include + +namespace mrn { + // for debug +#define MRN_CLASS_NAME "mrn::ContextPool::Impl" + + class ContextPool::Impl { + public: + Impl(mysql_mutex_t *mutex) + : mutex_(mutex), + pool_(NULL), + last_pull_time_(0) { + } + + ~Impl(void) { + clear(); + } + + grn_ctx *pull(void) { + MRN_DBUG_ENTER_METHOD(); + grn_ctx *ctx = NULL; + + { + time_t now; + time(&now); + + mrn::Lock lock(mutex_); + if (pool_) { + ctx = static_cast(pool_->data); + list_pop(pool_); + if ((uint) (now - last_pull_time_) >= CLEAR_THREATHOLD_IN_SECONDS) { + clear(); + } + } + last_pull_time_ = now; + } + + if (!ctx) { + ctx = grn_ctx_open(0); + } + + DBUG_RETURN(ctx); + } + + void release(grn_ctx *ctx) { + MRN_DBUG_ENTER_METHOD(); + + { + mrn::Lock lock(mutex_); + list_push(pool_, ctx); + grn_ctx_use(ctx, NULL); + } + + DBUG_VOID_RETURN; + } + + private: + static const int CLEAR_THREATHOLD_IN_SECONDS = 60 * 5; + + mysql_mutex_t *mutex_; + LIST *pool_; + time_t last_pull_time_; + + void clear(void) { + MRN_DBUG_ENTER_METHOD(); + while (pool_) { + grn_ctx *ctx = static_cast(pool_->data); + grn_ctx_close(ctx); + list_pop(pool_); + } + DBUG_VOID_RETURN; + } + }; + + // For debug +#undef MRN_CLASS_NAME +#define MRN_CLASS_NAME "mrn::ContextPool" + + ContextPool::ContextPool(mysql_mutex_t *mutex) + : impl_(new Impl(mutex)) { + } + + ContextPool::~ContextPool(void) { + delete impl_; + } + + grn_ctx *ContextPool::pull(void) { + MRN_DBUG_ENTER_METHOD(); + grn_ctx *ctx = impl_->pull(); + DBUG_RETURN(ctx); + } + + void ContextPool::release(grn_ctx *ctx) { + MRN_DBUG_ENTER_METHOD(); + impl_->release(ctx); + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_context_pool.hpp b/storage/mroonga/lib/mrn_context_pool.hpp new file mode 100644 index 00000000..22b4fed8 --- /dev/null +++ b/storage/mroonga/lib/mrn_context_pool.hpp @@ -0,0 +1,41 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_CONTEXT_POOL_HPP_ +#define MRN_CONTEXT_POOL_HPP_ + +#include + +#include + +namespace mrn { + class ContextPool { + public: + ContextPool(mysql_mutex_t *mutex); + ~ContextPool(void); + grn_ctx *pull(void); + void release(grn_ctx *context); + + private: + class Impl; + Impl *impl_; + }; +} + +#endif /* MRN_CONTEXT_POOL_HPP_ */ diff --git a/storage/mroonga/lib/mrn_count_skip_checker.cpp b/storage/mroonga/lib/mrn_count_skip_checker.cpp new file mode 100644 index 00000000..dfa1a11d --- /dev/null +++ b/storage/mroonga/lib/mrn_count_skip_checker.cpp @@ -0,0 +1,303 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_count_skip_checker.hpp" + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::CountSkipChecker" + +namespace mrn { + CountSkipChecker::CountSkipChecker(grn_ctx *ctx, + TABLE *table, + SELECT_LEX *select_lex, + KEY *key_info, + key_part_map target_key_part_map, + bool is_storage_mode) + : ctx_(ctx), + table_(table), + select_lex_(select_lex), + key_info_(key_info), + target_key_part_map_(target_key_part_map), + is_storage_mode_(is_storage_mode) { + } + + CountSkipChecker::~CountSkipChecker() { + } + + bool CountSkipChecker::check() { + MRN_DBUG_ENTER_METHOD(); + + if (select_lex_->item_list.elements != 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not only one item: %u", + select_lex_->item_list.elements); + DBUG_RETURN(false); + } + if (select_lex_->group_list.elements > 0) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] have groups: %u", + select_lex_->group_list.elements); + DBUG_RETURN(false); + } + if (MRN_SELECT_LEX_GET_HAVING_COND(select_lex_)) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] have HAVING"); + DBUG_RETURN(false); + } + if (select_lex_->table_list.elements != 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not only one table: %u", + select_lex_->table_list.elements); + DBUG_RETURN(false); + } + + Item *info = static_cast(select_lex_->item_list.first_node()->info); + if (info->type() != Item::SUM_FUNC_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] item isn't sum function: %u", + info->type()); + DBUG_RETURN(false); + } + Item_sum *sum_item = static_cast(info); + if (sum_item->sum_func() != Item_sum::COUNT_FUNC) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not COUNT: %u", + sum_item->sum_func()); + DBUG_RETURN(false); + } + if (ITEM_SUM_GET_NEST_LEVEL(sum_item) != 0 || + ITEM_SUM_GET_AGGR_LEVEL(sum_item) != 0 || + ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) != -1 || + sum_item->max_sum_func_level != -1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not simple COUNT(*): %d:%d:%d:%d", + ITEM_SUM_GET_NEST_LEVEL(sum_item), + ITEM_SUM_GET_AGGR_LEVEL(sum_item), + ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item), + sum_item->max_sum_func_level); + DBUG_RETURN(false); + } + + Item *where = MRN_SELECT_LEX_GET_WHERE_COND(select_lex_); + if (!where) { + if (is_storage_mode_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] no condition"); + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] no condition with wrapper mode"); + DBUG_RETURN(false); + } + } + + bool skippable = is_skippable(where); + DBUG_RETURN(skippable); + } + + bool CountSkipChecker::is_skippable(Item *where) { + MRN_DBUG_ENTER_METHOD(); + + bool skippable = false; + switch (where->type()) { + case Item::COND_ITEM: + { + Item_cond *cond_item = static_cast(where); + skippable = is_skippable(cond_item); + if (skippable) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] skippable multiple conditions"); + } + } + break; + case Item::FUNC_ITEM: + { + Item_func *func_item = static_cast(where); + if (func_item->functype() == Item_func::FT_FUNC) { + if (select_lex_->select_n_where_fields == 1) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] " + "only one full text search condition"); + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "full text search condition and more conditions: %u", + select_lex_->select_n_where_fields); + DBUG_RETURN(false); + } + } else { + skippable = is_skippable(func_item); + if (skippable) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][true] skippable condition"); + } + } + } + break; + default: + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] unsupported top level item: %u", + where->type()); + break; + } + + DBUG_RETURN(skippable); + } + + bool CountSkipChecker::is_skippable(Item_cond *cond_item) { + MRN_DBUG_ENTER_METHOD(); + + List_iterator iterator(*(cond_item->argument_list())); + Item *sub_item; + while ((sub_item = iterator++)) { + if (sub_item->type() != Item::FUNC_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "sub condition isn't function item: %u", + sub_item->type()); + DBUG_RETURN(false); + } + if (!is_skippable(static_cast(sub_item))) { + DBUG_RETURN(false); + } + } + DBUG_RETURN(true); + } + + bool CountSkipChecker::is_skippable(Item_func *func_item) { + MRN_DBUG_ENTER_METHOD(); + + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + case Item_func::EQUAL_FUNC: + case Item_func::NE_FUNC: + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GE_FUNC: + case Item_func::GT_FUNC: + { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + if (left_item->type() != Item::FIELD_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] not field: %u:%u", + func_item->functype(), + left_item->type()); + DBUG_RETURN(false); + } + + bool skippable = is_skippable(static_cast(left_item)); + DBUG_RETURN(skippable); + } + break; + case Item_func::BETWEEN: + { + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + if (target_item->type() != Item::FIELD_ITEM) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] BETWEEN target isn't field: %u", + target_item->type()); + DBUG_RETURN(false); + } + + bool skippable = is_skippable(static_cast(target_item)); + DBUG_RETURN(skippable); + } + break; + case Item_func::MULT_EQUAL_FUNC: +#ifdef MRN_HAVE_ITEM_EQUAL_FIELDS_ITERATOR + { + Item_equal *equal_item = static_cast(func_item); + Item_equal_fields_iterator iterator(*equal_item); + Item *field_item; + while ((field_item = iterator++)) { + bool skippable = is_skippable(static_cast(field_item)); + if (!skippable) { + DBUG_RETURN(skippable); + } + } + DBUG_RETURN(true); + } +#endif + break; + default: + break; + } + + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] unsupported function item: %u", + func_item->functype()); + DBUG_RETURN(false); + } + + bool CountSkipChecker::is_skippable(Item_field *field_item) { + MRN_DBUG_ENTER_METHOD(); + + Field *field = field_item->field; + if (!field) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] field is missing"); + DBUG_RETURN(false); + } + + if (field->table != table_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] external table's field"); + DBUG_RETURN(false); + } + + if (!key_info_) { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] no active index: <%s>:<%s>", + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } + + uint i; + KEY_PART_INFO *key_part = key_info_->key_part; + for (i = 0; i < KEY_N_KEY_PARTS(key_info_); i++) { + if (key_part[i].field == field) { + if ((target_key_part_map_ >> i) & 1) { + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] " + "field's index are out of key part map: %u:%lu: <%s>:<%s>", + i, + target_key_part_map_, + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } + } + } + + GRN_LOG(ctx_, GRN_LOG_DEBUG, + "[mroonga][count-skip][false] field isn't indexed: <%s>:<%s>", + *(field->table_name), + field->field_name.str); + DBUG_RETURN(false); + } +} diff --git a/storage/mroonga/lib/mrn_count_skip_checker.hpp b/storage/mroonga/lib/mrn_count_skip_checker.hpp new file mode 100644 index 00000000..8ea93cd3 --- /dev/null +++ b/storage/mroonga/lib/mrn_count_skip_checker.hpp @@ -0,0 +1,57 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2016 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#ifndef MRN_COUNT_SKIP_CHECKER_HPP_ +#define MRN_COUNT_SKIP_CHECKER_HPP_ + +#include + +#include + +#include + +namespace mrn { + class CountSkipChecker { + public: + CountSkipChecker(grn_ctx *ctx, + TABLE *table, + SELECT_LEX *select_lex, + KEY *key_info, + key_part_map target_key_part_map, + bool is_storage_mode); + ~CountSkipChecker(); + + bool check(); + + private: + grn_ctx *ctx_; + TABLE *table_; + SELECT_LEX *select_lex_; + KEY *key_info_; + key_part_map target_key_part_map_; + bool is_storage_mode_; + + bool is_skippable(Item *where); + bool is_skippable(Item_cond *cond_item); + bool is_skippable(Item_func *func_item); + bool is_skippable(Item_field *field_item); + }; +} + +#endif /* MRN_COUNT_SKIP_CHECKER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_current_thread.hpp b/storage/mroonga/lib/mrn_current_thread.hpp new file mode 100644 index 00000000..ee494f76 --- /dev/null +++ b/storage/mroonga/lib/mrn_current_thread.hpp @@ -0,0 +1,27 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#pragma once + +#include +#include + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# include +#endif diff --git a/storage/mroonga/lib/mrn_database.cpp b/storage/mroonga/lib/mrn_database.cpp new file mode 100644 index 00000000..12f0b348 --- /dev/null +++ b/storage/mroonga/lib/mrn_database.cpp @@ -0,0 +1,89 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_database.hpp" +#include "mrn_operations.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Database" + +namespace mrn { + Database::Database(grn_ctx *ctx, grn_obj *db) + : ctx_(ctx), + db_(db), + broken_table_names_(NULL), + is_broken_(false) { + Operations operations(ctx_); + broken_table_names_ = operations.collect_processing_table_names(); + is_broken_ = operations.is_locked(); + } + + Database::~Database(void) { + close(); + } + + void Database::close() { + MRN_DBUG_ENTER_METHOD(); + if (db_) { + grn_hash_close(ctx_, broken_table_names_); + broken_table_names_ = NULL; + grn_obj_close(ctx_, db_); + db_ = NULL; + } + DBUG_VOID_RETURN; + } + + grn_rc Database::remove() { + MRN_DBUG_ENTER_METHOD(); + grn_rc rc = GRN_SUCCESS; + if (db_) { + grn_hash_close(ctx_, broken_table_names_); + broken_table_names_ = NULL; + rc = grn_obj_remove(ctx_, db_); + if (rc == GRN_SUCCESS) { + db_ = NULL; + } + } + DBUG_RETURN(rc); + } + + grn_obj *Database::get() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(db_); + } + + bool Database::is_broken() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(is_broken_); + } + + bool Database::is_broken_table(const char *name, size_t name_size) { + MRN_DBUG_ENTER_METHOD(); + grn_id id = grn_hash_get(ctx_, broken_table_names_, name, name_size, NULL); + DBUG_RETURN(id != GRN_ID_NIL); + } + + void Database::mark_table_repaired(const char *name, size_t name_size) { + MRN_DBUG_ENTER_METHOD(); + grn_hash_delete(ctx_, broken_table_names_, name, name_size, NULL); + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_database.hpp b/storage/mroonga/lib/mrn_database.hpp new file mode 100644 index 00000000..cf9f9d4a --- /dev/null +++ b/storage/mroonga/lib/mrn_database.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_DATABASE_HPP_ +#define MRN_DATABASE_HPP_ + +#include + +namespace mrn { + class Database { + public: + Database(grn_ctx *ctx, grn_obj *db); + ~Database(void); + + void close(); + grn_rc remove(); + grn_obj *get(); + + bool is_broken(); + bool is_broken_table(const char *name, size_t name_size); + void mark_table_repaired(const char *name, size_t name_size); + + private: + grn_ctx *ctx_; + grn_obj *db_; + grn_hash *broken_table_names_; + bool is_broken_; + }; +} + +#endif /* MRN_DATABASE_HPP_ */ diff --git a/storage/mroonga/lib/mrn_database_manager.cpp b/storage/mroonga/lib/mrn_database_manager.cpp new file mode 100644 index 00000000..149c556f --- /dev/null +++ b/storage/mroonga/lib/mrn_database_manager.cpp @@ -0,0 +1,364 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_database_manager.hpp" +#include "mrn_encoding.hpp" +#include "mrn_lock.hpp" +#include "mrn_path_mapper.hpp" + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::DatabaseManager" + +#ifdef WIN32 +# include +# define MRN_MKDIR(pathname, mode) _mkdir((pathname)) +#else +# include +# include +# define MRN_MKDIR(pathname, mode) mkdir((pathname), (mode)) +#endif + +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, mysql_mutex_t *mutex) + : ctx_(ctx), + cache_(NULL), + mutex_(mutex) { + } + + DatabaseManager::~DatabaseManager(void) { + if (cache_) { + void *db_address; + GRN_HASH_EACH(ctx_, cache_, id, NULL, 0, &db_address, { + Database *db; + memcpy(&db, db_address, sizeof(grn_obj *)); + delete db; + }); + grn_hash_close(ctx_, cache_); + } + } + + bool DatabaseManager::init(void) { + MRN_DBUG_ENTER_METHOD(); + cache_ = grn_hash_create(ctx_, + NULL, + GRN_TABLE_MAX_KEY_SIZE, + sizeof(grn_obj *), + GRN_OBJ_KEY_VAR_SIZE); + if (!cache_) { + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to initialize hash table for caching opened databases"); + DBUG_RETURN(false); + } + + DBUG_RETURN(true); + } + + int DatabaseManager::open(const char *path, Database **db) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + *db = NULL; + + mrn::PathMapper mapper(path); + mrn::Lock lock(mutex_); + + error = mrn::encoding::set(ctx_, system_charset_info); + if (error) { + DBUG_RETURN(error); + } + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + if (id == GRN_ID_NIL) { + grn_obj *grn_db; + struct stat db_stat; + if (stat(mapper.db_path(), &db_stat)) { + GRN_LOG(ctx_, GRN_LOG_INFO, + "database not found. creating...: <%s>", mapper.db_path()); + if (path[0] == FN_CURLIB && + mrn_is_directory_separator(path[1])) { + ensure_database_directory(); + } + grn_db = grn_db_create(ctx_, mapper.db_path(), NULL); + if (ctx_->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx_->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } else { + grn_db = grn_db_open(ctx_, mapper.db_path()); + if (ctx_->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx_->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + *db = new Database(ctx_, grn_db); + grn_hash_add(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address, NULL); + memcpy(db_address, db, sizeof(Database *)); + error = ensure_normalizers_registered((*db)->get()); + if (!error) { + if ((*db)->is_broken()) { + error = ER_CANT_OPEN_FILE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: database: open: " + "The database maybe broken. " + "We recommend you to recreate the database. " + "If the database isn't broken, " + "you can remove this error by running " + "'groonga %s table_remove mroonga_operations' " + "on server. But the latter isn't recommended.", + mapper.db_path()); + my_message(error, error_message, MYF(0)); + } + } + } else { + memcpy(db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, (*db)->get()); + } + + DBUG_RETURN(error); + } + + void DatabaseManager::close(const char *path) { + MRN_DBUG_ENTER_METHOD(); + + mrn::PathMapper mapper(path); + mrn::Lock lock(mutex_); + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + if (id == GRN_ID_NIL) { + DBUG_VOID_RETURN; + } + + Database *db = NULL; + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); + if (db) { + delete db; + } + + grn_hash_delete_by_id(ctx_, cache_, id, NULL); + + DBUG_VOID_RETURN; + } + + bool DatabaseManager::drop(const char *path) { + MRN_DBUG_ENTER_METHOD(); + + mrn::PathMapper mapper(path); + mrn::Lock lock(mutex_); + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + + Database *db = NULL; + if (id == GRN_ID_NIL) { + struct stat dummy; + if (stat(mapper.db_path(), &dummy) == 0) { + grn_obj *grn_db = grn_db_open(ctx_, mapper.db_path()); + db = new Database(ctx_, grn_db); + } + } else { + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); + } + + if (!db) { + DBUG_RETURN(false); + } + + if (db->remove() == GRN_SUCCESS) { + if (id != GRN_ID_NIL) { + grn_hash_delete_by_id(ctx_, cache_, id, NULL); + } + delete db; + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to drop database: <%s>: <%s>", + mapper.db_path(), ctx_->errbuf); + if (id == GRN_ID_NIL) { + delete db; + } + DBUG_RETURN(false); + } + } + + int DatabaseManager::clear(void) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + mrn::Lock lock(mutex_); + + grn_hash_cursor *cursor; + cursor = grn_hash_cursor_open(ctx_, cache_, + NULL, 0, NULL, 0, + 0, -1, 0); + if (ctx_->rc) { + my_message(ER_ERROR_ON_READ, ctx_->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + + while (grn_hash_cursor_next(ctx_, cursor) != GRN_ID_NIL) { + if (ctx_->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx_->errbuf, MYF(0)); + break; + } + void *db_address; + Database *db; + grn_hash_cursor_get_value(ctx_, cursor, &db_address); + memcpy(&db, db_address, sizeof(Database *)); + grn_ctx_use(ctx_, db->get()); + grn_rc rc = grn_hash_cursor_delete(ctx_, cursor, NULL); + if (rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx_->errbuf, MYF(0)); + break; + } + delete db; + } + grn_hash_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } + + const char *DatabaseManager::error_message() { + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(ctx_->errbuf); + } + + void DatabaseManager::mkdir_p(const char *directory) { + MRN_DBUG_ENTER_METHOD(); + + int i = 0; + char sub_directory[MRN_MAX_PATH_SIZE]; + sub_directory[0] = '\0'; + while (true) { + if (mrn_is_directory_separator(directory[i]) || + directory[i] == '\0') { + sub_directory[i] = '\0'; + struct stat directory_status; + if (stat(sub_directory, &directory_status) != 0) { + DBUG_PRINT("info", ("mroonga: creating directory: <%s>", sub_directory)); + GRN_LOG(ctx_, GRN_LOG_INFO, "creating directory: <%s>", sub_directory); + if (MRN_MKDIR(sub_directory, S_IRWXU) == 0) { + DBUG_PRINT("info", + ("mroonga: created directory: <%s>", sub_directory)); + GRN_LOG(ctx_, GRN_LOG_INFO, "created directory: <%s>", sub_directory); + } else { + DBUG_PRINT("error", + ("mroonga: failed to create directory: <%s>: <%s>", + sub_directory, strerror(errno))); + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to create directory: <%s>: <%s>", + sub_directory, strerror(errno)); + DBUG_VOID_RETURN; + } + } + } + + if (directory[i] == '\0') { + break; + } + + sub_directory[i] = directory[i]; + ++i; + } + + DBUG_VOID_RETURN; + } + + void DatabaseManager::ensure_database_directory(void) { + MRN_DBUG_ENTER_METHOD(); + + const char *path_prefix = mrn::PathMapper::default_path_prefix; + if (!path_prefix) + DBUG_VOID_RETURN; + + const char *last_path_separator; + last_path_separator = strrchr(path_prefix, FN_LIBCHAR); +#ifdef FN_LIBCHAR2 + if (!last_path_separator) + last_path_separator = strrchr(path_prefix, FN_LIBCHAR2); +#endif + if (!last_path_separator) + DBUG_VOID_RETURN; + if (path_prefix == last_path_separator) + DBUG_VOID_RETURN; + + char database_directory[MRN_MAX_PATH_SIZE]; + size_t database_directory_length = last_path_separator - path_prefix; + strncpy(database_directory, path_prefix, database_directory_length); + database_directory[database_directory_length] = '\0'; + mkdir_p(database_directory); + + DBUG_VOID_RETURN; + } + + int DatabaseManager::ensure_normalizers_registered(grn_obj *db) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; +#ifdef WITH_GROONGA_NORMALIZER_MYSQL + { +# ifdef MRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED + GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(ctx_); + GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(ctx_); +# else + grn_obj *mysql_normalizer; + mysql_normalizer = grn_ctx_get(ctx_, "NormalizerMySQLGeneralCI", -1); + if (mysql_normalizer) { + grn_obj_unlink(ctx_, mysql_normalizer); + } else { + grn_plugin_register(ctx_, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME); + } +# endif + } +#endif + + DBUG_RETURN(error); + } +} diff --git a/storage/mroonga/lib/mrn_database_manager.hpp b/storage/mroonga/lib/mrn_database_manager.hpp new file mode 100644 index 00000000..05383af6 --- /dev/null +++ b/storage/mroonga/lib/mrn_database_manager.hpp @@ -0,0 +1,52 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_DATABASE_MANAGER_HPP_ +#define MRN_DATABASE_MANAGER_HPP_ + +#include "mrn_database.hpp" + +#include + +namespace mrn { + class DatabaseManager { + public: + DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex); + ~DatabaseManager(void); + bool init(void); + int open(const char *path, Database **db); + void close(const char *path); + bool drop(const char *path); + int clear(void); + const char *error_message(); + + private: + grn_ctx *ctx_; + grn_hash *cache_; + mysql_mutex_t *mutex_; + + void mkdir_p(const char *directory); + void ensure_database_directory(void); + int ensure_normalizers_registered(grn_obj *db); + }; +} + +#endif /* MRN_DATABASE_MANAGER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp new file mode 100644 index 00000000..c0c4a90e --- /dev/null +++ b/storage/mroonga/lib/mrn_database_repairer.cpp @@ -0,0 +1,300 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include +#include +#include + +#include "mrn_database_repairer.hpp" +#include "mrn_path_mapper.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::DatabaseRepairer" + +#include +#include +#include + +#ifndef WIN32 +# include +#endif + +namespace mrn { + struct CheckResult { + CheckResult() : + is_crashed(false), + is_corrupt(false) { + } + + bool is_crashed; + bool is_corrupt; + }; + + 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(); + + CheckResult result; + each_database(&DatabaseRepairer::check_body, &result); + + DBUG_RETURN(result.is_crashed); + } + + bool DatabaseRepairer::is_corrupt(void) { + MRN_DBUG_ENTER_METHOD(); + + CheckResult result; + each_database(&DatabaseRepairer::check_body, &result); + + DBUG_RETURN(result.is_corrupt); + } + + 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; + } + + grn_ctx ctx; + grn_rc rc = grn_ctx_init(&ctx, 0); + if (rc == GRN_SUCCESS) { + do { + each_database_body(data.cFileName, &ctx, each_body_func, user_data); + } while (FindNextFile(finder, &data) != 0); + grn_ctx_fin(&ctx); + } else { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "[mroonga][database][repairer][each] " + "failed to initialize grn_ctx: %d: %s", + rc, grn_rc_to_string(rc)); + } + FindClose(finder); +#else + DIR *dir = opendir(base_directory_); + if (!dir) { + DBUG_VOID_RETURN; + } + + grn_ctx ctx; + grn_rc rc = grn_ctx_init(&ctx, 0); + if (rc == GRN_SUCCESS) { + while (struct dirent *entry = readdir(dir)) { + each_database_body(entry->d_name, &ctx, each_body_func, user_data); + } + grn_ctx_fin(&ctx); + } else { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "[mroonga][database][repairer][each] " + "failed to initialize grn_ctx: %d: %s", + rc, grn_rc_to_string(rc)); + } + closedir(dir); +#endif + + DBUG_VOID_RETURN; + } + + void DatabaseRepairer::each_database_body(const char *base_path, + grn_ctx *ctx, + 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)(ctx, 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 (mrn_is_directory_separator(base_directory_buffer_[separator_position])) { + 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::check_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data) { + MRN_DBUG_ENTER_METHOD(); + + CheckResult *result = static_cast(user_data); + + if (grn_obj_is_locked(ctx, db)) { + result->is_crashed = true; + result->is_corrupt = 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) { + result->is_crashed = true; + result->is_corrupt = true; + DBUG_VOID_RETURN; + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) { + if (grn_id_is_builtin(ctx, id)) { + continue; + } + + grn_obj *object = grn_ctx_at(ctx, id); + + if (!object) { + if (ctx->rc == GRN_SUCCESS) { + continue; + } else { + result->is_corrupt = true; + break; + } + } + + 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: + if (grn_obj_is_locked(ctx_, object)) { + result->is_crashed = true; + result->is_corrupt = true; + } + break; + default: + break; + } + + grn_obj_unlink(ctx, object); + + if (result->is_crashed || result->is_corrupt) { + break; + } + } + grn_table_cursor_close(ctx, cursor); + + DBUG_VOID_RETURN; + } + + void DatabaseRepairer::repair_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data) { + MRN_DBUG_ENTER_METHOD(); + + bool *succeeded = static_cast(user_data); + if (grn_db_recover(ctx, db) != GRN_SUCCESS) { + push_warning_printf(thd_, + MRN_SEVERITY_WARNING, + 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 00000000..b56c2744 --- /dev/null +++ b/storage/mroonga/lib/mrn_database_repairer.hpp @@ -0,0 +1,67 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#ifndef MRN_DATABASE_REPAIRER_HPP_ +#define MRN_DATABASE_REPAIRER_HPP_ + +#include + +namespace mrn { + class DatabaseRepairer { + public: + DatabaseRepairer(grn_ctx *ctx, THD *thd); + ~DatabaseRepairer(void); + bool is_crashed(void); + bool is_corrupt(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_ctx *ctx, + 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, + grn_ctx *ctx, + EachBodyFunc each_body_func, + void *user_data); + void detect_paths(void); + + void check_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data); + void repair_body(grn_ctx *ctx, + grn_obj *db, + const char *db_path, + void *user_data); + }; +} + +#endif /* MRN_DATABASE_REPAIRER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_debug_column_access.cpp b/storage/mroonga/lib/mrn_debug_column_access.cpp new file mode 100644 index 00000000..cb2ce7e3 --- /dev/null +++ b/storage/mroonga/lib/mrn_debug_column_access.cpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_debug_column_access.hpp" + +namespace mrn { + DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP **bitmap) + : table_(table), + bitmap_(bitmap) { +#ifdef DBUG_ASSERT_EXISTS + map_ = dbug_tmp_use_all_columns(table_, bitmap_); +#endif + } + + DebugColumnAccess::~DebugColumnAccess() { +#ifdef DBUG_ASSERT_EXISTS + dbug_tmp_restore_column_map(bitmap_, map_); +#endif + } +} diff --git a/storage/mroonga/lib/mrn_debug_column_access.hpp b/storage/mroonga/lib/mrn_debug_column_access.hpp new file mode 100644 index 00000000..954e0413 --- /dev/null +++ b/storage/mroonga/lib/mrn_debug_column_access.hpp @@ -0,0 +1,38 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_DEBUG_COLUMN_ACCESS_HPP_ +#define MRN_DEBUG_COLUMN_ACCESS_HPP_ + +#include + +namespace mrn { + class DebugColumnAccess { + TABLE *table_; + MY_BITMAP **bitmap_; +#ifdef DBUG_ASSERT_EXISTS + MY_BITMAP *map_; +#endif + public: + DebugColumnAccess(TABLE *table, MY_BITMAP **bitmap); + ~DebugColumnAccess(); + }; +} + +#endif // MRN_DEBUG_COLUMN_ACCESS_HPP_ diff --git a/storage/mroonga/lib/mrn_encoding.cpp b/storage/mroonga/lib/mrn_encoding.cpp new file mode 100644 index 00000000..1cee6226 --- /dev/null +++ b/storage/mroonga/lib/mrn_encoding.cpp @@ -0,0 +1,242 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + Copyright(C) 2011-2013 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include +#include "mrn_encoding.hpp" + +namespace mrn { + namespace encoding { + CHARSET_INFO *mrn_charset_utf8 = NULL; + CHARSET_INFO *mrn_charset_utf8mb4 = NULL; + CHARSET_INFO *mrn_charset_binary = NULL; + CHARSET_INFO *mrn_charset_ascii = NULL; + CHARSET_INFO *mrn_charset_latin1_1 = NULL; + CHARSET_INFO *mrn_charset_latin1_2 = NULL; + CHARSET_INFO *mrn_charset_cp932 = NULL; + CHARSET_INFO *mrn_charset_sjis = NULL; + CHARSET_INFO *mrn_charset_eucjpms = NULL; + CHARSET_INFO *mrn_charset_ujis = NULL; + CHARSET_INFO *mrn_charset_koi8r = NULL; + + void init(void) { + CHARSET_INFO **cs; + MRN_DBUG_ENTER_FUNCTION(); + for (cs = all_charsets; cs < all_charsets + MY_ALL_CHARSETS_SIZE; cs++) + { + if (!cs[0]) + continue; + if (!strcmp(cs[0]->csname, "utf8")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_utf8) + mrn_charset_utf8 = cs[0]; + else if (mrn_charset_utf8->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "utf8mb4")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_utf8mb4) + mrn_charset_utf8mb4 = cs[0]; + else if (mrn_charset_utf8mb4->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "binary")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_binary) + mrn_charset_binary = cs[0]; + else if (mrn_charset_binary->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "ascii")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_ascii) + mrn_charset_ascii = cs[0]; + else if (mrn_charset_ascii->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "latin1")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_latin1_1) + mrn_charset_latin1_1 = cs[0]; + else if (mrn_charset_latin1_1->cset != cs[0]->cset) + { + if (!mrn_charset_latin1_2) + mrn_charset_latin1_2 = cs[0]; + else if (mrn_charset_latin1_2->cset != cs[0]->cset) + DBUG_ASSERT(0); + } + continue; + } + if (!strcmp(cs[0]->csname, "cp932")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_cp932) + mrn_charset_cp932 = cs[0]; + else if (mrn_charset_cp932->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "sjis")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_sjis) + mrn_charset_sjis = cs[0]; + else if (mrn_charset_sjis->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "eucjpms")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_eucjpms) + mrn_charset_eucjpms = cs[0]; + else if (mrn_charset_eucjpms->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "ujis")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_ujis) + mrn_charset_ujis = cs[0]; + else if (mrn_charset_ujis->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "koi8r")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_koi8r) + mrn_charset_koi8r = cs[0]; + else if (mrn_charset_koi8r->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + DBUG_PRINT("info", ("mroonga: %s[%s][%p] is not supported", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + } + DBUG_VOID_RETURN; + } + + int set(grn_ctx *ctx, const CHARSET_INFO *charset) { + MRN_DBUG_ENTER_FUNCTION(); + int error = 0; + + if (!set_raw(ctx, charset)) { + const char *name = ""; + const char *csname = ""; + if (charset) { + name = charset->name; + csname = charset->csname; + } + error = ER_MRN_CHARSET_NOT_SUPPORT_NUM; + my_printf_error(error, + ER_MRN_CHARSET_NOT_SUPPORT_STR, + MYF(0), name, csname); + } + + DBUG_RETURN(error); + } + + bool set_raw(grn_ctx *ctx, const CHARSET_INFO *charset) { + MRN_DBUG_ENTER_FUNCTION(); + if (!charset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_utf8->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (mrn_charset_utf8mb4 && charset->cset == mrn_charset_utf8mb4->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_cp932->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_eucjpms->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_latin1_1->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_latin1_2->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_koi8r->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_KOI8R); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_binary->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_ascii->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_sjis->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_ujis->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP); + DBUG_RETURN(true); + } + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(false); + } + } +} diff --git a/storage/mroonga/lib/mrn_encoding.hpp b/storage/mroonga/lib/mrn_encoding.hpp new file mode 100644 index 00000000..f321ca68 --- /dev/null +++ b/storage/mroonga/lib/mrn_encoding.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_ENCODING_HPP_ +#define MRN_ENCODING_HPP_ + +#include +#include + +#include + +namespace mrn { + namespace encoding { + void init(void); + int set(grn_ctx *ctx, const CHARSET_INFO *charset); + bool set_raw(grn_ctx *ctx, const CHARSET_INFO *charset); + } +} + +#endif // MRN_ENCODING_HPP_ diff --git a/storage/mroonga/lib/mrn_external_lock.cpp b/storage/mroonga/lib/mrn_external_lock.cpp new file mode 100644 index 00000000..762a96d0 --- /dev/null +++ b/storage/mroonga/lib/mrn_external_lock.cpp @@ -0,0 +1,43 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_external_lock.hpp" + +namespace mrn { + ExternalLock::ExternalLock(THD *thd, handler *handler, int lock_type) + : thd_(thd), + handler_(handler), + lock_type_(lock_type) { + if (lock_type_ != F_UNLCK) { + error_ = handler_->ha_external_lock(thd_, lock_type); + } else { + error_ = 0; + } + } + + ExternalLock::~ExternalLock() { + if (lock_type_ != F_UNLCK) { + handler_->ha_external_unlock(thd_); + } + } + + int ExternalLock::error() { + return error_; + } +} diff --git a/storage/mroonga/lib/mrn_external_lock.hpp b/storage/mroonga/lib/mrn_external_lock.hpp new file mode 100644 index 00000000..9bf7e811 --- /dev/null +++ b/storage/mroonga/lib/mrn_external_lock.hpp @@ -0,0 +1,38 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_EXTERNAL_LOCK_HPP_ +#define MRN_EXTERNAL_LOCK_HPP_ + +#include + +namespace mrn { + class ExternalLock { + THD *thd_; + handler *handler_; + int lock_type_; + int error_; + public: + ExternalLock(THD *thd, handler *handler, int lock_type); + ~ExternalLock(); + int error(); + }; +} + +#endif // MRN_EXTERNAL_LOCK_HPP_ diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp new file mode 100644 index 00000000..bb9982f0 --- /dev/null +++ b/storage/mroonga/lib/mrn_field_normalizer.cpp @@ -0,0 +1,145 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_field_normalizer.hpp" +#include "mrn_encoding.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::FieldNormalizer" + +namespace mrn { + FieldNormalizer::FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field) + : ctx_(ctx), + thread_(thread), + field_(field) { + } + + FieldNormalizer::~FieldNormalizer() { + } + + bool FieldNormalizer::should_normalize() { + MRN_DBUG_ENTER_METHOD(); + + DBUG_PRINT("info", + ("mroonga: result_type = %u", field_->result_type())); + DBUG_PRINT("info", + ("mroonga: charset->name = %s", field_->charset()->name)); + DBUG_PRINT("info", + ("mroonga: charset->csname = %s", field_->charset()->csname)); + DBUG_PRINT("info", + ("mroonga: charset->state = %u", field_->charset()->state)); + bool need_normalize_p; + if (field_->charset()->state & (MY_CS_BINSORT | MY_CS_CSSORT)) { + need_normalize_p = false; + DBUG_PRINT("info", + ("mroonga: should_normalize: false: sort is required")); + } else { + if (is_text_type()) { + need_normalize_p = true; + DBUG_PRINT("info", ("mroonga: should_normalize: true: text type")); + } else { + need_normalize_p = false; + DBUG_PRINT("info", ("mroonga: should_normalize: false: no text type")); + } + } + + DBUG_RETURN(need_normalize_p); + } + + bool FieldNormalizer::is_text_type() { + MRN_DBUG_ENTER_METHOD(); + bool text_type_p; + switch (field_->type()) { + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + text_type_p = true; + break; + case MYSQL_TYPE_STRING: + switch (field_->real_type()) { + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + text_type_p = false; + break; + default: + text_type_p = true; + break; + } + break; + default: + text_type_p = false; + break; + } + DBUG_RETURN(text_type_p); + } + + grn_obj *FieldNormalizer::normalize(const char *string, + unsigned int string_length) { + MRN_DBUG_ENTER_METHOD(); + grn_obj *normalizer = find_grn_normalizer(); + int flags = 0; + grn_encoding original_encoding = GRN_CTX_GET_ENCODING(ctx_); + encoding::set_raw(ctx_, field_->charset()); + grn_obj *grn_string = grn_string_open(ctx_, string, string_length, + normalizer, flags); + GRN_CTX_SET_ENCODING(ctx_, original_encoding); + DBUG_RETURN(grn_string); + } + + grn_obj *FieldNormalizer::find_grn_normalizer() { + MRN_DBUG_ENTER_METHOD(); + + const CHARSET_INFO *charset_info = field_->charset(); + const char *normalizer_name = NULL; + const char *default_normalizer_name = "NormalizerAuto"; + if ((strcmp(charset_info->name, "utf8_general_ci") == 0) || + (strcmp(charset_info->name, "utf8mb4_general_ci") == 0)) { + normalizer_name = "NormalizerMySQLGeneralCI"; + } else if ((strcmp(charset_info->name, "utf8_unicode_ci") == 0) || + (strcmp(charset_info->name, "utf8mb4_unicode_ci") == 0)) { + normalizer_name = "NormalizerMySQLUnicodeCI"; + } 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; + if (normalizer_name) { + normalizer = grn_ctx_get(ctx_, normalizer_name, -1); + if (!normalizer) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "%s normalizer isn't found for %s. " + "Install groonga-normalizer-mysql normalizer. " + "%s is used as fallback.", + normalizer_name, + charset_info->name, + default_normalizer_name); + push_warning(thread_, MRN_SEVERITY_WARNING, + HA_ERR_UNSUPPORTED, error_message); + } + } + + if (!normalizer) { + normalizer = grn_ctx_get(ctx_, default_normalizer_name, -1); + } + + DBUG_RETURN(normalizer); + } +} diff --git a/storage/mroonga/lib/mrn_field_normalizer.hpp b/storage/mroonga/lib/mrn_field_normalizer.hpp new file mode 100644 index 00000000..76083377 --- /dev/null +++ b/storage/mroonga/lib/mrn_field_normalizer.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_FIELD_NORMALIZER_HPP_ +#define MRN_FIELD_NORMALIZER_HPP_ + +#include +#include + +#include + +namespace mrn { + class FieldNormalizer { + public: + FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field); + ~FieldNormalizer(); + + bool should_normalize(); + grn_obj *normalize(const char *string, unsigned int string_length); + grn_obj *find_grn_normalizer(); + + private: + grn_ctx *ctx_; + THD *thread_; + Field *field_; + + bool is_text_type(); + }; +} + +#endif // MRN_FIELD_NORMALIZER_HPP_ diff --git a/storage/mroonga/lib/mrn_grn.hpp b/storage/mroonga/lib/mrn_grn.hpp new file mode 100644 index 00000000..f288f3e4 --- /dev/null +++ b/storage/mroonga/lib/mrn_grn.hpp @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_GRN_HPP_ +#define MRN_GRN_HPP_ + +#include + +namespace mrn { + namespace grn { + bool is_table(grn_obj *obj) { + grn_id type = obj->header.type; + return GRN_TABLE_HASH_KEY <= type && obj->header.type <= GRN_DB; + } + + bool is_vector_column(grn_obj *column) { + int column_type = (column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK); + return column_type == GRN_OBJ_COLUMN_VECTOR; + } + } +} + +#endif // MRN_GRN_HPP_ diff --git a/storage/mroonga/lib/mrn_index_column_name.cpp b/storage/mroonga/lib/mrn_index_column_name.cpp new file mode 100644 index 00000000..1a19b9d1 --- /dev/null +++ b/storage/mroonga/lib/mrn_index_column_name.cpp @@ -0,0 +1,96 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_index_column_name.hpp" + +#define MRN_MIN_INDEX_COLUMN_NAME_LENGTH 65 + +// for debug +#define MRN_CLASS_NAME "mrn::IndexColumnName" + +namespace mrn { + IndexColumnName::IndexColumnName(const char *table_name, + const char *mysql_column_name) + : table_name_(table_name), + mysql_column_name_(mysql_column_name) { + uchar encoded_mysql_column_name_multibyte[MRN_MAX_KEY_SIZE]; + const uchar *mysql_column_name_multibyte = + reinterpret_cast(mysql_column_name_); + encode(encoded_mysql_column_name_multibyte, + encoded_mysql_column_name_multibyte + MRN_MAX_KEY_SIZE, + mysql_column_name_multibyte, + mysql_column_name_multibyte + strlen(mysql_column_name_)); + snprintf(name_, MRN_MAX_KEY_SIZE, + "%s-%s", table_name_, encoded_mysql_column_name_multibyte); + length_ = strlen(name_); + if (length_ < MRN_MIN_INDEX_COLUMN_NAME_LENGTH) { + memset(name_ + length_, '-', MRN_MIN_INDEX_COLUMN_NAME_LENGTH - length_); + length_ = MRN_MIN_INDEX_COLUMN_NAME_LENGTH; + name_[length_] = '\0'; + } + } + + const char *IndexColumnName::c_str() { + return name_; + } + + size_t IndexColumnName::length() { + return length_; + } + + uint IndexColumnName::encode(uchar *encoded_start, + uchar *encoded_end, + const uchar *mysql_string_start, + const uchar *mysql_string_end) { + MRN_DBUG_ENTER_METHOD(); + my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc; + my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb; + DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start)); + encoded_end--; + uchar *encoded = encoded_start; + const uchar *mysql_string = mysql_string_start; + while (mysql_string < mysql_string_end && encoded < encoded_end) { + my_wc_t wc; + int mb_wc_converted_length; + int wc_mb_converted_length; + mb_wc_converted_length = + (*mb_wc)(NULL, &wc, mysql_string, mysql_string_end); + if (mb_wc_converted_length > 0) { + wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end); + if (wc_mb_converted_length <= 0) { + break; + } + } else if (mb_wc_converted_length == MY_CS_ILSEQ) { + *encoded = *mysql_string; + mb_wc_converted_length = 1; + wc_mb_converted_length = 1; + } else { + break; + } + mysql_string += mb_wc_converted_length; + encoded += wc_mb_converted_length; + } + *encoded = '\0'; + DBUG_PRINT("info", ("mroonga: out=%s", encoded_start)); + DBUG_RETURN(encoded - encoded_start); + } +} diff --git a/storage/mroonga/lib/mrn_index_column_name.hpp b/storage/mroonga/lib/mrn_index_column_name.hpp new file mode 100644 index 00000000..da3b96db --- /dev/null +++ b/storage/mroonga/lib/mrn_index_column_name.hpp @@ -0,0 +1,43 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_INDEX_COLUMN_NAME_HPP_ +#define MRN_INDEX_COLUMN_NAME_HPP_ + +#include + +namespace mrn { + class IndexColumnName { + public: + IndexColumnName(const char *table_name, const char *mysql_column_name); + const char *c_str(); + size_t length(); + private: + const char *table_name_; + const char *mysql_column_name_; + char name_[MRN_MAX_KEY_SIZE]; + size_t length_; + + uint encode(uchar *encoded_start, uchar *encoded_end, + const uchar *mysql_string_start, const uchar *mysql_string_end); + }; +} + +#endif /* MRN_INDEX_COLUMN_NAME_HPP_ */ diff --git a/storage/mroonga/lib/mrn_index_table_name.cpp b/storage/mroonga/lib/mrn_index_table_name.cpp new file mode 100644 index 00000000..62e67b3c --- /dev/null +++ b/storage/mroonga/lib/mrn_index_table_name.cpp @@ -0,0 +1,136 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_index_table_name.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::IndexTableName" + +namespace mrn { + const char *IndexTableName::SEPARATOR = "#"; + const char *IndexTableName::OLD_SEPARATOR = "-"; + + bool IndexTableName::is_custom_name(const char *table_name, + size_t table_name_length, + const char *index_table_name, + size_t index_table_name_length) + { + MRN_DBUG_ENTER_METHOD(); + + if (index_table_name_length <= (table_name_length + strlen(SEPARATOR))) { + DBUG_RETURN(true); + } + + if (strncmp(table_name, index_table_name, table_name_length) != 0) { + DBUG_RETURN(true); + } + + if ((strncmp(OLD_SEPARATOR, + index_table_name + table_name_length, + strlen(OLD_SEPARATOR)) != 0) && + (strncmp(SEPARATOR, + index_table_name + table_name_length, + strlen(SEPARATOR)) != 0)) { + DBUG_RETURN(true); + } + + DBUG_RETURN(false); + } + + IndexTableName::IndexTableName(const char *table_name, + const char *mysql_index_name) + : table_name_(table_name), + mysql_index_name_(mysql_index_name) { + uchar encoded_mysql_index_name_multibyte[MRN_MAX_KEY_SIZE]; + const uchar *mysql_index_name_multibyte = + reinterpret_cast(mysql_index_name_); + encode(encoded_mysql_index_name_multibyte, + encoded_mysql_index_name_multibyte + MRN_MAX_KEY_SIZE, + mysql_index_name_multibyte, + mysql_index_name_multibyte + strlen(mysql_index_name_)); + snprintf(old_name_, MRN_MAX_KEY_SIZE, + "%s%s%s", + table_name_, + OLD_SEPARATOR, + encoded_mysql_index_name_multibyte); + old_length_ = strlen(old_name_); + snprintf(name_, MRN_MAX_KEY_SIZE, + "%s%s%s", + table_name_, + SEPARATOR, + encoded_mysql_index_name_multibyte); + length_ = strlen(name_); + } + + const char *IndexTableName::c_str() { + return name_; + } + + size_t IndexTableName::length() { + return length_; + } + + const char *IndexTableName::old_c_str() { + return old_name_; + } + + size_t IndexTableName::old_length() { + return old_length_; + } + + uint IndexTableName::encode(uchar *encoded_start, + uchar *encoded_end, + const uchar *mysql_string_start, + const uchar *mysql_string_end) { + MRN_DBUG_ENTER_METHOD(); + my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc; + my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb; + DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start)); + encoded_end--; + uchar *encoded = encoded_start; + const uchar *mysql_string = mysql_string_start; + while (mysql_string < mysql_string_end && encoded < encoded_end) { + my_wc_t wc; + int mb_wc_converted_length; + int wc_mb_converted_length; + mb_wc_converted_length = + (*mb_wc)(NULL, &wc, mysql_string, mysql_string_end); + if (mb_wc_converted_length > 0) { + wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end); + if (wc_mb_converted_length <= 0) { + break; + } + } else if (mb_wc_converted_length == MY_CS_ILSEQ) { + *encoded = *mysql_string; + mb_wc_converted_length = 1; + wc_mb_converted_length = 1; + } else { + break; + } + mysql_string += mb_wc_converted_length; + encoded += wc_mb_converted_length; + } + *encoded = '\0'; + DBUG_PRINT("info", ("mroonga: out=%s", encoded_start)); + DBUG_RETURN(encoded - encoded_start); + } +} diff --git a/storage/mroonga/lib/mrn_index_table_name.hpp b/storage/mroonga/lib/mrn_index_table_name.hpp new file mode 100644 index 00000000..80d2444b --- /dev/null +++ b/storage/mroonga/lib/mrn_index_table_name.hpp @@ -0,0 +1,55 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_INDEX_TABLE_NAME_HPP_ +#define MRN_INDEX_TABLE_NAME_HPP_ + +#include + +namespace mrn { + class IndexTableName { + public: + static const char *SEPARATOR; + static const char *OLD_SEPARATOR; + + static bool is_custom_name(const char *table_name, + size_t table_name_length, + const char *index_table_name, + size_t index_table_name_length); + + IndexTableName(const char *table_name, const char *mysql_index_name); + const char *c_str(); + size_t length(); + const char *old_c_str(); + size_t old_length(); + private: + const char *table_name_; + const char *mysql_index_name_; + char old_name_[MRN_MAX_KEY_SIZE]; + size_t old_length_; + char name_[MRN_MAX_KEY_SIZE]; + size_t length_; + + uint encode(uchar *encoded_start, uchar *encoded_end, + const uchar *mysql_string_start, const uchar *mysql_string_end); + }; +} + +#endif /* MRN_INDEX_TABLE_NAME_HPP_ */ diff --git a/storage/mroonga/lib/mrn_lock.cpp b/storage/mroonga/lib/mrn_lock.cpp new file mode 100644 index 00000000..cfeb519b --- /dev/null +++ b/storage/mroonga/lib/mrn_lock.cpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_lock.hpp" + +namespace mrn { + Lock::Lock(mysql_mutex_t *mutex, bool execute) + : mutex_(mutex), + execute_(execute) { + if (execute_) { + mysql_mutex_lock(mutex_); + } + } + + Lock::~Lock() { + if (execute_) { + mysql_mutex_unlock(mutex_); + } + } +} diff --git a/storage/mroonga/lib/mrn_lock.hpp b/storage/mroonga/lib/mrn_lock.hpp new file mode 100644 index 00000000..29337d8e --- /dev/null +++ b/storage/mroonga/lib/mrn_lock.hpp @@ -0,0 +1,37 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_LOCK_HPP_ +#define MRN_LOCK_HPP_ + +#include +#include + +namespace mrn { + class Lock { + public: + Lock(mysql_mutex_t *mutex, bool execute=true); + ~Lock(); + private: + mysql_mutex_t *mutex_; + bool execute_; + }; +} + +#endif /* MRN_LOCK_HPP_ */ diff --git a/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp new file mode 100644 index 00000000..62e63023 --- /dev/null +++ b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp @@ -0,0 +1,33 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_match_escalation_threshold_scope.hpp" + +namespace mrn { + MatchEscalationThresholdScope::MatchEscalationThresholdScope( + grn_ctx *ctx, long long int threshold) + : ctx_(ctx), + original_threshold_(grn_ctx_get_match_escalation_threshold(ctx_)) { + grn_ctx_set_match_escalation_threshold(ctx_, threshold); + } + + MatchEscalationThresholdScope::~MatchEscalationThresholdScope() { + grn_ctx_set_match_escalation_threshold(ctx_, original_threshold_); + } +} diff --git a/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp new file mode 100644 index 00000000..1c5488f8 --- /dev/null +++ b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp @@ -0,0 +1,35 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ +#define MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ + +#include + +namespace mrn { + class MatchEscalationThresholdScope { + grn_ctx *ctx_; + long long int original_threshold_; + public: + MatchEscalationThresholdScope(grn_ctx *ctx, long long int threshold); + ~MatchEscalationThresholdScope(); + }; +} + +#endif // MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp new file mode 100644 index 00000000..73639685 --- /dev/null +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -0,0 +1,712 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012-2015 Kouhei Sutou + Copyright(C) 2013 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_multiple_column_key_codec.hpp" +#include "mrn_field_normalizer.hpp" +#include "mrn_smart_grn_obj.hpp" +#include "mrn_time_converter.hpp" +#include "mrn_value_decoder.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::MultipleColumnKeyCodec" + +#ifdef WORDS_BIGENDIAN +#define mrn_byte_order_host_to_network(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key); \ + while (size_--) { *buf_++ = *key_++; } \ +} +#define mrn_byte_order_network_to_host(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key); \ + while (size_) { *buf_++ = *key_++; size_--; } \ +} +#else /* WORDS_BIGENDIAN */ +#define mrn_byte_order_host_to_network(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key) + size_; \ + while (size_--) { *buf_++ = *(--key_); } \ +} +#define mrn_byte_order_network_to_host(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key) + size_; \ + while (size_) { *buf_++ = *(--key_); size_--; } \ +} +#endif /* WORDS_BIGENDIAN */ + +namespace mrn { + MultipleColumnKeyCodec::MultipleColumnKeyCodec(grn_ctx *ctx, + THD *thread, + KEY *key_info) + : ctx_(ctx), + thread_(thread), + key_info_(key_info) { + } + + MultipleColumnKeyCodec::~MultipleColumnKeyCodec() { + } + + int MultipleColumnKeyCodec::encode(const uchar *mysql_key, + uint mysql_key_length, + uchar *grn_key, + uint *grn_key_length) { + MRN_DBUG_ENTER_METHOD(); + int error = 0; + const uchar *current_mysql_key = mysql_key; + const uchar *mysql_key_end = mysql_key + mysql_key_length; + uchar *current_grn_key = grn_key; + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + *grn_key_length = 0; + for (int i = 0; i < n_key_parts && current_mysql_key < mysql_key_end; i++) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + bool is_null = false; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + *current_grn_key = 0; + is_null = *current_mysql_key; + current_mysql_key += 1; + current_grn_key += 1; + (*grn_key_length)++; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + uint grn_key_data_size = data_size; + + switch (data_type) { + case TYPE_UNKNOWN: + // TODO: This will not be happen. This is just for + // suppressing warnings by gcc -O2. :< + error = HA_ERR_UNSUPPORTED; + break; + case TYPE_LONG_LONG_NUMBER: + { + long long int long_long_value = 0; + long_long_value = sint8korr(current_mysql_key); + encode_long_long_int(long_long_value, current_grn_key); + } + break; + case TYPE_NUMBER: + { + Field_num *number_field = static_cast(field); + encode_number(current_mysql_key, + data_size, + !number_field->unsigned_flag, + current_grn_key); + } + break; + case TYPE_FLOAT: + { + float value; + value_decoder::decode(&value, current_mysql_key); + encode_float(value, data_size, current_grn_key); + } + break; + case TYPE_DOUBLE: + { + double value; + value_decoder::decode(&value, current_mysql_key); + encode_double(value, data_size, current_grn_key); + } + break; + case TYPE_DATETIME: + { + long long int mysql_datetime; +#ifdef WORDS_BIGENDIAN + if (field->table && field->table->s->db_low_byte_first) { + mysql_datetime = sint8korr(current_mysql_key); + } else +#endif + { + value_decoder::decode(&mysql_datetime, current_mysql_key); + } + TimeConverter time_converter; + bool truncated; + long long int grn_time = + time_converter.mysql_datetime_to_grn_time(mysql_datetime, + &truncated); + encode_long_long_int(grn_time, current_grn_key); + } + break; +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case TYPE_DATETIME2: + { + Field_datetimef *datetimef_field = + static_cast(field); + long long int mysql_datetime_packed = is_null ? 0 : + my_datetime_packed_from_binary(current_mysql_key, + datetimef_field->decimals()); + MYSQL_TIME mysql_time; + TIME_from_longlong_datetime_packed(&mysql_time, mysql_datetime_packed); + TimeConverter time_converter; + bool truncated; + long long int grn_time = + time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + grn_key_data_size = 8; + encode_long_long_int(grn_time, current_grn_key); + } + break; +#endif + case TYPE_BYTE_SEQUENCE: + memcpy(current_grn_key, current_mysql_key, data_size); + break; + case TYPE_BYTE_REVERSE: + encode_reverse(current_mysql_key, data_size, current_grn_key); + break; + case TYPE_BYTE_BLOB: + encode_blob(current_mysql_key, &data_size, field, current_grn_key); + grn_key_data_size = data_size; + break; + } + + if (error) { + break; + } + + current_mysql_key += data_size; + current_grn_key += grn_key_data_size; + *grn_key_length += grn_key_data_size; + } + + DBUG_RETURN(error); + } + + int MultipleColumnKeyCodec::decode(const uchar *grn_key, + uint grn_key_length, + uchar *mysql_key, + uint *mysql_key_length) { + MRN_DBUG_ENTER_METHOD(); + int error = 0; + const uchar *current_grn_key = grn_key; + const uchar *grn_key_end = grn_key + grn_key_length; + uchar *current_mysql_key = mysql_key; + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + *mysql_key_length = 0; + for (int i = 0; i < n_key_parts && current_grn_key < grn_key_end; i++) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + *current_mysql_key = 0; + current_grn_key += 1; + current_mysql_key += 1; + (*mysql_key_length)++; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + uint grn_key_data_size = data_size; + + switch (data_type) { + case TYPE_UNKNOWN: + // TODO: This will not be happen. This is just for + // suppressing warnings by gcc -O2. :< + error = HA_ERR_UNSUPPORTED; + break; + case TYPE_LONG_LONG_NUMBER: + { + long long int value; + decode_long_long_int(current_grn_key, &value); + int8store(current_mysql_key, value); + } + break; + case TYPE_NUMBER: + { + Field_num *number_field = static_cast(field); + decode_number(current_grn_key, + grn_key_data_size, + !number_field->unsigned_flag, + current_mysql_key); + } + break; + case TYPE_FLOAT: + decode_float(current_grn_key, grn_key_data_size, current_mysql_key); + break; + case TYPE_DOUBLE: + decode_double(current_grn_key, grn_key_data_size, current_mysql_key); + break; + case TYPE_DATETIME: + { + long long int grn_time; + decode_long_long_int(current_grn_key, &grn_time); + TimeConverter time_converter; + long long int mysql_datetime = + time_converter.grn_time_to_mysql_datetime(grn_time); +#ifdef WORDS_BIGENDIAN + if (field->table && field->table->s->db_low_byte_first) { + int8store(current_mysql_key, mysql_datetime); + } else +#endif + { + longlongstore(current_mysql_key, mysql_datetime); + } + } + break; +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case TYPE_DATETIME2: + { + Field_datetimef *datetimef_field = + static_cast(field); + long long int grn_time; + grn_key_data_size = 8; + decode_long_long_int(current_grn_key, &grn_time); + TimeConverter time_converter; + MYSQL_TIME mysql_time; + mysql_time.neg = FALSE; + mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME; + time_converter.grn_time_to_mysql_time(grn_time, &mysql_time); + long long int mysql_datetime_packed = + TIME_to_longlong_datetime_packed(&mysql_time); + my_datetime_packed_to_binary(mysql_datetime_packed, + current_mysql_key, + datetimef_field->decimals()); + } + break; +#endif + case TYPE_BYTE_SEQUENCE: + memcpy(current_mysql_key, current_grn_key, grn_key_data_size); + break; + case TYPE_BYTE_REVERSE: + decode_reverse(current_grn_key, grn_key_data_size, current_mysql_key); + break; + case TYPE_BYTE_BLOB: + memcpy(current_mysql_key, + current_grn_key + data_size, + HA_KEY_BLOB_LENGTH); + memcpy(current_mysql_key + HA_KEY_BLOB_LENGTH, + current_grn_key, + data_size); + data_size += HA_KEY_BLOB_LENGTH; + grn_key_data_size = data_size; + break; + } + + if (error) { + break; + } + + current_grn_key += grn_key_data_size; + current_mysql_key += data_size; + *mysql_key_length += data_size; + } + + DBUG_RETURN(error); + } + + uint MultipleColumnKeyCodec::size() { + MRN_DBUG_ENTER_METHOD(); + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + + uint total_size = 0; + for (int i = 0; i < n_key_parts; ++i) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + ++total_size; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + switch (data_type) { +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case TYPE_DATETIME2: + data_size = 8; + break; +#endif + case TYPE_BYTE_BLOB: + data_size += HA_KEY_BLOB_LENGTH; + break; + default: + break; + } + total_size += data_size; + } + + DBUG_RETURN(total_size); + } + + void MultipleColumnKeyCodec::get_key_info(KEY_PART_INFO *key_part, + DataType *data_type, + uint *data_size) { + MRN_DBUG_ENTER_METHOD(); + + *data_type = TYPE_UNKNOWN; + *data_size = 0; + + Field *field = key_part->field; + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DECIMAL")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_YEAR: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TINY")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_SHORT: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_SHORT")); + *data_type = TYPE_NUMBER; + *data_size = 2; + break; + case MYSQL_TYPE_LONG: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_LONG")); + *data_type = TYPE_NUMBER; + *data_size = 4; + break; + case MYSQL_TYPE_FLOAT: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_FLOAT")); + *data_type = TYPE_FLOAT; + *data_size = 4; + break; + case MYSQL_TYPE_DOUBLE: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DOUBLE")); + *data_type = TYPE_DOUBLE; + *data_size = 8; + break; + case MYSQL_TYPE_NULL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NULL")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_TIMESTAMP: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIMESTAMP")); + *data_type = TYPE_BYTE_REVERSE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_DATE: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATE")); + *data_type = TYPE_BYTE_REVERSE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_DATETIME: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME")); + *data_type = TYPE_DATETIME; + *data_size = key_part->length; + break; + case MYSQL_TYPE_NEWDATE: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NEWDATE")); + *data_type = TYPE_BYTE_REVERSE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_LONGLONG: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_LONGLONG")); + *data_type = TYPE_NUMBER; + *data_size = 8; + break; + case MYSQL_TYPE_INT24: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_INT24")); + *data_type = TYPE_NUMBER; + *data_size = 3; + break; + case MYSQL_TYPE_TIME: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIME")); + *data_type = TYPE_NUMBER; + *data_size = 3; + break; + case MYSQL_TYPE_VARCHAR: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_VARCHAR")); + *data_type = TYPE_BYTE_BLOB; + *data_size = key_part->length; + break; + case MYSQL_TYPE_BIT: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_BIT")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIMESTAMP2")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME2")); + *data_type = TYPE_DATETIME2; + *data_size = key_part->length; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIME2")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NEWDECIMAL")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_ENUM: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_ENUM")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_SET: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_SET")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_BLOB")); + *data_type = TYPE_BYTE_BLOB; + *data_size = key_part->length; + break; + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_STRING")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_GEOMETRY: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_GEOMETRY")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_VARCHAR_COMPRESSED: + case MYSQL_TYPE_BLOB_COMPRESSED: + DBUG_ASSERT(0); +#ifdef MRN_HAVE_MYSQL_TYPE_JSON + case MYSQL_TYPE_JSON: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_JSON")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_number(const uchar *mysql_key, + uint mysql_key_size, + bool is_signed, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + mrn_byte_order_host_to_network(grn_key, mysql_key, mysql_key_size); + if (is_signed) { + grn_key[0] ^= 0x80; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_number(const uchar *grn_key, + uint grn_key_size, + bool is_signed, + uchar *mysql_key) { + MRN_DBUG_ENTER_METHOD(); + uchar buffer[8]; + memcpy(buffer, grn_key, grn_key_size); + if (is_signed) { + buffer[0] ^= 0x80; + } + mrn_byte_order_network_to_host(mysql_key, buffer, grn_key_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_long_long_int(volatile long long int value, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + uint value_size = 8; + mrn_byte_order_host_to_network(grn_key, &value, value_size); + grn_key[0] ^= 0x80; + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_long_long_int(const uchar *grn_key, + long long int *value) { + MRN_DBUG_ENTER_METHOD(); + uint grn_key_size = 8; + uchar buffer[8]; + memcpy(buffer, grn_key, grn_key_size); + buffer[0] ^= 0x80; + mrn_byte_order_network_to_host(value, buffer, grn_key_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_float(volatile float value, + uint value_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + int n_bits = (value_size * 8 - 1); + volatile int *int_value_pointer = (int *)(&value); + int int_value = *int_value_pointer; + int_value ^= ((int_value >> n_bits) | (1 << n_bits)); + mrn_byte_order_host_to_network(grn_key, &int_value, value_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_float(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key) { + MRN_DBUG_ENTER_METHOD(); + int int_value; + mrn_byte_order_network_to_host(&int_value, grn_key, grn_key_size); + int max_bit = (grn_key_size * 8 - 1); + *((int *)mysql_key) = + int_value ^ (((int_value ^ (1 << max_bit)) >> max_bit) | + (1 << max_bit)); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_double(volatile double value, + uint value_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + int n_bits = (value_size * 8 - 1); + volatile long long int *long_long_value_pointer = (long long int *)(&value); + volatile long long int long_long_value = *long_long_value_pointer; + long_long_value ^= ((long_long_value >> n_bits) | (1LL << n_bits)); + mrn_byte_order_host_to_network(grn_key, &long_long_value, value_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_double(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key) { + MRN_DBUG_ENTER_METHOD(); + long long int long_long_value; + mrn_byte_order_network_to_host(&long_long_value, grn_key, grn_key_size); + int max_bit = (grn_key_size * 8 - 1); + long_long_value = + long_long_value ^ (((long_long_value ^ (1LL << max_bit)) >> max_bit) | + (1LL << max_bit)); + memcpy(mysql_key, &long_long_value, sizeof(long_long_value)); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_reverse(const uchar *mysql_key, + uint mysql_key_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < mysql_key_size; i++) { + grn_key[i] = mysql_key[mysql_key_size - i - 1]; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_reverse(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key) { + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < grn_key_size; i++) { + mysql_key[i] = grn_key[grn_key_size - i - 1]; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_blob(const uchar *mysql_key, + uint *mysql_key_size, + Field *field, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + FieldNormalizer normalizer(ctx_, thread_, field); + if (normalizer.should_normalize()) { +#if HA_KEY_BLOB_LENGTH != 2 +# error "TODO: support HA_KEY_BLOB_LENGTH != 2 case if it is needed" +#endif + const char *blob_data = + reinterpret_cast(mysql_key + HA_KEY_BLOB_LENGTH); + uint16 blob_data_length = *((uint16 *)(mysql_key)); + grn_obj *grn_string = normalizer.normalize(blob_data, + blob_data_length); + mrn::SmartGrnObj smart_grn_string(ctx_, grn_string); + const char *normalized; + unsigned int normalized_length = 0; + grn_string_get_normalized(ctx_, grn_string, + &normalized, &normalized_length, NULL); + uint16 new_blob_data_length; + if (normalized_length <= UINT_MAX16) { + if (normalized_length) + memcpy(grn_key, normalized, normalized_length); + if (normalized_length < *mysql_key_size) { + memset(grn_key + normalized_length, + '\0', *mysql_key_size - normalized_length); + } + new_blob_data_length = normalized_length; + } else { + push_warning_printf(thread_, + MRN_SEVERITY_WARNING, + MRN_ERROR_CODE_DATA_TRUNCATE(thread_), + "normalized data truncated " + "for multiple column index: " + "normalized-data-size: <%u> " + "max-data-size: <%u> " + "column-name: <%s> " + "data: <%.*s>", + normalized_length, + UINT_MAX16, + field->field_name, + blob_data_length, blob_data); + memcpy(grn_key, normalized, blob_data_length); + new_blob_data_length = blob_data_length; + } + memcpy(grn_key + *mysql_key_size, + &new_blob_data_length, + HA_KEY_BLOB_LENGTH); + } else { + memcpy(grn_key + *mysql_key_size, mysql_key, HA_KEY_BLOB_LENGTH); + memcpy(grn_key, mysql_key + HA_KEY_BLOB_LENGTH, *mysql_key_size); + } + *mysql_key_size += HA_KEY_BLOB_LENGTH; + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp new file mode 100644 index 00000000..26de08ca --- /dev/null +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp @@ -0,0 +1,100 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ +#define MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ + +#include +#include + +#include + +namespace mrn { + class MultipleColumnKeyCodec { + public: + MultipleColumnKeyCodec(grn_ctx *ctx, THD *thread, KEY *key_info); + ~MultipleColumnKeyCodec(); + + int encode(const uchar *mysql_key, uint mysql_key_length, + uchar *grn_key, uint *grn_key_length); + int decode(const uchar *grn_key, uint grn_key_length, + uchar *mysql_key, uint *mysql_key_length); + uint size(); + + private: + enum DataType { + TYPE_UNKNOWN, + TYPE_LONG_LONG_NUMBER, + TYPE_NUMBER, + TYPE_FLOAT, + TYPE_DOUBLE, + TYPE_DATETIME, +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + TYPE_DATETIME2, +#endif + TYPE_BYTE_SEQUENCE, + TYPE_BYTE_REVERSE, + TYPE_BYTE_BLOB + }; + + grn_ctx *ctx_; + THD *thread_; + KEY *key_info_; + + void get_key_info(KEY_PART_INFO *key_part, + DataType *data_type, uint *data_size); + + void encode_number(const uchar *mysql_key, + uint mysql_key_size, + bool is_signed, + uchar *grn_key); + void decode_number(const uchar *grn_key, + uint grn_key_size, + bool is_signed, + uchar *mysql_key); + void encode_long_long_int(volatile long long int value, + uchar *grn_key); + void decode_long_long_int(const uchar *grn_key, + long long int *value); + void encode_float(volatile float value, + uint value_size, + uchar *grn_key); + void decode_float(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key); + void encode_double(volatile double value, + uint value_size, + uchar *grn_key); + void decode_double(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key); + void encode_reverse(const uchar *mysql_key, + uint mysql_key_size, + uchar *grn_key); + void decode_reverse(const uchar *grn_key, + uint grn_key_size, + uchar *mysql_key); + void encode_blob(const uchar *mysql_key, + uint *mysql_key_size, + Field *field, + uchar *grn_key); + }; +} + +#endif // MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ diff --git a/storage/mroonga/lib/mrn_mysqlservices.cpp b/storage/mroonga/lib/mrn_mysqlservices.cpp new file mode 100644 index 00000000..d1fdd471 --- /dev/null +++ b/storage/mroonga/lib/mrn_mysqlservices.cpp @@ -0,0 +1,28 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include +#include + +/* +void *thd_alloc(MYSQL_THD thd, unsigned int size) +{ + return thd->alloc(size); +} +*/ diff --git a/storage/mroonga/lib/mrn_operation.cpp b/storage/mroonga/lib/mrn_operation.cpp new file mode 100644 index 00000000..e351945f --- /dev/null +++ b/storage/mroonga/lib/mrn_operation.cpp @@ -0,0 +1,51 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_operation.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Operation" + +namespace mrn { + Operation::Operation(mrn::Operations *operations, + const char *type, + const char *table_name, + size_t table_name_size) + : operations_(operations), + id_(operations_->start(type, table_name, table_name_size)) { + } + + Operation::~Operation() { + MRN_DBUG_ENTER_METHOD(); + + operations_->finish(id_); + + DBUG_VOID_RETURN; + } + + void Operation::record_target(grn_id record_id) { + MRN_DBUG_ENTER_METHOD(); + + operations_->record_target(id_, record_id); + + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_operation.hpp b/storage/mroonga/lib/mrn_operation.hpp new file mode 100644 index 00000000..9375cefb --- /dev/null +++ b/storage/mroonga/lib/mrn_operation.hpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_OPERATION_HPP_ +#define MRN_OPERATION_HPP_ + +#include + +namespace mrn { + class Operation { + public: + Operation(mrn::Operations *operations, + const char *type, + const char *table_name, + size_t table_name_size); + ~Operation(); + + void record_target(grn_id record_id); + + private: + mrn::Operations *operations_; + grn_id id_; + }; +} + +#endif /* MRN_OPERATION_HPP_ */ diff --git a/storage/mroonga/lib/mrn_operations.cpp b/storage/mroonga/lib/mrn_operations.cpp new file mode 100644 index 00000000..22a8901e --- /dev/null +++ b/storage/mroonga/lib/mrn_operations.cpp @@ -0,0 +1,401 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include + +#include "mrn_operations.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::Operations" + +#define TABLE_NAME "mroonga_operations" +#define COLUMN_TYPE_NAME "type" +#define COLUMN_TABLE_NAME "table" +#define COLUMN_RECORD_NAME "record" + +namespace mrn { + Operations::Operations(grn_ctx *ctx) + : ctx_(ctx) { + MRN_DBUG_ENTER_METHOD(); + + GRN_TEXT_INIT(&text_buffer_, GRN_OBJ_DO_SHALLOW_COPY); + GRN_UINT32_INIT(&id_buffer_, 0); + + table_ = grn_ctx_get(ctx_, TABLE_NAME, -1); + if (!table_) { + table_ = grn_table_create(ctx_, + TABLE_NAME, strlen(TABLE_NAME), + NULL, + GRN_OBJ_TABLE_NO_KEY | GRN_OBJ_PERSISTENT, + NULL, NULL); + columns_.type_ = + grn_column_create(ctx_, table_, + COLUMN_TYPE_NAME, strlen(COLUMN_TYPE_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_SHORT_TEXT)); + columns_.table_ = + grn_column_create(ctx_, table_, + COLUMN_TABLE_NAME, strlen(COLUMN_TABLE_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_SHORT_TEXT)); + columns_.record_ = + grn_column_create(ctx_, table_, + COLUMN_RECORD_NAME, strlen(COLUMN_RECORD_NAME), + NULL, + GRN_OBJ_COLUMN_SCALAR | GRN_OBJ_PERSISTENT, + grn_ctx_at(ctx_, GRN_DB_UINT32)); + } else { + columns_.type_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_TYPE_NAME, -1); + columns_.table_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_TABLE_NAME, -1); + columns_.record_ = grn_ctx_get(ctx_, TABLE_NAME "." COLUMN_RECORD_NAME, -1); + } + + is_enabled_recording_ = true; + + DBUG_VOID_RETURN; + } + + Operations::~Operations() { + MRN_DBUG_ENTER_METHOD(); + + GRN_OBJ_FIN(ctx_, &id_buffer_); + GRN_OBJ_FIN(ctx_, &text_buffer_); + + DBUG_VOID_RETURN; + } + + bool Operations::is_locked() { + MRN_DBUG_ENTER_METHOD(); + + if (grn_obj_is_locked(ctx_, table_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.type_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.table_) > 0) + DBUG_RETURN(true); + + if (grn_obj_is_locked(ctx_, columns_.record_) > 0) + DBUG_RETURN(true); + + DBUG_RETURN(false); + } + + grn_id Operations::start(const char *type, + const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_RETURN(GRN_ID_NIL); + } + + grn_id id = grn_table_add(ctx_, table_, NULL, 0, NULL); + + GRN_TEXT_SETS(ctx_, &text_buffer_, type); + grn_obj_set_value(ctx_, columns_.type_, id, &text_buffer_, GRN_OBJ_SET); + + GRN_TEXT_SET(ctx_, &text_buffer_, table_name, table_name_size); + grn_obj_set_value(ctx_, columns_.table_, id, &text_buffer_, GRN_OBJ_SET); + + DBUG_RETURN(id); + } + + void Operations::record_target(grn_id id, grn_id record_id) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_VOID_RETURN; + } + + GRN_UINT32_SET(ctx_, &id_buffer_, record_id); + grn_obj_set_value(ctx_, columns_.record_, id, &id_buffer_, GRN_OBJ_SET); + + DBUG_VOID_RETURN; + } + + void Operations::finish(grn_id id) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_enabled_recording_) { + DBUG_VOID_RETURN; + } + + grn_table_delete_by_id(ctx_, table_, id); + + DBUG_VOID_RETURN; + } + + void Operations::enable_recording() { + MRN_DBUG_ENTER_METHOD(); + + is_enabled_recording_ = true; + + DBUG_VOID_RETURN; + } + + void Operations::disable_recording() { + MRN_DBUG_ENTER_METHOD(); + + is_enabled_recording_ = false; + + DBUG_VOID_RETURN; + } + + grn_hash *Operations::collect_processing_table_names() { + MRN_DBUG_ENTER_METHOD(); + + grn_hash *table_names = + grn_hash_create(ctx_, NULL, GRN_TABLE_MAX_KEY_SIZE, 0, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_KEY_VAR_SIZE); + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + GRN_LOG(ctx_, GRN_LOG_NOTICE, + "[operations] failed to open cursor: %s", + ctx_->errbuf); + DBUG_RETURN(table_names); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if (GRN_TEXT_LEN(&text_buffer_) > 0) { + grn_hash_add(ctx_, table_names, + GRN_TEXT_VALUE(&text_buffer_), + GRN_TEXT_LEN(&text_buffer_), + NULL, + NULL); + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(table_names); + } + + int Operations::repair(const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + error = HA_ERR_CRASHED_ON_USAGE; + if (ctx_->rc) { + my_message(error, ctx_->errbuf, MYF(0)); + } else { + my_message(error, + "mroonga: repair: " + "failed to open cursor for operations table", + MYF(0)); + } + DBUG_RETURN(error); + } + + grn_obj *target_table = grn_ctx_get(ctx_, table_name, table_name_size); + if (!target_table) { + GRN_LOG(ctx_, GRN_LOG_WARNING, + "table doesn't exist for auto repair: <%.*s>", + static_cast(table_name_size), table_name); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if (!((static_cast(GRN_TEXT_LEN(&text_buffer_)) == + table_name_size) && + memcmp(GRN_TEXT_VALUE(&text_buffer_), + table_name, + table_name_size) == 0)) { + continue; + } + + if (!target_table) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an orphan operation: " + "[%u]: <%.*s>[%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + continue; + } + + GRN_BULK_REWIND(&id_buffer_); + grn_obj_get_value(ctx_, columns_.record_, id, &id_buffer_); + grn_id record_id = GRN_UINT32_VALUE(&id_buffer_); + if (record_id == GRN_ID_NIL) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: " + "failed to delete an operation that has no related record: " + "[%u]: <%.*s>[%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + continue; + } + + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + if (strcmp(GRN_TEXT_VALUE(&text_buffer_), "write") == 0 || + strcmp(GRN_TEXT_VALUE(&text_buffer_), "delete") == 0) { + grn_rc rc = grn_table_delete_by_id(ctx_, target_table, record_id); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an incomplete record: " + "[%u]: <%.*s>[%u]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + record_id, + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + + rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: failed to delete an incomplete operation: " + "[%u]: <%.*s>[%u][%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + record_id, + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + } else if (strcmp(GRN_TEXT_VALUE(&text_buffer_), "update") == 0) { + error = HA_ERR_CRASHED_ON_USAGE; + my_message(error, + "mroonga: repair: can't recover from crash while updating", + MYF(0)); + break; + } else { + error = HA_ERR_CRASHED_ON_USAGE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: repair: unknown operation type: " + "[%u]: <%.*s>[%u]: <%s>", + id, + static_cast(table_name_size), table_name, + record_id, + GRN_TEXT_VALUE(&text_buffer_)); + my_message(error, error_message, MYF(0)); + break; + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } + + int Operations::clear(const char *table_name, size_t table_name_size) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx_, table_, NULL, 0, NULL, 0, 0, -1, 0); + if (!cursor) { + error = HA_ERR_CRASHED_ON_USAGE; + if (ctx_->rc) { + my_message(error, ctx_->errbuf, MYF(0)); + } else { + my_message(error, + "mroonga: clear: " + "failed to open cursor for operations table", + MYF(0)); + } + DBUG_RETURN(error); + } + + grn_id id; + while ((id = grn_table_cursor_next(ctx_, cursor))) { + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.table_, id, &text_buffer_); + if ((static_cast(GRN_TEXT_LEN(&text_buffer_)) == + table_name_size) && + memcmp(GRN_TEXT_VALUE(&text_buffer_), + table_name, + table_name_size) == 0) { + grn_rc rc = grn_table_cursor_delete(ctx_, cursor); + if (rc != GRN_SUCCESS) { + error = HA_ERR_CRASHED_ON_USAGE; + GRN_BULK_REWIND(&id_buffer_); + grn_obj_get_value(ctx_, columns_.record_, id, &id_buffer_); + GRN_BULK_REWIND(&text_buffer_); + grn_obj_get_value(ctx_, columns_.type_, id, &text_buffer_); + GRN_TEXT_PUTC(ctx_, &text_buffer_, '\0'); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: clear: failed to delete an operation: " + "[%u]: <%.*s>[%u][%s]: <%s>(%d)", + id, + static_cast(table_name_size), table_name, + GRN_UINT32_VALUE(&id_buffer_), + GRN_TEXT_VALUE(&text_buffer_), + ctx_->errbuf, + rc); + my_message(error, error_message, MYF(0)); + break; + } + } + } + grn_table_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } +} diff --git a/storage/mroonga/lib/mrn_operations.hpp b/storage/mroonga/lib/mrn_operations.hpp new file mode 100644 index 00000000..803d9ab6 --- /dev/null +++ b/storage/mroonga/lib/mrn_operations.hpp @@ -0,0 +1,60 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_OPERATIONS_HPP_ +#define MRN_OPERATIONS_HPP_ + +#include + +namespace mrn { + class Operations { + public: + Operations(grn_ctx *ctx); + ~Operations(); + + bool is_locked(); + + grn_id start(const char *type, + const char *table_name, size_t table_name_size); + void record_target(grn_id id, grn_id target_id); + void finish(grn_id id); + + void enable_recording(); + void disable_recording(); + + grn_hash *collect_processing_table_names(); + + int repair(const char *table_name, size_t table_name_size); + int clear(const char *table_name, size_t table_name_size); + + private: + grn_ctx *ctx_; + grn_obj text_buffer_; + grn_obj id_buffer_; + grn_obj *table_; + struct { + grn_obj *type_; + grn_obj *table_; + grn_obj *record_; + } columns_; + bool is_enabled_recording_; + }; +} + +#endif /* MRN_OPERATIONS_HPP_ */ diff --git a/storage/mroonga/lib/mrn_parameters_parser.cpp b/storage/mroonga/lib/mrn_parameters_parser.cpp new file mode 100644 index 00000000..a1db22bf --- /dev/null +++ b/storage/mroonga/lib/mrn_parameters_parser.cpp @@ -0,0 +1,177 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_parameters_parser.hpp" + +#include +#include + +namespace mrn { + class Parameter { + public: + char *key_; + char *value_; + + Parameter(const char *key, unsigned int key_length, + const char *value, unsigned int value_length) + : key_(mrn_my_strndup(key, key_length, MYF(0))), + value_(mrn_my_strndup(value, value_length, MYF(0))) { + }; + ~Parameter() { + if (key_) { + my_free(key_); + } + if (value_) { + my_free(value_); + } + }; + }; + + ParametersParser::ParametersParser(const char *input, + unsigned int input_length) + : input_(input), + input_length_(input_length), + parameters_(NULL) { + } + + ParametersParser::~ParametersParser() { + for (LIST *next = parameters_; next; next = next->next) { + Parameter *parameter = static_cast(next->data); + delete parameter; + } + list_free(parameters_, false); + } + + void ParametersParser::parse() { + const char *current = input_; + const char *end = input_ + input_length_; + for (; current < end; ++current) { + if (is_white_space(current[0])) { + continue; + } + + const char *key = current; + unsigned int key_length = 0; + while (current < end && + !is_white_space(current[0]) && + current[0] != '\'' && current[0] != '"' && current[0] != ',') { + ++current; + ++key_length; + } + if (current == end) { + break; + } + + while (current < end && is_white_space(current[0])) { + ++current; + } + if (current == end) { + break; + } + current = parse_value(current, end, key, key_length); + if (!current) { + break; + } + + while (current < end && is_white_space(current[0])) { + ++current; + } + if (current == end) { + break; + } + if (current[0] != ',') { + // TODO: report error + break; + } + } + } + + const char *ParametersParser::parse_value(const char *current, + const char *end, + const char *key, + unsigned int key_length) { + char quote = current[0]; + if (quote != '\'' && quote != '"') { + // TODO: report error + return NULL; + } + ++current; + + bool found = false; + static const unsigned int max_value_length = 4096; + char value[max_value_length]; + unsigned int value_length = 0; + for (; current < end && value_length < max_value_length; ++current) { + if (current[0] == quote) { + Parameter *parameter = new Parameter(key, key_length, + value, value_length); + list_push(parameters_, parameter); + found = true; + ++current; + break; + } + + switch (current[0]) { + case '\\': + if (current + 1 == end) { + break; + } + switch (current[1]) { + case 'b': + value[value_length] = '\b'; + break; + case 'n': + value[value_length] = '\n'; + break; + case 'r': + value[value_length] = '\r'; + break; + case 't': + value[value_length] = '\t'; + break; + default: + value[value_length] = current[1]; + break; + } + break; + default: + value[value_length] = current[0]; + break; + } + ++value_length; + } + + if (!found) { + // TODO: report error + } + + return current; + } + + const char *ParametersParser::operator[](const char *key) { + for (LIST *next = parameters_; next; next = next->next) { + Parameter *parameter = static_cast(next->data); + if (strcasecmp(parameter->key_, key) == 0) { + return parameter->value_; + } + } + return NULL; + } +} diff --git a/storage/mroonga/lib/mrn_parameters_parser.hpp b/storage/mroonga/lib/mrn_parameters_parser.hpp new file mode 100644 index 00000000..18ad769e --- /dev/null +++ b/storage/mroonga/lib/mrn_parameters_parser.hpp @@ -0,0 +1,59 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_PARAMETERS_PARSER_HPP_ +#define MRN_PARAMETERS_PARSER_HPP_ + +#include +#include + +namespace mrn { + class ParametersParser { + public: + ParametersParser(const char *input, unsigned int input_length); + ~ParametersParser(); + void parse(); + const char *operator[](const char *key); + + private: + const char *input_; + unsigned int input_length_; + + LIST *parameters_; + + bool is_white_space(char character) { + switch (character) { + case ' ': + case '\r': + case '\n': + case '\t': + return true; + break; + default: + return false; + break; + } + }; + const char *parse_value(const char *current, const char *end, + const char *key, unsigned int key_length); + }; +} + +#endif /* MRN_PARAMETERS_PARSER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_path_mapper.cpp b/storage/mroonga/lib/mrn_path_mapper.cpp new file mode 100644 index 00000000..0e867b88 --- /dev/null +++ b/storage/mroonga/lib/mrn_path_mapper.cpp @@ -0,0 +1,229 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_path_mapper.hpp" + +#include + +namespace mrn { + char *PathMapper::default_path_prefix = NULL; + char *PathMapper::default_mysql_data_home_path = NULL; + + PathMapper::PathMapper(const char *original_mysql_path, + const char *path_prefix, + const char *mysql_data_home_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'; + } + + /** + * "./${db}/${table}" ==> "${db}.mrn" + * "./${db}/" ==> "${db}.mrn" + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" ==> + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0.mrn" + */ + const char *PathMapper::db_path() { + if (db_path_[0] != '\0') { + return db_path_; + } + + if (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(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(original_mysql_path_); + int mysql_data_home_len = strlen(mysql_data_home_path_); + if (len > 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_); + j = strlen(db_path_); + } else { + memcpy(db_path_, mysql_data_home_path_, mysql_data_home_len); + if (path_prefix_) { + if (path_prefix_[0] == FN_CURLIB && + path_prefix_[1] == FN_LIBCHAR) { + strcpy(&db_path_[mysql_data_home_len], &path_prefix_[2]); + } else { + strcpy(&db_path_[mysql_data_home_len], path_prefix_); + } + j = strlen(db_path_); + } else { + j = mysql_data_home_len; + } + } + + while (original_mysql_path_[i] != FN_LIBCHAR && i < len) { + db_path_[j++] = original_mysql_path_[i++]; + } + if (i == len) { + memcpy(db_path_, original_mysql_path_, len); + } else { + db_path_[j] = '\0'; + } + } else { + strcpy(db_path_, original_mysql_path_); + } + } else { + strcpy(db_path_, original_mysql_path_); + } + strcat(db_path_, MRN_DB_FILE_SUFFIX); + return db_path_; + } + + /** + * "./${db}/${table}" ==> "${db}" + * "./${db}/" ==> "${db}" + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" ==> + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" + */ + const char *PathMapper::db_name() { + if (db_name_[0] != '\0') { + return db_name_; + } + + if (original_mysql_path_[0] == FN_CURLIB && + original_mysql_path_[1] == FN_LIBCHAR) { + int i = 2, j = 0, len; + 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(original_mysql_path_); + int mysql_data_home_len = strlen(mysql_data_home_path_); + if (len > 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 (original_mysql_path_[i] != FN_LIBCHAR && i < len) { + db_name_[j++] = original_mysql_path_[i++]; + } + if (i == len) { + memcpy(db_name_, original_mysql_path_, len); + } else { + db_name_[j] = '\0'; + } + } else { + strcpy(db_name_, original_mysql_path_); + } + } else { + strcpy(db_name_, original_mysql_path_); + } + return db_name_; + } + + /** + * "./${db}/${table}" ==> "${table}" (with encoding first '_') + */ + const char *PathMapper::table_name() { + if (table_name_[0] != '\0') { + return table_name_; + } + + int len = strlen(original_mysql_path_); + int i = len, j = 0; + for (; original_mysql_path_[--i] != FN_LIBCHAR ;) {} + if (original_mysql_path_[i + 1] == '_') { + table_name_[j++] = '@'; + table_name_[j++] = '0'; + table_name_[j++] = '0'; + table_name_[j++] = '5'; + table_name_[j++] = 'f'; + i++; + } + for (; i < len ;) { + table_name_[j++] = original_mysql_path_[++i]; + } + table_name_[j] = '\0'; + return table_name_; + } + + /** + * "./${db}/${table}" ==> "${table}" (without encoding first '_') + */ + const char *PathMapper::mysql_table_name() { + if (mysql_table_name_[0] != '\0') { + return mysql_table_name_; + } + + int len = strlen(original_mysql_path_); + int i = len, j = 0; + for (; original_mysql_path_[--i] != FN_LIBCHAR ;) {} + for (; i < len ;) { + 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_; + } + + bool PathMapper::is_internal_table_name() { + return mysql_table_name()[0] == '#'; + } +} diff --git a/storage/mroonga/lib/mrn_path_mapper.hpp b/storage/mroonga/lib/mrn_path_mapper.hpp new file mode 100644 index 00000000..60e99717 --- /dev/null +++ b/storage/mroonga/lib/mrn_path_mapper.hpp @@ -0,0 +1,55 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_PATH_MAPPER_HPP_ +#define MRN_PATH_MAPPER_HPP_ + +#include + +namespace mrn { + class PathMapper { + public: + static char *default_path_prefix; + static char *default_mysql_data_home_path; + + PathMapper(const char *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(); + bool is_internal_table_name(); + bool is_temporary_table_name(); + private: + 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]; + }; +} + +#endif /* MRN_PATH_MAPPER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_query_parser.cpp b/storage/mroonga/lib/mrn_query_parser.cpp new file mode 100644 index 00000000..92387e25 --- /dev/null +++ b/storage/mroonga/lib/mrn_query_parser.cpp @@ -0,0 +1,361 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_query_parser.hpp" + +#include + +extern "C" { + /* Groonga's internal functions */ + int grn_atoi(const char *nptr, const char *end, const char **rest); + uint grn_atoui(const char *nptr, const char *end, const char **rest); +} + +#define MRN_CLASS_NAME "mrn::QueryParser" + +namespace mrn { + QueryParser::QueryParser(grn_ctx *ctx, + THD *thd, + grn_obj *expression, + grn_obj *default_column, + uint n_sections, + grn_obj *match_columns) + : ctx_(ctx), + thd_(thd), + expression_(expression), + default_column_(default_column), + n_sections_(n_sections), + match_columns_(match_columns) { + } + + QueryParser::~QueryParser() { + } + + grn_rc QueryParser::parse(const char *query, size_t query_length) { + MRN_DBUG_ENTER_METHOD(); + + const char *raw_query = NULL; + size_t raw_query_length = 0; + grn_operator default_operator = GRN_OP_OR; + grn_expr_flags expression_flags = 0; + parse_pragma(query, + query_length, + &raw_query, + &raw_query_length, + &default_operator, + &expression_flags); + + grn_obj *default_column = default_column_; + if (match_columns_) { + default_column = match_columns_; + } + grn_rc rc = grn_expr_parse(ctx_, + expression_, + raw_query, + raw_query_length, + default_column, + GRN_OP_MATCH, + default_operator, + expression_flags); + if (rc != GRN_SUCCESS) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to parse fulltext search keyword: <%.*s>: <%s>", + static_cast(query_length), + query, + ctx_->errbuf); + variables::ActionOnError action = + variables::get_action_on_fulltext_query_error(thd_); + switch (action) { + case variables::ACTION_ON_ERROR_ERROR: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + break; + case variables::ACTION_ON_ERROR_ERROR_AND_LOG: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + GRN_LOG(ctx_, GRN_LOG_ERROR, "%s", error_message); + break; + case variables::ACTION_ON_ERROR_IGNORE: + break; + case variables::ACTION_ON_ERROR_IGNORE_AND_LOG: + GRN_LOG(ctx_, GRN_LOG_ERROR, "%s", error_message); + break; + } + } + + DBUG_RETURN(rc); + } + + void QueryParser::parse_pragma(const char *query, + size_t query_length, + const char **raw_query, + size_t *raw_query_length, + grn_operator *default_operator, + grn_expr_flags *flags) { + MRN_DBUG_ENTER_METHOD(); + + const char *current_query = query; + size_t current_query_length = query_length; + + *default_operator = GRN_OP_OR; + + if (current_query_length >= 4 && memcmp(current_query, "*SS ", 4) == 0) { + *raw_query = current_query + 4; + *raw_query_length = current_query_length - 4; + *flags = GRN_EXPR_SYNTAX_SCRIPT; + DBUG_VOID_RETURN; + } + + bool weight_specified = false; + *raw_query = query; + *raw_query_length = query_length; + *flags = default_expression_flags(); + if (current_query_length >= 2 && current_query[0] == '*') { + bool parsed = false; + bool done = false; + current_query++; + current_query_length--; + while (!done) { + size_t consumed_query_length = 0; + switch (current_query[0]) { + case 'D': + if (parse_pragma_d(current_query + 1, + current_query_length - 1, + default_operator, + &consumed_query_length)) { + parsed = true; + consumed_query_length += 1; + current_query += consumed_query_length; + current_query_length -= consumed_query_length; + } else { + done = true; + } + break; + case 'W': + if (parse_pragma_w(current_query + 1, + current_query_length - 1, + &consumed_query_length)) { + parsed = true; + weight_specified = true; + consumed_query_length += 1; + current_query += consumed_query_length; + current_query_length -= consumed_query_length; + } else { + done = true; + } + break; + default: + done = true; + break; + } + } + if (parsed) { + *raw_query = current_query; + *raw_query_length = current_query_length; + } + } + + // WORKAROUND: ignore the first '+' to support "+apple macintosh" pattern. + while (*raw_query_length > 0 && (*raw_query)[0] == ' ') { + (*raw_query)++; + (*raw_query_length)--; + } + if (*raw_query_length > 0 && (*raw_query)[0] == '+') { + (*raw_query)++; + (*raw_query_length)--; + } + if (!weight_specified && match_columns_) { + grn_expr_append_obj(ctx_, match_columns_, default_column_, GRN_OP_PUSH, 1); + } + + DBUG_VOID_RETURN; + } + + bool QueryParser::parse_pragma_w(const char *query, + size_t query_length, + size_t *consumed_query_length) { + MRN_DBUG_ENTER_METHOD(); + + *consumed_query_length = 0; + + grn_obj section_value_buffer; + GRN_UINT32_INIT(§ion_value_buffer, 0); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(bool, specified_sections, n_sections_); + for (uint i = 0; i < n_sections_; ++i) { + specified_sections[i] = false; + } + + uint n_weights = 0; + while (query_length >= 1) { + if (n_weights >= 1) { + if (query[0] != ',') { + break; + } + size_t n_used_query_length = 1; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + if (query_length == 0) { + break; + } + } + + uint section = 0; + if ('1' <= query[0] && query[0] <= '9') { + const char *section_start = query; + const char *query_end = query + query_length; + const char *query_rest; + section = grn_atoui(section_start, query_end, &query_rest); + if (section_start == query_rest) { + break; + } + if (!(0 < section && section <= n_sections_)) { + break; + } + section -= 1; + specified_sections[section] = true; + size_t n_used_query_length = query_rest - query; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + } else { + break; + } + + int weight = 1; + if (query_length >= 2 && query[0] == ':') { + const char *weight_start = query + 1; + const char *query_end = query + query_length; + const char *query_rest; + weight = grn_atoi(weight_start, query_end, &query_rest); + if (weight_start == query_rest) { + break; + } + size_t n_used_query_length = query_rest - query; + *consumed_query_length += n_used_query_length; + query_length -= n_used_query_length; + query += n_used_query_length; + } + + n_weights++; + + append_section(section, + §ion_value_buffer, + weight, + n_weights); + } + + for (uint section = 0; section < n_sections_; ++section) { + if (specified_sections[section]) { + continue; + } + + ++n_weights; + + int default_weight = 1; + append_section(section, + §ion_value_buffer, + default_weight, + n_weights); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(specified_sections); + + GRN_OBJ_FIN(ctx_, §ion_value_buffer); + + DBUG_RETURN(n_weights > 0); + } + + void QueryParser::append_section(uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights) { + MRN_DBUG_ENTER_METHOD(); + + if (!match_columns_) { + DBUG_VOID_RETURN; + } + + grn_expr_append_obj(ctx_, match_columns_, default_column_, GRN_OP_PUSH, 1); + GRN_UINT32_SET(ctx_, section_value_buffer, section); + grn_expr_append_const(ctx_, match_columns_, section_value_buffer, + GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, match_columns_, GRN_OP_GET_MEMBER, 2); + + if (weight != 1) { + grn_expr_append_const_int(ctx_, match_columns_, weight, GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, match_columns_, GRN_OP_STAR, 2); + } + + if (n_weights >= 2) { + grn_expr_append_op(ctx_, match_columns_, GRN_OP_OR, 2); + } + + DBUG_VOID_RETURN; + } + + bool QueryParser::parse_pragma_d(const char *query, + size_t query_length, + grn_operator *default_operator, + size_t *consumed_query_length) { + MRN_DBUG_ENTER_METHOD(); + + bool succeeded = true; + if (query_length >= 1 && query[0] == '+') { + *default_operator = GRN_OP_AND; + *consumed_query_length = 1; + } else if (query_length >= 1 && query[0] == '-') { + *default_operator = GRN_OP_AND_NOT; + *consumed_query_length = 1; + } else if (query_length >= 2 && memcmp(query, "OR", 2) == 0) { + *default_operator = GRN_OP_OR; + *consumed_query_length = 2; + } else { + succeeded = false; + } + + DBUG_RETURN(succeeded); + } + + grn_expr_flags QueryParser::default_expression_flags() { + MRN_DBUG_ENTER_METHOD(); + + ulonglong syntax_flags = variables::get_boolean_mode_syntax_flags(thd_); + grn_expr_flags expression_flags = 0; + if (syntax_flags == variables::BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT) { + expression_flags = GRN_EXPR_SYNTAX_QUERY | GRN_EXPR_ALLOW_LEADING_NOT; + } else { + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT) { + expression_flags |= GRN_EXPR_SYNTAX_SCRIPT; + } else { + expression_flags |= GRN_EXPR_SYNTAX_QUERY; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN) { + expression_flags |= GRN_EXPR_ALLOW_COLUMN; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE) { + expression_flags |= GRN_EXPR_ALLOW_UPDATE; + } + if (syntax_flags & variables::BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT) { + expression_flags |= GRN_EXPR_ALLOW_LEADING_NOT; + } + } + + DBUG_RETURN(expression_flags); + } +} diff --git a/storage/mroonga/lib/mrn_query_parser.hpp b/storage/mroonga/lib/mrn_query_parser.hpp new file mode 100644 index 00000000..ba67394d --- /dev/null +++ b/storage/mroonga/lib/mrn_query_parser.hpp @@ -0,0 +1,67 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#pragma once + +#include +#include + +#include + +namespace mrn { + class QueryParser { + public: + QueryParser(grn_ctx *ctx, + THD *thd, + grn_obj *expression, + grn_obj *default_column, + uint n_sections, + grn_obj *match_columns=NULL); + ~QueryParser(); + + grn_rc parse(const char *query, size_t query_length); + void parse_pragma(const char *query, + size_t query_length, + const char **raw_query, + size_t *raw_query_length, + grn_operator *default_operator, + grn_expr_flags *flags); + + private: + grn_ctx *ctx_; + THD *thd_; + grn_obj *expression_; + grn_obj *default_column_; + uint n_sections_; + grn_obj *match_columns_; + + bool parse_pragma_w(const char *query, + size_t query_length, + size_t *consumed_query_length); + void append_section(uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights); + bool parse_pragma_d(const char *query, + size_t query_length, + grn_operator *default_operator, + size_t *consumed_query_length); + grn_expr_flags default_expression_flags(); + }; +} diff --git a/storage/mroonga/lib/mrn_smart_bitmap.cpp b/storage/mroonga/lib/mrn_smart_bitmap.cpp new file mode 100644 index 00000000..f8fd4f72 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_bitmap.cpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_smart_bitmap.hpp" + +namespace mrn { + SmartBitmap::SmartBitmap(MY_BITMAP *bitmap) + : bitmap_(bitmap) { + } + + SmartBitmap::~SmartBitmap() { + if (bitmap_) { + bitmap_free(bitmap_); + } + } + + MY_BITMAP *SmartBitmap::get() { + return bitmap_; + } + + MY_BITMAP *SmartBitmap::release() { + MY_BITMAP *bitmap = bitmap_; + bitmap_ = NULL; + return bitmap; + } +} diff --git a/storage/mroonga/lib/mrn_smart_bitmap.hpp b/storage/mroonga/lib/mrn_smart_bitmap.hpp new file mode 100644 index 00000000..5cc80df0 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_bitmap.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#pragma once + +#include +#include + +namespace mrn { + class SmartBitmap { + public: + SmartBitmap(MY_BITMAP *bitmap); + ~SmartBitmap(); + + MY_BITMAP *get(); + MY_BITMAP *release(); + private: + MY_BITMAP *bitmap_; + }; +} diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.cpp b/storage/mroonga/lib/mrn_smart_grn_obj.cpp new file mode 100644 index 00000000..845a5fb1 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_grn_obj.cpp @@ -0,0 +1,59 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include + +#include "mrn_smart_grn_obj.hpp" + +namespace mrn { + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, grn_obj *obj) + : ctx_(ctx), + obj_(obj) { + } + + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, const char *name, int name_size) + : ctx_(ctx), + obj_(NULL) { + if (name_size < 0) { + name_size = strlen(name); + } + obj_ = grn_ctx_get(ctx_, name, name_size); + } + + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, grn_id id) + : ctx_(ctx), + obj_(grn_ctx_at(ctx_, id)) { + } + + SmartGrnObj::~SmartGrnObj() { + if (obj_) { + grn_obj_unlink(ctx_, obj_); + } + } + + grn_obj *SmartGrnObj::get() { + return obj_; + } + + grn_obj *SmartGrnObj::release() { + grn_obj *obj = obj_; + obj_ = NULL; + return obj; + } +} diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.hpp b/storage/mroonga/lib/mrn_smart_grn_obj.hpp new file mode 100644 index 00000000..9158145e --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_grn_obj.hpp @@ -0,0 +1,40 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_SMART_GRN_OBJ_HPP_ +#define MRN_SMART_GRN_OBJ_HPP_ + +#include + +namespace mrn { + class SmartGrnObj { + grn_ctx *ctx_; + grn_obj *obj_; + public: + SmartGrnObj(grn_ctx *ctx, grn_obj *obj); + SmartGrnObj(grn_ctx *ctx, const char *name, int name_size=-1); + SmartGrnObj(grn_ctx *ctx, grn_id id); + ~SmartGrnObj(); + + grn_obj *get(); + grn_obj *release(); + }; +} + +#endif // MRN_SMART_GRN_OBJ_HPP_ diff --git a/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp b/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp new file mode 100644 index 00000000..bc2d2f25 --- /dev/null +++ b/storage/mroonga/lib/mrn_table_fields_offset_mover.cpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_table_fields_offset_mover.hpp" + +namespace mrn { + FieldTableChanger::FieldTableChanger(TABLE *table, + TABLE *new_table) + : old_table_(table), + new_table_(new_table) { + my_ptrdiff_t diff = + PTR_BYTE_DIFF(new_table_->record[0], old_table_->record[0]); + uint n_columns = old_table_->s->fields; + for (uint i = 0; i < n_columns; ++i) { + Field *field = old_table_->field[i]; + field->move_field_offset(diff); + field->table = new_table; + } + } + + FieldTableChanger::~FieldTableChanger() { + my_ptrdiff_t diff = + PTR_BYTE_DIFF(new_table_->record[0], old_table_->record[0]); + uint n_columns = old_table_->s->fields; + for (uint i = 0; i < n_columns; ++i) { + Field *field = old_table_->field[i]; + field->move_field_offset(-diff); + field->table = old_table_; + } + } +} diff --git a/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp b/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp new file mode 100644 index 00000000..94f96772 --- /dev/null +++ b/storage/mroonga/lib/mrn_table_fields_offset_mover.hpp @@ -0,0 +1,33 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#pragma once + +#include + +namespace mrn { + class FieldTableChanger { + public: + FieldTableChanger(TABLE *table, TABLE *new_table); + ~FieldTableChanger(); + private: + TABLE *old_table_; + TABLE *new_table_; + }; +} diff --git a/storage/mroonga/lib/mrn_time_converter.cpp b/storage/mroonga/lib/mrn_time_converter.cpp new file mode 100644 index 00000000..9bb8d89a --- /dev/null +++ b/storage/mroonga/lib/mrn_time_converter.cpp @@ -0,0 +1,295 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include "mrn_time_converter.hpp" + +#ifdef min +# undef min +#endif +#ifdef max +# undef max +#endif + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::TimeConverter" + +namespace mrn { + TimeConverter::TimeConverter() { + } + + TimeConverter::~TimeConverter() { + } + + time_t TimeConverter::tm_to_time_gm(struct tm *time, bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + *truncated = true; + struct tm gmdate; + time->tm_yday = -1; + time->tm_isdst = -1; + time_t sec_t = mktime(time); + if (time->tm_yday == -1) { + DBUG_RETURN(-1); + } + if (!gmtime_r(&sec_t, &gmdate)) { + DBUG_RETURN(-1); + } + int32 mrn_utc_diff_in_seconds = + ( + time->tm_mday > 25 && gmdate.tm_mday == 1 ? -1 : + time->tm_mday == 1 && gmdate.tm_mday > 25 ? 1 : + time->tm_mday - gmdate.tm_mday + ) * 24 * 60 * 60 + + (time->tm_hour - gmdate.tm_hour) * 60 * 60 + + (time->tm_min - gmdate.tm_min) * 60 + + (time->tm_sec - gmdate.tm_sec); + DBUG_PRINT("info", ("mroonga: time->tm_year=%d", time->tm_year)); + DBUG_PRINT("info", ("mroonga: time->tm_mon=%d", time->tm_mon)); + DBUG_PRINT("info", ("mroonga: time->tm_mday=%d", time->tm_mday)); + DBUG_PRINT("info", ("mroonga: time->tm_hour=%d", time->tm_hour)); + DBUG_PRINT("info", ("mroonga: time->tm_min=%d", time->tm_min)); + DBUG_PRINT("info", ("mroonga: time->tm_sec=%d", time->tm_sec)); + DBUG_PRINT("info", ("mroonga: mrn_utc_diff_in_seconds=%d", + mrn_utc_diff_in_seconds)); + if (mrn_utc_diff_in_seconds > 0) { + if (sec_t > std::numeric_limits::max() - mrn_utc_diff_in_seconds) { + DBUG_RETURN(-1); + } + } else { + if (sec_t < std::numeric_limits::min() - mrn_utc_diff_in_seconds) { + DBUG_RETURN(-1); + } + } + *truncated = false; + DBUG_RETURN(sec_t + mrn_utc_diff_in_seconds); + } + + long long int TimeConverter::tm_to_grn_time(struct tm *time, int usec, + bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + + long long int sec = tm_to_time_gm(time, truncated); + + DBUG_PRINT("info", ("mroonga: sec=%lld", sec)); + DBUG_PRINT("info", ("mroonga: usec=%d", usec)); + + long long int grn_time = *truncated ? 0 : GRN_TIME_PACK(sec, usec); + + DBUG_RETURN(grn_time); + } + + long long int TimeConverter::mysql_time_to_grn_time(MYSQL_TIME *mysql_time, + bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + + int usec = mysql_time->second_part; + long long int grn_time = 0; + + *truncated = false; + switch (mysql_time->time_type) { + case MYSQL_TIMESTAMP_DATE: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATE")); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = mysql_time->year - TM_YEAR_BASE; + if (mysql_time->month > 0) { + date.tm_mon = mysql_time->month - 1; + } else { + date.tm_mon = 0; + *truncated = true; + } + if (mysql_time->day > 0) { + date.tm_mday = mysql_time->day; + } else { + date.tm_mday = 1; + *truncated = true; + } + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + bool tm_truncated = false; + grn_time = tm_to_grn_time(&date, usec, &tm_truncated); + if (tm_truncated) { + *truncated = true; + } + } + break; + case MYSQL_TIMESTAMP_DATETIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATETIME")); + struct tm datetime; + memset(&datetime, 0, sizeof(struct tm)); + datetime.tm_year = mysql_time->year - TM_YEAR_BASE; + if (mysql_time->month > 0) { + datetime.tm_mon = mysql_time->month - 1; + } else { + datetime.tm_mon = 0; + *truncated = true; + } + if (mysql_time->day > 0) { + datetime.tm_mday = mysql_time->day; + } else { + datetime.tm_mday = 1; + *truncated = true; + } + datetime.tm_hour = mysql_time->hour; + datetime.tm_min = mysql_time->minute; + datetime.tm_sec = mysql_time->second; + DBUG_PRINT("info", ("mroonga: tm_year=%d", datetime.tm_year)); + DBUG_PRINT("info", ("mroonga: tm_mon=%d", datetime.tm_mon)); + DBUG_PRINT("info", ("mroonga: tm_mday=%d", datetime.tm_mday)); + DBUG_PRINT("info", ("mroonga: tm_hour=%d", datetime.tm_hour)); + DBUG_PRINT("info", ("mroonga: tm_min=%d", datetime.tm_min)); + DBUG_PRINT("info", ("mroonga: tm_sec=%d", datetime.tm_sec)); + bool tm_truncated = false; + grn_time = tm_to_grn_time(&datetime, usec, &tm_truncated); + if (tm_truncated) { + *truncated = true; + } + } + break; + case MYSQL_TIMESTAMP_TIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_TIME")); + int sec = + mysql_time->hour * 60 * 60 + + mysql_time->minute * 60 + + mysql_time->second; + DBUG_PRINT("info", ("mroonga: sec=%d", sec)); + grn_time = GRN_TIME_PACK(sec, usec); + if (mysql_time->neg) { + grn_time = -grn_time; + } + } + break; + default: + DBUG_PRINT("info", ("mroonga: default")); + grn_time = 0; + break; + } + + DBUG_RETURN(grn_time); + } + + void TimeConverter::grn_time_to_mysql_time(long long int grn_time, + MYSQL_TIME *mysql_time) { + MRN_DBUG_ENTER_METHOD(); + long long int sec; + int usec; + GRN_TIME_UNPACK(grn_time, sec, usec); + DBUG_PRINT("info", ("mroonga: sec=%lld", sec)); + DBUG_PRINT("info", ("mroonga: usec=%d", usec)); + switch (mysql_time->time_type) { + case MYSQL_TIMESTAMP_DATE: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATE")); + struct tm date; + time_t sec_t = sec; + // TODO: Add error check + gmtime_r(&sec_t, &date); + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + mysql_time->year = date.tm_year + TM_YEAR_BASE; + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + mysql_time->month = date.tm_mon + 1; + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + mysql_time->day = date.tm_mday; + } + break; + case MYSQL_TIMESTAMP_DATETIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATETIME")); + struct tm date; + time_t sec_t = sec; + // TODO: Add error check + gmtime_r(&sec_t, &date); + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + mysql_time->year = date.tm_year + TM_YEAR_BASE; + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + mysql_time->month = date.tm_mon + 1; + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + mysql_time->day = date.tm_mday; + DBUG_PRINT("info", ("mroonga: tm_hour=%d", date.tm_hour)); + mysql_time->hour = date.tm_hour; + DBUG_PRINT("info", ("mroonga: tm_min=%d", date.tm_min)); + mysql_time->minute = date.tm_min; + DBUG_PRINT("info", ("mroonga: tm_sec=%d", date.tm_sec)); + mysql_time->second = date.tm_sec; + mysql_time->second_part = usec; + } + break; + case MYSQL_TIMESTAMP_TIME: + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_TIME")); + if (sec < 0) { + mysql_time->neg = true; + sec = -sec; + } + mysql_time->hour = static_cast(sec / 60 / 60); + mysql_time->minute = sec / 60 % 60; + mysql_time->second = sec % 60; + mysql_time->second_part = usec; + break; + default: + DBUG_PRINT("info", ("mroonga: default")); + break; + } + DBUG_VOID_RETURN; + } + + long long int TimeConverter::mysql_datetime_to_grn_time(long long int mysql_datetime, + bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + + MYSQL_TIME mysql_time; + mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME; + mysql_time.neg = 0; + mysql_time.second_part = 0; + mysql_time.second = (mysql_datetime % 100); + mysql_time.minute = (mysql_datetime / 100 % 100); + mysql_time.hour = (mysql_datetime / 10000 % 100); + mysql_time.day = (mysql_datetime / 1000000 % 100); + mysql_time.month = (mysql_datetime / 100000000 % 100); + mysql_time.year = (mysql_datetime / 10000000000LL % 10000); + + long long int grn_time = mysql_time_to_grn_time(&mysql_time, truncated); + + DBUG_RETURN(grn_time); + } + + long long int TimeConverter::grn_time_to_mysql_datetime(long long int grn_time) { + MRN_DBUG_ENTER_METHOD(); + + MYSQL_TIME mysql_time; + mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME; + + grn_time_to_mysql_time(grn_time, &mysql_time); + + long long int mysql_datetime = + (mysql_time.second * 1) + + (mysql_time.minute * 100) + + (mysql_time.hour * 10000) + + (mysql_time.day * 1000000) + + (mysql_time.month * 100000000) + + (mysql_time.year * 10000000000LL); + + DBUG_RETURN(mysql_datetime); + } +} diff --git a/storage/mroonga/lib/mrn_time_converter.hpp b/storage/mroonga/lib/mrn_time_converter.hpp new file mode 100644 index 00000000..2f7f00f5 --- /dev/null +++ b/storage/mroonga/lib/mrn_time_converter.hpp @@ -0,0 +1,51 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_TIME_CONVERTER_HPP_ +#define MRN_TIME_CONVERTER_HPP_ + +#include + +#include + +namespace mrn { + class TimeConverter { + public: + static const long long int TM_YEAR_BASE = 1900; + + TimeConverter(); + ~TimeConverter(); + + long long int mysql_time_to_grn_time(MYSQL_TIME *mysql_time, + bool *truncated); + long long int mysql_datetime_to_grn_time(long long int mysql_datetime, + bool *truncated); + + long long int tm_to_grn_time(struct tm *time, int usec, bool *truncated); + + void grn_time_to_mysql_time(long long int grn_time, MYSQL_TIME *mysql_time); + long long int grn_time_to_mysql_datetime(long long int grn_time); + + private: + time_t tm_to_time_gm(struct tm *time, bool *truncated); + }; +} + +#endif /* MRN_TIME_CONVERTER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_value_decoder.cpp b/storage/mroonga/lib/mrn_value_decoder.cpp new file mode 100644 index 00000000..3b2eed67 --- /dev/null +++ b/storage/mroonga/lib/mrn_value_decoder.cpp @@ -0,0 +1,75 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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; + } + void decode(long long int *dest, const uchar *source) { + MRN_DBUG_ENTER_FUNCTION(); +#ifdef MRN_DEST_IS_POINTER + longlongget(dest, source); +#else + long long int value; + longlongget(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 00000000..7919a88e --- /dev/null +++ b/storage/mroonga/lib/mrn_value_decoder.hpp @@ -0,0 +1,34 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_VALUE_DECODER_HPP_ +#define MRN_VALUE_DECODER_HPP_ + +#include + +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); + void decode(long long int *dest, const uchar *source); + } +} + +#endif // MRN_VALUE_DECODER_HPP_ diff --git a/storage/mroonga/lib/mrn_windows.hpp b/storage/mroonga/lib/mrn_windows.hpp new file mode 100644 index 00000000..cfe35b41 --- /dev/null +++ b/storage/mroonga/lib/mrn_windows.hpp @@ -0,0 +1,31 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_WINDOWS_HPP_ +#define MRN_WINDOWS_HPP_ + +#if defined(_WIN32) || defined(_WIN64) +# define MRN_API __declspec(dllexport) +#else +# define MRN_API +#endif + +#endif /* MRN_WINDOWS_HPP_ */ diff --git a/storage/mroonga/mrn_constants.hpp b/storage/mroonga/mrn_constants.hpp new file mode 100644 index 00000000..9f21eb32 --- /dev/null +++ b/storage/mroonga/mrn_constants.hpp @@ -0,0 +1,49 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_CONSTANTS_HPP_ +#define MRN_CONSTANTS_HPP_ + +#include + +#include + +#define MRN_BUFFER_SIZE 1024 +#define MRN_MAX_KEY_SIZE GRN_TABLE_MAX_KEY_SIZE +#if defined(MAX_PATH) +# define MRN_MAX_PATH_SIZE (MAX_PATH + 1) +#elif defined(PATH_MAX) +# define MRN_MAX_PATH_SIZE (PATH_MAX) +#elif defined(MAXPATHLEN) +# define MRN_MAX_PATH_SIZE (MAXPATHLEN) +#else +# define MRN_MAX_PATH_SIZE (256) +#endif +#define MRN_DB_FILE_SUFFIX ".mrn" +#define MRN_LOG_FILE_PATH "groonga.log" +#define MRN_COLUMN_NAME_ID "_id" +#define MRN_COLUMN_NAME_KEY "_key" +#define MRN_COLUMN_NAME_SCORE "_score" +#ifndef MRN_DEFAULT_TOKENIZER +# define MRN_DEFAULT_TOKENIZER "TokenBigram" +#endif + +#endif /* MRN_CONSTANTS_HPP_ */ diff --git a/storage/mroonga/mrn_err.h b/storage/mroonga/mrn_err.h new file mode 100644 index 00000000..46eb24cc --- /dev/null +++ b/storage/mroonga/mrn_err.h @@ -0,0 +1,46 @@ +/* + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2014-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_ERR_H_ +#define MRN_ERR_H_ + +#define ER_MRN_INVALID_TABLE_PARAM_NUM 16501 +#define ER_MRN_INVALID_TABLE_PARAM_STR "The table parameter '%-.64s' is invalid" +#define ER_MRN_CHARSET_NOT_SUPPORT_NUM 16502 +#define ER_MRN_CHARSET_NOT_SUPPORT_STR "The character set '%s[%s]' is not supported by groonga" +#define ER_MRN_GEOMETRY_NOT_SUPPORT_NUM 16503 +#define ER_MRN_GEOMETRY_NOT_SUPPORT_STR "This geometry type is not supported. Groonga is supported point only" +#define ER_MRN_ERROR_FROM_GROONGA_NUM 16504 +#define ER_MRN_ERROR_FROM_GROONGA_STR "Error from Groonga [%s]" +#define ER_MRN_INVALID_NULL_VALUE_NUM 16505 +#define ER_MRN_INVALID_NULL_VALUE_STR "NULL value can't be used for %s" +#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. It is ignored" +#define ER_MRN_INVALID_INDEX_FLAG_NUM 16508 +#define ER_MRN_INVALID_INDEX_FLAG_STR \ + "The index flag '%-.64s' is invalid. It is ignored" +#define ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_NUM 16509 +#define ER_MRN_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN_STR \ + "Index for virtual generated column is not supported: %s" + +#endif /* MRN_ERR_H_ */ diff --git a/storage/mroonga/mrn_macro.hpp b/storage/mroonga/mrn_macro.hpp new file mode 100644 index 00000000..56576983 --- /dev/null +++ b/storage/mroonga/mrn_macro.hpp @@ -0,0 +1,30 @@ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_MACRO_HPP_ +#define MRN_MACRO_HPP_ + +#ifdef __cplusplus +# define MRN_BEGIN_DECLS extern "C" { +# define MRN_END_DECLS } +#else +# define MRN_BEGIN_DECLS +# define MRN_END_DECLS +#endif + +#endif /* MRN_MACRO_HPP_ */ diff --git a/storage/mroonga/mrn_mysql.h b/storage/mroonga/mrn_mysql.h new file mode 100644 index 00000000..9573caa9 --- /dev/null +++ b/storage/mroonga/mrn_mysql.h @@ -0,0 +1,74 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_MYSQL_H_ +#define MRN_MYSQL_H_ + +#ifdef HAVE_CONFIG_H +# include +/* We need to undefine them because my_config.h defines them. :< */ +# undef VERSION +# undef PACKAGE +# undef PACKAGE_BUGREPORT +# undef PACKAGE_NAME +# undef PACKAGE_STRING +# undef PACKAGE_TARNAME +# undef PACKAGE_VERSION +#endif + +#include + +#ifdef FORCE_FAST_MUTEX_DISABLED +# ifdef MY_PTHREAD_FASTMUTEX +# undef MY_PTHREAD_FASTMUTEX +# endif +#endif + +#define MYSQL_SERVER 1 +#include + +#ifdef MARIADB_BASE_VERSION +# define MRN_MARIADB_P 1 +#endif + +#include +#include +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID < 80002) +# include +#endif +#include +#include + +#define MRN_MESSAGE_BUFFER_SIZE 1024 + +#define MRN_DBUG_ENTER_FUNCTION() DBUG_ENTER(__FUNCTION__) + +#if !defined(DBUG_OFF) && !defined(_lint) +# define MRN_DBUG_ENTER_METHOD() \ + char method_name[MRN_MESSAGE_BUFFER_SIZE]; \ + method_name[0] = '\0'; \ + strcat(method_name, MRN_CLASS_NAME); \ + strcat(method_name, "::"); \ + strcat(method_name, __FUNCTION__); \ + DBUG_ENTER(method_name) +#else +# define MRN_DBUG_ENTER_METHOD() MRN_DBUG_ENTER_FUNCTION() +#endif + +#endif /* MRN_MYSQL_H_ */ diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h new file mode 100644 index 00000000..08d874fa --- /dev/null +++ b/storage/mroonga/mrn_mysql_compat.h @@ -0,0 +1,422 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#ifndef MRN_MYSQL_COMPAT_H_ +#define MRN_MYSQL_COMPAT_H_ + +#include "mrn_mysql.h" + +#if MYSQL_VERSION_ID >= 50604 +# define MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 +# define MRN_HAVE_MYSQL_TYPE_DATETIME2 +# define MRN_HAVE_MYSQL_TYPE_TIME2 +#endif + +#if MYSQL_VERSION_ID >= 50709 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_MYSQL_TYPE_JSON +#endif + +#if MYSQL_VERSION_ID < 50603 + typedef MYSQL_ERROR Sql_condition; +#endif + +#if defined(MRN_MARIADB_P) +# if MYSQL_VERSION_ID < 100000 + typedef COST_VECT Cost_estimate; +# endif +#endif + +#ifndef MRN_MARIADB_P + typedef char *range_id_t; +#endif + +#if defined(MRN_MARIADB_P) || MYSQL_VERSION_ID < 80002 + typedef st_select_lex SELECT_LEX; +#endif + +#if MYSQL_VERSION_ID >= 50609 +# define MRN_KEY_HAS_USER_DEFINED_KEYPARTS +#endif + +#ifdef MRN_KEY_HAS_USER_DEFINED_KEYPARTS +# define KEY_N_KEY_PARTS(key) (key)->user_defined_key_parts +#else +# define KEY_N_KEY_PARTS(key) (key)->key_parts +#endif + +# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \ + init_alloc_root(mrn_memory_key, PTR, SZ1, SZ2, FLAG) + +#if MYSQL_VERSION_ID < 100002 || !defined(MRN_MARIADB_P) +# define GTS_TABLE 0 +#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_ERROR_NUMBER thd_get_error_number(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_ERROR_NUMBER current_thd->get_stmt_da()->sql_errno() +# 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 +# define MRN_GET_ERROR_MESSAGE current_thd->stmt_da->message() +# define MRN_GET_ERROR_NUMBER current_thd->stmt_da->sql_errno() +# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->warning_info->current_row_for_warning() +#endif + +#if MYSQL_VERSION_ID >= 50607 && !defined(MRN_MARIADB_P) +# define MRN_ITEM_HAVE_ITEM_NAME +#endif + +#if MYSQL_VERSION_ID < 100000 +# define MRN_HAVE_TABLE_DEF_CACHE +#endif + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100009 +# define MRN_HAVE_TDC_ACQUIRE_SHARE +# if MYSQL_VERSION_ID < 100200 +# define MRN_TDC_ACQUIRE_SHARE_REQUIRE_KEY +# endif +#endif + +#if MYSQL_VERSION_ID >= 50613 +# define MRN_HAVE_ALTER_INFO +#endif + +#if MYSQL_VERSION_ID >= 50603 +# define MRN_HAVE_GET_TABLE_DEF_KEY +#endif + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100004 +# define MRN_TABLE_SHARE_HAVE_LOCK_SHARE +#endif + +#ifndef TIME_FUZZY_DATE +/* For MariaDB 10. */ +# ifdef TIME_FUZZY_DATES +# define TIME_FUZZY_DATE TIME_FUZZY_DATES +# endif +#endif + +#if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P) +# define MRN_USE_MYSQL_DATA_HOME +#endif + +#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 + +#ifdef HAVE_PSI_MEMORY_INTERFACE +#define MRN_HAVE_PSI_MEMORY_KEY +#endif + +# 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__) + +#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.str) +#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 + +#ifdef MRN_MARIADB_P +# define MRN_SUPPORT_CUSTOM_OPTIONS +#endif + +#ifdef MRN_MARIADB_P +# define MRN_HAVE_ITEM_EQUAL_FIELDS_ITERATOR +#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 + +# define mrn_init_sql_alloc(thd, mem_root) \ + init_sql_alloc(mrn_memory_key, mem_root, \ + TABLE_ALLOC_BLOCK_SIZE, \ + 0, \ + MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC)) + +#ifdef MRN_MARIADB_P +# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning +#else +# if MYSQL_VERSION_ID >= 50706 +# define MRN_ABORT_ON_WARNING(thd) thd->is_strict_mode() +# else +# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning +# endif +#endif + +#define MRN_ERROR_CODE_DATA_TRUNCATE(thd) \ + (MRN_ABORT_ON_WARNING(thd) ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED) + +# define mrn_my_hash_init(hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags) \ + my_hash_init(mrn_memory_key, hash, \ + charset, \ + default_array_elements, \ + key_offset, \ + key_length, \ + get_key, \ + free_element, \ + flags) + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000 +# define mrn_strconvert(from_cs, \ + from, \ + from_length, \ + to_cs, \ + to, \ + to_length, \ + errors) \ + strconvert((from_cs), \ + (from), \ + (from_length), \ + (to_cs), \ + (to), \ + (to_length), \ + (errors)) +#else +# define mrn_strconvert(from_cs, \ + from, \ + from_length, \ + to_cs, \ + to, \ + to_length, \ + errors) \ + strconvert((from_cs), \ + (from), \ + (to_cs), \ + (to), \ + (to_length), \ + (errors)) +#endif + +#if MYSQL_VERSION_ID >= 50717 && !defined(MRN_MARIADB_P) +# define mrn_is_directory_separator(c) \ + is_directory_separator((c)) +#else +# define mrn_is_directory_separator(c) \ + (c == FN_LIBCHAR || c == FN_LIBCHAR2) +#endif + +#if ((MYSQL_VERSION_ID < 50636) || \ + (MYSQL_VERSION_ID >= 50700 && MYSQL_VERSION_ID < 50718)) && !defined(MRN_MARIADB_P) +# define MRN_HAVE_MYSQL_FIELD_PART_OF_KEY_NOT_CLUSTERED +#endif + +#if defined(MRN_MARIADB_P) && \ + ((MYSQL_VERSION_ID >= 100207) || \ + ((MYSQL_VERSION_ID >= 100126) && (MYSQL_VERSION_ID < 100200)) || \ + ((MYSQL_VERSION_ID >= 100032) && (MYSQL_VERSION_ID < 100100)) || \ + ((MYSQL_VERSION_ID >= 50557) && (MYSQL_VERSION_ID < 100000))) +# define mrn_create_partition_name(out, \ + out_length, \ + in1, \ + in2, \ + name_variant, \ + translate) \ + create_partition_name(out, out_length, in1, in2, name_variant, translate) +# define mrn_create_subpartition_name(out, \ + out_length, \ + in1, \ + in2, \ + in3, \ + name_variant) \ + create_subpartition_name(out, out_length, in1, in2, in3, name_variant) +#else +# define mrn_create_partition_name(out, \ + out_length, \ + in1, \ + in2, \ + name_variant, \ + translate) \ + (create_partition_name(out, in1, in2, name_variant, translate), 0) +# define mrn_create_subpartition_name(out, \ + out_length, \ + in1, \ + in2, \ + in3, \ + name_variant) \ + (create_subpartition_name(out, in1, in2, in3, name_variant), 0) +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) +# define ITEM_SUM_GET_NEST_LEVEL(sum_item) (sum_item)->base_select->nest_level +# define ITEM_SUM_GET_AGGR_LEVEL(sum_item) (sum_item)->aggr_select->nest_level +# define ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) (sum_item)->max_aggr_level +#else +# define ITEM_SUM_GET_NEST_LEVEL(sum_item) (sum_item)->nest_level +# define ITEM_SUM_GET_AGGR_LEVEL(sum_item) (sum_item)->aggr_level +# define ITEM_SUM_GET_MAX_AGGR_LEVEL(sum_item) (sum_item)->max_arg_level +#endif + +#if (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 80002) + typedef bool mrn_bool; +#else + typedef my_bool mrn_bool; +#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) + +#if ((defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100203)) || \ + (!defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50711) +# define MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN \ + ALTER_ADD_VIRTUAL_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN \ + ALTER_ADD_STORED_BASE_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN \ + ALTER_ADD_STORED_GENERATED_COLUMN +#else +# define MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN 0 +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN \ + Alter_inplace_info::ADD_COLUMN +# define MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN 0 +#endif + +#if (defined(HA_CAN_VIRTUAL_COLUMNS) || defined(HA_GENERATED_COLUMNS)) +# define MRN_SUPPORT_GENERATED_COLUMNS +#endif + +#ifdef MRN_MARIADB_P +# if (MYSQL_VERSION_ID >= 100200) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db()) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->vcol_info && field->vcol_info->is_stored()) +# elif (MYSQL_VERSION_ID >= 50500) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->vcol_info && field->vcol_info->is_stored()) +# else +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) false +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) false +# endif +#else +# if (MYSQL_VERSION_ID >= 50708) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (field->is_virtual_gcol()) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->is_gcol() && !field->is_virtual_gcol()) +# elif (MYSQL_VERSION_ID >= 50706) +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) \ + (!field->stored_in_db) +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) \ + (field->gcol_info && field->gcol_info->get_field_stored()) +# else +# define MRN_GENERATED_COLUMNS_FIELD_IS_VIRTUAL(field) false +# define MRN_GENERATED_COLUMNS_FIELD_IS_STORED(field) false +# endif +#endif + +#ifdef MRN_MARIADB_P +# if (MYSQL_VERSION_ID >= 100203) +# define MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(table, field) \ + (table->update_virtual_field(field)) +# else +# define MRN_GENERATED_COLUMNS_UPDATE_VIRTUAL_FIELD(table, field) \ + (field->vcol_info->expr_item->save_in_field(field, 0)) +# endif +#endif + +#endif /* MRN_MYSQL_COMPAT_H_ */ diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp new file mode 100644 index 00000000..037a6a59 --- /dev/null +++ b/storage/mroonga/mrn_table.cpp @@ -0,0 +1,1198 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2017 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should 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-1335 USA +*/ + +#include "mrn_mysql.h" + +#if MYSQL_VERSION_ID >= 50500 +# include +# include +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE +# include +#endif +#include + +#include "mrn_err.h" +#include "mrn_table.hpp" +#include "mrn_mysql_compat.h" +#include "mrn_variables.hpp" +#include + +#ifdef MRN_MARIADB_P +# if MYSQL_VERSION_ID >= 100100 +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE) +# else +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name)) +# endif +#else +# if MYSQL_VERSION_ID >= 50603 +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE) +# else +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name)) +# endif +#endif + +#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P) +# define MRN_PLUGIN_DATA(plugin, type) plugin_data(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') + +#define MRN_DEFAULT_STR "DEFAULT" +#define MRN_DEFAULT_LEN (sizeof(MRN_DEFAULT_STR) - 1) +#define MRN_GROONGA_STR "GROONGA" +#define MRN_GROONGA_LEN (sizeof(MRN_GROONGA_STR) - 1) + +#ifdef MRN_HAVE_TABLE_DEF_CACHE +extern HASH *mrn_table_def_cache; +#endif + +#ifdef __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 +extern PSI_mutex_key *mrn_table_share_lock_ha_data; +# endif +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 mysql_mutex_t mrn_open_tables_mutex; +extern HASH mrn_long_term_share; +extern mysql_mutex_t mrn_long_term_share_mutex; +extern char *mrn_default_tokenizer; +extern char *mrn_default_wrapper_engine; +extern handlerton *mrn_hton_ptr; +extern HASH mrn_allocated_thds; +extern mysql_mutex_t mrn_allocated_thds_mutex; + +static char *mrn_get_string_between_quote(const char *ptr) +{ + const char *start_ptr, *end_ptr, *tmp_ptr, *esc_ptr; + bool find_flg = FALSE, esc_flg = FALSE; + MRN_DBUG_ENTER_FUNCTION(); + + start_ptr = strchr(ptr, '\''); + end_ptr = strchr(ptr, '"'); + if (start_ptr && (!end_ptr || start_ptr < end_ptr)) + { + tmp_ptr = ++start_ptr; + while (!find_flg) + { + if (!(end_ptr = strchr(tmp_ptr, '\''))) + DBUG_RETURN(NULL); + esc_ptr = tmp_ptr; + while (!find_flg) + { + esc_ptr = strchr(esc_ptr, '\\'); + if (!esc_ptr || esc_ptr > end_ptr) + find_flg = TRUE; + else if (esc_ptr == end_ptr - 1) + { + esc_flg = TRUE; + tmp_ptr = end_ptr + 1; + break; + } else { + esc_flg = TRUE; + esc_ptr += 2; + } + } + } + } else if (end_ptr) + { + start_ptr = end_ptr; + tmp_ptr = ++start_ptr; + while (!find_flg) + { + if (!(end_ptr = strchr(tmp_ptr, '"'))) + DBUG_RETURN(NULL); + esc_ptr = tmp_ptr; + while (!find_flg) + { + esc_ptr = strchr(esc_ptr, '\\'); + if (!esc_ptr || esc_ptr > end_ptr) + find_flg = TRUE; + else if (esc_ptr == end_ptr - 1) + { + esc_flg = TRUE; + tmp_ptr = end_ptr + 1; + break; + } else { + esc_flg = TRUE; + esc_ptr += 2; + } + } + } + } else + DBUG_RETURN(NULL); + + size_t length = end_ptr - start_ptr; + char *extracted_string = (char *)mrn_my_malloc(length + 1, MYF(MY_WME)); + if (esc_flg) { + size_t extracted_index = 0; + const char *current_ptr = start_ptr; + while (current_ptr < end_ptr) { + if (*current_ptr != '\\') { + extracted_string[extracted_index] = *current_ptr; + ++extracted_index; + current_ptr++; + continue; + } + + if (current_ptr + 1 == end_ptr) { + break; + } + + switch (*(current_ptr + 1)) + { + case 'b': + extracted_string[extracted_index] = '\b'; + break; + case 'n': + extracted_string[extracted_index] = '\n'; + break; + case 'r': + extracted_string[extracted_index] = '\r'; + break; + case 't': + extracted_string[extracted_index] = '\t'; + break; + default: + extracted_string[extracted_index] = *(current_ptr + 1); + break; + } + ++extracted_index; + } + } else { + memcpy(extracted_string, start_ptr, length); + extracted_string[length] = '\0'; + } + + DBUG_RETURN(extracted_string); +} + +#ifdef WITH_PARTITION_STORAGE_ENGINE +void mrn_get_partition_info(const char *table_name, uint table_name_length, + const TABLE *table, partition_element **part_elem, + partition_element **sub_elem) +{ + partition_info *part_info = table->part_info; + partition_element *tmp_part_elem = NULL, *tmp_sub_elem = NULL; + bool tmp_flg = FALSE, tmp_find_flg = FALSE; + MRN_DBUG_ENTER_FUNCTION(); + *part_elem = NULL; + *sub_elem = NULL; + if (!part_info) + DBUG_VOID_RETURN; + + if (table_name && !memcmp(table_name + table_name_length - 5, "#TMP#", 5)) + tmp_flg = TRUE; + + DBUG_PRINT("info", ("mroonga table_name=%s", table_name)); + List_iterator part_it(part_info->partitions); + while ((*part_elem = part_it++)) + { + if ((*part_elem)->subpartitions.elements) + { + List_iterator sub_it((*part_elem)->subpartitions); + while ((*sub_elem = sub_it++)) + { + char subpartition_name[FN_REFLEN + 1]; + int error = mrn_create_subpartition_name(subpartition_name, + sizeof(subpartition_name), + table->s->path.str, + (*part_elem)->partition_name, + (*sub_elem)->partition_name, + NORMAL_PART_NAME); + if (error != 0) + DBUG_VOID_RETURN; + DBUG_PRINT("info", ("mroonga subpartition name=%s", subpartition_name)); + if (table_name && + memcmp(table_name, subpartition_name, table_name_length + 1) == 0) + DBUG_VOID_RETURN; + if ( + tmp_flg && + table_name && + *(subpartition_name + table_name_length - 5) == '\0' && + memcmp(table_name, subpartition_name, table_name_length - 5) == 0 + ) { + tmp_part_elem = *part_elem; + tmp_sub_elem = *sub_elem; + tmp_flg = FALSE; + tmp_find_flg = TRUE; + } + } + } else { + char partition_name[FN_REFLEN + 1]; + int error = mrn_create_partition_name(partition_name, + sizeof(partition_name), + table->s->path.str, + (*part_elem)->partition_name, + NORMAL_PART_NAME, + TRUE); + if (error != 0) + DBUG_VOID_RETURN; + DBUG_PRINT("info", ("mroonga partition name=%s", partition_name)); + if (table_name && + memcmp(table_name, partition_name, table_name_length + 1) == 0) + DBUG_VOID_RETURN; + if ( + tmp_flg && + table_name && + *(partition_name + table_name_length - 5) == '\0' && + memcmp(table_name, partition_name, table_name_length - 5) == 0 + ) { + tmp_part_elem = *part_elem; + tmp_flg = FALSE; + tmp_find_flg = TRUE; + } + } + } + if (tmp_find_flg) + { + *part_elem = tmp_part_elem; + *sub_elem = tmp_sub_elem; + DBUG_PRINT("info", ("mroonga tmp find")); + DBUG_VOID_RETURN; + } + *part_elem = NULL; + *sub_elem = NULL; + DBUG_PRINT("info", ("mroonga no hit")); + DBUG_VOID_RETURN; +} +#endif + +#define MRN_PARAM_STR_LEN(name) name ## _length +#define MRN_PARAM_STR(title_name, param_name) \ + if (!strncasecmp(tmp_ptr, title_name, title_length)) \ + { \ + DBUG_PRINT("info", ("mroonga " title_name " start")); \ + if (!share->param_name) \ + { \ + if ((share->param_name = mrn_get_string_between_quote( \ + start_ptr))) \ + share->MRN_PARAM_STR_LEN(param_name) = strlen(share->param_name); \ + else { \ + error = ER_MRN_INVALID_TABLE_PARAM_NUM; \ + my_printf_error(error, ER_MRN_INVALID_TABLE_PARAM_STR, \ + MYF(0), tmp_ptr); \ + goto error; \ + } \ + DBUG_PRINT("info", ("mroonga " title_name "=%s", share->param_name)); \ + } \ + break; \ + } + +#define MRN_PARAM_STR_LIST(title_name, param_name, param_pos) \ + if (!strncasecmp(tmp_ptr, title_name, title_length)) \ + { \ + DBUG_PRINT("info", ("mroonga " title_name " start")); \ + if (share->param_name && !share->param_name[param_pos]) \ + { \ + if ((share->param_name[param_pos] = mrn_get_string_between_quote( \ + start_ptr))) \ + share->MRN_PARAM_STR_LEN(param_name)[param_pos] = \ + strlen(share->param_name[param_pos]); \ + else { \ + error = ER_MRN_INVALID_TABLE_PARAM_NUM; \ + my_printf_error(error, ER_MRN_INVALID_TABLE_PARAM_STR, \ + MYF(0), tmp_ptr); \ + goto error; \ + } \ + DBUG_PRINT("info", ("mroonga " title_name "[%d]=%s", param_pos, \ + share->param_name[param_pos])); \ + } \ + break; \ + } + +int mrn_parse_table_param(MRN_SHARE *share, TABLE *table) +{ + int i, error = 0; + int title_length; + const char *sprit_ptr[2]; + const char *tmp_ptr, *start_ptr; + char *params_string = NULL; +#ifdef WITH_PARTITION_STORAGE_ENGINE + partition_element *part_elem; + partition_element *sub_elem; +#endif + MRN_DBUG_ENTER_FUNCTION(); +#ifdef WITH_PARTITION_STORAGE_ENGINE + mrn_get_partition_info(share->table_name, share->table_name_length, table, + &part_elem, &sub_elem); +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE + for (i = 4; i > 0; i--) +#else + for (i = 2; i > 0; i--) +#endif + { + const char *params_string_value = NULL; + uint params_string_length = 0; + switch (i) + { +#ifdef WITH_PARTITION_STORAGE_ENGINE + case 4: + if (!sub_elem || !sub_elem->part_comment) + continue; + DBUG_PRINT("info", ("mroonga create sub comment string")); + params_string_value = sub_elem->part_comment; + params_string_length = strlen(params_string_value); + DBUG_PRINT("info", + ("mroonga sub comment string=%s", params_string_value)); + break; + case 3: + if (!part_elem || !part_elem->part_comment) + continue; + DBUG_PRINT("info", ("mroonga create part comment string")); + params_string_value = part_elem->part_comment; + params_string_length = strlen(params_string_value); + DBUG_PRINT("info", + ("mroonga part comment string=%s", params_string_value)); + break; +#endif + case 2: + if (LEX_STRING_IS_EMPTY(table->s->comment)) + continue; + DBUG_PRINT("info", ("mroonga create comment string")); + params_string_value = table->s->comment.str; + params_string_length = table->s->comment.length; + DBUG_PRINT("info", + ("mroonga comment string=%.*s", + params_string_length, params_string_value)); + break; + default: + if (LEX_STRING_IS_EMPTY(table->s->connect_string)) + continue; + DBUG_PRINT("info", ("mroonga create connect_string string")); + params_string_value = table->s->connect_string.str; + params_string_length = table->s->connect_string.length; + DBUG_PRINT("info", + ("mroonga connect_string=%.*s", + params_string_length, params_string_value)); + break; + } + + if (!params_string_value) { + continue; + } + + { + params_string = mrn_my_strndup(params_string_value, + params_string_length, + MYF(MY_WME)); + if (!params_string) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + + sprit_ptr[0] = params_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + DBUG_PRINT("info", ("mroonga title_str=%s", tmp_ptr)); + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t' && *start_ptr != ',') + { + title_length++; + start_ptr++; + } + DBUG_PRINT("info", ("mroonga title_length=%u", title_length)); + + switch (title_length) + { + case 6: + MRN_PARAM_STR("engine", engine); + break; + case 10: + MRN_PARAM_STR("normalizer", normalizer); + break; + case 13: + MRN_PARAM_STR("token_filters", token_filters); + break; + case 17: + MRN_PARAM_STR("default_tokenizer", default_tokenizer); + break; + default: + break; + } + } + + my_free(params_string); + params_string = NULL; + } + } + + if (!share->engine && mrn_default_wrapper_engine) + { + share->engine_length = strlen(mrn_default_wrapper_engine); + if ( + !(share->engine = mrn_my_strndup(mrn_default_wrapper_engine, + share->engine_length, + MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + } + + if (share->engine) + { + LEX_CSTRING engine_name; + if ( + ( + share->engine_length == MRN_DEFAULT_LEN && + !strncasecmp(share->engine, MRN_DEFAULT_STR, MRN_DEFAULT_LEN) + ) || + ( + share->engine_length == MRN_GROONGA_LEN && + !strncasecmp(share->engine, MRN_GROONGA_STR, MRN_GROONGA_LEN) + ) + ) { + my_free(share->engine); + share->engine = NULL; + share->engine_length = 0; + } else { + engine_name.str = share->engine; + engine_name.length = share->engine_length; + if (!(share->plugin = MRN_HA_RESOLVE_BY_NAME(&engine_name))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), share->engine); + error = ER_UNKNOWN_STORAGE_ENGINE; + goto error; + } + share->hton = MRN_PLUGIN_DATA(share->plugin, handlerton *); + share->wrapper_mode = TRUE; + } + } + +error: + if (params_string) + my_free(params_string); + DBUG_RETURN(error); +} + +bool mrn_is_geo_key(const KEY *key_info) +{ + return key_info->algorithm == HA_KEY_ALG_UNDEF && + KEY_N_KEY_PARTS(key_info) == 1 && + key_info->key_part[0].field->type() == MYSQL_TYPE_GEOMETRY; +} + +int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i) +{ + int error; + char *param_string = NULL; +#if MYSQL_VERSION_ID >= 50500 + int title_length; + char *sprit_ptr[2]; + char *tmp_ptr, *start_ptr; +#endif + THD *thd = current_thd; + MRN_DBUG_ENTER_FUNCTION(); + +#if MYSQL_VERSION_ID >= 50500 + if (key_info->comment.length == 0) + { + if (share->key_tokenizer[i]) { + my_free(share->key_tokenizer[i]); + } + share->key_tokenizer[i] = mrn_my_strdup(mrn_default_tokenizer, MYF(MY_WME)); + if (!share->key_tokenizer[i]) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + share->key_tokenizer_length[i] = strlen(share->key_tokenizer[i]); + + DBUG_RETURN(0); + } + DBUG_PRINT("info", ("mroonga create comment string")); + if ( + !(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; + } + DBUG_PRINT("info", ("mroonga comment string=%s", param_string)); + + sprit_ptr[0] = param_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + *sprit_ptr[1] = '\0'; + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t') + { + title_length++; + start_ptr++; + } + + switch (title_length) + { + case 5: + MRN_PARAM_STR_LIST("table", index_table, i); + break; + case 6: + push_warning_printf(thd, MRN_SEVERITY_WARNING, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), + "parser", "tokenizer"); + MRN_PARAM_STR_LIST("parser", key_tokenizer, i); + break; + case 9: + MRN_PARAM_STR_LIST("tokenizer", key_tokenizer, i); + break; + default: + break; + } + } +#endif + if (!share->key_tokenizer[i]) { + share->key_tokenizer[i] = mrn_my_strdup(mrn_default_tokenizer, MYF(MY_WME)); + if (!share->key_tokenizer[i]) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + share->key_tokenizer_length[i] = strlen(share->key_tokenizer[i]); + } + + if (param_string) + my_free(param_string); + DBUG_RETURN(0); + +error: + if (param_string) + my_free(param_string); +#if MYSQL_VERSION_ID >= 50500 +error_alloc_param_string: +#endif + DBUG_RETURN(error); +} + +int mrn_parse_index_param(MRN_SHARE *share, TABLE *table) +{ + int error; + MRN_DBUG_ENTER_FUNCTION(); + for (uint i = 0; i < table->s->keys; i++) + { + KEY *key_info = &table->s->key_info[i]; + bool is_wrapper_mode = share->engine != NULL; + + if (is_wrapper_mode) { + if (!(key_info->flags & HA_FULLTEXT) && !mrn_is_geo_key(key_info)) { + continue; + } + } + + if ((error = mrn_add_index_param(share, key_info, i))) + goto error; + } + DBUG_RETURN(0); + +error: + DBUG_RETURN(error); +} + +int mrn_add_column_param(MRN_SHARE *share, Field *field, int i) +{ + int error; + char *param_string = NULL; + int title_length; + char *sprit_ptr[2]; + char *tmp_ptr, *start_ptr; + + MRN_DBUG_ENTER_FUNCTION(); + + if (share->wrapper_mode) { + DBUG_RETURN(0); + } + + DBUG_PRINT("info", ("mroonga create comment string")); + if ( + !(param_string = mrn_my_strndup(field->comment.str, + field->comment.length, + MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error_alloc_param_string; + } + DBUG_PRINT("info", ("mroonga comment string=%s", param_string)); + + sprit_ptr[0] = param_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + *sprit_ptr[1] = '\0'; + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t') + { + title_length++; + start_ptr++; + } + + switch (title_length) + { + case 4: + MRN_PARAM_STR_LIST("type", col_type, i); + break; + case 5: + MRN_PARAM_STR_LIST("flags", col_flags, i); + break; + case 12: + MRN_PARAM_STR_LIST("groonga_type", col_type, i); + break; + default: + break; + } + } + + if (param_string) + my_free(param_string); + DBUG_RETURN(0); + +error: + if (param_string) + my_free(param_string); +error_alloc_param_string: + DBUG_RETURN(error); +} + +int mrn_parse_column_param(MRN_SHARE *share, TABLE *table) +{ + int error; + MRN_DBUG_ENTER_FUNCTION(); + for (uint i = 0; i < table->s->fields; i++) + { + Field *field = table->s->field[i]; + + if (LEX_STRING_IS_EMPTY(field->comment)) { + continue; + } + + if ((error = mrn_add_column_param(share, field, i))) + goto error; + } + DBUG_RETURN(0); + +error: + DBUG_RETURN(error); +} + +int mrn_free_share_alloc( + MRN_SHARE *share +) { + uint i; + MRN_DBUG_ENTER_FUNCTION(); + if (share->engine) + my_free(share->engine); + if (share->default_tokenizer) + my_free(share->default_tokenizer); + if (share->normalizer) + my_free(share->normalizer); + if (share->token_filters) + 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]); + if (share->key_tokenizer[i]) + my_free(share->key_tokenizer[i]); + } + for (i = 0; i < share->table_share->fields; i++) + { + if (share->col_flags && share->col_flags[i]) + my_free(share->col_flags[i]); + if (share->col_type && share->col_type[i]) + my_free(share->col_type[i]); + } + DBUG_RETURN(0); +} + +void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share) +{ + MRN_DBUG_ENTER_FUNCTION(); + { + mrn::Lock lock(&mrn_long_term_share_mutex); + my_hash_delete(&mrn_long_term_share, (uchar*) long_term_share); + } + mysql_mutex_destroy(&long_term_share->auto_inc_mutex); + my_free(long_term_share); + DBUG_VOID_RETURN; +} + +MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name, + uint table_name_length, + int *error) +{ + MRN_LONG_TERM_SHARE *long_term_share; + char *tmp_name; + MRN_DBUG_ENTER_FUNCTION(); + DBUG_PRINT("info", ("mroonga: table_name=%s", table_name)); + mrn::Lock lock(&mrn_long_term_share_mutex); + if (!(long_term_share = (MRN_LONG_TERM_SHARE*) + my_hash_search(&mrn_long_term_share, (uchar*) table_name, + table_name_length))) + { + if (!(long_term_share = (MRN_LONG_TERM_SHARE *) + mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &long_term_share, sizeof(*long_term_share), + &tmp_name, table_name_length + 1, + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + goto error_alloc_long_term_share; + } + long_term_share->table_name = tmp_name; + long_term_share->table_name_length = table_name_length; + memcpy(long_term_share->table_name, table_name, table_name_length); + if (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; + } + if (my_hash_insert(&mrn_long_term_share, (uchar*) long_term_share)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_hash_insert; + } + } + DBUG_RETURN(long_term_share); + +error_hash_insert: + mysql_mutex_destroy(&long_term_share->auto_inc_mutex); +error_init_auto_inc_mutex: + my_free(long_term_share); +error_alloc_long_term_share: + DBUG_RETURN(NULL); +} + +MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error) +{ + MRN_SHARE *share; + char *tmp_name, **index_table, **key_tokenizer, **col_flags, **col_type; + uint length, *wrap_key_nr, *index_table_length; + uint *key_tokenizer_length, *col_flags_length, *col_type_length, i, j; + KEY *wrap_key_info; + TABLE_SHARE *wrap_table_share; + MRN_DBUG_ENTER_FUNCTION(); + length = (uint) strlen(table_name); + mrn::Lock lock(&mrn_open_tables_mutex); + if (!(share = (MRN_SHARE*) my_hash_search(&mrn_open_tables, + (uchar*) table_name, length))) + { + if (!(share = (MRN_SHARE *) + mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &share, sizeof(*share), + &tmp_name, length + 1, + &index_table, sizeof(char *) * table->s->keys, + &index_table_length, sizeof(uint) * table->s->keys, + &key_tokenizer, sizeof(char *) * table->s->keys, + &key_tokenizer_length, sizeof(uint) * table->s->keys, + &col_flags, sizeof(char *) * table->s->fields, + &col_flags_length, sizeof(uint) * table->s->fields, + &col_type, sizeof(char *) * table->s->fields, + &col_type_length, sizeof(uint) * table->s->fields, + &wrap_key_nr, sizeof(*wrap_key_nr) * table->s->keys, + &wrap_key_info, sizeof(*wrap_key_info) * table->s->keys, + &wrap_table_share, sizeof(*wrap_table_share), + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + goto error_alloc_share; + } + share->use_count = 0; + share->table_name_length = length; + share->table_name = tmp_name; + share->index_table = index_table; + share->index_table_length = index_table_length; + share->key_tokenizer = key_tokenizer; + share->key_tokenizer_length = key_tokenizer_length; + share->col_flags = col_flags; + share->col_flags_length = col_flags_length; + share->col_type = col_type; + share->col_type_length = col_type_length; + mrn_my_stpmov(share->table_name, table_name); + share->table_share = table->s; + + if ( + (*error = mrn_parse_table_param(share, table)) || + (*error = mrn_parse_column_param(share, table)) || + (*error = mrn_parse_index_param(share, table)) + ) + goto error_parse_table_param; + + if (share->wrapper_mode) + { + j = 0; + for (i = 0; i < table->s->keys; i++) + { + if (table->s->key_info[i].algorithm != HA_KEY_ALG_FULLTEXT && + !mrn_is_geo_key(&table->s->key_info[i])) + { + wrap_key_nr[i] = j; + memcpy(&wrap_key_info[j], &table->s->key_info[i], + sizeof(*wrap_key_info)); + j++; + } else { + wrap_key_nr[i] = MAX_KEY; + } + } + share->wrap_keys = j; + share->base_keys = table->s->keys; + share->base_key_info = table->s->key_info; + share->base_primary_key = table->s->primary_key; + if (i) + { + share->wrap_key_nr = wrap_key_nr; + share->wrap_key_info = wrap_key_info; + if (table->s->primary_key == MAX_KEY) + share->wrap_primary_key = MAX_KEY; + else + share->wrap_primary_key = wrap_key_nr[table->s->primary_key]; + } else { + share->wrap_key_nr = NULL; + share->wrap_key_info = NULL; + share->wrap_primary_key = MAX_KEY; + } + *wrap_table_share= *table->s; + mrn_init_sql_alloc(current_thd, &(wrap_table_share->mem_root)); + wrap_table_share->keys = share->wrap_keys; + wrap_table_share->key_info = share->wrap_key_info; + wrap_table_share->primary_key = share->wrap_primary_key; + wrap_table_share->keys_in_use.init(share->wrap_keys); + wrap_table_share->keys_for_keyread.init(share->wrap_keys); +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE +# ifdef WIN32 + mysql_mutex_init(*mrn_table_share_lock_share, + &(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW); +# else + mysql_mutex_init(key_TABLE_SHARE_LOCK_share, + &(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW); +# endif +#endif +#ifdef WIN32 + mysql_mutex_init(*mrn_table_share_lock_ha_data, + &(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST); +#else + mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data, + &(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST); +#endif + share->wrap_table_share = wrap_table_share; + } + + if (mysql_mutex_init(mrn_share_mutex_key, + &share->record_mutex, + MY_MUTEX_INIT_FAST) != 0) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_init_mutex; + } + thr_lock_init(&share->lock); + if (!(share->long_term_share = mrn_get_long_term_share(table_name, length, + error))) + { + goto error_get_long_term_share; + } + if (my_hash_insert(&mrn_open_tables, (uchar*) share)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_hash_insert; + } + } + share->use_count++; + DBUG_RETURN(share); + +error_hash_insert: +error_get_long_term_share: + mysql_mutex_destroy(&share->record_mutex); +error_init_mutex: +error_parse_table_param: + mrn_free_share_alloc(share); + my_free(share); +error_alloc_share: + DBUG_RETURN(NULL); +} + +int mrn_free_share(MRN_SHARE *share) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn::Lock lock(&mrn_open_tables_mutex); + if (!--share->use_count) + { + my_hash_delete(&mrn_open_tables, (uchar*) share); + if (share->wrapper_mode) + plugin_unlock(NULL, share->plugin); + mrn_free_share_alloc(share); + thr_lock_delete(&share->lock); + mysql_mutex_destroy(&share->record_mutex); + if (share->wrapper_mode) { +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE + mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share)); +#endif + mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data)); + free_root(&(share->wrap_table_share->mem_root), MYF(0)); + } + my_free(share); + } + DBUG_RETURN(0); +} + +TABLE_SHARE *mrn_get_table_share(TABLE_LIST *table_list, int *error) +{ + TABLE_SHARE *share; + THD *thd = current_thd; + MRN_DBUG_ENTER_FUNCTION(); +#if defined(MRN_HAVE_TDC_ACQUIRE_SHARE) && \ + !defined(MRN_TDC_ACQUIRE_SHARE_REQUIRE_KEY) + share = tdc_acquire_share(thd, table_list, GTS_TABLE); +#else + uint key_length; +# ifdef MRN_HAVE_GET_TABLE_DEF_KEY + const char *key; + key_length = get_table_def_key(table_list, &key); +# else + char key[MAX_DBKEY_LENGTH]; + key_length = create_table_def_key(thd, key, table_list, FALSE); +# endif +# ifdef MRN_HAVE_TABLE_DEF_CACHE + my_hash_value_type hash_value; + hash_value = my_calc_hash(mrn_table_def_cache, (uchar*) key, key_length); + share = get_table_share(thd, table_list, key, key_length, 0, error, + hash_value); +# elif defined(MRN_HAVE_TDC_ACQUIRE_SHARE) + share = tdc_acquire_share(thd, table_list, GTS_TABLE); +# else + share = get_table_share(thd, table_list, key, key_length, 0, error); +# endif +#endif + DBUG_RETURN(share); +} + +TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path, + int *error) +{ + uint key_length; + TABLE_SHARE *share; + THD *thd = current_thd; + + MRN_DBUG_ENTER_FUNCTION(); +#ifdef MRN_HAVE_GET_TABLE_DEF_KEY + const char *key; + key_length = get_table_def_key(table_list, &key); +#else + char key[MAX_DBKEY_LENGTH]; + key_length = create_table_def_key(thd, key, table_list, FALSE); +#endif +#if MYSQL_VERSION_ID >= 100002 && defined(MRN_MARIADB_P) + share = alloc_table_share(table_list->db.str, table_list->table_name.str, key, + key_length); +#else + share = alloc_table_share(table_list, key, key_length); +#endif + if (!share) + { + *error = ER_CANT_OPEN_FILE; + DBUG_RETURN(NULL); + } + share->tmp_table = NO_TMP_TABLE; // TODO: is this right? + share->path.str = (char *) path; + 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; + mrn_free_tmp_table_share(share); + DBUG_RETURN(NULL); + } + DBUG_RETURN(share); +} + +void mrn_free_tmp_table_share(TABLE_SHARE *tmp_table_share) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *normalized_path = tmp_table_share->normalized_path.str; + free_table_share(tmp_table_share); + my_free((char*) normalized_path); + DBUG_VOID_RETURN; +} + +KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error) +{ + uint *wrap_key_nr = share->wrap_key_nr, i, j; + KEY *wrap_key_info; + MRN_DBUG_ENTER_FUNCTION(); + if (share->wrap_keys) + { + if (!(wrap_key_info = (KEY *) + mrn_my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &wrap_key_info, sizeof(*wrap_key_info) * share->wrap_keys, + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + DBUG_RETURN(NULL); + } + for (i = 0; i < table->s->keys; i++) + { + j = wrap_key_nr[i]; + if (j < MAX_KEY) + { + memcpy(&wrap_key_info[j], &table->key_info[i], + sizeof(*wrap_key_info)); + } + } + } else + wrap_key_info = NULL; + *error = 0; + DBUG_RETURN(wrap_key_info); +} + +void mrn_set_bitmap_by_key(MY_BITMAP *map, KEY *key_info) +{ + uint i; + MRN_DBUG_ENTER_FUNCTION(); + for (i = 0; i < KEY_N_KEY_PARTS(key_info); i++) + { + Field *field = key_info->key_part[i].field; + bitmap_set_bit(map, field->field_index); + } + DBUG_VOID_RETURN; +} + +st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_slot_data *slot_data = + (st_mrn_slot_data*) thd_get_ha_data(thd, mrn_hton_ptr); + if (slot_data == NULL) { + slot_data = (st_mrn_slot_data*) malloc(sizeof(st_mrn_slot_data)); + slot_data->last_insert_record_id = GRN_ID_NIL; + slot_data->first_wrap_hton = NULL; + slot_data->alter_create_info = NULL; + slot_data->disable_keys_create_info = NULL; + slot_data->alter_connect_string = NULL; + slot_data->alter_comment = NULL; + thd_set_ha_data(thd, mrn_hton_ptr, slot_data); + { + mrn::Lock lock(&mrn_allocated_thds_mutex); + if (my_hash_insert(&mrn_allocated_thds, (uchar*) thd)) + { + free(slot_data); + DBUG_RETURN(NULL); + } + } + } + DBUG_RETURN(slot_data); +} + +void mrn_clear_slot_data(THD *thd) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, FALSE); + if (slot_data) { + if (slot_data->first_wrap_hton) { + st_mrn_wrap_hton *tmp_wrap_hton; + st_mrn_wrap_hton *wrap_hton = slot_data->first_wrap_hton; + while (wrap_hton) + { + tmp_wrap_hton = wrap_hton->next; + free(wrap_hton); + wrap_hton = tmp_wrap_hton; + } + slot_data->first_wrap_hton = NULL; + } + slot_data->alter_create_info = NULL; + slot_data->disable_keys_create_info = NULL; + if (slot_data->alter_connect_string) { + my_free(slot_data->alter_connect_string); + slot_data->alter_connect_string = NULL; + } + if (slot_data->alter_comment) { + my_free(slot_data->alter_comment); + slot_data->alter_comment = NULL; + } + } + DBUG_VOID_RETURN; +} + +#ifdef __cplusplus +} +#endif diff --git a/storage/mroonga/mrn_table.hpp b/storage/mroonga/mrn_table.hpp new file mode 100644 index 00000000..5ef7bc71 --- /dev/null +++ b/storage/mroonga/mrn_table.hpp @@ -0,0 +1,179 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_TABLE_HPP_ +#define MRN_TABLE_HPP_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct st_mroonga_long_term_share +{ + char *table_name; + uint table_name_length; + + // for auto_increment (storage mode only) + mysql_mutex_t auto_inc_mutex; + bool auto_inc_inited; + ulonglong auto_inc_value; +} MRN_LONG_TERM_SHARE; + +typedef struct st_mroonga_share +{ + char *table_name; + uint table_name_length; + uint use_count; + mysql_mutex_t record_mutex; + THR_LOCK lock; + TABLE_SHARE *table_share; + TABLE_SHARE *wrap_table_share; + MRN_LONG_TERM_SHARE *long_term_share; + + char *engine; + int engine_length; + char *default_tokenizer; + int default_tokenizer_length; + char *normalizer; + int normalizer_length; + char *token_filters; + int token_filters_length; + plugin_ref plugin; + handlerton *hton; + char **index_table; + char **key_tokenizer; + char **col_flags; + char **col_type; + uint *index_table_length; + uint *key_tokenizer_length; + uint *col_flags_length; + uint *col_type_length; + uint *wrap_key_nr; + uint wrap_keys; + uint base_keys; + KEY *wrap_key_info; + KEY *base_key_info; + uint wrap_primary_key; + uint base_primary_key; + bool wrapper_mode; + bool disable_keys; +} MRN_SHARE; + +struct st_mrn_wrap_hton +{ + char path[FN_REFLEN + 1]; + handlerton *hton; + st_mrn_wrap_hton *next; +}; + +struct st_mrn_slot_data +{ + grn_id last_insert_record_id; + st_mrn_wrap_hton *first_wrap_hton; + HA_CREATE_INFO *alter_create_info; + HA_CREATE_INFO *disable_keys_create_info; + char *alter_connect_string; + char *alter_comment; +}; + +#define MRN_SET_WRAP_ALTER_KEY(file, ha_alter_info) \ + alter_table_operations base_handler_flags = ha_alter_info->handler_flags; \ + ha_table_option_struct* base_option_struct = ha_alter_info->create_info->option_struct; \ + KEY *base_key_info_buffer = ha_alter_info->key_info_buffer; \ + uint base_key_count = ha_alter_info->key_count; \ + uint base_index_drop_count = ha_alter_info->index_drop_count; \ + KEY **base_index_drop_buffer = ha_alter_info->index_drop_buffer; \ + uint base_index_add_count = ha_alter_info->index_add_count; \ + uint *base_index_add_buffer = ha_alter_info->index_add_buffer; \ + ha_alter_info->handler_flags = file->alter_handler_flags; \ + ha_alter_info->create_info->option_struct = wrap_altered_table->s->option_struct; \ + ha_alter_info->key_info_buffer = file->alter_key_info_buffer; \ + ha_alter_info->key_count = file->alter_key_count; \ + ha_alter_info->index_drop_count = file->alter_index_drop_count; \ + ha_alter_info->index_drop_buffer = &file->alter_index_drop_buffer; \ + ha_alter_info->index_add_count = file->alter_index_add_count; \ + ha_alter_info->index_add_buffer = file->alter_index_add_buffer; + +#define MRN_SET_BASE_ALTER_KEY(share, table_share) \ + ha_alter_info->handler_flags = base_handler_flags; \ + ha_alter_info->create_info->option_struct = base_option_struct; \ + ha_alter_info->key_info_buffer = base_key_info_buffer; \ + ha_alter_info->key_count = base_key_count; \ + ha_alter_info->index_drop_count = base_index_drop_count; \ + ha_alter_info->index_drop_buffer = base_index_drop_buffer; \ + ha_alter_info->index_add_count = base_index_add_count; \ + ha_alter_info->index_add_buffer = base_index_add_buffer; + +#define MRN_SET_WRAP_SHARE_KEY(share, table_share) +/* + table_share->keys = share->wrap_keys; \ + table_share->key_info = share->wrap_key_info; \ + table_share->primary_key = share->wrap_primary_key; +*/ + +#define MRN_SET_BASE_SHARE_KEY(share, table_share) +/* + table_share->keys = share->base_keys; \ + table_share->key_info = share->base_key_info; \ + table_share->primary_key = share->base_primary_key; +*/ + +#define MRN_SET_WRAP_TABLE_KEY(file, table) \ + table->key_info = file->wrap_key_info; \ + table->s = share->wrap_table_share; + +#define MRN_SET_BASE_TABLE_KEY(file, table) \ + table->key_info = file->base_key_info; \ + table->s = share->table_share; + +#ifdef WITH_PARTITION_STORAGE_ENGINE +void mrn_get_partition_info(const char *table_name, uint table_name_length, + const TABLE *table, partition_element **part_elem, + partition_element **sub_elem); +#endif +int mrn_parse_table_param(MRN_SHARE *share, TABLE *table); +bool mrn_is_geo_key(const KEY *key_info); +int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i); +int mrn_parse_index_param(MRN_SHARE *share, TABLE *table); +int mrn_add_column_param(MRN_SHARE *share, Field *field, int i); +int mrn_parse_column_param(MRN_SHARE *share, TABLE *table); +MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error); +int mrn_free_share_alloc(MRN_SHARE *share); +int mrn_free_share(MRN_SHARE *share); +MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name, + uint table_name_length, + int *error); +void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share); +TABLE_SHARE *mrn_get_table_share(TABLE_LIST *table_list, int *error); +TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path, + int *error); +void mrn_free_tmp_table_share(TABLE_SHARE *table_share); +KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error); +void mrn_set_bitmap_by_key(MY_BITMAP *map, KEY *key_info); +st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create); +void mrn_clear_slot_data(THD *thd); + +#ifdef __cplusplus +} +#endif + +#endif /* MRN_TABLE_HPP_ */ diff --git a/storage/mroonga/mrn_variables.hpp b/storage/mroonga/mrn_variables.hpp new file mode 100644 index 00000000..8a0113c5 --- /dev/null +++ b/storage/mroonga/mrn_variables.hpp @@ -0,0 +1,51 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_VARIABLES_HPP_ +#define MRN_VARIABLES_HPP_ + +#include "mrn_mysql_compat.h" + +extern PSI_memory_key mrn_memory_key; + +namespace mrn { + namespace variables { + enum BooleanModeSyntaxFlag { + BOOLEAN_MODE_SYNTAX_FLAG_DEFAULT = (1 << 0), + BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_QUERY = (1 << 1), + BOOLEAN_MODE_SYNTAX_FLAG_SYNTAX_SCRIPT = (1 << 2), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_COLUMN = (1 << 3), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_UPDATE = (1 << 4), + BOOLEAN_MODE_SYNTAX_FLAG_ALLOW_LEADING_NOT = (1 << 5) + }; + + ulonglong get_boolean_mode_syntax_flags(THD *thd); + + enum ActionOnError { + ACTION_ON_ERROR_ERROR, + ACTION_ON_ERROR_ERROR_AND_LOG, + ACTION_ON_ERROR_IGNORE, + ACTION_ON_ERROR_IGNORE_AND_LOG, + }; + + ActionOnError get_action_on_fulltext_query_error(THD *thd); + } +} + +#endif /* MRN_VARIABLES_HPP_ */ diff --git a/storage/mroonga/mrn_version.h.in b/storage/mroonga/mrn_version.h.in new file mode 100644 index 00000000..edeecb63 --- /dev/null +++ b/storage/mroonga/mrn_version.h.in @@ -0,0 +1,40 @@ +/* + Copyright(C) 2011 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#ifndef MRN_VERSION_H_ +#define MRN_VERSION_H_ + +/* Define mroonga version in string */ +#define MRN_VERSION "@MRN_VERSION@" + +/* Define mroonga version in hex */ +#define MRN_VERSION_IN_HEX @MRN_VERSION_IN_HEX@ + +/* Define mroonga major version */ +#define MRN_VERSION_MAJOR @MRN_VERSION_MAJOR@ + +/* Define mroonga minor version */ +#define MRN_VERSION_MINOR @MRN_VERSION_MINOR@ + +/* Define mroonga micro version */ +#define MRN_VERSION_MICRO @MRN_VERSION_MICRO@ + +/* Define to the full name and version of this package. */ +#define MRN_PACKAGE_STRING "@MRN_PACKAGE_STRING@" + +#endif /* MRN_VERSION_H_ */ diff --git a/storage/mroonga/mysql-test/Makefile.am b/storage/mroonga/mysql-test/Makefile.am new file mode 100644 index 00000000..9ea677b5 --- /dev/null +++ b/storage/mroonga/mysql-test/Makefile.am @@ -0,0 +1,8 @@ +dist-hook: + if [ -n "`find mroonga -name '*.reject'`" ]; then \ + echo "reject files exist"; \ + exit 1; \ + fi + +EXTRA_DIST = \ + mroonga diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc new file mode 100644 index 00000000..9d1ee1d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_64bit.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +disable_query_log; +disable_warnings; +let $version_compile_64bit= + `SELECT IF(@@version_compile_machine LIKE '%64%', 1, 0)`; +enable_warnings; +enable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc new file mode 100644 index 00000000..51bbe572 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--disable_query_log +let $version_compile_os_freebsd= + `SELECT IF(@@version_compile_os LIKE '%freebsd%', 1, 0);`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc new file mode 100644 index 00000000..fef9de96 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_windows.inc + +--disable_query_log +if ($VERSION_COMPILE_OS_WIN) { + let ha_mroonga_so='ha_mroonga.dll'; +} +if (!$VERSION_COMPILE_OS_WIN) { + let ha_mroonga_so='ha_mroonga.so'; +} +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc new file mode 100644 index 00000000..926620eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_embedded.inc @@ -0,0 +1,19 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--disable_query_log +let $libgroonga_embedded = `SELECT @@mroonga_libgroonga_embedded;`; +--enable_query_log 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 00000000..2acfb1fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_lz4.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..e9b8dee0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zlib.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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_libgroonga_support_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc new file mode 100644 index 00000000..bdaf5cdf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_libgroonga_support_zstd.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--disable_query_log +let $libgroonga_support_zstd = + `SELECT @@mroonga_libgroonga_support_zstd;`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc new file mode 100644 index 00000000..5e4a986f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc @@ -0,0 +1,19 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--disable_query_log +let $mariadb = `SELECT LOCATE('MariaDB', @@global.version) > 0`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc new file mode 100644 index 00000000..facfcc92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc @@ -0,0 +1,31 @@ +# Copyright(C) 2014 Toshihisa Tashiro +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--disable_query_log +let $version_compile_os_osx=`SELECT IF(@@version_compile_os like 'osx%', 1, 0);`; +if ($version_compile_os_osx) { + let $version_compile_os_osx_10_8_or_later= + `SELECT IF(@@version_compile_os = 'osx10.6', 0, 1);`; + if ($version_compile_os_osx_10_8_or_later) { + let $version_compile_os_osx_10_8_or_later= + `SELECT IF(@@version_compile_os = 'osx10.7', 0, 1);`; + } +} +if (!$version_comiple_os_osx) { + let $version_compile_os_osx_10_8_or_later=0; +} +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc new file mode 100644 index 00000000..7e942c09 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_solaris.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--disable_query_log +let $version_compile_os_solaris= + `SELECT IF(@@version_compile_os LIKE 'sun-solaris%', 1, 0);`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc new file mode 100644 index 00000000..8a4ac6c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--disable_query_log +let $strict_sql_mode = + `SELECT @@sql_mode LIKE '%STRICT_TRANS_TABLES%' OR + @@sql_mode LIKE '%STRICT_ALL_TABLES%'`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc new file mode 100644 index 00000000..8b5ea402 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc @@ -0,0 +1,33 @@ +# Copyright(C) 2012-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--disable_query_log +let $version_major_minor = + `SELECT CAST(SUBSTRING_INDEX(@@global.version, '.', 2) AS DECIMAL(4, 2))`; + +let $version_5_5 = `SELECT $version_major_minor = 5.5`; +let $version_5_6 = `SELECT $version_major_minor = 5.6`; +let $version_5_7 = `SELECT $version_major_minor = 5.7`; +let $version_10_0 = `SELECT $version_major_minor = 10.0`; +let $version_10_1 = `SELECT $version_major_minor = 10.1`; +let $version_10_2 = `SELECT $version_major_minor = 10.2`; + +let $version_5_5_or_later = `SELECT $version_major_minor >= 5.5`; +let $version_5_6_or_later = `SELECT $version_major_minor >= 5.6`; +let $version_5_7_or_later = `SELECT $version_major_minor >= 5.7`; +let $version_10_0_or_later = `SELECT $version_major_minor >= 10.0`; +let $version_10_2_or_later = `SELECT $version_major_minor >= 10.2`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc new file mode 100644 index 00000000..e9fad828 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--disable_query_log +let $VERSION_COMPILE_OS_WIN=`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc new file mode 100644 index 00000000..824e960a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc @@ -0,0 +1,32 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_mariadb.inc +--source ../../include/mroonga/check_version.inc + +if ($mariadb) { + let $fractional_seconds = 1; +} + +if (!$mariadb) { + if ($version_5_6) { + let $fractional_seconds = `SELECT @@global.version >= '5.6'`; + } +} + +if (!$fractional_seconds) { + --skip fractional seconds in time values are available in MySQL version 5.6 or later or MariaDB +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc new file mode 100644 index 00000000..1a93d014 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_freebsd.inc + +if (!$version_compile_os_freebsd) { + --skip Need OS FreeBSD +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc new file mode 100644 index 00000000..dafbc344 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_groonga_plugin_register.inc @@ -0,0 +1,22 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_libgroonga_embedded.inc + +if ($libgroonga_embedded) { + --source ../../include/mroonga/have_mroonga_deinit.inc + --skip This test requires plugin_register of Groonga. libgroonga embedded build doesn't support it. +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc new file mode 100644 index 00000000..df30270a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb.inc @@ -0,0 +1,21 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_mariadb.inc + +if (!$mariadb) { + --skip This test is for MariaDB +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc new file mode 100644 index 00000000..6cb565ab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mariadb_10_2_or_later.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if (!$mariadb) { + --skip This test is for MariaDB version 10.2.x or later +} + +if (!$version_10_2_or_later) { + --skip This test is for MariaDB version 10.2.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc new file mode 100644 index 00000000..98d387b0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc @@ -0,0 +1,47 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013-2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_ha_mroonga_so.inc + +disable_query_log; + +let have_mroonga_storage_engine=`SELECT 1 FROM information_schema.plugins WHERE plugin_name = "mroonga"`; +if (!$have_mroonga_storage_engine) { + eval INSTALL PLUGIN mroonga SONAME $ha_mroonga_so; + eval INSTALL PLUGIN mroonga_stats SONAME $ha_mroonga_so; +} + +let have_default_storage_engine_variable=`SELECT 1 FROM information_schema.global_variables WHERE variable_name = "default_storage_engine"`; +if ($have_default_storage_engine_variable) { + let original_default_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "default_storage_engine"`; + set default_storage_engine=Mroonga; +} +if (!$have_default_storage_engine_variable) { + let original_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "storage_engine"`; + set storage_engine=Mroonga; +} + +let have_default_tmp_storage_engine_variable=`SELECT 1 FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`; +if ($have_default_tmp_storage_engine_variable) { + let original_default_tmp_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`; + if (!$original_default_tmp_storage_engine) { + let original_default_tmp_storage_engine=NULL; + } + set default_tmp_storage_engine=Mroonga; +} + +enable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc new file mode 100644 index 00000000..e29300b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc @@ -0,0 +1,42 @@ +# Copyright(C) 2010-2014 Kentoku SHIBA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +disable_query_log; + +if ($have_default_storage_engine_variable) { + eval set default_storage_engine=$original_default_storage_engine; +} +if (!$have_default_storage_engine_variable) { + eval set storage_engine=$original_storage_engine; +} + +if ($have_default_tmp_storage_engine_variable) { + eval set default_tmp_storage_engine=$original_default_tmp_storage_engine; +} + +if (!$have_mroonga_storage_engine) { + UNINSTALL PLUGIN mroonga_stats; + UNINSTALL PLUGIN mroonga; +} + +# Some test re-creates the test database. Put it back in the +# original character set +--source include/default_charset.inc +disable_query_log; +drop database test; +create database test; +enable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc new file mode 100644 index 00000000..83d74867 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc @@ -0,0 +1,17 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +let MYSQLD_DATADIR= `select @@datadir`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc new file mode 100644 index 00000000..90e98c56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + --skip This test is for MySQL +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc new file mode 100644 index 00000000..d354b151 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql_5_7_or_later.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + --skip This test is for MySQL version 5.7.x or later +} + +if (!$version_5_7_or_later) { + --skip This test is for MySQL version 5.7.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc new file mode 100644 index 00000000..d19cca5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_signed_64bit_time_t.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_64bit.inc +--source ../../include/mroonga/check_osx.inc + +if (!$version_compile_64bit) { + --skip Need a 64 binary for signed 64bit time_t +} + +if ($version_compile_os_osx) { + if (!$version_compile_os_osx_10_8_or_later) { + --skip Need OS X 10.8 or later for signed 64bit time_t + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc new file mode 100644 index 00000000..a4ab246c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_solaris.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_solaris.inc + +if (!$version_compile_os_solaris) { + --skip Need Solaris +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc new file mode 100644 index 00000000..a490b7e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_strict_sql_mode.inc + +if (!$strict_sql_mode) { + --skip This test is for STRICT_ALL_TABLES or STRICT_TRANS_TABLES +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc new file mode 100644 index 00000000..260e5d3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_10_0) { + --skip This test is for MariaDB version 10.0.x +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc new file mode 100644 index 00000000..35f8fb7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_10_0_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_10_0_or_later) { + --skip This test is for MariaDB version 10.0.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc new file mode 100644 index 00000000..a04fe560 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_5.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_5) { + --skip This test is for MySQL version 5.5.x +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc new file mode 100644 index 00000000..d23f23e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_6) { + --skip This test is for MySQL version 5.6.x +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc new file mode 100644 index 00000000..db1ac8aa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_6_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_6_or_later) { + --skip This test is for MySQL version 5.6.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc new file mode 100644 index 00000000..80f15c56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7.inc @@ -0,0 +1,21 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_7) { + --skip This test is for MySQL version 5.7.x +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc new file mode 100644 index 00000000..f5898b0b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_5_7_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_5_7_or_later) { + --skip This test is for MySQL version 5.7.x or later or MariaDB 10.0.x or later +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc new file mode 100644 index 00000000..cbcf659f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_ha_mroonga_so.inc + +--disable_query_log +eval CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_command RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_escape RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_snippet_html RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_normalize RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_highlight_html RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_query_expand RETURNS STRING SONAME $ha_mroonga_so; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc new file mode 100644 index 00000000..d5f8c129 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/print_groonga_query_log.inc @@ -0,0 +1,8 @@ +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +perl; +open(F, '<', $_="$ENV{MYSQLD_DATADIR}/groonga-query-log.log") or die "open(<$_): $!"; +while () { + s/^[^|]+\|[^|]+\|[^|]+\| *//; + print; +} +EOF diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc new file mode 100644 index 00000000..51f783e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_freebsd.inc + +if ($version_compile_os_freebsd) { + --skip This test is not for FreeBSD +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc new file mode 100644 index 00000000..67d6251b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_0_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2012-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if ($version_10_0_or_later) { + --skip This test is not for MariaDB 10.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc new file mode 100644 index 00000000..7e4c1279 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_10_1) { + if ($mariadb) { + --skip This test is not for MariaDB 10.1.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc new file mode 100644 index 00000000..506beeb9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_1_or_earlier.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if (!$version_10_2_or_later) { + --skip This test is not for MariaDB 5.x, MariaDB 10.0.x nor 10.1.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc new file mode 100644 index 00000000..d40c4ddd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_10_2_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + if ($version_10_2_or_later) { + --skip This test is not for MariaDB 10.2.x or later + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc new file mode 100644 index 00000000..974851f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_5_5.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2012-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_5_5) { + if ($mariadb) { + --skip This test is not for MariaDB 5.5.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc new file mode 100644 index 00000000..7446ffa5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_5.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_5_5) { + if (!$mariadb) { + --skip This test is not for MySQL 5.5.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc new file mode 100644 index 00000000..6eaa60a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7.inc @@ -0,0 +1,24 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_5_7) { + if (!$mariadb) { + --skip This test is not for MySQL 5.7.x + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc new file mode 100644 index 00000000..599831e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_5_7_or_later.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_5_7_or_later) { + if (!$mariadb) { + --skip This test is not for MySQL 5.7.x or later + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc new file mode 100644 index 00000000..2c1da974 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_osx.inc + +if ($VERSION_COMPILE_OS_OSX) { + --skip This test is not for OSX +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc new file mode 100644 index 00000000..cc06b529 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_signed_64bit_time_t.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_64bit.inc +--source ../../include/mroonga/check_osx.inc + +if ($version_compile_64bit) { + --skip This test is for environment that doesn't have signed 64bit time_t +} + +if ($version_compile_os_osx) { + if (!$version_compile_os_osx_10_8_or_later) { + --skip This test is not for OS X 10.7 or earlier that isn't detected signed 64bit time_t availability + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc new file mode 100644 index 00000000..b79188e4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_solaris.inc + +if ($version_compile_os_solaris) { + --skip This test is not for Solaris +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc new file mode 100644 index 00000000..8bb15b03 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_strict_sql_mode.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/check_strict_sql_mode.inc + +if ($strict_sql_mode) { + --skip This test is not for STRICT_ALL_TABLES nor STRICT_TRANS_TABLES +} 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 00000000..40fc5978 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_lz4.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..9d0ed6c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zlib.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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/support_libgroonga_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc new file mode 100644 index 00000000..d09495bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/support_libgroonga_zstd.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_libgroonga_support_zstd.inc + +if (!$libgroonga_support_zstd) { + --source ../../include/mroonga/have_mroonga_deinit.inc + --skip This test is for libgroonga supports zstd +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc new file mode 100644 index 00000000..e72baac2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--disable_query_log +DROP FUNCTION last_insert_grn_id; +DROP FUNCTION mroonga_snippet; +DROP FUNCTION mroonga_command; +DROP FUNCTION mroonga_escape; +DROP FUNCTION mroonga_snippet_html; +DROP FUNCTION mroonga_normalize; +DROP FUNCTION mroonga_highlight_html; +DROP FUNCTION mroonga_query_expand; +--enable_query_log 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 00000000..f82fc328 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_lz4.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..c93038b0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zlib.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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/include/mroonga/unsupport_libgroonga_zstd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc new file mode 100644 index 00000000..b1c081e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unsupport_libgroonga_zstd.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/check_libgroonga_support_zstd.inc + +if ($libgroonga_support_zstd) { + --source ../../include/mroonga/have_mroonga_deinit.inc + --skip This test is for libgroonga doesn't support zstd +} diff --git a/storage/mroonga/mysql-test/mroonga/storage/disabled.def b/storage/mroonga/mysql-test/mroonga/storage/disabled.def new file mode 100644 index 00000000..6866adc1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/disabled.def @@ -0,0 +1,10 @@ +alter_table_add_index_token_filters_one_token_filter : Bundled Mroonga does not support token filter yet. +alter_table_change_token_filter : Bundled Mroonga does not support token filter yet. +fulltext_token_filters_skip : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does not support token filter yet. +create_table_token_filters_table_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_table_comment_one_token_filter : Bundled Mroonga does not support token filter yet. +foreign_key_create : Bundled Mroonga does not support this test yet. +partition_insert : Bundled Mroonga does not support this test yet. + diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result new file mode 100644 index 00000000..15cd3499 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries ADD title VARCHAR(40) AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result new file mode 100644 index 00000000..8b3de1bf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries ADD title VARCHAR(40) FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `title` varchar(40) DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +title id body +groonga (1) 1 starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result new file mode 100644 index 00000000..de0482e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_comment.result @@ -0,0 +1,15 @@ +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 --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 +column_create tags name COLUMN_VECTOR ShortText +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result new file mode 100644 index 00000000..b3c9875f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_flags_parameter.result @@ -0,0 +1,22 @@ +CREATE TABLE tags ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR'; +SHOW CREATE TABLE tags; +Table Create Table +tags CREATE TABLE `tags` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(64) DEFAULT NULL `FLAGS`='COLUMN_VECTOR', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 +column_create tags name COLUMN_VECTOR ShortText +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result new file mode 100644 index 00000000..8a1c18b7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_comment.result @@ -0,0 +1,23 @@ +CREATE TABLE tags ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags 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_column_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result new file mode 100644 index 00000000..85330471 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_groonga_type_parameter.result @@ -0,0 +1,30 @@ +CREATE TABLE tags ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `name` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags 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_column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result new file mode 100644 index 00000000..6fb1a107 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_cp932.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int PRIMARY KEY +) DEFAULT CHARSET=cp932; +ALTER TABLE users +ADD COLUMN O text, +ADD FULLTEXT INDEX (O); +INSERT INTO users VALUES (1, "܂"); +INSERT INTO users VALUES (2, "Ȃ"); +INSERT INTO users VALUES (3, ""); +SELECT * FROM users; +id O +1 ܂ +2 Ȃ +3 +SELECT * FROM users +WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); +id O +2 Ȃ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_PAT_KEY Int32 +column_create users @540d@524d COLUMN_SCALAR LongText +column_create users id COLUMN_SCALAR Int32 + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result new file mode 100644 index 00000000..70c9ea0c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multibyte_utf8.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE users +ADD COLUMN 名前 text, +ADD FULLTEXT INDEX (名前); +INSERT INTO users VALUES (1, "やまだ"); +INSERT INTO users VALUES (2, "たなか"); +INSERT INTO users VALUES (3, "すずき"); +SELECT * FROM users; +id 名前 +1 やまだ +2 たなか +3 すずき +SELECT * FROM users +WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); +id 名前 +2 たなか +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_PAT_KEY Int32 +column_create users @540d@524d COLUMN_SCALAR LongText +column_create users id COLUMN_SCALAR Int32 + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result new file mode 100644 index 00000000..6c6024e4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries +ADD COLUMN body VARCHAR(140) FIRST, +ADD COLUMN published BOOLEAN AFTER id, +ADD COLUMN created_at DATETIME; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +body id published title created_at +will start groonga! 1 0 survey 1970-01-01 00:00:00 +INSERT INTO diaries (title, body, published, created_at) +VALUES ("groonga (1)", "starting groonga...", TRUE, "2014-2-9 02:09:00"); +INSERT INTO diaries (title, body, published, created_at) +VALUES ("groonga (2)", "started groonga.", FALSE, "2014-2-9 12:19:00"); +SELECT * FROM diaries; +body id published title created_at +will start groonga! 1 0 survey 1970-01-01 00:00:00 +starting groonga... 2 1 groonga (1) 2014-02-09 02:09:00 +started groonga. 3 0 groonga (2) 2014-02-09 12:19:00 +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `body` varchar(140) DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `published` tinyint(1) DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result new file mode 100644 index 00000000..5a5d3715 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body VARCHAR(140); +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result new file mode 100644 index 00000000..51362826 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_type_comment.result @@ -0,0 +1,23 @@ +CREATE TABLE tags ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 + +column_create bugs name COLUMN_SCALAR tags +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result new file mode 100644 index 00000000..373c70e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result @@ -0,0 +1,22 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL +) DEFAULT CHARSET=utf8; +ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create memos#content index COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result new file mode 100644 index 00000000..8b8b2efb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT +) DEFAULT CHARSET UTF8; +INSERT INTO ids (id) values (1), (1); +ALTER TABLE ids ADD UNIQUE INDEX (id); +ERROR 23000: Can't write, because of unique constraint, to table 'ids' +SHOW CREATE TABLE ids; +Table Create Table +ids CREATE TABLE `ids` ( + `id` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT * FROM ids; +id +1 +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_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 00000000..8ab7ef22 --- /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_key_multiple_column_with_data.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result new file mode 100644 index 00000000..73fb6a7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS scores; +SET NAMES UTF8; +CREATE TABLE scores ( +id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +ALTER TABLE scores ADD KEY property (name, score); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_primary_key.result new file mode 100644 index 00000000..439684ac --- /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_column_comment_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result new file mode 100644 index 00000000..a993756a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs +CHANGE COLUMN +tag +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result new file mode 100644 index 00000000..c51c10b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +title VARCHAR(32), +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs CHANGE COLUMN title title VARCHAR(64); +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result new file mode 100644 index 00000000..a9b192e9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description VARCHAR(140) AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(140) DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id description title +1 starting groonga. groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result new file mode 100644 index 00000000..4faf39ad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description VARCHAR(140) FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `description` varchar(140) DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +description id title +starting groonga. 1 groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result new file mode 100644 index 00000000..f640e8de --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries +CHANGE body description VARCHAR(140) FIRST, +CHANGE title subject VARCHAR(40) AFTER internal_id, +CHANGE id internal_id INT AUTO_INCREMENT; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `description` varchar(140) DEFAULT NULL, + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `subject` varchar(40) DEFAULT NULL, + PRIMARY KEY (`internal_id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT IGNORE INTO diaries (subject, description) +VALUES ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +description internal_id subject +starting groonga. 1 groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result new file mode 100644 index 00000000..d49acc52 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description VARCHAR(140); +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `description` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title description +1 groonga (1) starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result new file mode 100644 index 00000000..dc2ae025 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_decimal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +temperature DECIMAL(6, 3) +) ENGINE InnoDB DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +INSERT INTO diaries (temperature) VALUES (21.281); +SELECT * FROM diaries; +id temperature +1 21.281 +ALTER TABLE diaries ENGINE = mroonga; +SELECT * FROM diaries; +id temperature +1 21.281 +INSERT INTO diaries (temperature) VALUES (14.213); +INSERT INTO diaries (temperature) VALUES (17.821); +SELECT * FROM diaries; +id temperature +1 21.281 +2 14.213 +3 17.821 +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result new file mode 100644 index 00000000..706764a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine_fulltext_index.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries MyISAM +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries ENGINE = mroonga; +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries Mroonga +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result new file mode 100644 index 00000000..9fc3b408 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result @@ -0,0 +1,63 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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 + +column_create terms content COLUMN_INDEX|WITH_POSITION memos content +ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; +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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_create_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result new file mode 100644 index 00000000..6127df61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +CREATE FULLTEXT INDEX title_index on diaries (title); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result new file mode 100644 index 00000000..7416481e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_table.result @@ -0,0 +1,41 @@ +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 memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText + +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 memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result new file mode 100644 index 00000000..ff7bc5e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES ujis; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "ŷ"); +INSERT INTO diaries VALUES (3, "ٻλ"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("ٻλ"); +id title +3 ٻλ +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("ٻλ"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result new file mode 100644 index 00000000..cbaa8d62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result new file mode 100644 index 00000000..9d6cdcd9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result new file mode 100644 index 00000000..09399c12 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result new file mode 100644 index 00000000..f94c98ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result new file mode 100644 index 00000000..7b71832b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +first_name VARCHAR(32) NOT NULL, +last_name VARCHAR(32) NOT NULL, +KEY (first_name, last_name) +); +INSERT INTO users VALUES("Taro", "Yamada"); +INSERT INTO users VALUES("Hanako", "Tanaka"); +INSERT INTO users VALUES("Joe", "Honda"); +SELECT * FROM users; +first_name last_name +Taro Yamada +Hanako Tanaka +Joe Honda +ALTER TABLE users DISABLE KEYS; +TRUNCATE users; +SELECT * FROM users; +first_name last_name +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result new file mode 100644 index 00000000..8b6f94c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +c1 int NOT NULL, +c2 text NOT NULL, +c3 int NOT NULL, +c4 int NOT NULL, +PRIMARY KEY(c1), +KEY idx1(c3,c4), +FULLTEXT KEY ft1(c2) +); +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result new file mode 100644 index 00000000..a8b8edf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries +DROP COLUMN title, +DROP COLUMN body; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +SELECT * FROM diaries; +id +1 +INSERT INTO diaries () VALUES (); +SELECT * FROM diaries; +id +1 +2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result new file mode 100644 index 00000000..569bba2f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +SELECT * FROM diaries; +id title +1 survey +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; +id title +1 survey +2 groonga (1) +3 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result new file mode 100644 index 00000000..b0aa59a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS scores; +SET NAMES UTF8; +CREATE TABLE scores ( +id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +KEY property (name, score) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +ALTER TABLE scores DROP KEY property; +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_primary_key.result new file mode 100644 index 00000000..cbcf9a69 --- /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.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result new file mode 100644 index 00000000..e5c8a349 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result new file mode 100644 index 00000000..7b3b2863 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_table.result @@ -0,0 +1,42 @@ +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 memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText +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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create terms term COLUMN_SCALAR ShortText + +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_enable_keys_fulltext_ujis.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result new file mode 100644 index 00000000..3853cc84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES ujis; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "ŷ"); +INSERT INTO diaries VALUES (3, "ٻλ"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("ٻλ"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("ٻλ"); +id title +3 ٻλ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result new file mode 100644 index 00000000..e5c8a349 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result new file mode 100644 index 00000000..e252061d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result new file mode 100644 index 00000000..0e56e78d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result new file mode 100644 index 00000000..722e62f9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result new file mode 100644 index 00000000..bf7593f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE memos ( +content varchar(32) +) DEFAULT CHARSET="utf8"; +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `content` varchar(32) DEFAULT NULL, + FULLTEXT KEY `content_index` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); +content +Starting Groonga... +Started Groonga. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result new file mode 100644 index 00000000..cf6840a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT +) DEFAULT CHARSET="utf8"; +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SELECT * FROM memos WHERE MATCH(content) AGAINST("+groonga" IN BOOLEAN MODE); +id content +1 Starting Groonga... +2 Started Groonga. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result new file mode 100644 index 00000000..705d2f70 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); +SELECT * FROM bugs; +id tags +1 GROONGA MROONGA +ALTER TABLE bugs ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; +SELECT * FROM bugs +WHERE MATCH(tags) AGAINST("Groonga"); +id tags +1 GROONGA MROONGA +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result new file mode 100644 index 00000000..2d5e3d55 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags"', +FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); +ALTER TABLE bugs DROP INDEX bugs_tags_index; +ALTER TABLE bugs +ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; +SELECT * FROM bugs +WHERE MATCH(tags) AGAINST("Groonga"); +id tags +1 GROONGA MROONGA +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result new file mode 100644 index 00000000..9b7040bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY body VARCHAR(140) AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` varchar(140) DEFAULT NULL, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id body title +1 starting groonga. groonga (1) +2 started groonga. groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result new file mode 100644 index 00000000..f6b3df92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY body VARCHAR(140) FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `body` varchar(140) DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +body id title +starting groonga. 1 groonga (1) +started groonga. 2 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result new file mode 100644 index 00000000..e156a7fd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY title VARCHAR(100); +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(100) DEFAULT NULL, + `body` varchar(140) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +2 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result new file mode 100644 index 00000000..6ee8f8ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX (body) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 survey will start mroonga! +SELECT * FROM diaries +WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries +DROP INDEX body, +ADD FULLTEXT INDEX (body); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 survey will start mroonga! +SELECT * FROM diaries +WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result new file mode 100644 index 00000000..84861ea7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries, memos; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine +diaries Mroonga +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +id title body +1 survey will start groonga! +SELECT * FROM memos +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +SELECT table_name, engine +FROM information_schema.tables +WHERE table_name = 'memos'; +table_name engine +memos Mroonga +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result new file mode 100644 index 00000000..ac1a096d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result @@ -0,0 +1,132 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name VARCHAR(40), +location GEOMETRY NOT NULL +); +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +ST_GeomFromText('POINT(139.711517 35.647701)')); +ALTER TABLE shops ADD SPATIAL KEY location_index (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) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +SHOW CREATE TABLE shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(40) DEFAULT NULL, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result new file mode 100644 index 00000000..6a5729af --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result @@ -0,0 +1,53 @@ +drop table if exists t1; +create table t1 (c1 int auto_increment, primary key(c1)); +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +1 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +2 +insert into t1 values(10); +select c1 from t1 order by c1 desc limit 1; +c1 +10 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +11 +insert into t1 values(6); +select c1 from t1 order by c1 desc limit 1; +c1 +11 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +12 +drop table t1; +create table t1 (c1 int, c2 int auto_increment, primary key(c1), key idx1(c2)); +insert into t1 values(1, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +1 1 +insert into t1 values(2, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +2 2 +insert into t1 values(3, 10); +select * from t1 order by c2 desc limit 1; +c1 c2 +3 10 +insert into t1 values(4, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +4 11 +insert into t1 values(5, 6); +select * from t1 order by c2 desc limit 1; +c1 c2 +4 11 +insert into t1 values(6, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +6 12 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result new file mode 100644 index 00000000..f89b74e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result @@ -0,0 +1,70 @@ +drop table if exists t1; +create table t1 (c1 int auto_increment, primary key(c1)) auto_increment=34129; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34129 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga AUTO_INCREMENT=34130 DEFAULT CHARSET=latin1 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34130 +34129 +insert into t1 values(10); +select c1 from t1 order by c1 desc; +c1 +34130 +34129 +10 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34131 +34130 +34129 +10 +insert into t1 values(6); +select c1 from t1 order by c1 desc; +c1 +34131 +34130 +34129 +10 +6 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34132 +34131 +34130 +34129 +10 +6 +truncate table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +1 +delete from t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +2 +rename table t1 to t2; +insert into t2 values(null); +select c1 from t2 order by c1 desc; +c1 +3 +2 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +drop table t2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result new file mode 100644 index 00000000..fe5e6409 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result @@ -0,0 +1,15 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text +); +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +id body +1 started groonga (long text) +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +id body +1 started groonga (long text) +2 sleeping... (short text) +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result new file mode 100644 index 00000000..340509f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result @@ -0,0 +1,34 @@ +drop table if exists t1; +show variables like 'log_bin'; +Variable_name Value +log_bin ON +set binlog_format="STATEMENT"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="ROW"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="MIXED"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result new file mode 100644 index 00000000..4926a72a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_broken.result @@ -0,0 +1,18 @@ +SET NAMES UTF8; +CREATE DATABASE check_test; +USE check_test; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +INSERT INTO diaries VALUES ('Hello'); +FLUSH TABLES; +CHECK TABLE diaries; +Table Op Msg_type Msg_text +check_test.diaries check error Corrupt +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +check_test.diaries repair status OK +DROP TABLE diaries; +DROP DATABASE check_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result new file mode 100644 index 00000000..def3368e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/check_table_not_broken.result @@ -0,0 +1,13 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT +); +INSERT INTO diaries VALUES ('Hello'); +CHECK TABLE diaries; +Table Op Msg_type Msg_text +test.diaries check status OK +SELECT * FROM diaries; +title +Hello +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result new file mode 100644 index 00000000..880092f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_general_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("Je suis un garçon."); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); +content +Je suis un garçon. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_520_ci_french.result new file mode 100644 index 00000000..b9e22da4 --- /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 00000000..29e55b7d --- /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/collation_utf8_unicode_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result new file mode 100644 index 00000000..3f24de87 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_unicode_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("Je suis un garçon."); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); +content +Je suis un garçon. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result new file mode 100644 index 00000000..94ef2608 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_unicode_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("ひらがなとカタカナを覚えました。"); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("かたかな"); +content +ひらがなとカタカナを覚えました。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result new file mode 100644 index 00000000..94b3a603 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED, +INDEX (id) COMMENT 'ID search is required.' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned DEFAULT NULL, + KEY `id` (`id`) COMMENT 'ID search is required.' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result new file mode 100644 index 00000000..162b515d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result new file mode 100644 index 00000000..9aec8dd6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +created_at DATE, +KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `created_at` date DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +3 cloudy day 2012-01-31 +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result new file mode 100644 index 00000000..4d2166ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(40), +created_at DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(40) DEFAULT NULL, + `created_at` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +3 cloudy day 2012-01-31 +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result new file mode 100644 index 00000000..022d6c00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; +Table Create Table +timestamps CREATE TABLE `timestamps` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_dt` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SET sql_mode = ''; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +SET sql_mode = DEFAULT; +SELECT * FROM timestamps; +id create_dt +1 2012-01-01 +2 2012-01-01 +SELECT * FROM timestamps WHERE create_dt = "2012-01-01"; +id create_dt +1 2012-01-01 +2 2012-01-01 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result new file mode 100644 index 00000000..712d87ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); +INSERT IGNORE INTO diaries (title, created_at) +VALUES ('2038-01-20 03:14:08', '2038-01-20 03:14:08'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2038-01-18 03:14:07 2038-01-18 03:14:07 +2 2038-01-20 03:14:08 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result new file mode 100644 index 00000000..85f091cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT IGNORE INTO diaries (title, created_at) +VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 1000-01-01 00:00:00 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result new file mode 100644 index 00000000..9d9e2f61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT IGNORE INTO diaries (title, created_at) +VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 9999-12-31 23:59:59 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result new file mode 100644 index 00000000..99611268 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT IGNORE INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result new file mode 100644 index 00000000..f0f03a82 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-19 03:14:08', '2038-01-19 03:14:08'); +SELECT * FROM diaries; +id title created_at +1 2038-01-19 03:14:07 2038-01-19 03:14:07 +2 2038-01-19 03:14:08 2038-01-19 03:14:08 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result new file mode 100644 index 00000000..8a775960 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('1000-01-02 00:00:00', '1000-01-02 00:00:00'); +SELECT * FROM diaries; +id title created_at +1 1000-01-02 00:00:00 1000-01-02 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result new file mode 100644 index 00000000..44d20d97 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); +SELECT * FROM diaries; +id title created_at +1 9999-12-31 23:59:59 9999-12-31 23:59:59 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result new file mode 100644 index 00000000..6617b49d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_strict_sql_mode_out_of_range.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +ERROR 22007: Incorrect datetime value: '2012' for column `test`.`diaries`.`created_at` at row 1 +SELECT * FROM diaries; +id title created_at +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result new file mode 100644 index 00000000..21e715e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_5_out_of_range.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1264 Out of range value for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 0000-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result new file mode 100644 index 00000000..3500d651 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_5_6_or_later_out_of_range.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +INSERT INTO diaries (title, created_at) VALUES ('2012', '2012'); +ERROR 22007: Incorrect datetime value: '2012' for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 0000-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result new file mode 100644 index 00000000..e7094fd4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME(6), +KEY (created_at) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +3 cloudy day 2012-01-31 08:32:10.555500 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result new file mode 100644 index 00000000..028fb257 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME(6) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +3 cloudy day 2012-01-31 08:32:10.555500 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result new file mode 100644 index 00000000..a48be4da --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 1000-01-01 00:00:00 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result new file mode 100644 index 00000000..ffd6a707 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_date.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; +id create_dt +2 2015-06-17 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result new file mode 100644 index 00000000..61d2ed8d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mariadb_10_2_or_later_zero_month_day.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result new file mode 100644 index 00000000..0ca19e54 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_date.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; +id create_dt +1 2015-06-17 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result new file mode 100644 index 00000000..94479c23 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_mysql_5_7_or_later_zero_month_day.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +ERROR 22007: Incorrect datetime value: '2012-00-01 00:00:00' for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +ERROR 22007: Incorrect datetime value: '2012-01-00 00:00:00' for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result new file mode 100644 index 00000000..510fa2dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ('NULL', NULL); +SELECT * FROM diaries; +id title created_at +1 NULL 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result new file mode 100644 index 00000000..6f79b31f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME, +KEY (created_at) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +3 cloudy day 2012-01-31 08:32:10 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result new file mode 100644 index 00000000..8a45ece7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +3 cloudy day 2012-01-31 08:32:10 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result new file mode 100644 index 00000000..659c5742 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +SET sql_mode='STRICT_TRANS_TABLES'; +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +ERROR 22003: Out of range value for column 'create_dt' at row 1 +SET sql_mode=default; +SELECT * FROM timestamps; +id create_dt +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; +id create_dt +2 2015-06-17 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result new file mode 100644 index 00000000..03633a50 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_month_day.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result new file mode 100644 index 00000000..196e4b80 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL(6, 3), +KEY (temperature) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +2 rainy day 14.213 +3 cloudy day 17.821 +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; +id title temperature +2 rainy day 14.213 +3 cloudy day 17.821 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result new file mode 100644 index 00000000..b67846bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL(6, 3) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +2 rainy day 14.213 +3 cloudy day 17.821 +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; +id title temperature +2 rainy day 14.213 +3 cloudy day 17.821 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result new file mode 100644 index 00000000..620e9b69 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL, +KEY (temperature) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); +SELECT * FROM diaries; +id title temperature +1 clear day 21 +2 rainy day 14 +3 cloudy day 17 +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; +id title temperature +2 rainy day 14 +3 cloudy day 17 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result new file mode 100644 index 00000000..1ba47b34 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); +SELECT * FROM diaries; +id title temperature +1 clear day 21 +2 rainy day 14 +3 cloudy day 17 +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; +id title temperature +2 rainy day 14 +3 cloudy day 17 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result new file mode 100644 index 00000000..28c80dcc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +size ENUM("small", "medium", "large"), +INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `size` enum('small','medium','large') DEFAULT NULL, + KEY `size` (`size`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart for child", "small"); +INSERT INTO items VALUES ("leadies' coat", "medium"); +INSERT INTO items VALUES ("parka", "large"); +INSERT INTO items VALUES ("hat", "medium"); +SELECT * FROM items; +name size +t-shart for child small +leadies' coat medium +parka large +hat medium +SELECT * FROM items WHERE size = "medium"; +name size +leadies' coat medium +hat medium +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result new file mode 100644 index 00000000..731a9690 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result @@ -0,0 +1,287 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +size ENUM("size1", +"size2", +"size3", +"size4", +"size5", +"size6", +"size7", +"size8", +"size9", +"size10", +"size11", +"size12", +"size13", +"size14", +"size15", +"size16", +"size17", +"size18", +"size19", +"size20", +"size21", +"size22", +"size23", +"size24", +"size25", +"size26", +"size27", +"size28", +"size29", +"size30", +"size31", +"size32", +"size33", +"size34", +"size35", +"size36", +"size37", +"size38", +"size39", +"size40", +"size41", +"size42", +"size43", +"size44", +"size45", +"size46", +"size47", +"size48", +"size49", +"size50", +"size51", +"size52", +"size53", +"size54", +"size55", +"size56", +"size57", +"size58", +"size59", +"size60", +"size61", +"size62", +"size63", +"size64", +"size65", +"size66", +"size67", +"size68", +"size69", +"size70", +"size71", +"size72", +"size73", +"size74", +"size75", +"size76", +"size77", +"size78", +"size79", +"size80", +"size81", +"size82", +"size83", +"size84", +"size85", +"size86", +"size87", +"size88", +"size89", +"size90", +"size91", +"size92", +"size93", +"size94", +"size95", +"size96", +"size97", +"size98", +"size99", +"size100", +"size101", +"size102", +"size103", +"size104", +"size105", +"size106", +"size107", +"size108", +"size109", +"size110", +"size111", +"size112", +"size113", +"size114", +"size115", +"size116", +"size117", +"size118", +"size119", +"size120", +"size121", +"size122", +"size123", +"size124", +"size125", +"size126", +"size127", +"size128", +"size129", +"size130", +"size131", +"size132", +"size133", +"size134", +"size135", +"size136", +"size137", +"size138", +"size139", +"size140", +"size141", +"size142", +"size143", +"size144", +"size145", +"size146", +"size147", +"size148", +"size149", +"size150", +"size151", +"size152", +"size153", +"size154", +"size155", +"size156", +"size157", +"size158", +"size159", +"size160", +"size161", +"size162", +"size163", +"size164", +"size165", +"size166", +"size167", +"size168", +"size169", +"size170", +"size171", +"size172", +"size173", +"size174", +"size175", +"size176", +"size177", +"size178", +"size179", +"size180", +"size181", +"size182", +"size183", +"size184", +"size185", +"size186", +"size187", +"size188", +"size189", +"size190", +"size191", +"size192", +"size193", +"size194", +"size195", +"size196", +"size197", +"size198", +"size199", +"size200", +"size201", +"size202", +"size203", +"size204", +"size205", +"size206", +"size207", +"size208", +"size209", +"size210", +"size211", +"size212", +"size213", +"size214", +"size215", +"size216", +"size217", +"size218", +"size219", +"size220", +"size221", +"size222", +"size223", +"size224", +"size225", +"size226", +"size227", +"size228", +"size229", +"size230", +"size231", +"size232", +"size233", +"size234", +"size235", +"size236", +"size237", +"size238", +"size239", +"size240", +"size241", +"size242", +"size243", +"size244", +"size245", +"size246", +"size247", +"size248", +"size249", +"size250", +"size251", +"size252", +"size253", +"size254", +"size255", +"size256"), +INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `size` enum('size1','size2','size3','size4','size5','size6','size7','size8','size9','size10','size11','size12','size13','size14','size15','size16','size17','size18','size19','size20','size21','size22','size23','size24','size25','size26','size27','size28','size29','size30','size31','size32','size33','size34','size35','size36','size37','size38','size39','size40','size41','size42','size43','size44','size45','size46','size47','size48','size49','size50','size51','size52','size53','size54','size55','size56','size57','size58','size59','size60','size61','size62','size63','size64','size65','size66','size67','size68','size69','size70','size71','size72','size73','size74','size75','size76','size77','size78','size79','size80','size81','size82','size83','size84','size85','size86','size87','size88','size89','size90','size91','size92','size93','size94','size95','size96','size97','size98','size99','size100','size101','size102','size103','size104','size105','size106','size107','size108','size109','size110','size111','size112','size113','size114','size115','size116','size117','size118','size119','size120','size121','size122','size123','size124','size125','size126','size127','size128','size129','size130','size131','size132','size133','size134','size135','size136','size137','size138','size139','size140','size141','size142','size143','size144','size145','size146','size147','size148','size149','size150','size151','size152','size153','size154','size155','size156','size157','size158','size159','size160','size161','size162','size163','size164','size165','size166','size167','size168','size169','size170','size171','size172','size173','size174','size175','size176','size177','size178','size179','size180','size181','size182','size183','size184','size185','size186','size187','size188','size189','size190','size191','size192','size193','size194','size195','size196','size197','size198','size199','size200','size201','size202','size203','size204','size205','size206','size207','size208','size209','size210','size211','size212','size213','size214','size215','size216','size217','size218','size219','size220','size221','size222','size223','size224','size225','size226','size227','size228','size229','size230','size231','size232','size233','size234','size235','size236','size237','size238','size239','size240','size241','size242','size243','size244','size245','size246','size247','size248','size249','size250','size251','size252','size253','size254','size255','size256') DEFAULT NULL, + KEY `size` (`size`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart for child", "size1"); +INSERT INTO items VALUES ("leadies' coat", "size1"); +INSERT INTO items VALUES ("parka", "size256"); +INSERT INTO items VALUES ("hat", "size256"); +SELECT * FROM items; +name size +t-shart for child size1 +leadies' coat size1 +parka size256 +hat size256 +SELECT * FROM items WHERE size = "size1"; +name size +t-shart for child size1 +leadies' coat size1 +SELECT * FROM items WHERE size = "size256"; +name size +parka size256 +hat size256 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result new file mode 100644 index 00000000..924c3134 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result @@ -0,0 +1,16 @@ +set names utf8mb4; +CREATE TABLE logs ( +id INT, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (1, json_object('message', repeat('☹', 253))); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result new file mode 100644 index 00000000..1ee7d8f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result new file mode 100644 index 00000000..5b518516 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_drop_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result new file mode 100644 index 00000000..ff22175e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result new file mode 100644 index 00000000..fac82467 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_reindex.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result new file mode 100644 index 00000000..71fc442d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_update.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "shutdown"} "shutdown" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result new file mode 100644 index 00000000..27c9effc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result new file mode 100644 index 00000000..260c774e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs; +id record message +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result new file mode 100644 index 00000000..bc9339ab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_drop_column.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result new file mode 100644 index 00000000..92463c94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result new file mode 100644 index 00000000..1a502edf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_add_index.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ALTER TABLE logs ADD INDEX (message); +ERROR HY000: mroonga: storage: failed to create index: Index for virtual generated column is not supported: message +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result new file mode 100644 index 00000000..16acc89b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL, +FULLTEXT INDEX (message) +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ERROR HY000: mroonga: storage: failed to create index: Index for virtual generated column is not supported: message diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result new file mode 100644 index 00000000..93046e39 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_mysql_5_7_or_later_add_index.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +ALTER TABLE logs ADD INDEX (message); +ERROR HY000: Table storage engine 'Mroonga' does not support the create option 'Index on virtual generated column' +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result new file mode 100644 index 00000000..c4e46d0d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_virtual_update.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "shutdown"} "shutdown" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result new file mode 100644 index 00000000..33f31ed3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS contents; +CREATE TABLE contents ( +_id INT, +content TEXT NOT NULL, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +INSERT INTO contents (content) VALUES ('first'); +INSERT INTO contents (content) VALUES ('second'); +SELECT _id, content FROM contents; +_id content +1 first +2 second +DROP TABLE contents; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result new file mode 100644 index 00000000..903e3a85 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS contents; +CREATE TABLE contents ( +_i INT, +content TEXT NOT NULL, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +ERROR HY000: [column][create] name can't start with '_' and contains only 0-9, A-Z, a-z, #, @, - or _: <_i> +DROP TABLE IF EXISTS contents; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result new file mode 100644 index 00000000..767fe491 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result @@ -0,0 +1,30 @@ +CREATE TABLE terms ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='default_tokenizer "TokenBigram"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +title TEXT, +FULLTEXT INDEX (title) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +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 (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 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 00000000..f9fc8366 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_vector_other_table.result @@ -0,0 +1,38 @@ +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 bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit +column_create tags name COLUMN_SCALAR ShortText + +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 new file mode 100644 index 00000000..0f57885c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result @@ -0,0 +1,39 @@ +DROP DATABASE IF EXISTS mroonga; +CREATE DATABASE mroonga; +USE mroonga; +CREATE TABLE priorities ( +id INT PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +priority INT COMMENT 'type "priorities"', +INDEX bugs_priority_index (priority) COMMENT 'table "priorities"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, priority) VALUES (1, 10); +INSERT INTO bugs (id, priority) VALUES (2, 3); +INSERT INTO bugs (id, priority) VALUES (3, -2); +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create priorities TABLE_PAT_KEY Int32 +column_create priorities id COLUMN_SCALAR Int32 + +column_create bugs priority COLUMN_SCALAR priorities + +column_create priorities bugs_priority_index COLUMN_INDEX bugs priority +SELECT * +FROM bugs +WHERE priority = 3; +id priority +2 3 +DROP TABLE bugs; +DROP TABLE priorities; +DROP DATABASE mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result new file mode 100644 index 00000000..8acf8aab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag TEXT COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); +SELECT * FROM bugs; +id tag +1 Linux +2 MySQL +3 groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_lz4.result new file mode 100644 index 00000000..11875e15 --- /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 00000000..5d704e3e --- /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_support_zstd.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.result new file mode 100644 index 00000000..a9c917f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_support_zstd.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_ZSTD"' +) 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 00000000..a9a5f55f --- /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 00000000..068ce58b --- /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/column_groonga_scalar_unsupport_zstd.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.result new file mode 100644 index 00000000..b2bb3b89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_unsupport_zstd.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_ZSTD"' +) DEFAULT CHARSET=utf8; +Warnings: +Warning 16506 The column flag 'COMPRESS_ZSTD' 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_with_not_for_mroonga_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result new file mode 100644 index 00000000..cd910206 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag TEXT COMMENT 'It references to tags.name, type "tags"' +) DEFAULT CHARSET=utf8; +SHOW FULL COLUMNS FROM bugs LIKE 'tag'; +Field Type Collation Null Key Default Extra Privileges Comment +tag text utf8_general_ci YES NULL select,insert,update,references It references to tags.name, type "tags" +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); +SELECT * FROM bugs; +id tag +1 Linux +2 MySQL +3 groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result new file mode 100644 index 00000000..468115e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL Groonga"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL Mroonga"); +INSERT INTO bugs (id, tags) VALUES (3, "Ruby Rroonga"); +SELECT * FROM tags ORDER BY SUBSTRING(name, 1, 1) ASC; +name +Groonga +Linux +Mroonga +MySQL +Rroonga +Ruby +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result new file mode 100644 index 00000000..a6afe72f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tags` varchar(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +SELECT * FROM bugs; +id tags +1 Linux MySQL groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result new file mode 100644 index 00000000..1afd7da9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT KEY +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 200); +INSERT INTO items VALUES ("smile", 0); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +smile 0 +coke 100 +hamburger 200 +SELECT * FROM items WHERE price = 0; +name price +smile 0 +SELECT * FROM items WHERE price <= 100; +name price +smile 0 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result new file mode 100644 index 00000000..e6a3aa5e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_json_insert.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; +INSERT INTO logs VALUES ('{"message": "start"}'); +INSERT INTO logs VALUES ('{"message": "restart"}'); +INSERT INTO logs VALUES ('{"message": "shutdown"}'); +SELECT * FROM logs; +record +{"message": "start"} +{"message": "restart"} +{"message": "shutdown"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result new file mode 100644 index 00000000..eb1a08f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_cp932.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +O text, +FULLTEXT INDEX (O) +) DEFAULT CHARSET=cp932; +INSERT INTO users VALUES ("܂"); +INSERT INTO users VALUES ("Ȃ"); +INSERT INTO users VALUES (""); +SELECT * FROM users; +O +܂ +Ȃ + +SELECT * FROM users +WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); +O +Ȃ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_NO_KEY +column_create users @540d@524d COLUMN_SCALAR LongText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result new file mode 100644 index 00000000..6f63b5b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_multibyte_utf8.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +名前 text, +FULLTEXT INDEX (名前) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES ("やまだ"); +INSERT INTO users VALUES ("たなか"); +INSERT INTO users VALUES ("すずき"); +SELECT * FROM users; +名前 +やまだ +たなか +すずき +SELECT * FROM users +WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); +名前 +たなか +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_NO_KEY +column_create users @540d@524d COLUMN_SCALAR LongText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users @540d@524d +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result new file mode 100644 index 00000000..ee818a62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "white,dark gray"); +INSERT INTO items VALUES ("parka", "chartreuse,orange"); +SELECT * FROM items; +name colors +t-shart black,gray +hat dark gray,white +parka orange,chartreuse +SELECT * FROM items WHERE colors = "dark gray,white"; +name colors +hat dark gray,white +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result new file mode 100644 index 00000000..10d4fd8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result @@ -0,0 +1,48 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,lawn green"); +INSERT INTO items VALUES ("parka", "gray,medium blue"); +SELECT * FROM items; +name colors +t-shart black,white +hat white,lawn green +parka gray,medium blue +SELECT * FROM items WHERE colors = "white,lawn green"; +name colors +hat white,lawn green +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result new file mode 100644 index 00000000..0432970a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result @@ -0,0 +1,56 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet", +"dark magenta", +"magenta", +"dark red", +"brown", +"firebrick", +"indian red", +"light coral", +"salmon"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet','dark magenta','magenta','dark red','brown','firebrick','indian red','light coral','salmon') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,dark violet"); +INSERT INTO items VALUES ("parka", "green,brown,red"); +SELECT * FROM items; +name colors +t-shart black,white +hat white,dark violet +parka red,green,brown +SELECT * FROM items WHERE colors = "white,dark violet"; +name colors +hat white,dark violet +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result new file mode 100644 index 00000000..5b6d4511 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result @@ -0,0 +1,88 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet", +"dark magenta", +"magenta", +"dark red", +"brown", +"firebrick", +"indian red", +"light coral", +"salmon", +"light salmon", +"tomato", +"coral", +"dark salmon", +"rosy brown", +"sienna", +"saddle brown", +"chocolate", +"peru", +"sandy brown", +"burlywood", +"tan", +"navajo white", +"wheat", +"dark goldenrod", +"goldenrod", +"light goldenrod", +"pale goldenrod", +"cornsilk", +"dark khaki", +"khaki", +"lemon chiffon", +"dark olive green", +"olive drab", +"yellow green", +"green yellow", +"light green", +"forest green", +"dark green", +"lime green", +"pale green", +"dark sea green"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet','dark magenta','magenta','dark red','brown','firebrick','indian red','light coral','salmon','light salmon','tomato','coral','dark salmon','rosy brown','sienna','saddle brown','chocolate','peru','sandy brown','burlywood','tan','navajo white','wheat','dark goldenrod','goldenrod','light goldenrod','pale goldenrod','cornsilk','dark khaki','khaki','lemon chiffon','dark olive green','olive drab','yellow green','green yellow','light green','forest green','dark green','lime green','pale green','dark sea green') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white,lawn green,dark violet"); +INSERT INTO items VALUES ("hat", "white,dark violet,yellow green"); +INSERT INTO items VALUES ("parka", "green,brown,red,lime green"); +SELECT * FROM items; +name colors +t-shart black,white,lawn green,dark violet +hat white,dark violet,yellow green +parka red,green,brown,lime green +SELECT * FROM items WHERE colors = "white,dark violet,yellow green"; +name colors +hat white,dark violet,yellow green +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result new file mode 100644 index 00000000..3e6bf4e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "dim gray,dark gray"); +INSERT INTO items VALUES ("parka", "white smoke,light gray"); +SELECT * FROM items; +name colors +t-shart black,gray +hat dim gray,dark gray +parka light gray,white smoke +SELECT * FROM items WHERE colors = "dim gray,dark gray"; +name colors +hat dim gray,dark gray +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result new file mode 100644 index 00000000..262f7755 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price BIGINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("house", 9223372036854775807); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -9223372036854775808); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 2147483648); +SELECT * FROM items; +name price +discount -9223372036854775808 +coke 100 +note PC 32767 +super car 2147483648 +house 9223372036854775807 +SELECT * FROM items WHERE price <= 2147483648; +name price +discount -9223372036854775808 +coke 100 +note PC 32767 +super car 2147483648 +SELECT * FROM items WHERE price > 2147483647; +name price +super car 2147483648 +house 9223372036854775807 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result new file mode 100644 index 00000000..867b8871 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 2147483647); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -2147483647); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 16777216); +SELECT * FROM items; +name price +discount -2147483647 +coke 100 +note PC 32767 +bike 16777216 +car 2147483647 +SELECT * FROM items WHERE price <= 16777216; +name price +discount -2147483647 +coke 100 +note PC 32767 +bike 16777216 +SELECT * FROM items WHERE price > 16777215; +name price +bike 16777216 +car 2147483647 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result new file mode 100644 index 00000000..c8b4f895 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price MEDIUMINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 8388607); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -8388608); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 32768); +SELECT * FROM items; +name price +discount -8388608 +coke 100 +note PC 32767 +bike 32768 +car 8388607 +SELECT * FROM items WHERE price <= 127; +name price +discount -8388608 +coke 100 +SELECT * FROM items WHERE price >= 32768; +name price +bike 32768 +car 8388607 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result new file mode 100644 index 00000000..8a51ee5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price SMALLINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -32768); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 20000); +SELECT * FROM items; +name price +discount -32768 +coke 100 +tablet PC 20000 +note PC 32767 +SELECT * FROM items WHERE price <= 127; +name price +discount -32768 +coke 100 +SELECT * FROM items WHERE price >= 128; +name price +tablet PC 20000 +note PC 32767 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result new file mode 100644 index 00000000..d14efcca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price TINYINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 120); +INSERT INTO items VALUES ("discount", -10); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +discount -10 +coke 100 +hamburger 120 +SELECT * FROM items WHERE price <= 100; +name price +discount -10 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result new file mode 100644 index 00000000..35434a00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +average TIME(6), +max TIME(6), +KEY (average) +) DEFAULT CHARSET UTF8; +INSERT INTO running_records (title, average, max) +VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); +INSERT INTO running_records (title, average, max) +VALUES ("bad condition", "12:23:34.123456", "838:59:58.999999"); +INSERT INTO running_records (title, average, max) +VALUES ("record failure", "-838:59:59.000000", "-838:59:59.000000"); +SELECT * FROM running_records; +id title average max +1 normal condition 01:00:00.000001 01:05:00.000001 +2 bad condition 12:23:34.123456 838:59:58.999999 +3 record failure -838:59:59.000000 -838:59:59.000000 +SELECT * FROM running_records +WHERE average BETWEEN "00:59:59.999999" AND "100:10:10.101010"; +id title average max +1 normal condition 01:00:00.000001 01:05:00.000001 +2 bad condition 12:23:34.123456 838:59:58.999999 +SELECT * FROM running_records +WHERE average BETWEEN "-838:59:59.000000" AND "01:00:00.000001"; +id title average max +3 record failure -838:59:59.000000 -838:59:59.000000 +1 normal condition 01:00:00.000001 01:05:00.000001 +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result new file mode 100644 index 00000000..a0b0350a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +average TIME, +max TIME, +KEY (average) +) DEFAULT CHARSET UTF8; +INSERT INTO running_records (title, average, max) +VALUES ("normal condition", "01:00:00", "01:05:00"); +INSERT INTO running_records (title, average, max) +VALUES ("bad condition", "12:23:34", "838:59:59"); +INSERT INTO running_records (title, average, max) +VALUES ("record failure", "-838:59:59", "-838:59:59"); +SELECT * FROM running_records; +id title average max +1 normal condition 01:00:00 01:05:00 +2 bad condition 12:23:34 838:59:59 +3 record failure -838:59:59 -838:59:59 +SELECT * FROM running_records +WHERE average BETWEEN "00:59:59" AND "100:10:10"; +id title average max +1 normal condition 01:00:00 01:05:00 +2 bad condition 12:23:34 838:59:59 +SELECT * FROM running_records +WHERE average BETWEEN "-838:59:59" AND "01:00:00"; +id title average max +3 record failure -838:59:59 -838:59:59 +1 normal condition 01:00:00 01:05:00 +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result new file mode 100644 index 00000000..7ccb1fa2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at TIMESTAMP(6), +updated_at TIMESTAMP(6), +KEY (updated_at) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("clear day", +"2012-01-29 21:51:01.111111", +"2012-01-29 21:51:02.222222"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("rainy day", +"2012-01-30 01:23:45.333", +"2012-01-30 01:23:46.444"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("cloudy day", +"2012-01-31 08:32:10.5555", +"2012-01-31 08:32:11.6666"); +SELECT * FROM diaries; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01.111111 2012-01-29 21:51:02.222222 +2 rainy day 2012-01-30 01:23:45.333000 2012-01-30 01:23:46.444000 +3 cloudy day 2012-01-31 08:32:10.555500 2012-01-31 08:32:11.666600 +SELECT * FROM diaries +WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01.111111 2012-01-29 21:51:02.222222 +2 rainy day 2012-01-30 01:23:45.333000 2012-01-30 01:23:46.444000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result new file mode 100644 index 00000000..4c221d9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', +updated_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', +KEY (updated_at) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("rainy day", "2012-01-30 01:23:45", "2012-01-30 01:23:46"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("cloudy day", "2012-01-31 08:32:10", "2012-01-31 08:32:11"); +SELECT * FROM diaries; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01 2012-01-29 21:51:02 +2 rainy day 2012-01-30 01:23:45 2012-01-30 01:23:46 +3 cloudy day 2012-01-31 08:32:10 2012-01-31 08:32:11 +SELECT * FROM diaries +WHERE updated_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01 2012-01-29 21:51:02 +2 rainy day 2012-01-30 01:23:45 2012-01-30 01:23:46 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result new file mode 100644 index 00000000..8dde1bdd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result @@ -0,0 +1,18 @@ +drop table if exists books; +create table books(title varchar(255), published tinyint); +insert into books values ("MySQL", 1); +insert into books values ("groonga", 1); +insert into books values ("mroonga", 0); +select count(*) from books where published = 0; +count(*) +1 +select count(*) from books where published = 1; +count(*) +2 +select count(*) from books where published != 2; +count(*) +3 +select count(*) from books where published != 1; +count(*) +1 +drop table books; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result new file mode 100644 index 00000000..d16004e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price BIGINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("house", 18446744073709551615); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 9223372036854775808); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +super car 9223372036854775808 +house 18446744073709551615 +SELECT * FROM items WHERE price <= 9223372036854775808; +name price +discount 0 +coke 100 +note PC 32767 +super car 9223372036854775808 +SELECT * FROM items WHERE price > 9223372036854775807; +name price +super car 9223372036854775808 +house 18446744073709551615 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result new file mode 100644 index 00000000..277580c7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT UNSIGNED +) DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES (317173755057152000); +INSERT INTO ids VALUES (317173755057152002); +SELECT * FROM ids; +id +317173755057152000 +317173755057152002 +SELECT * FROM ids WHERE id = 317173755057152000; +id +317173755057152000 +SELECT * FROM ids WHERE id = 317173755057152002; +id +317173755057152002 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result new file mode 100644 index 00000000..d14ef877 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 4294967295); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 2147483648); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +bike 2147483648 +car 4294967295 +SELECT * FROM items WHERE price <= 2147483648; +name price +discount 0 +coke 100 +note PC 32767 +bike 2147483648 +SELECT * FROM items WHERE price > 2147483647; +name price +bike 2147483648 +car 4294967295 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result new file mode 100644 index 00000000..2825aada --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price MEDIUMINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 16777215); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 8388607); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +bike 8388607 +car 16777215 +SELECT * FROM items WHERE price <= 8388608; +name price +discount 0 +coke 100 +note PC 32767 +bike 8388607 +SELECT * FROM items WHERE price >= 8388607; +name price +bike 8388607 +car 16777215 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result new file mode 100644 index 00000000..8586d091 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price SMALLINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("note PC", 65535); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 32767); +SELECT * FROM items; +name price +discount 0 +coke 100 +tablet PC 32767 +note PC 65535 +SELECT * FROM items WHERE price <= 32768; +name price +discount 0 +coke 100 +tablet PC 32767 +SELECT * FROM items WHERE price >= 32767; +name price +tablet PC 32767 +note PC 65535 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result new file mode 100644 index 00000000..90adb048 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price TINYINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 255); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +discount 0 +coke 100 +hamburger 255 +SELECT * FROM items WHERE price <= 100; +name price +discount 0 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result new file mode 100644 index 00000000..be97d4fc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +party_year YEAR, +KEY (party_year) +) DEFAULT CHARSET UTF8; +INSERT INTO aniversary_memos (title, party_year) +VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Wow! Today is the anniversary party day!", "13"); +SELECT * FROM aniversary_memos; +id title party_year +1 We need a big cake! 2011 +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +id title party_year +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result new file mode 100644 index 00000000..a56271bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +party_year YEAR +) DEFAULT CHARSET UTF8; +INSERT INTO aniversary_memos (title, party_year) +VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Wow! Today is the anniversary party day!", "13"); +SELECT * FROM aniversary_memos; +id title party_year +1 We need a big cake! 2011 +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +id title party_year +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result b/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result new file mode 100644 index 00000000..ab6be3a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/count_star.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int PRIMARY KEY +); +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +SELECT COUNT(*) FROM ids; +COUNT(*) +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result new file mode 100644 index 00000000..56c868b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result @@ -0,0 +1,33 @@ +DROP DATABASE IF EXISTS `master/production`; +DROP DATABASE IF EXISTS `master/development`; +CREATE DATABASE `master/production`; +USE `master/production`; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title) VALUES ("clear day (production)"); +INSERT INTO diaries (title) VALUES ("rainy day (production)"); +INSERT INTO diaries (title) VALUES ("cloudy day (production)"); +SELECT * FROM diaries; +id title +1 clear day (production) +2 rainy day (production) +3 cloudy day (production) +CREATE DATABASE `master/development`; +USE `master/development`; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title) VALUES ("clear day (development)"); +INSERT INTO diaries (title) VALUES ("rainy day (development)"); +INSERT INTO diaries (title) VALUES ("cloudy day (development)"); +SELECT * FROM diaries; +id title +1 clear day (development) +2 rainy day (development) +3 cloudy day (development) +USE test; +DROP DATABASE `master/production`; +DROP DATABASE `master/development`; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000..d2a00b77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result @@ -0,0 +1,172 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int); +create table t2 (c1 int); +create table t3 (c1 int); +drop table t1,t2,t3; +create table t1 (c1 int, c2 int, c3 int); +create table t2 (c1 int primary key, c2 int, c3 int); +drop table t1,t2; +create table t1 (c1 bit); +desc t1; +Field Type Null Key Default Extra +c1 bit(1) YES NULL +drop table t1; +create table t1 (c1 tinyint); +desc t1; +Field Type Null Key Default Extra +c1 tinyint(4) YES NULL +drop table t1; +create table t1 (c1 smallint); +desc t1; +Field Type Null Key Default Extra +c1 smallint(6) YES NULL +drop table t1; +create table t1 (c1 mediumint); +desc t1; +Field Type Null Key Default Extra +c1 mediumint(9) YES NULL +drop table t1; +create table t1 (c1 int); +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +drop table t1; +create table t1 (c1 bigint); +desc t1; +Field Type Null Key Default Extra +c1 bigint(20) YES NULL +drop table t1; +create table t1 (c1 double); +desc t1; +Field Type Null Key Default Extra +c1 double YES NULL +drop table t1; +create table t1 (c1 float); +desc t1; +Field Type Null Key Default Extra +c1 float YES NULL +drop table t1; +create table t1 (c1 decimal); +desc t1; +Field Type Null Key Default Extra +c1 decimal(10,0) YES NULL +drop table t1; +create table t1 (c1 date); +desc t1; +Field Type Null Key Default Extra +c1 date YES NULL +drop table t1; +create table t1 (c1 time); +desc t1; +Field Type Null Key Default Extra +c1 time YES NULL +drop table t1; +create table t1 (c1 timestamp); +desc t1; +Field Type Null Key Default Extra +c1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +drop table t1; +create table t1 (c1 datetime); +desc t1; +Field Type Null Key Default Extra +c1 datetime YES NULL +drop table t1; +create table t1 (c1 year); +desc t1; +Field Type Null Key Default Extra +c1 year(4) YES NULL +drop table t1; +create table t1 (c1 char(10)); +desc t1; +Field Type Null Key Default Extra +c1 char(10) YES NULL +drop table t1; +create table t1 (c1 varchar(10)); +desc t1; +Field Type Null Key Default Extra +c1 varchar(10) YES NULL +drop table t1; +create table t1 (c1 binary(10)); +desc t1; +Field Type Null Key Default Extra +c1 binary(10) YES NULL +drop table t1; +create table t1 (c1 varbinary(10)); +desc t1; +Field Type Null Key Default Extra +c1 varbinary(10) YES NULL +drop table t1; +create table t1 (c1 tinyblob); +desc t1; +Field Type Null Key Default Extra +c1 tinyblob YES NULL +drop table t1; +create table t1 (c1 blob); +desc t1; +Field Type Null Key Default Extra +c1 blob YES NULL +drop table t1; +create table t1 (c1 mediumblob); +desc t1; +Field Type Null Key Default Extra +c1 mediumblob YES NULL +drop table t1; +create table t1 (c1 longblob); +desc t1; +Field Type Null Key Default Extra +c1 longblob YES NULL +drop table t1; +create table t1 (c1 tinytext); +desc t1; +Field Type Null Key Default Extra +c1 tinytext YES NULL +drop table t1; +create table t1 (c1 text); +desc t1; +Field Type Null Key Default Extra +c1 text YES NULL +drop table t1; +create table t1 (c1 mediumtext); +desc t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +drop table t1; +create table t1 (c1 longtext); +desc t1; +Field Type Null Key Default Extra +c1 longtext YES NULL +drop table t1; +create table t1 (c1 enum("yes","no")); +desc t1; +Field Type Null Key Default Extra +c1 enum('yes','no') YES NULL +drop table t1; +create table t1 (c1 set("A","B","AB","O")); +desc t1; +Field Type Null Key Default Extra +c1 set('A','B','AB','O') YES NULL +drop table t1; +create table t1 (c1 int, `_id` int) engine = mroonga; +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +_id int(11) YES NULL +drop table t1; +create table t1 (c1 int, `_score` float) engine = mroonga; +ERROR HY000: [column][create] name can't start with '_' and contains only 0-9, A-Z, a-z, #, @, - or _: <_score> +create table t1 (c1 int, `_id` text) engine = mroonga; +ERROR HY000: _id must be numeric data type +create table t1 (c1 int, `_id` int, index(`_id`)) engine = mroonga; +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, primary key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, primary key (_id) using hash); +drop table t1; +create table t1 (_id int, c1 int, unique key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, unique key (_id) using hash); +drop table t1; +create table t1 (_id int, c1 int, key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, key (_id) using hash); +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result new file mode 100644 index 00000000..e4c4ea05 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_comment.result @@ -0,0 +1,15 @@ +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR"' +) DEFAULT CHARSET=utf8; +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result new file mode 100644 index 00000000..9923b91f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_flags_parameter.result @@ -0,0 +1,15 @@ +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT FLAGS='COLUMN_VECTOR' +) DEFAULT CHARSET=utf8; +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result new file mode 100644 index 00000000..7dede867 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_comment.result @@ -0,0 +1,23 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'groonga_type "tags"' +) DEFAULT CHARSET=utf8; +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + +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_column_groonga_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_nonexistent.result new file mode 100644 index 00000000..99dc30aa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_nonexistent.result @@ -0,0 +1,6 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'groonga_type "Nonexistent"' +) DEFAULT CHARSET=utf8mb4; +ERROR HY000: unknown custom Groonga type name for column: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result new file mode 100644 index 00000000..89e28aea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_groonga_type_parameter.result @@ -0,0 +1,30 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) GROONGA_TYPE='tags' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL `GROONGA_TYPE`='tags', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + +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_column_type_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result new file mode 100644 index 00000000..357adfdf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_comment.result @@ -0,0 +1,23 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText + +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_column_type_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_nonexistent.result new file mode 100644 index 00000000..a66a2bd2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_column_type_nonexistent.result @@ -0,0 +1,6 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'type "Nonexistent"' +) DEFAULT CHARSET=utf8mb4; +ERROR HY000: unknown custom Groonga type name for column: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result new file mode 100644 index 00000000..edda98cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED +) DEFAULT CHARSET=utf8 +COMMENT='Free style normal comment'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='Free style normal comment' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result new file mode 100644 index 00000000..0c33fac1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result @@ -0,0 +1,15 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result new file mode 100644 index 00000000..8d39cac4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_comment.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT '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_index_flags_index_medium.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result new file mode 100644 index 00000000..e9d90b0b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_medium.result @@ -0,0 +1,10 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +content_size INT NOT NULL, +KEY (content_size) COMMENT 'flags "INDEX_MEDIUM"' +) 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_size index COLUMN_INDEX|INDEX_MEDIUM memos content_size +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result new file mode 100644 index 00000000..38a83b89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_index_small.result @@ -0,0 +1,10 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +is_read BOOL NOT NULL, +KEY (is_read) COMMENT 'flags "INDEX_SMALL"' +) 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#is_read index COLUMN_INDEX|INDEX_SMALL memos is_read +DROP TABLE memos; 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 00000000..e90fd833 --- /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 '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_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result new file mode 100644 index 00000000..8fbbd197 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_flags_parameter.result @@ -0,0 +1,15 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `content` varchar(64) NOT NULL, + FULLTEXT KEY `content` (`content`) `FLAGS`='WITH_POSITION|WITH_WEIGHT' +) ENGINE=Mroonga 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_index_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_none.result new file mode 100644 index 00000000..3d31400f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_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_index_flags_with_position_and_with_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_index_flags_with_position_and_with_weight.result new file mode 100644 index 00000000..8f0c4995 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_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_index_normalizer_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result new file mode 100644 index 00000000..e2d405a1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_comment.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んだ。"); +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ふらつく" IN BOOLEAN MODE); +day content +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); +day content +2013-04-23 ブラックコーヒーを飲んだ。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result new file mode 100644 index 00000000..b6da79c7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_fulltext_index_bin.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んだ。"); +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ふらつく" IN BOOLEAN MODE); +day content +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); +day content +2013-04-23 ブラックコーヒーを飲んだ。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result new file mode 100644 index 00000000..2a05ccdc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_index_bin.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create diaries TABLE_PAT_KEY Time +column_create diaries content COLUMN_SCALAR ShortText +column_create diaries day COLUMN_SCALAR Time + +table_create diaries#content TABLE_PAT_KEY ShortText --normalizer NormalizerAuto + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create diaries#content index COLUMN_INDEX diaries content +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result new file mode 100644 index 00000000..9d12e2d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES latin1; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerMySQLGeneralCI"' +) DEFAULT CHARSET=latin1; +INSERT INTO diaries VALUES ("2013-04-23", "I drunk a black cookie."); +ERROR HY000: [tokenizer] failed to open normalized string +SELECT * FROM diaries; +day content +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_none.result new file mode 100644 index 00000000..52c6f055 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_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_index_normalizer_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result new file mode 100644 index 00000000..d68de436 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_normalizer_parameter.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) `NORMALIZER`='NormalizerAuto' +) ENGINE=Mroonga 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; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result new file mode 100644 index 00000000..29f27d15 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_comment.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id int PRIMARY KEY AUTO_INCREMENT, +body text, +FULLTEXT INDEX body_index (body) +COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' +) DEFAULT CHARSET utf8; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); +SELECT * FROM diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) +ORDER BY id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +DROP TABLE diaries; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result new file mode 100644 index 00000000..34545ecc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_default.result @@ -0,0 +1,25 @@ +drop table if exists diaries; +set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer; +set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +insert into diaries (body) values ("finished Groonga."); +select * from diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +4 finished Groonga. +select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +drop table diaries; +set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result new file mode 100644 index 00000000..f827c0ad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_parser_off.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS variables; +CREATE TABLE variables ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +FULLTEXT INDEX (name) COMMENT 'parser "off"' +) DEFAULT CHARSET=utf8; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); +SELECT * FROM variables; +id name +1 mroonga_database_path_prefix +2 mroonga_default_tokenizer +3 mroonga_default_wrapper_engine +4 mroonga_dry_write +5 mroonga_enable_optimization +6 mroonga_libgroonga_version +7 mroonga_log_file +8 mroonga_log_level +9 mroonga_match_escalation_threshold +10 mroonga_version +SELECT * FROM variables +WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); +id name +3 mroonga_default_wrapper_engine +2 mroonga_default_tokenizer +DROP TABLE variables; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result new file mode 100644 index 00000000..ad68ca01 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_multiple_token_filters.result @@ -0,0 +1,22 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result new file mode 100644 index 00000000..2cbb5a6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_one_token_filter.result @@ -0,0 +1,22 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_index_token_filters_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result new file mode 100644 index 00000000..333cf3d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_token_filters_parameter.result @@ -0,0 +1,28 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `content` varchar(64) NOT NULL, + FULLTEXT KEY `content` (`content`) `TOKEN_FILTERS`='TokenFilterStopWord,TokenFilterStopWord' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_index_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result new file mode 100644 index 00000000..a3904216 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_comment.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id int PRIMARY KEY AUTO_INCREMENT, +body text, +FULLTEXT INDEX body_index (body) +COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) DEFAULT CHARSET utf8; +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); +SELECT * FROM diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) +ORDER BY id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result new file mode 100644 index 00000000..34545ecc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_default.result @@ -0,0 +1,25 @@ +drop table if exists diaries; +set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer; +set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +insert into diaries (body) values ("finished Groonga."); +select * from diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +4 finished Groonga. +select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +drop table diaries; +set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result new file mode 100644 index 00000000..91a5b96d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_off.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS variables; +CREATE TABLE variables ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +FULLTEXT INDEX (name) COMMENT 'tokenizer "off"' +) DEFAULT CHARSET=utf8; +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); +SELECT * FROM variables; +id name +1 mroonga_database_path_prefix +2 mroonga_default_tokenizer +3 mroonga_default_wrapper_engine +4 mroonga_dry_write +5 mroonga_enable_optimization +6 mroonga_libgroonga_version +7 mroonga_log_file +8 mroonga_log_level +9 mroonga_match_escalation_threshold +10 mroonga_version +SELECT * FROM variables +WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); +id name +3 mroonga_default_wrapper_engine +2 mroonga_default_tokenizer +DROP TABLE variables; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result new file mode 100644 index 00000000..c827abe2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_index_tokenizer_parameter.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id int PRIMARY KEY AUTO_INCREMENT, +body text, +FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' +) DEFAULT CHARSET utf8; +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); +SELECT * FROM diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) +ORDER BY id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result new file mode 100644 index 00000000..dbf69362 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_default.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +DROP TABLE IF EXISTS terms; +SET NAMES utf8; +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY +) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); +id content +1 1日の消費㌍は約2000㌔㌍ +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_hash.result new file mode 100644 index 00000000..5e4f4afa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_normalizer_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_table_token_filters_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result new file mode 100644 index 00000000..8934be78 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_multiple_token_filters.result @@ -0,0 +1,30 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord,TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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 + +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_table_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result new file mode 100644 index 00000000..e3df2850 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_one_token_filter.result @@ -0,0 +1,30 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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/create_table_table_token_filters_stop_word.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result new file mode 100644 index 00000000..bc21ed97 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_table_token_filters_stop_word.result @@ -0,0 +1,23 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +INSERT INTO terms VALUES ("and", true); +INSERT INTO memos VALUES (1, "Hello"); +INSERT INTO memos VALUES (2, "Hello and Good-bye"); +INSERT INTO memos VALUES (3, "Good-bye"); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("+\"Hello and\"" IN BOOLEAN MODE); +id content +1 Hello +2 Hello and Good-bye +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result new file mode 100644 index 00000000..5fb52294 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result @@ -0,0 +1,21 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +20 ka ki ku ke +delete from t1 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result new file mode 100644 index 00000000..f318e125 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT, +KEY (id) +) DEFAULT CHARSET UTF8; +INSERT INTO ids VALUES(1); +INSERT INTO ids VALUES(2); +INSERT INTO ids VALUES(3); +SELECT * FROM ids ORDER BY id; +id +1 +2 +3 +DELETE FROM ids WHERE id = 1; +SELECT * FROM ids ORDER BY id; +id +2 +3 +DELETE FROM ids WHERE id = 2; +SELECT * FROM ids ORDER BY id; +id +3 +DELETE FROM ids WHERE id = 3; +SELECT * FROM ids ORDER BY id; +id +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result new file mode 100644 index 00000000..76a4ed88 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result @@ -0,0 +1,19 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +delete from t1 where _id = 2; +select * from t1; +_id c1 +1 100 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result new file mode 100644 index 00000000..6307c55f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result @@ -0,0 +1,19 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +delete from t1 where _id = 2; +select * from t1; +_id c1 +1 100 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result new file mode 100644 index 00000000..7503c0b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result @@ -0,0 +1,34 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +4 102 +delete from t1 where c1=3; +select * from t1; +c1 c2 +1 100 +2 101 +4 102 +flush tables; +delete from t1 where c1=2; +select * from t1; +c1 c2 +1 100 +4 102 +delete from t1; +select * from t1; +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result new file mode 100644 index 00000000..23cc23ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS numbers; +CREATE TABLE numbers ( +data BIGINT UNSIGNED +); +INSERT INTO numbers VALUES(18446744073709551615); +SELECT * FROM numbers ORDER BY data; +data +18446744073709551615 +DELETE FROM numbers WHERE data = 18446744073709551615; +SELECT * FROM numbers ORDER BY data; +data +DROP TABLE numbers; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result new file mode 100644 index 00000000..4bd97162 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result @@ -0,0 +1,14 @@ +drop database if exists groonga; +create database groonga; +drop database groonga; +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop database groonga; +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop table t1, t2; +drop database groonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result new file mode 100644 index 00000000..ebc7db1c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_no_table.result @@ -0,0 +1,20 @@ +SET NAMES UTF8; +DROP DATABASE IF EXISTS another; +CREATE DATABASE another; +USE another; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +DROP TABLE diaries; +USE test; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX (title) +); +DROP DATABASE another; +SELECT mroonga_command('object_exist mroonga_operations'); +mroonga_command('object_exist mroonga_operations') +true +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000..99896765 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result @@ -0,0 +1,5 @@ +drop table if exists alphabet, `with-hyphen`; +create table alphabet (c1 int primary key, c2 int, c3 int); +drop table alphabet; +create table `with-hyphen` (c1 int primary key, c2 int, c3 int); +drop table `with-hyphen`; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result b/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result new file mode 100644 index 00000000..449f6437 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result @@ -0,0 +1 @@ +flush logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result new file mode 100644 index 00000000..e2e712af --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_add.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned +); +ALTER TABLE articles ADD FOREIGN KEY (comment) REFERENCES comments (comment); +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result new file mode 100644 index 00000000..fc3cda00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_alter_drop.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +ALTER TABLE articles DROP FOREIGN KEY comment; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result new file mode 100644 index 00000000..c17780c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +DROP TABLE articles; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result new file mode 100644 index 00000000..e16157b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_existent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 100; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (one or more child rows exist in ) +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result new file mode 100644 index 00000000..edaba25f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_delete_nonexistent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 200; +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result new file mode 100644 index 00000000..ddc54cb3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result @@ -0,0 +1,51 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result new file mode 100644 index 00000000..c220bb89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_nonexistent.result @@ -0,0 +1,37 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (foreign record doesn't exist: :<1>) +SELECT * FROM entries; +content comment_id +SELECT * FROM comments; +id content +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result new file mode 100644 index 00000000..5ea0ae3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_rename.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +DROP TABLE IF EXISTS articles2; +DROP TABLE IF EXISTS comments2; +CREATE TABLE comments ( +comment int unsigned PRIMARY KEY, +content text NOT NULL +); +CREATE TABLE articles ( +content text NOT NULL, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +RENAME TABLE comments TO comments2; +RENAME TABLE articles TO articles2; +SHOW CREATE TABLE articles2; +Table Create Table +articles2 CREATE TABLE `articles2` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments2` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +SELECT * FROM information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles2 comments2 +DROP TABLE articles2; +DROP TABLE comments2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result new file mode 100644 index 00000000..9db892d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_existent.result @@ -0,0 +1,55 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; +SELECT * FROM entries; +content comment_id +Hello! 200 +SELECT * FROM comments; +id content +100 Good entry! +200 Very good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100], +[200,"Very good entry!",200] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,200,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result new file mode 100644 index 00000000..615c3a09 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_update_nonexistent.result @@ -0,0 +1,53 @@ +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE TABLE comments ( +id int unsigned PRIMARY KEY, +content varchar(140) NOT NULL +); +CREATE TABLE entries ( +content varchar(140) NOT NULL, +comment_id int unsigned, +FOREIGN KEY (comment_id) REFERENCES comments (id) +); +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (foreign record doesn't exist: :<200>) +SELECT * FROM entries; +content comment_id +Hello! 100 +SELECT * FROM comments; +id content +100 Good entry! +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create comments TABLE_PAT_KEY UInt32 +column_create comments content COLUMN_SCALAR ShortText +column_create comments id COLUMN_SCALAR UInt32 + +table_create entries TABLE_NO_KEY +column_create entries content COLUMN_SCALAR ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create entries comment_id COLUMN_SCALAR comments + +load --table comments +[ +["_key","content","id"], +[100,"Good entry!",100] +] + +load --table entries +[ +["_id","comment_id","content"], +[1,100,"Hello!"] +] + +column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id +DROP TABLE entries; +DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result new file mode 100644 index 00000000..96c6ae41 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST("" IN BOOLEAN MODE); +title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result new file mode 100644 index 00000000..5beda03c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("\\(groonga\\)*" IN BOOLEAN MODE); +id content +1 (groonga) Installed! +3 (groonga) Upgraded! +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result new file mode 100644 index 00000000..758f969f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); +id title content +3 富士山 今日も天気がよくてきれいに見える。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_all.result new file mode 100644 index 00000000..c8270bc3 --- /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_boolean_mode_pragma_default_operator_minus_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result new file mode 100644 index 00000000..d10b5dad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); +content +Yesterday was fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result new file mode 100644 index 00000000..82c7e799 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); +content +Today is good day. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result new file mode 100644 index 00000000..c4c7b0e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); +content +Today is good day. +Yesterday was good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result new file mode 100644 index 00000000..0c81bf6c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE) +ORDER BY content; +content +Today is fine. +Today is good day. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result new file mode 100644 index 00000000..dfeb71f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE) +ORDER BY content; +content +Today is fine. +Tomorrow will be fine. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result new file mode 100644 index 00000000..e72cf8d4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE) +ORDER BY content; +content +Today is good day. +Tomorrow will be fine. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result new file mode 100644 index 00000000..4d1f6592 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); +content +Today is good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result new file mode 100644 index 00000000..7a30baab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today fi*" IN BOOLEAN MODE); +content +Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result new file mode 100644 index 00000000..deda6f3b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); +content +Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result new file mode 100644 index 00000000..2d25388f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); +content +Today is good day. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result new file mode 100644 index 00000000..deb4bd85 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_operator.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*SS content @ '天気'" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*SS content @ '天気'" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 1 +3 富士山 今日も天気がよくてきれいに見える。 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result new file mode 100644 index 00000000..43b21bc1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_syntax_script_selector.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS items; +DROP TABLE IF EXISTS readings; +SET NAMES utf8; +CREATE TABLE readings ( +reading VARCHAR(255) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE items ( +name VARCHAR(255) PRIMARY KEY, +readings TEXT COMMENT 'flags "COLUMN_VECTOR", type "readings"', +FULLTEXT INDEX items_index(readings) COMMENT 'table "readings"' +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES("日本", "ニホン ニッポン"); +INSERT INTO items VALUES("ローマ字", "ローマジ"); +INSERT INTO items VALUES("漢字", "カンジ"); +SELECT *, MATCH(readings) +AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE) AS score +FROM items +WHERE MATCH(readings) +AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE); +name readings score +日本 ニホン ニッポン 1 +DROP TABLE items; +DROP TABLE readings; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result new file mode 100644 index 00000000..b8f15d98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 12 +3 富士山 今日も天気がよくてきれいに見える。 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result new file mode 100644 index 00000000..42aa068a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 3 +3 富士山 今日も天気がよくてきれいに見える。 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result new file mode 100644 index 00000000..c73d2660 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 3 +3 富士山 今日も天気がよくてきれいに見える。 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result new file mode 100644 index 00000000..b1b9d5f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +title VARCHAR(255), +tag1 VARCHAR(10), +tag2 VARCHAR(10), +tag3 VARCHAR(10), +tag4 VARCHAR(10), +tag5 VARCHAR(10), +tag6 VARCHAR(10), +tag7 VARCHAR(10), +tag8 VARCHAR(10), +tag9 VARCHAR(10), +tag10 VARCHAR(10), +FULLTEXT INDEX (tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +) DEFAULT CHARSET=utf8; +INSERT INTO memos +VALUES("Groonga", +"tag 1", +"tag 2", +"tag 3", +"tag 4", +"tag 5", +"tag 6", +"tag 7", +"tag 8", +"tag 9", +"tag 10"); +SELECT title, +MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE) AS score +FROM memos +WHERE MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE); +title score +Groonga 110 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result new file mode 100644 index 00000000..02db17e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +category VARCHAR(10), +content TEXT, +FULLTEXT INDEX (title, category, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "日記", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気予報", "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "天気", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, category, content) +AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, category, content) +AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE); +id title category content score +2 天気予報 天気 明日の富士山の天気について 13 +3 富士山 天気 今日も天気がよくてきれいに見える。 11 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result new file mode 100644 index 00000000..46dd3290 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result new file mode 100644 index 00000000..d782357e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result new file mode 100644 index 00000000..fd5b8d1e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = "IGNORE"; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +id content +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result new file mode 100644 index 00000000..a485e1ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +id content +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result new file mode 100644 index 00000000..c542ba1a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result @@ -0,0 +1,29 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii"); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result new file mode 100644 index 00000000..bd208d52 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "̕xmR̓VCɂ‚",""); +insert into t1 values(2, "","̕xmR̓VC͕܂"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ̕xmR̓VCɂ‚ +2 ̕xmR̓VC͕܂ +3 dummy dummy +select * from t1 where match(c2) against("xmR"); +c1 c2 c3 +1 ̕xmR̓VCɂ‚ +select * from t1 where match(c3) against("xmR"); +c1 c2 c3 +2 ̕xmR̓VC͕܂ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result new file mode 100644 index 00000000..51360875 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "ٻλŷˤĤ",""); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ٻλŷˤĤ +2 ٻλŷʬޤ +3 dummy dummy +select * from t1 where match(c2) against("ٻλ"); +c1 c2 c3 +1 ٻλŷˤĤ +select * from t1 where match(c3) against("ٻλ"); +c1 c2 c3 +2 ٻλŷʬޤ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result new file mode 100644 index 00000000..cfff3f2e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日の富士山の天気について あああああああ +2 いいいいい 明日の富士山の天気は分かりません +3 dummy dummy +select * from t1 where match(c2) against("富士山"); +c1 c2 c3 +1 明日の富士山の天気について あああああああ +select * from t1 where match(c3) against("富士山"); +c1 c2 c3 +2 いいいいい 明日の富士山の天気は分かりません +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result new file mode 100644 index 00000000..136585c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8mb4; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci, +content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET utf8mb4; +INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); +INSERT INTO diaries VALUES(2, "Mathmatics", "𝐀𝐁𝐂𝐃𝐄 | U+1D400-U+1D405"); +INSERT INTO diaries VALUES(3, "ひらがな", "あいうえお"); +SELECT * +FROM diaries +WHERE MATCH (content) AGAINST("ABCDE" IN BOOLEAN MODE); +id title content +1 Alphabet ABCDE +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result new file mode 100644 index 00000000..bb7b3b63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST(""); +title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result new file mode 100644 index 00000000..25da7011 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT SQL_CALC_FOUND_ROWS * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +6 2011 12 2 初雪 今日の天気は雪! +1 2011 11 9 Hello 今日からはじめました。 +2 2011 11 10 天気 明日の富士山の天気について +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +SELECT FOUND_ROWS(); +FOUND_ROWS() +6 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result new file mode 100644 index 00000000..a23d8e5b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS bugs, tags; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags", flags "COLUMN_VECTOR"', +FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL groonga"); +INSERT INTO bugs (id, tags) VALUES (3, "mroonga"); +SELECT * +FROM bugs +WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); +id tags +1 Linux MySQL +2 MySQL groonga +DROP TABLE bugs, tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result new file mode 100644 index 00000000..e38913a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result @@ -0,0 +1,32 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +drop index title on diaries; +select * from diaries where match(title) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +create fulltext index new_title_index on diaries (title); +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result new file mode 100644 index 00000000..c337bfcb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result @@ -0,0 +1,46 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +drop table t1,t2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result new file mode 100644 index 00000000..5c48cadf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result @@ -0,0 +1,17 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result new file mode 100644 index 00000000..6475f9ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result @@ -0,0 +1,23 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(content) against("富士山"); +id title content +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result new file mode 100644 index 00000000..4244af26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result @@ -0,0 +1,29 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result new file mode 100644 index 00000000..8d18efaa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result @@ -0,0 +1,31 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +drop index title on diaries; +select * from diaries where match(title, content) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result new file mode 100644 index 00000000..0e85b45a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result @@ -0,0 +1,26 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +update diaries set title = "チョモランマ" where id = 3; +update diaries set content = "チョモランマと富士山" where id = 1; +select * from diaries where match(title, content) against("富士山"); +id title content +1 Hello チョモランマと富士山 +2 天気 明日の富士山の天気について +select * from diaries where match(title) against("富士山"); +id title content +select * from diaries where match(content) against("富士山"); +id title content +1 Hello チョモランマと富士山 +2 天気 明日の富士山の天気について +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result new file mode 100644 index 00000000..37d7597b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result @@ -0,0 +1,23 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +title text, +body text, +fulltext index title_index (title), +fulltext index body_index (body) +) default charset utf8; +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); +select * from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body +1 survey will start groonga! +select *, match(title) against("survey"), match(body) against("groonga") +from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body match(title) against("survey") match(body) against("groonga") +1 survey will start groonga! 1048577 149797 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result new file mode 100644 index 00000000..db4afff0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES("Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES("天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES("富士山", "今日も天気がよくてきれいに見える。"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("*D+ 今日 天気" IN BOOLEAN MODE); +title content +富士山 今日も天気がよくてきれいに見える。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result new file mode 100644 index 00000000..b6d6febf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result @@ -0,0 +1,68 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +1 10 aa ii uu ee oo +3 10 aa ii uu ee oo +5 20 aa ii uu ee oo +7 20 aa ii uu ee oo +select * from t1 where not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where match(c3) against("+dummy" in boolean mode) order by c1; +c1 c2 c3 +select * from t1 where not match(c3) against("+dummy" in boolean mode) order by c1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("+uu" in boolean mode) order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result new file mode 100644 index 00000000..f1f7888c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST("Ruby" IN BOOLEAN MODE) OR +MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +title +Start mroonga +Start groonga and Ruby +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result new file mode 100644 index 00000000..d1f0d6bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_against.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga mroonga" IN BOOLEAN MODE) +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start mroonga 0 +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result new file mode 100644 index 00000000..b4a07cd0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_different_match.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +body TEXT, +FULLTEXT KEY (title), +FULLTEXT KEY (body) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga", "I read groonga's tutorial."); +INSERT INTO diaries VALUES("Start mroonga", "I read mroonga's tutorial."); +INSERT INTO diaries VALUES("Start groonga and Ruby", "I installed rroonga."); +SELECT * FROM diaries; +title body +Start groonga I read groonga's tutorial. +Start mroonga I read mroonga's tutorial. +Start groonga and Ruby I installed rroonga. +SELECT *, MATCH(body) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) +ORDER BY MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +title body score +Start groonga and Ruby I installed rroonga. 0 +Start groonga I read groonga's tutorial. 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result new file mode 100644 index 00000000..125b35fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_no_where.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start mroonga 0 +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result new file mode 100644 index 00000000..a3a668c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_boolean_mode_same_match_against.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_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 00000000..7f0934d3 --- /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 00000000..fa577b17 --- /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 00000000..958883e5 --- /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 00000000..76abb660 --- /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 00000000..30130e6c --- /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 00000000..ac2e7522 --- /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/fulltext_two_inner_join.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result new file mode 100644 index 00000000..e39790ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result @@ -0,0 +1,41 @@ +DROP TABLE IF EXISTS users, posts, comments; +SET NAMES utf8; +CREATE TABLE users ( +id int NOT NULL, +name varchar(50) NOT NULL, +PRIMARY KEY (id), +KEY (name) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE posts ( +id int NOT NULL, +content mediumtext, +user_id int NOT NULL, +PRIMARY KEY (id), +FULLTEXT KEY (content) +) DEFAULT CHARSET=utf8; +CREATE TABLE comments ( +id int NOT NULL, +user_id int NOT NULL, +post_id int NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"), +(2, "Bob"), +(3, "Calros"); +INSERT INTO posts VALUES (1, "Hello!", 1), +(2, "World!", 2), +(3, "Great!", 3); +INSERT INTO comments VALUES (1, 1, 1), +(2, 2, 1), +(3, 3, 3); +SELECT * +FROM comments +INNER JOIN posts +ON posts.id = comments.post_id AND +MATCH (posts.content) AGAINST ("Hello!" IN BOOLEAN MODE) +INNER JOIN users +ON users.id = comments.user_id AND +users.name = "Alice"; +id user_id post_id id content user_id id name +1 1 1 1 Hello! 1 1 Alice +DROP TABLE users, posts, comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result new file mode 100644 index 00000000..d3ac2387 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_10_0_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result new file mode 100644 index 00000000..5f7bc98a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_5_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +id title body +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result new file mode 100644 index 00000000..d3ac2387 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_5_6_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result new file mode 100644 index 00000000..e07eae11 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_auto-escape.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES('It is Groonga'); +INSERT INTO diaries VALUES('It is Mroonga'); +SELECT mroonga_command('select', +'table', 'diaries', +'filter', 'title @ "Groonga"'); +mroonga_command('select', +'table', 'diaries', +'filter', 'title @ "Groonga"') +[[[1],[["_id","UInt32"],["title","LongText"]],[1,"It is Groonga"]]] +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result new file mode 100644 index 00000000..1551d32c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT mroonga_command('select diaries --match_columns "title" --query "groonga"'); +mroonga_command('select diaries --match_columns "title" --query "groonga"') +[[[2],[["_id","UInt32"],["title","LongText"]],[1,"Start groonga"],[3,"Start groonga and Ruby"]]] +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result new file mode 100644 index 00000000..e588408e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_special-database-name.result @@ -0,0 +1,22 @@ +DROP DATABASE IF EXISTS `db-1`; +CREATE DATABASE `db-1`; +USE `db-1`; +SET NAMES UTF8; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +SELECT mroonga_command('dump --dump_plugins no'); +mroonga_command('dump --dump_plugins no') +table_create diaries TABLE_NO_KEY +column_create diaries title COLUMN_SCALAR LongText + +table_create diaries#title TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +column_create diaries#title index COLUMN_INDEX|WITH_POSITION diaries title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result new file mode 100644 index 00000000..98213e81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape() AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): Incorrect number of arguments: 0 for 1..2 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result new file mode 100644 index 00000000..bb68bbff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape(29) AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 1st query argument must be string diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result new file mode 100644 index 00000000..77dc420f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:', 29) AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 2st argument must be escape target characters as string diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result new file mode 100644 index 00000000..b002262a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_all.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:') AS escaped_query; +escaped_query +\+\-\>\<\~\*\(\)\"\\\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result new file mode 100644 index 00000000..c2e7d8f5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_custom.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:', '()<>~') AS escaped_query; +escaped_query ++-\>\<\~*\(\)"\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result new file mode 100644 index 00000000..ec765b11 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_join.result @@ -0,0 +1,26 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS queries; +CREATE TABLE users ( +id INT +); +CREATE TABLE queries ( +user_id INT, +query TEXT +); +INSERT INTO users VALUES (1); +INSERT INTO users VALUES (2); +INSERT INTO users VALUES (3); +INSERT INTO queries VALUES (1, '(a)'); +INSERT INTO queries VALUES (2, '(b)'); +INSERT INTO queries VALUES (3, '(c)'); +SELECT users.id, mroonga_escape(queries.query) AS escaped_query +FROM queries +LEFT JOIN users ON users.id = queries.user_id +ORDER BY users.id; +id escaped_query +1 \(a\) +2 \(b\) +3 \(c\) +DROP TABLE queries; +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result new file mode 100644 index 00000000..adf6b3a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_match_against.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET NAMES utf8mb4; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8mb4; +INSERT INTO memos VALUES(1, "(Groonga) Installed!"); +INSERT INTO memos VALUES(2, "(Mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(Groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST(mroonga_escape("(groonga)") IN BOOLEAN MODE); +id content +1 (Groonga) Installed! +3 (Groonga) Upgraded! +DROP TABLE memos; +SET GLOBAL mroonga_default_tokenizer = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result new file mode 100644 index 00000000..c6c39fcc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_named.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:' AS query) AS escaped_query; +escaped_query +\+\-\>\<\~\*\(\)\"\\\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result new file mode 100644 index 00000000..5a57c144 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_query_nested.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT mroonga_escape(mroonga_escape('*groonga*')); +mroonga_escape(mroonga_escape('*groonga*')) +\\\*groonga\\\* +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result new file mode 100644 index 00000000..246f2800 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_decimal.result @@ -0,0 +1,11 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS data; +CREATE TABLE data ( +value DECIMAL(5, 3) +); +INSERT INTO data VALUES (2.9); +SELECT mroonga_escape(value AS script) +FROM data; +mroonga_escape(value AS script) +2.9 +DROP TABLE data; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result new file mode 100644 index 00000000..902bbd31 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_integer.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape(-29 AS script) AS escaped_query; +escaped_query +-29 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result new file mode 100644 index 00000000..178ff312 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_real.result @@ -0,0 +1,11 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS data; +CREATE TABLE data ( +value REAL +); +INSERT INTO data VALUES (2.9); +SELECT mroonga_escape(value AS script) +FROM data; +mroonga_escape(value AS script) +2.9 +DROP TABLE data; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result new file mode 100644 index 00000000..6f5e9b2a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_script_string.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('a\"\\\'z' AS script) AS escaped_query; +escaped_query +"a\"\\'z" diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result new file mode 100644 index 00000000..96df6506 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_dynamic_keyword.result @@ -0,0 +1,11 @@ +CREATE TABLE keywords ( +keyword text +); +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +keyword) AS highlighted +FROM keywords; +highlighted +Mroonga is the Groonga based storage engine. +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result new file mode 100644 index 00000000..ca7d7968 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_japanese.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'ロック', '更新') AS highlighted; +highlighted +Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result new file mode 100644 index 00000000..9f4a3dff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_multiple_keywords.result @@ -0,0 +1,4 @@ +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +'Mroonga', 'Groonga') AS highlighted; +highlighted +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result new file mode 100644 index 00000000..bf280dba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_normalizer.result @@ -0,0 +1,4 @@ +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', +'mroonga') AS highlighted; +highlighted +Mroonga is the Groonga based storage engine. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result new file mode 100644 index 00000000..b2d0f509 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'ロック 更新 -ボトルネック' AS query) AS highlighted; +highlighted +Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result new file mode 100644 index 00000000..bd11a908 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_query_pragma.result @@ -0,0 +1,13 @@ +SET NAMES utf8; +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'*D- +ロック +更新 ボトルネック' AS query) AS highlighted; +highlighted +Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result new file mode 100644 index 00000000..fce13d9c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_highlight_html_record.result @@ -0,0 +1,32 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); +SELECT mroonga_highlight_html(content, 'Mroonga') AS highlighted +FROM memos; +highlighted +Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL. +Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL's official binary. So we can use it more easily than Tritonn. +Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga's fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga's read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data. diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result new file mode 100644 index 00000000..42064b7f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result @@ -0,0 +1,28 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int); +select last_insert_grn_id(); +last_insert_grn_id() +0 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +2 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +4 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +6 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +8 +select last_insert_grn_id(1); +ERROR HY000: Can't initialize function 'last_insert_grn_id'; last_insert_grn_id must not have arguments +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result new file mode 100644 index 00000000..b0db86cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +); +SELECT last_insert_id(); +last_insert_id() +0 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result new file mode 100644 index 00000000..ec6f2f98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +); +SELECT last_insert_id(); +last_insert_id() +0 +SELECT last_insert_id(10); +last_insert_id(10) +10 +SELECT last_insert_id(); +last_insert_id() +10 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result new file mode 100644 index 00000000..fe5cc885 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_default.result @@ -0,0 +1,3 @@ +SELECT mroonga_normalize('aBcAbC㍑'); +mroonga_normalize('aBcAbC㍑') +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result new file mode 100644 index 00000000..3d675fb0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_normalizer.result @@ -0,0 +1,3 @@ +SELECT mroonga_normalize('aBcAbC㍑', "NormalizerAuto"); +mroonga_normalize('aBcAbC㍑', "NormalizerAuto") +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result new file mode 100644 index 00000000..7d4192f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_normalize_record.result @@ -0,0 +1,7 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('aBcAbC㍑'); +SELECT mroonga_normalize(content) FROM memos; +mroonga_normalize(content) +abcabcリットル diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result new file mode 100644 index 00000000..9160633c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_multiple.result @@ -0,0 +1,18 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +INSERT INTO synonyms VALUES ('Mroonga', 'Mroonga'); +INSERT INTO synonyms VALUES ('Mroonga', 'Groonga MySQL'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +((Mroonga) OR (Groonga MySQL)) ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result new file mode 100644 index 00000000..6a2b5d7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_no_index.result @@ -0,0 +1,15 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result new file mode 100644 index 00000000..5f7b0f73 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_one.result @@ -0,0 +1,16 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'Mroonga Rroonga PGroonga') AS query; +query +Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result new file mode 100644 index 00000000..4690cd01 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_query_expand_pragma.result @@ -0,0 +1,17 @@ +SET NAMES UTF8; +DROP TABLE IF EXISTS synonyms; +CREATE TABLE synonyms ( +term varchar(255), +synonym varchar(255), +INDEX (term) +); +INSERT INTO synonyms VALUES ('D+', '[D+]'); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +SELECT mroonga_query_expand('synonyms', +'term', +'synonym', +'*D+ Mroonga Rroonga PGroonga') AS query; +query +*D+ Mroonga ((Rroonga) OR (Groonga Ruby)) PGroonga +DROP TABLE synonyms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result new file mode 100644 index 00000000..5766f822 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result @@ -0,0 +1,120 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa bb cc dd ee >< ff gg hh ii jj kk ll mm nn"); +insert into t1 values(2,20,"nn mm ll kk jj >< ii hh gg ff ee dd cc bb aa"); +insert into t1 values(3,30,"cc dd ee ff gg >< hh ii jj kk ll mm nn oo pp"); +insert into t1 values(4,40,"ee ff gg hh ii >< jj kk ll mm nn oo pp qq rr"); +insert into t1 values(5,50,"AA BB CC DD EE >< FF GG HH II JJ KK LL MM NN"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ...a bb cc dd...
+...e >< ff gg...
+ +2 20 ...g ff ee dd...
+... cc bb aa...
+ +3 30 ...c dd ee ff...
+ +4 40 ...ee ff gg h...
+ +5 50 ...A BB CC DD...
+...E >< FF GG...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 ... BB CC DD ...
+... >< FF GG ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ...a(w1)[ bb] cc(w3)[ dd]... +...e ><(w2)[ ff] gg... + +2 20 ...g(w2)[ ff] ee(w3)[ dd]... +... cc(w1)[ bb] aa... + +3 30 ...c(w3)[ dd] ee(w2)[ ff]... + +4 40 ...ee(w2)[ ff] gg h... + +5 50 ...A(w1)[ BB] CC(w3)[ DD]... +...E ><(w2)[ FF] GG... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 ... (w1)[BB] CC (w3)[DD] ... +... >< (w2)[FF] GG ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result new file mode 100644 index 00000000..a21157a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result @@ -0,0 +1,91 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "","QX̕xmR̓VCɂ‚"); +insert into t1 values(2, "","QX̕xmR̓VC͕܂"); +insert into t1 values(3, "","29̕xmR̓VCɂ‚"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') +1 ...QX̕x...
+...VCɂ...
+ +2 ...QX̕x...
+...VC͕...
+ +3 ...29̕xm...
+...VCɂ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') +1 ...QX̕x...
+...VCɂ...
+ +2 ...QX̕x...
+...VC͕...
+ +3 ...xmR...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') +1 ...QX̕x...
+...VCɂ...
+ +2 ...QX̕x...
+...VC͕...
+ +3 ...29̕xm...
+...VCɂ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') +1 ...QX̕x...
+...VCɂ...
+ +2 ...QX̕x...
+...VC͕...
+ +3 ...xmR...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') +1 ...(w1)[QX]̕x... +...(w2)[VC]ɂ... + +2 ...(w1)[QX]̕x... +...(w2)[VC]͕... + +3 ...(w1)[29]̕xm... +...(w2)[VC]ɂ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') +1 ...(w1)[QX]̕x... +...(w2)[VC]ɂ... + +2 ...(w1)[QX]̕x... +...(w2)[VC]͕... + +3 ...(w3)[xmR]... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') +1 ...(w1)[QX]̕x... +...(w2)[VC]ɂ... + +2 ...(w1)[QX]̕x... +...(w2)[VC]͕... + +3 ...(w1)[29]̕xm... +...(w2)[VC]ɂ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') +1 ...(w1)[QX]̕x... +...(w2)[VC]ɂ... + +2 ...(w1)[QX]̕x... +...(w2)[VC]͕... + +3 ...(w3)[xmR]... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result new file mode 100644 index 00000000..e4c6a417 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result @@ -0,0 +1,91 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "","ٻλŷˤĤ"); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "","29ٻλŷˤĤ"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') +1 ......
+...ŷˤ...
+ +2 ......
+...ŷʬ...
+ +3 ...29ٻ...
+...ŷˤ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') +1 ......
+...ŷˤ...
+ +2 ......
+...ŷʬ...
+ +3 ...ٻλ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') +1 ......
+...ŷˤ...
+ +2 ......
+...ŷʬ...
+ +3 ...29ٻ...
+...ŷˤ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') +1 ......
+...ŷˤ...
+ +2 ......
+...ŷʬ...
+ +3 ...ٻλ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') +1 ...(w1)[]... +...(w2)[ŷ]ˤ... + +2 ...(w1)[]... +...(w2)[ŷ]ʬ... + +3 ...(w1)[29]ٻ... +...(w2)[ŷ]ˤ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') +1 ...(w1)[]... +...(w2)[ŷ]ˤ... + +2 ...(w1)[]... +...(w2)[ŷ]ʬ... + +3 ...(w3)[ٻλ]... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') +1 ...(w1)[]... +...(w2)[ŷ]ˤ... + +2 ...(w1)[]... +...(w2)[ŷ]ʬ... + +3 ...(w1)[29]ٻ... +...(w2)[ŷ]ˤ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') +1 ...(w1)[]... +...(w2)[ŷ]ˤ... + +2 ...(w1)[]... +...(w2)[ŷ]ʬ... + +3 ...(w3)[ٻλ]... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result new file mode 100644 index 00000000..24665fbf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_dynamic_keyword.result @@ -0,0 +1,11 @@ +CREATE TABLE keywords ( +keyword text +); +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', +keyword) as snippet +FROM keywords; +snippet +
Mroonga is the Groonga based storage engine.
+
Mroonga is the Groonga based storage engine.
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result new file mode 100644 index 00000000..f1efa42c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_japanese.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'ロック', '更新') as snippet; +snippet +
がデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。
用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネッ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result new file mode 100644 index 00000000..013ad5b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_keywords.result @@ -0,0 +1,4 @@ +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', +'Mroonga', 'Groonga') as snippet; +snippet +
Mroonga is the Groonga based storage engine.
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result new file mode 100644 index 00000000..d3f790b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_multiple_snippets.result @@ -0,0 +1,10 @@ +SELECT mroonga_snippet_html('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.', +'lock') as snippet; +snippet +
ng. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one
f the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga's read-lock free characteristic. And you might have the performance bottle neck in the storage engine in upda
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result new file mode 100644 index 00000000..d05c2323 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'ロック 更新 -ボトルネック' AS query) as snippet; +snippet +
がデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。
用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネッ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result new file mode 100644 index 00000000..02ce9098 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_query_pragma.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', +'*D- +ロック +更新 ボトルネック' AS query) as snippet; +snippet +
がデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。
用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネッ
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result new file mode 100644 index 00000000..469defbc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_html_record.result @@ -0,0 +1,30 @@ +CREATE TABLE memos ( +content text +); +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); +SELECT mroonga_snippet_html(content, 'Mroonga') as snippet +FROM memos; +snippet +
Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily.
So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.
+
onn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can
+
Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result new file mode 100644 index 00000000..78cee626 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_snippet("Invalid charset test", 10, 2, "nonexistent_charset", +1, 0, "...", "...", "charset", "<", ">"); +ERROR HY000: Can't initialize function 'mroonga_snippet'; Unknown charset: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result new file mode 100644 index 00000000..bf967adb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_snippet("Unsuppported charset test", 10, 2, "big5", +1, 0, "...", "...", "charset", "<", ">"); +ERROR HY000: Can't initialize function 'mroonga_snippet'; Unknown charset: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result new file mode 100644 index 00000000..05a63a3d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result @@ -0,0 +1,95 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "あああああ","29日の富士山の天気について"); +insert into t1 values(2, "いいいいい","29日の富士山の天気は分かりません"); +insert into t1 values(3, "ううううう","29日の富士山の天気について"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 あああああ ...29日...
+...富士山...
+ +2 いいいいい ...29日...
+...富士山...
+ +3 ううううう ...29日の...
+...天気に...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 あああああ ...29日...
+...富士山...
+ +2 いいいいい ...29日...
+...富士山...
+ +3 ううううう ...富士山...
+...天気に...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 あああああ ...29日...
+...富士山...
+ +2 いいいいい ...29日...
+...富士山...
+ +3 ううううう ...29日の...
+...天気に...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 あああああ ...29日...
+...富士山...
+ +2 いいいいい ...29日...
+...富士山...
+ +3 ううううう ...富士山...
+...天気に...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 あああああ ...(w1)[29日]... +...(w3)[富士山]... + +2 いいいいい ...(w1)[29日]... +...(w3)[富士山]... + +3 ううううう ...(w1)[29日]の... +...(w2)[天気]に... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 あああああ ...(w1)[29日]... +...(w3)[富士山]... + +2 いいいいい ...(w1)[29日]... +...(w3)[富士山]... + +3 ううううう ...(w3)[富士山]... +...(w2)[天気]に... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 あああああ ...(w1)[29日]... +...(w3)[富士山]... + +2 いいいいい ...(w1)[29日]... +...(w3)[富士山]... + +3 ううううう ...(w1)[29日]の... +...(w2)[天気]に... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 あああああ ...(w1)[29日]... +...(w3)[富士山]... + +2 いいいいい ...(w1)[29日]... +...(w3)[富士山]... + +3 ううううう ...(w3)[富士山]... +...(w2)[天気]に... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result new file mode 100644 index 00000000..fc16c590 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +location GEOMETRY NOT NULL +); +INSERT IGNORE INTO shops VALUES (NULL), (NULL); +Warnings: +Warning 1048 Column 'location' cannot be null +Warning 1048 Column 'location' cannot be null +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 new file mode 100644 index 00000000..5095232d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result @@ -0,0 +1,167 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL, +SPATIAL KEY location_index (location) +); +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +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) +3 soba-taiyaki-ku POINT(139.65908805555557 35.68371194444445) +4 kuruma POINT(139.70620694444446 35.72151611111111) +5 hirose-ya POINT(139.68560805555555 35.71484388888889) +6 sazare POINT(139.68504305555555 35.71465305555556) +7 omede-taiyaki POINT(139.8171538888889 35.70051611111111) +8 onaga-ya POINT(139.81105 35.69825388888889) +9 shiro-ya POINT(139.63861111111112 35.70551694444445) +10 fuji-ya POINT(139.637115 35.703938055555554) +11 miyoshi POINT(139.53732305555556 35.644538888888896) +12 juju-ya POINT(139.69575500000002 35.62892194444445) +13 tatsumi-ya POINT(139.63865694444445 35.66550111111111) +14 tetsuji POINT(139.76857 35.680911944444446) +15 gazuma-ya POINT(139.64759805555553 35.70081694444444) +16 honma-mon POINT(139.65257305555556 35.72273611111111) +17 naniwa-ya POINT(139.79623388888888 35.73006111111111) +18 kuro-dai POINT(139.70483388888888 35.650345) +19 daruma POINT(139.7705988888889 35.68146111111111) +20 yanagi-ya POINT(139.78398111111113 35.685341111111114) +21 sharaku POINT(139.79484611111113 35.71696888888889) +22 takane POINT(139.56091305555555 35.69860111111112) +23 chiyoda POINT(139.65281694444442 35.64260111111111) +24 da-ka-po POINT(139.72735611111113 35.62734611111111) +25 matsushima-ya POINT(139.73738111111112 35.64055611111111) +26 kazuya POINT(139.760895 35.67350805555556) +27 furuya-kogane-an POINT(139.67607111111113 35.68060305555556) +28 hachi-no-ie POINT(139.66810611111111 35.608021111111114) +29 azuki-chan POINT(139.67320305555555 35.641510000000004) +30 kuriko-an POINT(139.79682888888888 35.71201305555556) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.71252388888888 35.61619888888889) +32 naze-ya POINT(139.66583305555557 35.60903888888889) +33 sanoki-ya POINT(139.7707211111111 35.66592) +34 shigeta POINT(139.78027305555557 35.67262611111111) +35 nishimi-ya POINT(139.77462805555555 35.671825) +36 hiiragi POINT(139.71151694444444 35.64770111111111) +SELECT id, name, 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) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +EXPLAIN +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 select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE shops range location_index location_index 34 NULL 36 Using where; Using filesort +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result new file mode 100644 index 00000000..73573355 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_bulk_insert_null.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +location GEOMETRY NOT NULL +); +INSERT INTO shops VALUES (NULL), (NULL); +ERROR 23000: Column 'location' cannot be null +SELECT ST_AsText(location) FROM shops; +ST_AsText(location) +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result new file mode 100644 index 00000000..2f432fc8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_strict_sql_mode_contains.result @@ -0,0 +1,169 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL, +SPATIAL KEY location_index (location) +); +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +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) +3 soba-taiyaki-ku POINT(139.65908805555557 35.68371194444445) +4 kuruma POINT(139.70620694444446 35.72151611111111) +5 hirose-ya POINT(139.68560805555555 35.71484388888889) +6 sazare POINT(139.68504305555555 35.71465305555556) +7 omede-taiyaki POINT(139.8171538888889 35.70051611111111) +8 onaga-ya POINT(139.81105 35.69825388888889) +9 shiro-ya POINT(139.63861111111112 35.70551694444445) +10 fuji-ya POINT(139.637115 35.703938055555554) +11 miyoshi POINT(139.53732305555556 35.644538888888896) +12 juju-ya POINT(139.69575500000002 35.62892194444445) +13 tatsumi-ya POINT(139.63865694444445 35.66550111111111) +14 tetsuji POINT(139.76857 35.680911944444446) +15 gazuma-ya POINT(139.64759805555553 35.70081694444444) +16 honma-mon POINT(139.65257305555556 35.72273611111111) +17 naniwa-ya POINT(139.79623388888888 35.73006111111111) +18 kuro-dai POINT(139.70483388888888 35.650345) +19 daruma POINT(139.7705988888889 35.68146111111111) +20 yanagi-ya POINT(139.78398111111113 35.685341111111114) +21 sharaku POINT(139.79484611111113 35.71696888888889) +22 takane POINT(139.56091305555555 35.69860111111112) +23 chiyoda POINT(139.65281694444442 35.64260111111111) +24 da-ka-po POINT(139.72735611111113 35.62734611111111) +25 matsushima-ya POINT(139.73738111111112 35.64055611111111) +26 kazuya POINT(139.760895 35.67350805555556) +27 furuya-kogane-an POINT(139.67607111111113 35.68060305555556) +28 hachi-no-ie POINT(139.66810611111111 35.608021111111114) +29 azuki-chan POINT(139.67320305555555 35.641510000000004) +30 kuriko-an POINT(139.79682888888888 35.71201305555556) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.71252388888888 35.61619888888889) +32 naze-ya POINT(139.66583305555557 35.60903888888889) +33 sanoki-ya POINT(139.7707211111111 35.66592) +34 shigeta POINT(139.78027305555557 35.67262611111111) +35 nishimi-ya POINT(139.77462805555555 35.671825) +36 hiiragi POINT(139.71151694444444 35.64770111111111) +SELECT id, name, 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) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +EXPLAIN +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 select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE shops NULL range location_index location_index 34 NULL 36 100.00 Using where; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`shops`.`id` AS `id`,`test`.`shops`.`name` AS `name`,st_astext(`test`.`shops`.`location`) AS `location_text` from `test`.`shops` where mbrcontains((st_geometryfromtext('LineString(139.7727 35.6684, 139.7038 35.7121)')),`test`.`shops`.`location`) order by `test`.`shops`.`id` +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result b/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result new file mode 100644 index 00000000..b403eccf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/i_s.result @@ -0,0 +1,7 @@ +SHOW CREATE TABLE INFORMATION_SCHEMA.MROONGA_STATS; +Table Create Table +Mroonga_stats CREATE TEMPORARY TABLE `Mroonga_stats` ( + `VERSION` varchar(40) NOT NULL DEFAULT '', + `rows_written` int(11) NOT NULL DEFAULT 0, + `rows_read` int(11) NOT NULL DEFAULT 0 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result new file mode 100644 index 00000000..78ed69f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +created_at datetime, +title varchar(256), +KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); +SELECT * +FROM diaries FORCE INDEX(created_at_key) +WHERE created_at = "2012-10-25 16:18:29"; +created_at title +2012-10-25 16:18:29 Today is shiny day. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result new file mode 100644 index 00000000..a55a184d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS timer; +CREATE TABLE timer ( +id int PRIMARY KEY, +elapsed time, +KEY elapsed_key(elapsed) +); +INSERT INTO timer VALUES (1, "00:00:00"); +INSERT INTO timer VALUES (2, "15:11:12"); +INSERT INTO timer VALUES (3, "838:59:59"); +INSERT INTO timer VALUES (4, "-838:59:59"); +SELECT * +FROM timer FORCE INDEX(elapsed_key) +WHERE elapsed = "-838:59:59"; +id elapsed +4 -838:59:59 +DROP TABLE timer; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result new file mode 100644 index 00000000..57eb6ae2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +created_at timestamp, +title varchar(256), +KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("1970-01-01 12:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-05 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("2038-01-18 15:14:07", "The end"); +SELECT * +FROM diaries FORCE INDEX(created_at_key) +WHERE created_at = "2012-10-05 16:18:29"; +created_at title +2012-10-05 16:18:29 Today is shiny day. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result new file mode 100644 index 00000000..043d1e3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, index using btree (c2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) USING BTREE +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +flush tables; +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result new file mode 100644 index 00000000..5f92c086 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, a int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id a +1 100 +2 100 +3 100 +4 100 +select * from t1 where _id = 2; +_id a +2 100 +select * from t1 where _id = 20; +_id a +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result new file mode 100644 index 00000000..b0bbaf09 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); +INSERT INTO t1 VALUES(null, 100); +ERROR 23000: Column '_id' cannot be null +INSERT INTO t1 VALUES(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +SELECT * FROM t1; +_id a +1 100 +2 100 +3 100 +4 100 +SELECT * FROM t1 WHERE _id = 2; +_id a +2 100 +SELECT * FROM t1 WHERE _id = 20; +_id a +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result new file mode 100644 index 00000000..1a30a1ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, a int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id a +1 100 +2 100 +3 100 +4 100 +select * from t1 where _id = 2; +_id a +2 100 +select * from t1 where _id = 20; +_id a +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result new file mode 100644 index 00000000..6e642ce1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, index using hash (c2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) USING HASH +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +flush tables; +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result new file mode 100644 index 00000000..8fb46156 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_strict_sql_mode_id_primary.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); +INSERT INTO t1 VALUES(null, 100); +ERROR 23000: Column '_id' cannot be null +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +INSERT INTO t1 VALUES(1,100); +ERROR 01000: Data truncated for column '_id' at row 1 +SELECT * FROM t1; +_id a +SELECT * FROM t1 WHERE _id = 2; +_id a +SELECT * FROM t1 WHERE _id = 20; +_id a +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result new file mode 100644 index 00000000..c680a373 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result @@ -0,0 +1,32 @@ +drop table if exists listing; +set names utf8; +create table scores ( +id int primary key auto_increment not null, +name char(30) not null, +score int not null, +index property (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +id name score +2 Taro Yamada -12 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result new file mode 100644 index 00000000..a627f432 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 SMALLINT, +c2 SMALLINT, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` smallint(6) DEFAULT NULL, + `c2` smallint(6) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result new file mode 100644 index 00000000..368f88a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 BIGINT UNSIGNED, +c2 BIGINT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` bigint(20) unsigned DEFAULT NULL, + `c2` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result new file mode 100644 index 00000000..6d5516f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 INT UNSIGNED, +c2 INT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` int(10) unsigned DEFAULT NULL, + `c2` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result new file mode 100644 index 00000000..b0edfb9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 SMALLINT UNSIGNED, +c2 SMALLINT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` smallint(5) unsigned DEFAULT NULL, + `c2` smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result new file mode 100644 index 00000000..587e3c5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 VARCHAR(10), +c2 VARCHAR(10), +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` varchar(10) DEFAULT NULL, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +('1999', '12'), +('2000', '11'), +('2001', '10'), +('2002', '09'), +('2003', '08'), +('2004', '07'), +('2005', '06'), +('2006', '05'), +('2007', '04'), +('2008', '03'), +('2009', '02'), +('2010', '01'); +SELECT * FROM t1 WHERE c1 > '2005'; +id c1 c2 +8 2006 05 +9 2007 04 +10 2008 03 +11 2009 02 +12 2010 01 +SELECT * FROM t1 WHERE c1 >= '2005'; +id c1 c2 +7 2005 06 +8 2006 05 +9 2007 04 +10 2008 03 +11 2009 02 +12 2010 01 +SELECT * FROM t1 WHERE c1 = '2005'; +id c1 c2 +7 2005 06 +SELECT * FROM t1 WHERE c1 <= '2005'; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 09 +5 2003 08 +6 2004 07 +7 2005 06 +SELECT * FROM t1 WHERE c1 < '2005'; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 09 +5 2003 08 +6 2004 07 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result new file mode 100644 index 00000000..055ca69f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_asc_asc.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +score3 INT, +INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `score3` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`score2`,`score3`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); +SELECT * +FROM items +WHERE score1 = 2 +ORDER BY score2 ASC, score3 ASC; +id score1 score2 score3 +3 2 10 100 +7 2 20 -100 +8 2 20 0 +9 2 20 100 +4 2 30 -100 +5 2 30 0 +6 2 30 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result new file mode 100644 index 00000000..0d7faddc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_order_by_where_equal_desc_desc.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +score3 INT, +INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `score3` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`score2`,`score3`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); +SELECT * +FROM items +WHERE score1 = 2 +ORDER BY score2 DESC, score3 DESC; +id score1 score2 score3 +6 2 30 100 +5 2 30 0 +4 2 30 -100 +9 2 20 100 +8 2 20 0 +7 2 20 -100 +3 2 10 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result new file mode 100644 index 00000000..ac673bac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result @@ -0,0 +1,29 @@ +drop table if exists listing; +set names utf8; +create table scores ( +name char(30) not null, +score int not null, +primary key (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +name score +Taro Yamada -12 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result new file mode 100644 index 00000000..20b45861 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result @@ -0,0 +1,37 @@ +drop table if exists listing; +set names utf8; +create table scores ( +name char(30) not null, +score int not null, +primary key (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where name = "Taro Yamada"; +name score +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where name = "Taro Yamada" and score = 29; +name score +Taro Yamada 29 +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result new file mode 100644 index 00000000..b390ca7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_strict_sql_mode_update.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +name char(30) NOT NULL, +score int NOT NULL, +PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); +SELECT * FROM scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; +ERROR 01000: data truncated for primary key column: +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result new file mode 100644 index 00000000..a58a487a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +name char(30) NOT NULL, +score int NOT NULL, +PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); +SELECT * FROM scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; +Warnings: +Warning 1265 data truncated for primary key column: +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result new file mode 100644 index 00000000..870c5ba7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at > "2014-09-11 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result new file mode 100644 index 00000000..06661210 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at >= "2014-09-11 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result new file mode 100644 index 00000000..f528f90b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at < "2014-09-12 00:00:00" + ORDER BY created_at DESC; +id score created_at +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result new file mode 100644 index 00000000..9250ecb8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_all_used_less_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at <= "2014-09-12 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result new file mode 100644 index 00000000..8e5f4329 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +8 2 0 2015-07-02 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result new file mode 100644 index 00000000..1a3021e2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +8 2 0 2015-07-02 00:00:00 +5 2 0 2015-07-01 12:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result new file mode 100644 index 00000000..6adaa987 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +2 2 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result new file mode 100644 index 00000000..dfc7ef6f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score1` (`score1`,`created_at`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE score1 = 2 AND created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +5 2 0 2015-07-01 12:00:00 +2 2 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result new file mode 100644 index 00000000..502c0c10 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +4 2 0 2015-07-02 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result new file mode 100644 index 00000000..60ffa88b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +4 2 0 2015-07-02 00:00:00 +3 2 0 2015-07-01 12:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result new file mode 100644 index 00000000..2cdb3de3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +2 2 0 2015-07-01 00:00:00 +1 1 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result new file mode 100644 index 00000000..3443bbc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT, +score2 INT, +created_at DATETIME, +INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score1` int(11) DEFAULT NULL, + `score2` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`,`score1`,`score2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +SELECT * +FROM items +WHERE created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; +id score1 score2 created_at +3 2 0 2015-07-01 12:00:00 +2 2 0 2015-07-01 00:00:00 +1 1 0 2015-07-01 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result new file mode 100644 index 00000000..02222965 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result @@ -0,0 +1,39 @@ +drop table if exists listing; +set names utf8; +create table listing ( +id int primary key auto_increment not null, +last_name char(30) not null, +first_name char(30) not null, +index name (last_name, first_name) +) default charset utf8; +show create table listing; +Table Create Table +listing CREATE TABLE `listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `last_name` char(30) NOT NULL, + `first_name` char(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `name` (`last_name`,`first_name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop index name on listing; +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +create index new_name_index on listing (last_name, first_name); +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop table listing; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result new file mode 100644 index 00000000..df67c8a3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +INDEX property (NAME, SCORE) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +REPLACE scores (id, name, score) VALUES (3, "Taro Yamada", 28); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Taro Yamada 28 +4 Taro Yamada 10 +SELECT * FROM scores WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +3 Taro Yamada 28 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result new file mode 100644 index 00000000..c75733f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS temperatures; +CREATE TABLE temperatures ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(20), +temperature DOUBLE, +KEY temperature_index(temperature), +KEY multi_index(temperature, title) +); +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +temperature +12.7 +28.2 +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +temperature +-2.8 +12.7 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +title temperature +Rainy! 12.7 +Hot! 28.2 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +title temperature +Snow! -2.8 +Rainy! 12.7 +DROP TABLE temperatures; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result new file mode 100644 index 00000000..452cae2d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS temperatures; +CREATE TABLE temperatures ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(20), +temperature FLOAT, +KEY temperature_index(temperature), +KEY multi_index(temperature, title) +); +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +temperature +12.7 +28.2 +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +temperature +-2.8 +12.7 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +title temperature +Rainy! 12.7 +Hot! 28.2 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +title temperature +Snow! -2.8 +Rainy! 12.7 +DROP TABLE temperatures; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result new file mode 100644 index 00000000..ecf7706b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +INDEX property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`score`,`name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +SELECT * FROM scores WHERE score = 29; +id name score +1 Taro Yamada 29 +SELECT * FROM scores WHERE score = 29 AND name = "Taro Yamada"; +id name score +1 Taro Yamada 29 +SELECT * FROM scores WHERE (score >= -12 AND score < 29) AND name = "Taro Yamada"; +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result new file mode 100644 index 00000000..b6091784 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_max.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT NOT NULL, +score2 INT NOT NULL, +INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); +SELECT MAX(score2) FROM scores WHERE score1 = 2; +MAX(score2) +3 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result new file mode 100644 index 00000000..0792751a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_min.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score1 INT NOT NULL, +score2 INT NOT NULL, +INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); +SELECT MIN(score2) FROM scores WHERE score1 = 2; +MIN(score2) +-3 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result new file mode 100644 index 00000000..ad73669e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result @@ -0,0 +1,40 @@ +drop table if exists listing; +set names utf8; +create table listing ( +id int primary key auto_increment not null, +last_name char(30) not null, +first_name char(30) not null, +index name (last_name, first_name) +) default charset utf8; +show create table listing; +Table Create Table +listing CREATE TABLE `listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `last_name` char(30) NOT NULL, + `first_name` char(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `name` (`last_name`,`first_name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing; +id last_name first_name +1 Taro Yamada +2 Taro Suzuki +3 Jiro Yamada +4 Taro Tanaka +select * from listing where last_name = "Taro"; +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +1 Taro Yamada +select * from listing where last_name = "Taro" and first_name = "Suzuki"; +id last_name first_name +2 Taro Suzuki +select * from listing where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop table listing; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result new file mode 100644 index 00000000..543a9012 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result @@ -0,0 +1,41 @@ +drop table if exists scores; +set names utf8; +create table scores ( +given_name varchar(30) not null, +family_name varchar(30) not null, +score int not null, +primary key property (given_name, family_name, score) +) default charset utf8; +Warnings: +Warning 1280 Name 'property' ignored for PRIMARY key. +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `given_name` varchar(30) NOT NULL, + `family_name` varchar(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`given_name`,`family_name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores values("Taro", "Yamada", 29); +insert into scores values("Taro", "Yamada", -12); +insert into scores values("Jiro", "Yamada", 27); +insert into scores values("Taro", "Yamada", 10); +select * from scores; +given_name family_name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada"; +given_name family_name score +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada" and score = 29; +given_name family_name score +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada" and (score >= -12 and score < 29); +given_name family_name score +Taro Yamada -12 +Taro Yamada 10 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result new file mode 100644 index 00000000..61ce4406 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = "1000-01-01" AND end = "9999-12-31"; +id start end +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result new file mode 100644 index 00000000..21168547 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = "1000-01-02" AND end = "9999-12-31"; +id start end +2 1000-01-02 9999-12-31 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result new file mode 100644 index 00000000..93e34d88 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1000-01-02 2012-10-05 +1000-01-02 9999-12-31 +2012-10-25 9999-12-31 +9999-12-31 1000-01-02 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result new file mode 100644 index 00000000..bc1c3c57 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970-01-01 2012-10-05 +4 1970-01-01 1970-01-01 +1 2012-10-25 1970-01-01 +3 1970-01-01 1970-01-01 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result new file mode 100644 index 00000000..820ee4f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 1970-01-01 1970-01-01 +1 2012-10-25 1970-01-01 +4 1970-01-01 1970-01-01 +2 1970-01-01 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result new file mode 100644 index 00000000..c2a94a84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1000-01-02 2012-10-05 +4 1000-01-02 9999-12-31 +1 2012-10-25 9999-12-31 +3 9999-12-31 1000-01-02 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result new file mode 100644 index 00000000..2d100156 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 9999-12-31 1000-01-02 +1 2012-10-25 9999-12-31 +4 1000-01-02 9999-12-31 +2 1000-01-02 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result new file mode 100644 index 00000000..bd1bdc33 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; +id start end +1 2010-01-01 2012-10-05 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; +id start end +1 2010-01-01 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result new file mode 100644 index 00000000..a8546c4b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1000-01-02 00:00:00 2012-10-05 16:18:29 +1000-01-02 00:00:00 9999-12-31 23:59:59 +2012-10-25 16:18:29 9999-12-31 23:59:59 +9999-12-31 23:59:59 1000-01-02 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result new file mode 100644 index 00000000..130c03ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +SELECT * FROM ranges; +id start end +1 1990-01-01 00:00:00 2012-10-05 23:59:59 +DELETE FROM ranges WHERE id = 1; +INSERT IGNORE INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +SELECT * FROM ranges; +id start end +1 1990-01-01 00:00:00 2012-10-05 23:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result new file mode 100644 index 00000000..5cffb71d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1000-01-02 00:00:00 2012-10-05 16:18:29 +4 1000-01-02 00:00:00 9999-12-31 23:59:59 +1 2012-10-25 16:18:29 9999-12-31 23:59:59 +3 9999-12-31 23:59:59 1000-01-02 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result new file mode 100644 index 00000000..4429f787 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 9999-12-31 23:59:59 1000-01-02 00:00:00 +1 2012-10-25 16:18:29 9999-12-31 23:59:59 +4 1000-01-02 00:00:00 9999-12-31 23:59:59 +2 1000-01-02 00:00:00 2012-10-05 16:18:29 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result new file mode 100644 index 00000000..50d5da49 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result new file mode 100644 index 00000000..cb8a1c61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result @@ -0,0 +1,36 @@ +drop table if exists t1; +create table t1 (c1 int primary key, c2 decimal(65,30), c3 decimal(65,30), unique key uk1(c2,c3)); +insert into t1 values(1,123.456,0.000000000000000000000000000001); +insert into t1 values(2,-123.456,123.456); +insert into t1 values(3,98765432109876543210987654321098765.432109876543210987654321098765,-123.456); +insert into t1 values(4,-98765432109876543210987654321098765.432109876543210987654321098765,98765432109876543210987654321098765.432109876543210987654321098765); +insert into t1 values(5,0.000000000000000000000000000001,-98765432109876543210987654321098765.432109876543210987654321098765); +select c1, c2, c3 from t1 force index(uk1) where c2 = -98765432109876543210987654321098765.432109876543210987654321098765 and c3 = 98765432109876543210987654321098765.432109876543210987654321098765; +c1 c2 c3 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +c1 c2 c3 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +2 -123.456000000000000000000000000000 123.456000000000000000000000000000 +5 0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +1 123.456000000000000000000000000000 0.000000000000000000000000000001 +3 98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +c1 c2 c3 +3 98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +1 123.456000000000000000000000000000 0.000000000000000000000000000001 +5 0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +2 -123.456000000000000000000000000000 123.456000000000000000000000000000 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +select c2, c3 from t1 force index(uk1) order by c2, c3; +c2 c3 +-98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +-123.456000000000000000000000000000 123.456000000000000000000000000000 +0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +123.456000000000000000000000000000 0.000000000000000000000000000001 +98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +insert into t1 values(6,123.456,0.000000000000000000000000000001); +ERROR 23000: Duplicate entry '123.456000000000000000000000000000-0.000000000000000000000000...' for key 'uk1' +delete from t1 where c1 = 1; +insert into t1 values(1,123.456,0.000000000000000000000000000001); +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result new file mode 100644 index 00000000..4e0dec32 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (2, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (3, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (4, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +-838:59:59 838:59:59 +00:00:00 15:11:11 +00:00:00 838:59:59 +15:11:12 838:59:59 +838:59:59 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result new file mode 100644 index 00000000..3c6520a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +5 -838:59:59 838:59:59 +2 00:00:00 15:11:11 +4 00:00:00 838:59:59 +1 15:11:12 838:59:59 +3 838:59:59 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result new file mode 100644 index 00000000..c1be8030 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 838:59:59 00:00:00 +1 15:11:12 838:59:59 +4 00:00:00 838:59:59 +2 00:00:00 15:11:11 +5 -838:59:59 838:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result new file mode 100644 index 00000000..0613de3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; +id start end +1 13:21:48 15:11:12 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; +id start end +1 13:21:48 15:11:12 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result new file mode 100644 index 00000000..92e95d92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (4, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1970-01-01 12:00:00 2012-10-05 16:18:29 +1970-01-01 12:00:00 2038-01-18 15:14:07 +2012-10-25 16:18:29 2038-01-18 15:14:07 +2038-01-18 15:14:07 1970-01-01 12:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result new file mode 100644 index 00000000..35bc4123 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970-01-01 12:00:00 2012-10-05 16:18:29 +4 1970-01-01 12:00:00 2038-01-18 15:14:07 +1 2012-10-25 16:18:29 2038-01-18 15:14:07 +3 2038-01-18 15:14:07 1970-01-01 12:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result new file mode 100644 index 00000000..fbf88cf3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 2038-01-18 15:14:07 1970-01-01 12:00:00 +1 2012-10-25 16:18:29 2038-01-18 15:14:07 +4 1970-01-01 12:00:00 2038-01-18 15:14:07 +2 1970-01-01 12:00:00 2012-10-05 16:18:29 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result new file mode 100644 index 00000000..b799cc27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp DEFAULT '2016-04-21 00:00:00', +end timestamp DEFAULT '2016-04-22 00:00:00', +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result new file mode 100644 index 00000000..5c9cd959 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result new file mode 100644 index 00000000..ad936268 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (2, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (3, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = 1901 AND end = 2155; +id start end +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result new file mode 100644 index 00000000..e96754e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = 1901 AND end = 2155; +id start end +2 1901 2155 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result new file mode 100644 index 00000000..997c5e7d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1901 2012 +1901 2155 +2012 2155 +2155 1901 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result new file mode 100644 index 00000000..8200263a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (2, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (3, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970 2012 +4 1970 1970 +1 2012 1970 +3 1970 1970 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result new file mode 100644 index 00000000..fc85d2a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT IGNORE INTO ranges VALUES (1, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (2, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT IGNORE INTO ranges VALUES (3, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT IGNORE INTO ranges VALUES (4, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 1970 1970 +1 2012 1970 +4 1970 1970 +2 1970 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result new file mode 100644 index 00000000..335b9eb9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1901 2012 +4 1901 2155 +1 2012 2155 +3 2155 1901 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result new file mode 100644 index 00000000..524456b7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 2155 1901 +1 2012 2155 +4 1901 2155 +2 1901 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result new file mode 100644 index 00000000..7362411d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; +id start end +1 2010 2012 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; +id start end +1 2010 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result new file mode 100644 index 00000000..bfc30a1f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS scores; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +KEY property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`score`,`name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores WHERE score = 29; +id name score +3 Jiro Yamada 29 +1 Taro Yamada 29 +UPDATE scores SET name = "Saburo YAMADA" WHERE id = 3; +SELECT * FROM scores WHERE score = 29; +id name score +3 Saburo YAMADA 29 +1 Taro Yamada 29 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result new file mode 100644 index 00000000..550551d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result @@ -0,0 +1,34 @@ +drop table if exists listing; +set names utf8; +create table scores ( +id int primary key auto_increment not null, +name char(30) not null, +score int not null, +index property (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +3 Taro Yamada 27 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result new file mode 100644 index 00000000..95d7c78b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id char(10) CHARACTER SET latin1 PRIMARY KEY +); +INSERT INTO ids VALUES('abcdefghij'); +INSERT INTO ids VALUES('klmnopqrst'); +INSERT INTO ids VALUES('uvwxyz0123'); +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; +id +abcdefghij +klmnopqrst +uvwxyz0123 +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = 'abcdefghij'; +id +abcdefghij +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result new file mode 100644 index 00000000..f7a80206 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result new file mode 100644 index 00000000..fb08c660 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id char(6) CHARACTER SET latin1 PRIMARY KEY +); +INSERT INTO ids VALUES("abcdef"); +INSERT INTO ids VALUES( "cdef"); +INSERT INTO ids VALUES( "ef"); +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; +id +abcdef +cdef +ef +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "cdef"; +id +cdef +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result new file mode 100644 index 00000000..b1eafd2d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "cloudy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "duplicated day"); +ERROR 23000: Duplicate entry '2012-01-31' for key 'PRIMARY' +SELECT * FROM diaries; +day title +2012-01-29 clear day +2012-01-30 rainy day +2012-01-31 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29" AND "2012-01-30"; +day title +2012-01-29 clear day +2012-01-30 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result new file mode 100644 index 00000000..0ae41c51 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATETIME(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (day, title) +VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); +SELECT * FROM diaries; +day title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +2012-01-31 08:32:10.555500 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +day title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result new file mode 100644 index 00000000..f5e743dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATETIME PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (day, title) +VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-31 08:32:10", "cloudy day"); +SELECT * FROM diaries; +day title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +2012-01-31 08:32:10 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +day title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result new file mode 100644 index 00000000..6a529b50 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS releases; +CREATE TABLE releases ( +version DECIMAL(6, 3) PRIMARY KEY, +message TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); +INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); +INSERT INTO releases (version, message) VALUES (999.999, "the last release!"); +SELECT * FROM releases; +version message +10.000 10th release! +10.001 minor fix. +999.999 the last release! +SELECT * FROM releases WHERE version BETWEEN "9.000" AND "10.001"; +version message +10.000 10th release! +10.001 minor fix. +DROP TABLE releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result new file mode 100644 index 00000000..d36688bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS releases; +CREATE TABLE releases ( +version DECIMAL PRIMARY KEY, +message TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); +INSERT INTO releases (version, message) VALUES (10, "10th release!"); +INSERT INTO releases (version, message) VALUES (999, "the last release!"); +SELECT * FROM releases; +version message +1 the first release!!! +10 10th release! +999 the last release! +SELECT * FROM releases WHERE version BETWEEN "1" AND "10"; +version message +1 the first release!!! +10 10th release! +DROP TABLE releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result new file mode 100644 index 00000000..5437c789 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +time TIME(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO running_records (time, title) +VALUES ("01:00:00.000001", "normal condition"); +INSERT INTO running_records (time, title) +VALUES ("12:23:34.123456", "bad condition"); +INSERT INTO running_records (time, title) +VALUES ("-838:59:59.000000", "record failure"); +SELECT * FROM running_records; +time title +-838:59:59.000000 record failure +01:00:00.000001 normal condition +12:23:34.123456 bad condition +SELECT * FROM running_records +WHERE time BETWEEN "00:59:59.999999" AND "12:23:34.123456"; +time title +01:00:00.000001 normal condition +12:23:34.123456 bad condition +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result new file mode 100644 index 00000000..e59dee4c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +time TIME PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO running_records (time, title) +VALUES ("01:00:00", "normal condition"); +INSERT INTO running_records (time, title) +VALUES ("12:23:34", "bad condition"); +INSERT INTO running_records (time, title) +VALUES ("-838:59:59", "record failure"); +SELECT * FROM running_records; +time title +-838:59:59 record failure +01:00:00 normal condition +12:23:34 bad condition +SELECT * FROM running_records +WHERE time BETWEEN "00:59:59" AND "12:23:34"; +time title +01:00:00 normal condition +12:23:34 bad condition +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result new file mode 100644 index 00000000..0fba3da7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +time TIMESTAMP(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (time, title) +VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (time, title) +VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (time, title) +VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); +SELECT * FROM diaries; +time title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +2012-01-31 08:32:10.555500 cloudy day +SELECT * FROM diaries +WHERE time BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +time title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result new file mode 100644 index 00000000..8116bda2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +time TIMESTAMP PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-31 08:32:10", "cloudy day"); +SELECT * FROM diaries; +time title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +2012-01-31 08:32:10 cloudy day +SELECT * FROM diaries +WHERE time BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +time title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result new file mode 100644 index 00000000..9079d9c4 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result new file mode 100644 index 00000000..78c56f25 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +party_year YEAR PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +INSERT INTO aniversary_memos (party_year, title) +VALUES ("11", "We need a big cake!"); +INSERT INTO aniversary_memos (party_year, title) +VALUES ("2012", "Invitations are sent."); +INSERT INTO aniversary_memos (party_year, title) +VALUES ("13", "Wow! Today is the anniversary party day!"); +SELECT * FROM aniversary_memos; +party_year title +2011 We need a big cake! +2012 Invitations are sent. +2013 Wow! Today is the anniversary party day! +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +party_year title +2012 Invitations are sent. +2013 Wow! Today is the anniversary party day! +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_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 00000000..c2adc1cd --- /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 00000000..715d299d --- /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 00000000..d562fbbb --- /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 00000000..5ecb4699 --- /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 00000000..45b3fbe1 --- /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 00000000..2e896e5e --- /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 00000000..d5313c9d --- /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 00000000..c56a4332 --- /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_primary_greater_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_asc.result new file mode 100644 index 00000000..1ca4b145 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id > 1 ORDER BY ids.id ASC LIMIT 3; +id +2 +3 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result new file mode 100644 index 00000000..80dcb25f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_desc.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id > 3 ORDER BY ids.id DESC LIMIT 3; +id +5 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_asc.result new file mode 100644 index 00000000..4c1ff997 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id >= 2 ORDER BY ids.id ASC LIMIT 3; +id +2 +3 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_desc.result new file mode 100644 index 00000000..4998725a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_greater_than_or_equal_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id >= 3 ORDER BY ids.id DESC LIMIT 3; +id +5 +4 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result new file mode 100644 index 00000000..8b142f30 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id ASC LIMIT 3; +id +1 +2 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result new file mode 100644 index 00000000..eaf5b87e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id DESC LIMIT 3; +id +3 +2 +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_asc.result new file mode 100644 index 00000000..e1e96c9c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id ASC LIMIT 3; +id +1 +2 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_desc.result new file mode 100644 index 00000000..e8124ca1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_primary_less_than_or_equal_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id DESC LIMIT 3; +id +4 +3 +2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result new file mode 100644 index 00000000..77b32101 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT, +value BIGINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result new file mode 100644 index 00000000..b0004a3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT UNSIGNED, +value BIGINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result new file mode 100644 index 00000000..862a314c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id DOUBLE, +value DOUBLE, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); +SELECT * FROM ids; +id value +-16.6 1.1 +-8.8 2.2 +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +16.6 -1.1 +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; +id value +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result new file mode 100644 index 00000000..04d44130 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id FLOAT, +value FLOAT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); +SELECT * FROM ids; +id value +-16.6 1.1 +-8.8 2.2 +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +16.6 -1.1 +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; +id value +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result new file mode 100644 index 00000000..8d3f6f7f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +value INT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result new file mode 100644 index 00000000..d09f97e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT UNSIGNED, +value INT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result new file mode 100644 index 00000000..5242f10f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id MEDIUMINT, +value MEDIUMINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result new file mode 100644 index 00000000..41d9c0eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id MEDIUMINT UNSIGNED, +value MEDIUMINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result new file mode 100644 index 00000000..e34b7b7d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id SMALLINT, +value SMALLINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result new file mode 100644 index 00000000..9014f9af --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id SMALLINT UNSIGNED, +value SMALLINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result new file mode 100644 index 00000000..63b27fdd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id TINYINT, +value TINYINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result new file mode 100644 index 00000000..412b9b7c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id TINYINT UNSIGNED, +value TINYINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result new file mode 100644 index 00000000..c08522d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(5), +value VARCHAR(10), +KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_bin; +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); +SELECT * FROM ids; +id value +ABC aBC +ACD AbC +ADE ABc +AEF ABC +abc Abc +acd aBc +ade abC +aef abc +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; +id value +abc Abc +acd aBc +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result new file mode 100644 index 00000000..9882f2b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(5), +value VARCHAR(10), +KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); +SELECT * FROM ids; +id value +abc Abc +acd aBc +ade abC +aef abc +ABC aBC +ACD AbC +ADE ABc +AEF ABC +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; +id value +abc Abc +ABC aBC +acd aBc +ACD AbC +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result new file mode 100644 index 00000000..67f1f4f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +KEY (id) +); +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; +SELECT * FROM ids; +id +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result new file mode 100644 index 00000000..2cdde6c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(10), +KEY (id) +); +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; +SELECT * FROM ids; +id +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result new file mode 100644 index 00000000..23f63d2f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +PRIMARY KEY (id) +); +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; +SELECT * FROM ids; +id +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result new file mode 100644 index 00000000..7fa17bd7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(10), +PRIMARY KEY (id) +); +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; +SELECT * FROM ids; +id +1 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +2 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +3 +30 +31 +32 +4 +5 +6 +7 +8 +9 +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result new file mode 100644 index 00000000..f2a0b28b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_all.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int, +UNIQUE KEY (id) +); +INSERT INTO ids VALUES (1); +DELETE FROM ids; +INSERT INTO ids VALUES (1); +SELECT * FROM ids; +id +1 +INSERT INTO ids VALUES (1); +ERROR 23000: Duplicate entry '1' for key 'id' +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result new file mode 100644 index 00000000..4e10cf72 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"); +DELETE FROM users WHERE id = 1; +INSERT INTO users VALUES (1, "Alice"); +SELECT * FROM users; +id name +1 Alice +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result new file mode 100644 index 00000000..7b2c0b86 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"); +INSERT INTO users VALUES (1, "Bob"); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO users VALUES (2, "Bob"); +SELECT * FROM users; +id name +1 Alice +2 Bob +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_search_after_duplicated.result new file mode 100644 index 00000000..1d9d5fbb --- /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/index_unique_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result new file mode 100644 index 00000000..155cdf15 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES ("Alice"); +INSERT INTO users VALUES ("Bob"); +SELECT * FROM users; +name +Alice +Bob +SELECT * FROM users WHERE name = "aLiCe"; +name +Alice +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result new file mode 100644 index 00000000..9165ca26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +deleted BOOLEAN, +value INT, +INDEX (deleted, value) +); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 2); +SELECT count(*) FROM scores WHERE deleted = FALSE; +count(*) +3 +UPDATE scores SET deleted = TRUE WHERE value = 1; +SELECT count(*) FROM scores WHERE deleted = FALSE; +count(*) +1 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result new file mode 100644 index 00000000..b283af17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +value INT, +INDEX (value) +); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (22); +SELECT count(*) FROM scores WHERE value >= 20; +count(*) +3 +UPDATE scores SET value = 11 WHERE value = 21; +SELECT count(*) FROM scores WHERE value >= 20; +count(*) +1 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in new file mode 100644 index 00000000..f1020453 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE +Mroonga @MRN_PLUGIN_VERSION@ STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result new file mode 100644 index 00000000..c23dab5e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY +); +SELECT AUTO_INCREMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "ids"; +AUTO_INCREMENT +NULL +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result new file mode 100644 index 00000000..96d1b0ad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT AUTO_INCREMENT PRIMARY KEY +); +SELECT AUTO_INCREMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "ids"; +AUTO_INCREMENT +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result new file mode 100644 index 00000000..3600c920 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT COUNT(*) +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "diaries" AND DATA_LENGTH > 0; +COUNT(*) +1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result new file mode 100644 index 00000000..f8d41bb7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result @@ -0,0 +1,78 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 tinyint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 smallint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 mediumint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 int); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 bigint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 float); +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 double); +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 date); +insert into t1 values("2010/03/26"); +select * from t1; +c1 +2010-03-26 +drop table t1; +create table t1 (c1 time); +insert into t1 values("11:22:33"); +select * from t1; +c1 +11:22:33 +drop table t1; +create table t1 (c1 year); +insert into t1 values("2010"); +select * from t1; +c1 +2010 +drop table t1; +create table t1 (c1 datetime); +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +c1 +2010-03-26 11:22:33 +drop table t1; +create table t1 (c1 int primary key, c2 int); +insert into t1 values(1,100); +select * from t1; +c1 c2 +1 100 +insert into t1 values(1,200); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1; +c1 c2 +1 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result new file mode 100644 index 00000000..eb11e26e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT DELAYED INTO ids (id) VALUES (1); +ERROR HY000: DELAYED option not supported for table 'ids' +SELECT * FROM ids; +id +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result new file mode 100644 index 00000000..0d2c9dd7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS numbers; +CREATE TABLE numbers ( +id INT, +count INT, +UNIQUE (id) +); +INSERT INTO numbers (id, count) VALUES (1, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (1, 3) ON DUPLICATE KEY UPDATE count = 4; +SELECT * FROM numbers; +id count +1 4 +INSERT INTO numbers (id, count) VALUES (2, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (2, 3) ON DUPLICATE KEY UPDATE count = 4; +SELECT * FROM numbers; +id count +1 4 +2 4 +DROP TABLE numbers; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result new file mode 100644 index 00000000..94421a5c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "clear day") +ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "rainy day") +ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-15", "cloudy day") +ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; +SELECT * FROM diaries; +day title +2012-02-14 rainy day (duplicated) +2012-02-15 cloudy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result new file mode 100644 index 00000000..1ef6f1f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +day DATE, +title TEXT, +UNIQUE KEY day (day) +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "clear day1") +ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)"; +INSERT INTO diaries (day, title) +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 clear day3 (duplicated) +4 2012-02-15 cloudy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result new file mode 100644 index 00000000..624ac00d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_virtual_column.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int, _id int); +SET sql_mode=""; +INSERT INTO t1 (c1,_id) VALUES (1,1); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +SET sql_mode="STRICT_ALL_TABLES"; +INSERT INTO t1 (c1,_id) VALUES (4,1); +ERROR 01000: Data truncated for column '_id' at row 1 +SELECT * FROM t1; +c1 _id +1 1 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result b/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result new file mode 100644 index 00000000..1cc1d924 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS terms; +SET NAMES utf8; +CREATE TABLE terms ( +content varchar(64) NOT NULL COLLATE 'utf8_unicode_ci', +INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO terms VALUES ('track'); +INSERT INTO terms VALUES ('trackback'); +SELECT * FROM terms WHERE content LIKE 'TRACK%'; +content +track +trackback +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result new file mode 100644 index 00000000..4e1db465 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS counts; +CREATE TABLE counts ( +id INT PRIMARY KEY AUTO_INCREMENT +); +LOCK TABLES counts READ; +UNLOCK TABLES; +DROP TABLE counts; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result new file mode 100644 index 00000000..c09ec340 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_multithread.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX ft(title) +); +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_single_thread.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_single_thread.result new file mode 100644 index 00000000..c09ec340 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_after_insert_single_thread.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX ft(title) +); +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result new file mode 100644 index 00000000..8d29e042 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_disabled.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, "はれ", "天気がよいのは今日までみたい。"); +SET mroonga_enable_optimization=FALSE; +SELECT COUNT(*) FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE); +COUNT(*) +4 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SET mroonga_enable_optimization=TRUE; +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result new file mode 100644 index 00000000..26ca6de7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_and.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT, +age INT, +INDEX (id, age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); +SELECT COUNT(*) FROM users WHERE id = 2 AND age = 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result new file mode 100644 index 00000000..c4b1dbf7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_between.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); +SELECT COUNT(*) FROM users WHERE age BETWEEN 28 AND 30; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result new file mode 100644 index 00000000..2bbcfe75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +SELECT COUNT(*) FROM users WHERE age = 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result new file mode 100644 index 00000000..6ec4d774 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_boolean_mode.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); +SELECT COUNT(*) FROM memos +WHERE MATCH(content) AGAINST('+Groonga' IN BOOLEAN MODE); +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result new file mode 100644 index 00000000..36a19589 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_full_text_search_in_natural_language_mode.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); +SELECT COUNT(*) FROM memos +WHERE MATCH(content) AGAINST('Groonga'); +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result new file mode 100644 index 00000000..4eba1922 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (1),(2),(3),(4),(5),(6); +SELECT COUNT(*) FROM users WHERE age > 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result new file mode 100644 index 00000000..4de49651 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_greater_equal.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (1),(2),(3),(4),(5),(6); +SELECT COUNT(*) FROM users WHERE age >= 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result new file mode 100644 index 00000000..a57a3b8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); +SELECT COUNT(*) FROM users WHERE age < 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result new file mode 100644 index 00000000..c770b63d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_less_equal.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); +SELECT COUNT(*) FROM users WHERE age <= 29; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result new file mode 100644 index 00000000..a1a123e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_not_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +SELECT COUNT(*) FROM users WHERE age <> 29; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 2 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result new file mode 100644 index 00000000..407347a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_index_view.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries, users; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +user_id INT NOT NULL, +title VARCHAR(45) NOT NULL, +KEY (user_id), +FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET=UTF8; +CREATE TABLE users ( +id INT PRIMARY KEY AUTO_INCREMENT, +name VARCHAR(45) NOT NULL, +INDEX (name) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO users (id, name) VALUES (1, "Alice"), (2, "Bob"); +INSERT INTO diaries (user_id, title) VALUES (1, "survey"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (1)"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (2)"); +CREATE VIEW articles AS +SELECT diaries.user_id AS user_id, +diaries.title AS title, +users.name AS name +FROM diaries, users +WHERE diaries.user_id = users.id; +SELECT COUNT(*) FROM articles WHERE name = 'Bob'; +COUNT(*) +2 +DROP VIEW articles; +DROP TABLE diaries, users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result new file mode 100644 index 00000000..39a0f0bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_multiple_conditions.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT, +age INT, +INDEX (age) +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); +SELECT COUNT(*) FROM users WHERE id = 3 AND age = 29; +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result new file mode 100644 index 00000000..26c8b6a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_between.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (32),(33),(34),(35),(36),(37); +SELECT COUNT(*) FROM users WHERE id BETWEEN 2 AND 4; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result new file mode 100644 index 00000000..713a19dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id = 3; +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result new file mode 100644 index 00000000..fe9de9e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (-1),(-2),(-3),(-4); +SELECT COUNT(*) FROM users WHERE id > 3; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result new file mode 100644 index 00000000..2fa5213e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_greater_equal.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (-1),(-2),(-3),(-4); +SELECT COUNT(*) FROM users WHERE id >= 3; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result new file mode 100644 index 00000000..05afd7e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id < 3; +COUNT(*) +2 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result new file mode 100644 index 00000000..200f89d3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_less_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id <= 3; +COUNT(*) +3 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result new file mode 100644 index 00000000..1b253a8e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_count_skip_primary_key_not_equal.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +FLUSH STATUS; +CREATE TABLE users ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +SELECT COUNT(*) FROM users WHERE id <> 3; +COUNT(*) +4 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result new file mode 100644 index 00000000..dcf0f3ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SET mroonga_enable_optimization=FALSE; +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +month = 11 +ORDER BY day LIMIT 1,2; +id year month day title content +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +4 2011 11 12 帰り道 今日は天気がよくてよかった。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +SET mroonga_enable_optimization=TRUE; +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result new file mode 100644 index 00000000..124a7750 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_multiple_match_againsts.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(title), +FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(5, "title 1", "content a"); +INSERT INTO memos VALUES(12, "title 1", "content a"); +INSERT INTO memos VALUES(10, "title 1", "content a"); +INSERT INTO memos VALUES(4, "title 2", "content b"); +INSERT INTO memos VALUES(6, "title 2", "content b"); +INSERT INTO memos VALUES(1, "title 2", "content b"); +INSERT INTO memos VALUES(11, "title 1-a", "content a-1"); +INSERT INTO memos VALUES(3, "title 2-b", "content a-2"); +INSERT INTO memos VALUES(2, "title 2-c", "content a-3"); +INSERT INTO memos VALUES(8, "title 1-a", "content b-1"); +INSERT INTO memos VALUES(9, "title 2-b", "content b-2"); +INSERT INTO memos VALUES(7, "title 2-c", "content b-3"); +SELECT * FROM memos +WHERE MATCH(title) AGAINST("+1" IN BOOLEAN MODE) AND +MATCH(content) AGAINST("+a" IN BOOLEAN MODE) +ORDER BY id +LIMIT 1,3; +id title content +10 title 1 content a +11 title 1-a content a-1 +12 title 1 content a +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result new file mode 100644 index 00000000..5a0ea86c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day; +id year month day title content +7 2011 12 2 初雪 今日の天気は雪! +1 2011 11 9 Hello 今日からはじめました。 +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +4 2011 11 12 帰り道 今日は天気がよくてよかった。 +5 2011 11 13 はれ 天気がよいのは今日までみたい。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result new file mode 100644 index 00000000..d58c3cf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_cp932.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES CP932; +CREATE TABLE memos ( +ʎq INT UNSIGNED, +e TEXT, +FULLTEXT INDEX(e), +KEY(ʎq) +) DEFAULT CHARSET CP932; +INSERT INTO memos VALUES(2, "͎RoB"); +INSERT INTO memos VALUES(3, "̓T{eB"); +INSERT INTO memos VALUES(1, "͓VC悭Ă悩B"); +SELECT * FROM memos +WHERE MATCH(e) AGAINST("" IN BOOLEAN MODE) +ORDER BY ʎq +LIMIT 1; +ʎq e +1 ͓VC悭Ă悩B +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result new file mode 100644 index 00000000..f1cc14b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result new file mode 100644 index 00000000..0374f500 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result new file mode 100644 index 00000000..4bc3f9d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:34", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:34", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date = "2011-11-11 12:23:34" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:34 I will do something today! +4 2011-11-11 12:23:34 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result new file mode 100644 index 00000000..56629777 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date > "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; +id date content +4 2011-11-11 12:23:33 I don't want to anything today... +5 2011-11-11 12:23:34 I'm sleepy today. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result new file mode 100644 index 00000000..b03fe20f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date >= "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result new file mode 100644 index 00000000..c25f2a56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date < "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +2 2011-11-11 12:23:31 Today's lucky item is flower! +3 2011-11-11 12:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result new file mode 100644 index 00000000..ef93bf8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date <= "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +2 2011-11-11 12:23:31 Today's lucky item is flower! +3 2011-11-11 12:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_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 00000000..9ea8ea40 --- /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/optimization_order_limit_optimized_enum_name.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result new file mode 100644 index 00000000..f20089f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_name.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES utf8; +CREATE TABLE memos ( +id int PRIMARY KEY, +tag ENUM('Groonga', 'Mroonga'), +content TEXT, +FULLTEXT INDEX(content), +KEY(tag), +KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND +tag = 'Mroonga' + ORDER BY id LIMIT 1; +id tag content +4 Mroonga Mroonga is based on Groonga. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result new file mode 100644 index 00000000..88ec9dd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_enum_value.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES utf8; +CREATE TABLE memos ( +id int PRIMARY KEY, +tag ENUM('Groonga', 'Mroonga'), +content TEXT, +FULLTEXT INDEX(content), +KEY(tag), +KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND +tag = 2 +ORDER BY id LIMIT 1; +id tag content +4 Mroonga Mroonga is based on Groonga. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result new file mode 100644 index 00000000..5c18e22d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +6 2011 12 2 初雪 今日の天気は雪! +1 2011 11 9 Hello 今日からはじめました。 +2 2011 11 10 天気 明日の富士山の天気について +4 2011 11 11 帰り道 今日は天気がよくてよかった。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result new file mode 100644 index 00000000..ed86c0e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED, +content TEXT, +FULLTEXT INDEX(content), +KEY(id) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +id BETWEEN 2 AND 4 +ORDER BY id LIMIT 1,2; +id content +3 I will do something today! +4 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result new file mode 100644 index 00000000..a18e2a15 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED, +content TEXT, +FULLTEXT INDEX(content), +KEY(id) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +id BETWEEN 2 AND 6 +ORDER BY id LIMIT 1,2; +id content +3 I will do something today! +4 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result new file mode 100644 index 00000000..634fe89c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +month = 11 +ORDER BY day LIMIT 1,2; +id year month day title content +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +4 2011 11 12 帰り道 今日は天気がよくてよかった。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result new file mode 100644 index 00000000..22305c70 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day > 10 +ORDER BY day LIMIT 1,2; +id year month day title content +4 2011 11 12 帰り道 今日は天気がよくてよかった。 +5 2011 11 13 はれ 天気がよいのは今日までみたい。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result new file mode 100644 index 00000000..439f453d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day >= 10 +ORDER BY day LIMIT 1,2; +id year month day title content +4 2011 11 12 帰り道 今日は天気がよくてよかった。 +5 2011 11 13 はれ 天気がよいのは今日までみたい。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result new file mode 100644 index 00000000..51ec2fde --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day < 12 +ORDER BY day LIMIT 1,2; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result new file mode 100644 index 00000000..3c4f3973 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day <= 12 +ORDER BY day LIMIT 1,2; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result new file mode 100644 index 00000000..03364eb1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +6 2011 12 2 初雪 今日の天気は雪! +1 2011 11 9 Hello 今日からはじめました。 +2 2011 11 10 天気 明日の富士山の天気について +4 2011 11 11 帰り道 今日は天気がよくてよかった。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result new file mode 100644 index 00000000..9730069c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result @@ -0,0 +1,19 @@ +drop table if exists t1; +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, _id int, key idx1(c2), fulltext index ft(c3)) default charset utf8; +insert into t1 values(1,10,"aa ii uu ee oo",null); +insert into t1 values(2,20,"ka ki ku ke ko",null); +insert into t1 values(3,30,"ii si ii se ii",null); +insert into t1 values(4,40,"ta ti tu te to",null); +insert into t1 values(5,50,"aa ii uu ii oo",null); +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select *, match(c3) against("ii") from t1 order by c1 desc limit 2; +c1 c2 c3 _id match(c3) against("ii") +5 50 aa ii uu ii oo 5 349526 +4 40 ta ti tu te to 4 0 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result new file mode 100644 index 00000000..a284f4dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day ASC LIMIT 1; +id year month day title content +7 2011 12 2 初雪 今日の天気は雪! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result new file mode 100644 index 00000000..270d2639 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day DESC LIMIT 1; +id year month day title content +5 2011 11 13 はれ 天気がよいのは今日までみたい。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result new file mode 100644 index 00000000..eb19384e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +_id INT, +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(NULL, 3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(NULL, 4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(NULL, 5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(NULL, 6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(NULL, 7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY _id +LIMIT 1; +_id id year month day title content +1 1 2011 11 9 Hello 今日からはじめました。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result new file mode 100644 index 00000000..80bd895a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result new file mode 100644 index 00000000..b3ed4bf6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT *, MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +LIMIT 1; +id year month day title content MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +1 2011 11 9 Hello 今日からはじめました。 1 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result new file mode 100644 index 00000000..793423f5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time BETWEEN "1:23:31" AND "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result new file mode 100644 index 00000000..f50417d1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time BETWEEN "1:23:31" AND "1:23:43" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result new file mode 100644 index 00000000..26da3500 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); +INSERT INTO memos VALUES(3, "1:23:34", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:34", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time = "1:23:34" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:34 I will do something today! +4 01:23:34 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result new file mode 100644 index 00000000..342947cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time > "1:23:31" + ORDER BY id LIMIT 1,2; +id writing_time content +4 01:23:33 I don't want to anything today... +5 01:23:34 I'm sleepy today. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result new file mode 100644 index 00000000..adc4ec63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time >= "1:23:31" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result new file mode 100644 index 00000000..2881cc77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time < "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +2 01:23:31 Today's lucky item is flower! +3 01:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result new file mode 100644 index 00000000..d1a9fc27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time <= "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +2 01:23:31 Today's lucky item is flower! +3 01:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result new file mode 100644 index 00000000..bff0d993 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(title), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +title = "hello" + ORDER BY day LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result new file mode 100644 index 00000000..cc3173ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +title = "hello" + ORDER BY day LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result new file mode 100644 index 00000000..5a1b1bda --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year BETWEEN "11" AND "2013" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +2 Rename Groonga storage engine to Mroonga 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result new file mode 100644 index 00000000..b0ad41fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year BETWEEN "11" AND "2015" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +4 Mroonga 3.0 has been released 2013 +3 Mroonga 2.0 has been released 2012 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result new file mode 100644 index 00000000..08db6b38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 1.0 has been released", "11"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 1.11 has been released", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year = "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +1 Groonga storage engine (code name Mroonga) 1.0 has been released 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result new file mode 100644 index 00000000..a33cd484 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year > "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id ASC LIMIT 2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +4 Mroonga 3.0 has been released 2013 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result new file mode 100644 index 00000000..7d2471b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year >= "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id ASC LIMIT 2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +3 Mroonga 2.0 has been released 2012 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result new file mode 100644 index 00000000..cac3d6f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year < "13" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +1 Groonga storage engine (code name Mroonga) 0.1 has been released 2010 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result new file mode 100644 index 00000000..df57f51e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year <= "13" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +2 Rename Groonga storage engine to Mroonga 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/partition_insert.result new file mode 100644 index 00000000..0252fd90 --- /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 + 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 00000000..754c4f98 --- /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 +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 00000000..24d427ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/repair_table_no_index_file.result @@ -0,0 +1,31 @@ +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; +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: system call error: No such file or directory: failed to open path: +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 new file mode 100644 index 00000000..e88a799f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS geo_replace; +CREATE TABLE geo_replace ( +id INT NOT NULL, +geo GEOMETRY NOT NULL, +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO geo_replace VALUES(1, POINT(100,100)); +SELECT id, 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, 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, ST_AsText(geo) FROM geo_replace; +id ST_AsText(geo) +1 POINT(200 200) +UPDATE geo_replace SET geo = POINT(200,300); +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_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result new file mode 100644 index 00000000..b9aebee3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS videos_master, videos_groonga; +CREATE TABLE `videos_master` ( +`id` bigint(1) unsigned NOT NULL, +`video_id` varchar(64) NOT NULL, +`description` text, +`tags_unpack` text, +PRIMARY KEY (`video_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `videos_groonga` ( +`id` bigint(1) unsigned NOT NULL, +`video_id` varchar(64) NOT NULL, +`description` text, +`tags_unpack` text, +PRIMARY KEY (`video_id`), +FULLTEXT INDEX (`description`), +FULLTEXT INDEX (`tags_unpack`) +) DEFAULT CHARSET=utf8; +INSERT INTO videos_master VALUES (1, "video-1", "My Familly", "familly human"); +INSERT INTO videos_master VALUES (2, "video-2", "My Cat", "family cat"); +REPLACE INTO videos_groonga +SELECT v.id, v.video_id, v.description, NULL +FROM videos_master AS v +WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("cat") FROM videos_groonga +WHERE MATCH(description) AGAINST("cat"); +id video_id description tags_unpack MATCH(description) AGAINST("cat") +2 video-2 My Cat 1048577 +INSERT INTO videos_master VALUES (3, "video-3", "My Dog", "family dog"); +REPLACE INTO videos_groonga +SELECT v.id, v.video_id, v.description, NULL +FROM videos_master AS v +WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga +WHERE MATCH(description) AGAINST("my") +ORDER BY id; +id video_id description tags_unpack MATCH(description) AGAINST("my") +1 video-1 My Familly 209716 +2 video-2 My Cat 209716 +3 video-3 My Dog 209716 +DROP TABLE videos_master, videos_groonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result new file mode 100644 index 00000000..c70ce337 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result @@ -0,0 +1,25 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content text, +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); +select * from diaries; +id content +1 今日からはじめました。 +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +select * from diaries where match(content) against("天気"); +id content +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +replace into diaries values(2, "明日の天気は雨みたい。"); +select * from diaries where match(content) against("天気"); +id content +2 明日の天気は雨みたい。 +3 今日も天気がよくてきれいに見える。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result new file mode 100644 index 00000000..fd2cb655 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result @@ -0,0 +1,25 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content varchar(256), +fulltext index (content) +) default charset utf8; +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); +select * from diaries; +id content +1 今日からはじめました。 +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +select * from diaries where match(content) against("天気"); +id content +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +replace into diaries values(2, "明日の天気は雨みたい。"); +select * from diaries where match(content) against("天気"); +id content +2 明日の天気は雨みたい。 +3 今日も天気がよくてきれいに見える。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result new file mode 100644 index 00000000..3e987631 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS vector_replace; +DROP TABLE IF EXISTS vector_replace_vec; +CREATE TABLE vector_replace_vec ( +vec CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE vector_replace ( +id INT NOT NULL, +vec TEXT COMMENT 'flags "COLUMN_VECTOR", type "vector_replace_vec"', +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO vector_replace VALUES(1, 'first second third'); +SELECT id, vec FROM vector_replace; +id vec +1 FIRST SECOND THIRD +REPLACE INTO vector_replace VALUES(1, 'fourth fifth'); +SELECT id, vec FROM vector_replace; +id vec +1 FOURTH FIFTH +INSERT INTO vector_replace VALUES(1, 'sixth seventh') ON DUPLICATE KEY UPDATE vec = 'sixth seventh'; +SELECT id, vec FROM vector_replace; +id vec +1 SIXTH SEVENTH +UPDATE vector_replace SET vec = 'eighth nineth tenth'; +SELECT id, vec FROM vector_replace; +id vec +1 EIGHTH NINETH TENTH +DROP TABLE vector_replace; +DROP TABLE vector_replace_vec; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_without_key.result new file mode 100644 index 00000000..e67f0fe4 --- /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"); +Got one of the listed errors +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result new file mode 100644 index 00000000..18318bdb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result @@ -0,0 +1,198 @@ +drop table if exists t1, t2, t3; +create table t1(c1 int, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); +select * from t1; +c1 c2 c3 +1 10 100 +2 30 500 +5 20 200 +3 60 300 +4 50 600 +6 40 400 +select c1 from t1; +c1 +1 +2 +5 +3 +4 +6 +select c2 from t1; +c2 +10 +30 +20 +60 +50 +40 +select c3 from t1; +c3 +100 +500 +200 +300 +600 +400 +select * from t1 where c1 <= 3; +c1 c2 c3 +1 10 100 +2 30 500 +3 60 300 +select * from t1 where c2 > 40; +c1 c2 c3 +3 60 300 +4 50 600 +select * from t1 where c3 = 300; +c1 c2 c3 +3 60 300 +select * from t1 order by c1; +c1 c2 c3 +1 10 100 +2 30 500 +3 60 300 +4 50 600 +5 20 200 +6 40 400 +select * from t1 order by c2 desc; +c1 c2 c3 +3 60 300 +4 50 600 +6 40 400 +2 30 500 +5 20 200 +1 10 100 +select * from t1 order by c3, c1; +c1 c2 c3 +1 10 100 +5 20 200 +3 60 300 +6 40 400 +2 30 500 +4 50 600 +drop table t1; +create table t1 (c1 int, c2 varchar(100)); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); +select * from t1; +c1 c2 +1 hoge +4 hogefuga +2 fuga +5 moge +3 mo +select * from t1 order by c1; +c1 c2 +1 hoge +2 fuga +3 mo +4 hogefuga +5 moge +select * from t1 order by c1 desc; +c1 c2 +5 moge +4 hogefuga +3 mo +2 fuga +1 hoge +select * from t1 order by c2; +c1 c2 +2 fuga +1 hoge +4 hogefuga +3 mo +5 moge +drop table t1; +create table t1 (c1 int, c2 text); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); +select * from t1; +c1 c2 +1 hoge +4 hogefuga +2 fuga +5 moge +3 mo +drop table t1; +create table t1 (c1 int, c2 int, c3 text); +insert into t1 values(1, 20, "hoge"); +insert into t1 values(4, 60, "hogefuga"); +insert into t1 values(2, 50, "fuga"); +insert into t1 values(5, 30, "moge"); +insert into t1 values(3, 40, "mo"); +select * from t1 order by c1 asc; +c1 c2 c3 +1 20 hoge +2 50 fuga +3 40 mo +4 60 hogefuga +5 30 moge +select * from t1 order by c1 desc; +c1 c2 c3 +5 30 moge +4 60 hogefuga +3 40 mo +2 50 fuga +1 20 hoge +select * from t1 order by c2 asc; +c1 c2 c3 +1 20 hoge +5 30 moge +3 40 mo +2 50 fuga +4 60 hogefuga +select * from t1 order by c2 desc; +c1 c2 c3 +4 60 hogefuga +2 50 fuga +3 40 mo +5 30 moge +1 20 hoge +select * from t1 order by c3 asc; +c1 c2 c3 +2 50 fuga +1 20 hoge +4 60 hogefuga +3 40 mo +5 30 moge +select * from t1 order by c3 desc; +c1 c2 c3 +5 30 moge +3 40 mo +4 60 hogefuga +1 20 hoge +2 50 fuga +drop table t1; +create table t1 (_id int, c1 int); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +5 100 +select * from t1 where _id < 3; +_id c1 +1 100 +2 100 +select * from t1 where _id >= 3; +_id c1 +3 100 +4 100 +5 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result new file mode 100644 index 00000000..e0e3e21c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS tags; +CREATE TABLE tags ( +name VARCHAR(16) NOT NULL, +KEY index_name (name) +); +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); +SELECT * FROM tags WHERE name = ""; +name + +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result new file mode 100644 index 00000000..3732cb28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS tags; +CREATE TABLE tags ( +name VARCHAR(16) NOT NULL, +KEY index_name (name) +); +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); +SELECT * FROM tags WHERE name != ""; +name +mroonga +mysql +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result new file mode 100644 index 00000000..a111880a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +name varchar(40), +age int, +KEY (age) +); +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); +SELECT age, COUNT(*) FROM users GROUP BY age; +age COUNT(*) +20 2 +29 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result new file mode 100644 index 00000000..93d29c2d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +name varchar(40), +age int +); +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); +SELECT age, COUNT(*) FROM users GROUP BY age; +age COUNT(*) +20 2 +29 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result new file mode 100644 index 00000000..99f69f49 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result @@ -0,0 +1,27 @@ +drop table if exists t1, t2, t3; +create table t1(c1 int primary key, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); +select * from t1 where c1=1; +c1 c2 c3 +1 10 100 +select * from t1 where c1=2; +c1 c2 c3 +2 30 500 +select * from t1 where c1=3; +c1 c2 c3 +3 60 300 +select * from t1 where c1=4; +c1 c2 c3 +4 50 600 +select * from t1 where c1=5; +c1 c2 c3 +5 20 200 +select * from t1 where c1=6; +c1 c2 c3 +6 40 400 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result new file mode 100644 index 00000000..1c24089e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result @@ -0,0 +1,55 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 force index(idx1) where c2 = 30; +c1 c2 c3 +3 30 sa si su se so +select * from t1 force index(idx1) where c2 = 20; +c1 c2 c3 +2 20 ka ki ku ke ko +insert into t1 values(6,30,"aa bb cc dd ee"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +6 30 aa bb cc dd ee +select * from t1 force index(idx1) where c2 = 30; +c1 c2 c3 +3 30 sa si su se so +6 30 aa bb cc dd ee +drop table t1; +create table t1 (c1 varchar(5) primary key, c2 varchar(5), c3 text, key idx1(c2), fulltext index ft(c3))engine=mroonga; +insert into t1 values('ab','ijk',"aa ii uu ee oo"); +insert into t1 values('bc','ghi',"ka ki ku ke ko"); +insert into t1 values('cd','efg',"sa si su se so"); +insert into t1 values('de','cde',"ta ti tu te to"); +insert into t1 values('ef','abc',"aa ii uu ee oo"); +select * from t1 force index(idx1) where c2 < 'e' order by c1 asc; +c1 c2 c3 +de cde ta ti tu te to +ef abc aa ii uu ee oo +select * from t1 force index(idx1) where c2 > 'e' order by c1 asc; +c1 c2 c3 +ab ijk aa ii uu ee oo +bc ghi ka ki ku ke ko +cd efg sa si su se so +select * from t1 force index(idx1) where c2 between 'c' and 'h' order by c1 asc; +c1 c2 c3 +bc ghi ka ki ku ke ko +cd efg sa si su se so +de cde ta ti tu te to +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000..ef87703e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int primary key, c2 varchar(100)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` varchar(100) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result new file mode 100644 index 00000000..87c9f4ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries, users; +CREATE TABLE users ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT +) DEFAULT CHARSET UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +user_id INT UNSIGNED NOT NULL, +title TEXT, +FULLTEXT INDEX (title) +) DEFAULT CHARSET UTF8; +INSERT INTO users (name) VALUES ("alice"); +INSERT INTO users (name) VALUES ("bob"); +INSERT INTO users (name) VALUES ("carlos"); +SELECT * FROM users; +id name +1 alice +2 bob +3 carlos +INSERT INTO diaries (user_id, title) VALUES (1, "Hello!"); +INSERT INTO diaries (user_id, title) VALUES (2, "my name is bob"); +INSERT INTO diaries (user_id, title) VALUES (3, "my name is carlos"); +SELECT * FROM diaries; +id user_id title +1 1 Hello! +2 2 my name is bob +3 3 my name is carlos +SELECT * FROM users +WHERE id IN (SELECT user_id FROM diaries +WHERE MATCH(title) AGAINST("name")) +ORDER BY id DESC; +id name +3 carlos +2 bob +DROP TABLE diaries, users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result new file mode 100644 index 00000000..0a18d817 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result @@ -0,0 +1,14 @@ +DROP TEMPORARY TABLE IF EXISTS diaries; +CREATE TEMPORARY TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); +SELECT * FROM diaries; +id title +1 clear day +2 rainy day +3 cloudy day +DROP TEMPORARY TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result new file mode 100644 index 00000000..3525e235 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +2 2011 11 10 天気 明日の富士山の天気について +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +id year month day title content +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰り道", "つかれたー"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "初雪", "今年はじめての雪!"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 11 帰り道 つかれたー +2 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +3 2011 12 2 初雪 今年はじめての雪! +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+悪い" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +2 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result new file mode 100644 index 00000000..72a913b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_binlog_row.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS memos; +SET SESSION binlog_format = 'ROW'; +CREATE TABLE memos ( +title varchar(20) PRIMARY KEY, +content varchar(140) NOT NULL +) COLLATE=utf8mb4_general_ci +DEFAULT CHARSET=utf8mb4; +INSERT INTO memos (title, content) VALUES ('Mroonga', 'Mroonga is great!'); +SELECT * FROM memos; +title content +Mroonga Mroonga is great! +UPDATE memos SET content = 'Mroonga is very great!' WHERE title = 'Mroonga'; +SELECT * FROM memos; +title content +Mroonga Mroonga is very great! +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result new file mode 100644 index 00000000..bf81d5e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result @@ -0,0 +1,22 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +20 ta ti tu te +30 sa si su se +select * from t1 where match(c2) against("ti"); +c1 c2 +20 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result new file mode 100644 index 00000000..35d8843a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result @@ -0,0 +1,20 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +update t1 set c1 = 200 where _id = 2; +select * from t1; +_id c1 +1 100 +2 200 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result new file mode 100644 index 00000000..dba9c964 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result @@ -0,0 +1,20 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +update t1 set c1 = 200 where _id = 2; +select * from t1; +_id c1 +1 100 +2 200 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result new file mode 100644 index 00000000..e022fa23 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result @@ -0,0 +1,42 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +update t1 set c2=c2+100 where c1=1; +select * from t1; +c1 c2 +1 200 +2 101 +3 102 +update t1 set c2=c2+100 where c1=2; +select * from t1; +c1 c2 +1 200 +2 201 +3 102 +update t1 set c2=c2+100 where c1=3; +select * from t1; +c1 c2 +1 200 +2 201 +3 202 +flush tables; +update t1 set c1=5, c2=50; +select * from t1; +c1 c2 +5 50 +5 50 +5 50 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result new file mode 100644 index 00000000..af592631 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result @@ -0,0 +1,29 @@ +drop table if exists memos; +create table memos ( +_id int, +content varchar(255), +unique key (_id) using hash +); +insert into memos values (null, "今夜はさんま。"); +insert into memos values (null, "明日はgroongaをアップデート。"); +insert into memos values (null, "帰りにおだんご。"); +insert into memos values (null, "金曜日は肉の日。"); +select * from memos; +_id content +1 今夜はさんま。 +2 明日はgroongaをアップデート。 +3 帰りにおだんご。 +4 金曜日は肉の日。 +insert into memos values (null, "冷蔵庫に牛乳が残り1本。"); +select last_insert_grn_id(); +last_insert_grn_id() +5 +update memos set content = "冷蔵庫に牛乳はまだたくさんある。" where _id = last_insert_grn_id(); +select * from memos; +_id content +1 今夜はさんま。 +2 明日はgroongaをアップデート。 +3 帰りにおだんご。 +4 金曜日は肉の日。 +5 冷蔵庫に牛乳はまだたくさんある。 +drop table memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result new file mode 100644 index 00000000..e823e128 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int, _id int); +INSERT INTO t1 VALUES(1,null); +INSERT INTO t1 VALUES(2,null); +INSERT INTO t1 VALUES(3,null); +SELECT * FROM t1; +c1 _id +1 1 +2 2 +3 3 +SET sql_mode=""; +UPDATE t1 SET _id = 10 WHERE c1 = 1; +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +SELECT * FROM t1; +c1 _id +1 1 +2 2 +3 3 +SET sql_mode="STRICT_ALL_TABLES"; +UPDATE t1 SET _id = 11 WHERE c1 = 1; +ERROR 01000: Data truncated for column '_id' at row 1 +SELECT * FROM t1; +c1 _id +1 1 +2 2 +3 3 +DROP TABLE t1; +SET sql_mode=DEFAULT; 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 00000000..37826335 --- /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 00000000..d3ccb150 --- /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 00000000..55cd8742 --- /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 00000000..5736fd52 --- /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 00000000..e42fa259 --- /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 new file mode 100644 index 00000000..beca93b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result @@ -0,0 +1,17 @@ +SET GLOBAL mroonga_database_path_prefix = "test/mroonga.data/"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_database_path_prefix'; +Variable_name Value +mroonga_database_path_prefix test/mroonga.data/ +CREATE DATABASE clean_test; +USE clean_test; +CREATE TABLE counts ( +id INT PRIMARY KEY AUTO_INCREMENT +); +INSERT INTO counts VALUES (NULL); +SELECT * FROM counts; +id +1 +DROP TABLE counts; +DROP DATABASE clean_test; +SET GLOBAL mroonga_database_path_prefix = NULL; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result new file mode 100644 index 00000000..959383ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_default_parser_backup = @@mroonga_default_parser; +SET GLOBAL mroonga_default_parser = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +Variable_name Value +mroonga_default_parser TokenBigramSplitAlpha +SET GLOBAL mroonga_default_parser = @mroonga_default_parser_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result new file mode 100644 index 00000000..7f441b4b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_default_parser = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +Variable_name Value +mroonga_default_parser TokenBigram diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result new file mode 100644 index 00000000..1f457eb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_default_tokenizer_backup = @@mroonga_default_tokenizer; +SET GLOBAL mroonga_default_tokenizer = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +Variable_name Value +mroonga_default_tokenizer TokenBigramSplitAlpha +SET GLOBAL mroonga_default_tokenizer = @mroonga_default_tokenizer_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result new file mode 100644 index 00000000..9ad80e9a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_tokenizer_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_default_tokenizer = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +Variable_name Value +mroonga_default_tokenizer TokenBigram diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result new file mode 100644 index 00000000..4238cb63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result @@ -0,0 +1,20 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=true; +delete from diaries where id = 1; +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +delete from diaries where id = 1; +select * from diaries; +id body +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result new file mode 100644 index 00000000..429398f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result @@ -0,0 +1,22 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result new file mode 100644 index 00000000..9cd6f5c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result @@ -0,0 +1,18 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start groonga!"); +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 starting groonga... +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result new file mode 100644 index 00000000..5a19ab6f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_enable_operations_recording_insert.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +title TEXT +) DEFAULT CHARSET=utf8; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +INSERT INTO diaries VALUES("Unlogged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +mroonga_command('load --table mroonga_operations --values "[{}]"') +1 +SELECT mroonga_command('select mroonga_operations --output_columns _id'); +mroonga_command('select mroonga_operations --output_columns _id') +[[[1],[["_id","UInt32"]],[2]]] +SET GLOBAL mroonga_enable_operations_recording = false; +FLUSH TABLES; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +INSERT INTO diaries VALUES("Logged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +mroonga_command('load --table mroonga_operations --values "[{}]"') +1 +SELECT mroonga_command('select mroonga_operations --output_columns _id'); +mroonga_command('select mroonga_operations --output_columns _id') +[[[1],[["_id","UInt32"]],[1]]] +DROP TABLE diaries; +SELECT mroonga_command('truncate mroonga_operations'); +mroonga_command('truncate mroonga_operations') +true +SET GLOBAL mroonga_enable_operations_recording = default; +FLUSH TABLES; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result new file mode 100644 index 00000000..789316d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = -1; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout -1 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result new file mode 100644 index 00000000..029b1ab1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result @@ -0,0 +1,6 @@ +SET GLOBAL mroonga_lock_timeout = -2; +Warnings: +Warning 1292 Truncated incorrect mroonga_lock_timeout value: '-2' +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout -1 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result new file mode 100644 index 00000000..f47a2e66 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = 0; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout 0 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result new file mode 100644 index 00000000..6ec1004f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = 1000; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout 1000 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result new file mode 100644 index 00000000..db469479 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_log_file_backup = @@mroonga_log_file; +SET GLOBAL mroonga_log_file = "new-mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file new-mroonga.log +SET GLOBAL mroonga_log_file = @mroonga_log_file_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result new file mode 100644 index 00000000..1dbec1f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_log_file = "nonexistent/mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file groonga.log diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result new file mode 100644 index 00000000..5824f090 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_log_file = "groonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file groonga.log diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result new file mode 100644 index 00000000..cb646ece --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result @@ -0,0 +1,49 @@ +set @mroonga_log_level_backup=@@mroonga_log_level; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NOTICE +set global mroonga_log_level=NONE; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NONE +set global mroonga_log_level=EMERG; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level EMERG +set global mroonga_log_level=ALERT; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level ALERT +set global mroonga_log_level=CRIT; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level CRIT +set global mroonga_log_level=ERROR; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level ERROR +set global mroonga_log_level=WARNING; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level WARNING +set global mroonga_log_level=NOTICE; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NOTICE +set global mroonga_log_level=INFO; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level INFO +set global mroonga_log_level=DEBUG; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level DEBUG +set global mroonga_log_level=DUMP; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level DUMP +set global mroonga_log_level=dummy; +ERROR 42000: Variable 'mroonga_log_level' can't be set to the value of 'dummy' +set session mroonga_log_level=NOTICE; +ERROR HY000: Variable 'mroonga_log_level' is a GLOBAL variable and should be set with SET GLOBAL +set global mroonga_log_level=@mroonga_log_level_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result new file mode 100644 index 00000000..19abff38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET GLOBAL mroonga_match_escalation_threshold = -1; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title, tags) VALUES ("Hello Groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello Mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+install" IN BOOLEAN MODE); +id title tags +1 Hello Groonga! groonga install +2 Hello Mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); +id title tags +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); +id title tags +1 Hello Groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result new file mode 100644 index 00000000..30e9262b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +SET mroonga_match_escalation_threshold = -1; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_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 00000000..0181fe02 --- /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_mysql_5_7_or_later_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result new file mode 100644 index 00000000..ff574f7b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.result @@ -0,0 +1,22 @@ +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 partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 5) +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_mysql_5_7_or_later_not_found_in_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result new file mode 100644 index 00000000..5ecf8969 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +INDEX (id) +) DEFAULT CHARSET=UTF8; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +DELETE FROM ids WHERE id < 2; +SET mroonga_max_n_records_for_estimate = 1; +EXPLAIN SELECT * FROM ids WHERE id > 0; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range id id 5 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 0) +SET 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_mysql_5_7_or_later_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result new file mode 100644 index 00000000..b28eac5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.result @@ -0,0 +1,22 @@ +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 partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`ids`.`id` AS `id` from `test`.`ids` where (`test`.`ids`.`id` > 5) +SET 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_not_found_in_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result new file mode 100644 index 00000000..d318a654 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +INDEX (id) +) DEFAULT CHARSET=UTF8; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +INSERT INTO ids VALUES (4),(5),(6),(7); +DELETE FROM ids WHERE id < 2; +SET mroonga_max_n_records_for_estimate = 1; +EXPLAIN SELECT * FROM ids WHERE id > 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE ids range id id 5 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_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 00000000..aca9d75c --- /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_query_log_file_disabled_empty_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result new file mode 100644 index 00000000..3d7f36d1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_empty_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = ""; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is still disabled +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result new file mode 100644 index 00000000..aed9d91a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_disabled_null_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = NULL; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is still disabled +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result new file mode 100644 index 00000000..22ac271e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_empty_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = ""; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is disabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result new file mode 100644 index 00000000..3921fb16 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_enabled_null_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = NULL; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file +log file is changed: -> +query log file is disabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result new file mode 100644 index 00000000..7b1be136 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_new_value.result @@ -0,0 +1,9 @@ +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file groonga-query.log +log file is changed: -> +query log is enabled: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result new file mode 100644 index 00000000..adf3d1bf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_query_log_file_same_value.result @@ -0,0 +1,10 @@ +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +SHOW GLOBAL VARIABLES LIKE "mroonga_query_log_file"; +Variable_name Value +mroonga_query_log_file groonga-query.log +log file is changed: -> +query log file isn't changed because the requested path isn't different: +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result new file mode 100644 index 00000000..f3c8f1e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS document; +DROP TABLE IF EXISTS category; +CREATE TABLE category ( +category CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE document ( +id INT NOT NULL, +title TEXT, +categories TEXT COMMENT 'flags "COLUMN_VECTOR", type "category"', +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; +Variable_name Value +mroonga_vector_column_delimiter +INSERT INTO document VALUES(1, "Mroonga is the fastest search engine", "it database fulltext"); +SELECT id, title, categories FROM document; +id title categories +1 Mroonga is the fastest search engine IT DATABASE FULLTEXT +SET GLOBAL mroonga_vector_column_delimiter = ';'; +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; +Variable_name Value +mroonga_vector_column_delimiter ; +SELECT id, title, categories FROM document; +id title categories +1 Mroonga is the fastest search engine IT;DATABASE;FULLTEXT +DROP TABLE document; +DROP TABLE category; +SET GLOBAL mroonga_vector_column_delimiter = ' '; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in new file mode 100644 index 00000000..26ff300a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in @@ -0,0 +1,3 @@ +show variables like 'mroonga_version'; +Variable_name Value +mroonga_version @MRN_VERSION@ diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.opt b/storage/mroonga/mysql-test/mroonga/storage/suite.opt new file mode 100644 index 00000000..d5a1e519 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/suite.opt @@ -0,0 +1 @@ +--loose-plugin-load-add=$HA_MROONGA_SO --loose-plugin-mroonga=ON diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.pm b/storage/mroonga/mysql-test/mroonga/storage/suite.pm new file mode 100644 index 00000000..7e4f8c17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/suite.pm @@ -0,0 +1,23 @@ +package My::Suite::Mroonga; + +@ISA = qw(My::Suite); + +return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or + $::mysqld_variables{'mroonga'} eq "ON"; + +sub is_default { not $::opt_embedded_server } + +my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql'; +my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins'; + +if (-d $groonga_normalizer_mysql_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_dir; +} +elsif (-d $groonga_normalizer_mysql_install_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_install_dir; +} + +bless { }; + diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test new file mode 100644 index 00000000..0e348f26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries ADD title VARCHAR(40) AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test new file mode 100644 index 00000000..4375a6f1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries ADD title VARCHAR(40) FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test new file mode 100644 index 00000000..ec9e3c9d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test new file mode 100644 index 00000000..e3b7df72 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test @@ -0,0 +1,41 @@ +# Copyright(C) 2014 Kenji Maruyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR'; +SHOW CREATE TABLE tags; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test new file mode 100644 index 00000000..964426b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kenji Maruyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test new file mode 100644 index 00000000..0f92c024 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test @@ -0,0 +1,47 @@ +# Copyright(C) 2014 Kenji Maruyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags'; +SHOW CREATE TABLE bugs; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test new file mode 100644 index 00000000..0516186b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int PRIMARY KEY +) DEFAULT CHARSET=cp932; +ALTER TABLE users + ADD COLUMN O text, + ADD FULLTEXT INDEX (O); + +INSERT INTO users VALUES (1, "܂"); +INSERT INTO users VALUES (2, "Ȃ"); +INSERT INTO users VALUES (3, ""); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test new file mode 100644 index 00000000..0ed92333 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE users + ADD COLUMN 名前 text, + ADD FULLTEXT INDEX (名前); + +INSERT INTO users VALUES (1, "やまだ"); +INSERT INTO users VALUES (2, "たなか"); +INSERT INTO users VALUES (3, "すずき"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test new file mode 100644 index 00000000..a76869ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test @@ -0,0 +1,50 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries + ADD COLUMN body VARCHAR(140) FIRST, + ADD COLUMN published BOOLEAN AFTER id, + ADD COLUMN created_at DATETIME; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body, published, created_at) + VALUES ("groonga (1)", "starting groonga...", TRUE, "2014-2-9 02:09:00"); +INSERT INTO diaries (title, body, published, created_at) + VALUES ("groonga (2)", "started groonga.", FALSE, "2014-2-9 12:19:00"); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test new file mode 100644 index 00000000..3e21daab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test @@ -0,0 +1,45 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body VARCHAR(140); +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test new file mode 100644 index 00000000..54fb986a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test new file mode 100644 index 00000000..8a63885a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL +) DEFAULT CHARSET=utf8; + +ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; + +SELECT mroonga_command("dump --dump_plugins 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/alter_table_add_index_unique_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test new file mode 100644 index 00000000..bfc527c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT +) DEFAULT CHARSET UTF8; + +INSERT INTO ids (id) values (1), (1); + +--error ER_DUP_UNIQUE +ALTER TABLE ids ADD UNIQUE INDEX (id); +SHOW CREATE TABLE ids; + +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_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 00000000..dccba803 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test new file mode 100644 index 00000000..a7d9c4a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE scores ( + id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +ALTER TABLE scores ADD KEY property (name, score); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_primary_key.test new file mode 100644 index 00000000..a1cf13c2 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_column_comment_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test new file mode 100644 index 00000000..3f7aea2a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs + CHANGE COLUMN + tag + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test new file mode 100644 index 00000000..0fb3f176 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(32), + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs CHANGE COLUMN title title VARCHAR(64); + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test new file mode 100644 index 00000000..70cf4d14 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description VARCHAR(140) AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test new file mode 100644 index 00000000..b959d30e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description VARCHAR(140) FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test new file mode 100644 index 00000000..fa97b30d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries + CHANGE body description VARCHAR(140) FIRST, + CHANGE title subject VARCHAR(40) AFTER internal_id, + CHANGE id internal_id INT AUTO_INCREMENT; +SHOW CREATE TABLE diaries; + +INSERT IGNORE INTO diaries (subject, description) + VALUES ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test new file mode 100644 index 00000000..3e02a644 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description VARCHAR(140); +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test new file mode 100644 index 00000000..d8775f07 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_decimal.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + temperature DECIMAL(6, 3) +) ENGINE InnoDB DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (temperature) VALUES (21.281); +SELECT * FROM diaries; + +ALTER TABLE diaries ENGINE = mroonga; +SELECT * FROM diaries; + +INSERT INTO diaries (temperature) VALUES (14.213); +INSERT INTO diaries (temperature) VALUES (17.821); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test new file mode 100644 index 00000000..b9dfddda --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine_fulltext_index.test @@ -0,0 +1,58 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries ENGINE = mroonga; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test new file mode 100644 index 00000000..8efaad2a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -0,0 +1,55 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no"); + +ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; + +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; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test new file mode 100644 index 00000000..ed3d4a13 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + WHERE MATCH (title) AGAINST ("富士山"); + +CREATE FULLTEXT INDEX title_index on diaries (title); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test new file mode 100644 index 00000000..83ce2ca7 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_disable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test new file mode 100644 index 00000000..f612272f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES ujis; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "ŷ"); +INSERT INTO diaries VALUES (3, "ٻλ"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("ٻλ"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("ٻλ"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test new file mode 100644 index 00000000..999415b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test new file mode 100644 index 00000000..d0e7e0e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test new file mode 100644 index 00000000..e8140ff5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test new file mode 100644 index 00000000..390afd98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test new file mode 100644 index 00000000..8b3e0928 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + first_name VARCHAR(32) NOT NULL, + last_name VARCHAR(32) NOT NULL, + KEY (first_name, last_name) +); + +INSERT INTO users VALUES("Taro", "Yamada"); +INSERT INTO users VALUES("Hanako", "Tanaka"); +INSERT INTO users VALUES("Joe", "Honda"); + +SELECT * FROM users; + +ALTER TABLE users DISABLE KEYS; +TRUNCATE users; + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test new file mode 100644 index 00000000..94a3de4b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + c1 int NOT NULL, + c2 text NOT NULL, + c3 int NOT NULL, + c4 int NOT NULL, + PRIMARY KEY(c1), + KEY idx1(c3,c4), + FULLTEXT KEY ft1(c2) +); +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test new file mode 100644 index 00000000..d640249d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test @@ -0,0 +1,45 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries + DROP COLUMN title, + DROP COLUMN body; +SHOW CREATE TABLE diaries; +SELECT * FROM diaries; + +INSERT INTO diaries () VALUES (); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test new file mode 100644 index 00000000..9544eb90 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +SELECT * FROM diaries; + +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test new file mode 100644 index 00000000..8596e18f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE scores ( + id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + KEY property (name, score) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +ALTER TABLE scores DROP KEY property; +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_primary_key.test new file mode 100644 index 00000000..e12e5b8d --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test new file mode 100644 index 00000000..e7f9f548 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test new file mode 100644 index 00000000..424e51ad --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_enable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test new file mode 100644 index 00000000..c5889caf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES ujis; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "ŷ"); +INSERT INTO diaries VALUES (3, "ٻλ"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("ٻλ"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("ٻλ"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test new file mode 100644 index 00000000..e7f9f548 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test new file mode 100644 index 00000000..7ae83d84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test @@ -0,0 +1,53 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test new file mode 100644 index 00000000..012fae91 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test new file mode 100644 index 00000000..9817aa94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test new file mode 100644 index 00000000..41fae0e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE memos ( + content varchar(32) +) DEFAULT CHARSET="utf8"; + +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); + +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; + +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test new file mode 100644 index 00000000..dab39fc8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT +) DEFAULT CHARSET="utf8"; + +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); + +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); + +SELECT * FROM memos WHERE MATCH(content) AGAINST("+groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test new file mode 100644 index 00000000..fd2a6008 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test @@ -0,0 +1,47 @@ +# Copyright(C) 2014 HAYASHI Kentaro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); + +SELECT * FROM bugs; + +ALTER TABLE bugs ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; + +SELECT * FROM bugs + WHERE MATCH(tags) AGAINST("Groonga"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test new file mode 100644 index 00000000..d59e24f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test @@ -0,0 +1,48 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags"', + FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); + +ALTER TABLE bugs DROP INDEX bugs_tags_index; +ALTER TABLE bugs + ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; + +SELECT * FROM bugs + WHERE MATCH(tags) AGAINST("Groonga"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test new file mode 100644 index 00000000..fb967163 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY body VARCHAR(140) AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test new file mode 100644 index 00000000..86d22e3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY body VARCHAR(140) FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test new file mode 100644 index 00000000..d39b4fc9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + body VARCHAR(140) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY title VARCHAR(100); +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test new file mode 100644 index 00000000..93210e13 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX (body) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries + DROP INDEX body, + ADD FULLTEXT INDEX (body); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test new file mode 100644 index 00000000..1102144b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test @@ -0,0 +1,53 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, memos; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'diaries'; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +SELECT * FROM memos + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +SELECT table_name, engine + FROM information_schema.tables + WHERE table_name = 'memos'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test new file mode 100644 index 00000000..2581fa7c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test @@ -0,0 +1,151 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name VARCHAR(40), + location GEOMETRY NOT NULL +); + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + ST_GeomFromText('POINT(139.711517 35.647701)')); + +ALTER TABLE shops ADD SPATIAL KEY location_index (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; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test new file mode 100644 index 00000000..34a517f9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test @@ -0,0 +1,53 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int auto_increment, primary key(c1)); +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(10); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(6); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +drop table t1; + +create table t1 (c1 int, c2 int auto_increment, primary key(c1), key idx1(c2)); +insert into t1 values(1, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(2, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(3, 10); +select * from t1 order by c2 desc limit 1; +insert into t1 values(4, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(5, 6); +select * from t1 order by c2 desc limit 1; +insert into t1 values(6, null); +select * from t1 order by c2 desc limit 1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test new file mode 100644 index 00000000..f5de201d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int auto_increment, primary key(c1)) auto_increment=34129; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +show create table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +insert into t1 values(10); +select c1 from t1 order by c1 desc; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +insert into t1 values(6); +select c1 from t1 order by c1 desc; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +truncate table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +delete from t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +rename table t1 to t2; +insert into t2 values(null); +select c1 from t2 order by c1 desc; +show create table t2; +drop table t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test new file mode 100644 index 00000000..a23e09de --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test @@ -0,0 +1,33 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text +); +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test new file mode 100644 index 00000000..281617e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test @@ -0,0 +1,53 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_log_bin.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +show variables like 'log_bin'; + +set binlog_format="STATEMENT"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="ROW"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="MIXED"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test new file mode 100644 index 00000000..d438a912 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_broken.test @@ -0,0 +1,45 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET NAMES UTF8; + +CREATE DATABASE check_test; +USE check_test; + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + +INSERT INTO diaries VALUES ('Hello'); + +--remove_file $MYSQLD_DATADIR/check_test.mrn.000010C + +FLUSH TABLES; + +CHECK TABLE diaries; + +REPAIR TABLE diaries; +DROP TABLE diaries; + +DROP DATABASE check_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test new file mode 100644 index 00000000..c3f24494 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/check_table_not_broken.test @@ -0,0 +1,38 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT +); + +INSERT INTO diaries VALUES ('Hello'); + +CHECK TABLE diaries; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test new file mode 100644 index 00000000..1139d5eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_general_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("Je suis un garçon."); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test new file mode 100644 index 00000000..e0480fb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_520_ci_french.test @@ -0,0 +1,36 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_6_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 ("Je suis un garçon."); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("+garcon" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc 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 00000000..a23126c3 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_version_5_6_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/collation_utf8_unicode_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test new file mode 100644 index 00000000..2fbf5da8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_unicode_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("Je suis un garçon."); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test new file mode 100644 index 00000000..bc598fea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_unicode_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("ひらがなとカタカナを覚えました。"); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("かたかな"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test new file mode 100644 index 00000000..c21ce814 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED, + INDEX (id) COMMENT 'ID search is required.' +) DEFAULT CHARSET=utf8; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test new file mode 100644 index 00000000..f0d4aebf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test new file mode 100644 index 00000000..ef53212b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + created_at DATE, + KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test new file mode 100644 index 00000000..63a2a39d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(40), + created_at DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test new file mode 100644 index 00000000..8b069cab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; + +SET sql_mode = ''; +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01"); +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00"); +SET sql_mode = DEFAULT; + +SELECT * FROM timestamps; + +SELECT * FROM timestamps WHERE create_dt = "2012-01-01"; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test new file mode 100644 index 00000000..c9308b95 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); +INSERT IGNORE INTO diaries (title, created_at) + VALUES ('2038-01-20 03:14:08', '2038-01-20 03:14:08'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test new file mode 100644 index 00000000..5a6cee77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT IGNORE INTO diaries (title, created_at) + VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test new file mode 100644 index 00000000..502d261c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT IGNORE INTO diaries (title, created_at) + VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test new file mode 100644 index 00000000..aa0bf65d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT IGNORE INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test new file mode 100644 index 00000000..9c2a4d92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-19 03:14:08', '2038-01-19 03:14:08'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test new file mode 100644 index 00000000..942a8cc5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('1000-01-02 00:00:00', '1000-01-02 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test new file mode 100644 index 00000000..e1df8812 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test new file mode 100644 index 00000000..ba01e892 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_strict_sql_mode_out_of_range.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test new file mode 100644 index 00000000..e3115505 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_5_out_of_range.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_version_5_5.inc +--source ../../include/mroonga/have_mysql.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test new file mode 100644 index 00000000..cfd370ae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_5_6_or_later_out_of_range.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test new file mode 100644 index 00000000..7cf8be3f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME(6), + KEY (created_at) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test new file mode 100644 index 00000000..2b3865f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME(6) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test new file mode 100644 index 00000000..cebffc7e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test @@ -0,0 +1,37 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_freebsd.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test new file mode 100644 index 00000000..6cd65be5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_date.test @@ -0,0 +1,39 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); + +SELECT * FROM timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test new file mode 100644 index 00000000..8639e9ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mariadb_10_2_or_later_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test new file mode 100644 index 00000000..e4ed57dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_date.test @@ -0,0 +1,39 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); + +SELECT * FROM timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test new file mode 100644 index 00000000..e2fd01b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_mysql_5_7_or_later_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test new file mode 100644 index 00000000..e51a6623 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test @@ -0,0 +1,36 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ('NULL', NULL); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test new file mode 100644 index 00000000..f93bffd9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME, + KEY (created_at) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test new file mode 100644 index 00000000..0df1be26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test new file mode 100644 index 00000000..b0c0e11a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test @@ -0,0 +1,42 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +SET sql_mode='STRICT_TRANS_TABLES'; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO timestamps (create_dt) VALUES ("0000-00-00 00:00:00"); +SET sql_mode=default; + +SELECT * FROM timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2015-06-17 00:00:00"); +SELECT * FROM timestamps; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test new file mode 100644 index 00000000..f3ec9465 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_month_day.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; + +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test new file mode 100644 index 00000000..cf201088 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL(6, 3), + KEY (temperature) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test new file mode 100644 index 00000000..83fd7564 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL(6, 3) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test new file mode 100644 index 00000000..315846cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL, + KEY (temperature) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test new file mode 100644 index 00000000..6924885f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test new file mode 100644 index 00000000..ae85ae7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + size ENUM("small", "medium", "large"), + INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart for child", "small"); +INSERT INTO items VALUES ("leadies' coat", "medium"); +INSERT INTO items VALUES ("parka", "large"); +INSERT INTO items VALUES ("hat", "medium"); + +SELECT * FROM items; + +SELECT * FROM items WHERE size = "medium"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test new file mode 100644 index 00000000..91daafed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test @@ -0,0 +1,298 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + size ENUM("size1", + "size2", + "size3", + "size4", + "size5", + "size6", + "size7", + "size8", + "size9", + "size10", + "size11", + "size12", + "size13", + "size14", + "size15", + "size16", + "size17", + "size18", + "size19", + "size20", + "size21", + "size22", + "size23", + "size24", + "size25", + "size26", + "size27", + "size28", + "size29", + "size30", + "size31", + "size32", + "size33", + "size34", + "size35", + "size36", + "size37", + "size38", + "size39", + "size40", + "size41", + "size42", + "size43", + "size44", + "size45", + "size46", + "size47", + "size48", + "size49", + "size50", + "size51", + "size52", + "size53", + "size54", + "size55", + "size56", + "size57", + "size58", + "size59", + "size60", + "size61", + "size62", + "size63", + "size64", + "size65", + "size66", + "size67", + "size68", + "size69", + "size70", + "size71", + "size72", + "size73", + "size74", + "size75", + "size76", + "size77", + "size78", + "size79", + "size80", + "size81", + "size82", + "size83", + "size84", + "size85", + "size86", + "size87", + "size88", + "size89", + "size90", + "size91", + "size92", + "size93", + "size94", + "size95", + "size96", + "size97", + "size98", + "size99", + "size100", + "size101", + "size102", + "size103", + "size104", + "size105", + "size106", + "size107", + "size108", + "size109", + "size110", + "size111", + "size112", + "size113", + "size114", + "size115", + "size116", + "size117", + "size118", + "size119", + "size120", + "size121", + "size122", + "size123", + "size124", + "size125", + "size126", + "size127", + "size128", + "size129", + "size130", + "size131", + "size132", + "size133", + "size134", + "size135", + "size136", + "size137", + "size138", + "size139", + "size140", + "size141", + "size142", + "size143", + "size144", + "size145", + "size146", + "size147", + "size148", + "size149", + "size150", + "size151", + "size152", + "size153", + "size154", + "size155", + "size156", + "size157", + "size158", + "size159", + "size160", + "size161", + "size162", + "size163", + "size164", + "size165", + "size166", + "size167", + "size168", + "size169", + "size170", + "size171", + "size172", + "size173", + "size174", + "size175", + "size176", + "size177", + "size178", + "size179", + "size180", + "size181", + "size182", + "size183", + "size184", + "size185", + "size186", + "size187", + "size188", + "size189", + "size190", + "size191", + "size192", + "size193", + "size194", + "size195", + "size196", + "size197", + "size198", + "size199", + "size200", + "size201", + "size202", + "size203", + "size204", + "size205", + "size206", + "size207", + "size208", + "size209", + "size210", + "size211", + "size212", + "size213", + "size214", + "size215", + "size216", + "size217", + "size218", + "size219", + "size220", + "size221", + "size222", + "size223", + "size224", + "size225", + "size226", + "size227", + "size228", + "size229", + "size230", + "size231", + "size232", + "size233", + "size234", + "size235", + "size236", + "size237", + "size238", + "size239", + "size240", + "size241", + "size242", + "size243", + "size244", + "size245", + "size246", + "size247", + "size248", + "size249", + "size250", + "size251", + "size252", + "size253", + "size254", + "size255", + "size256"), + INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart for child", "size1"); +INSERT INTO items VALUES ("leadies' coat", "size1"); +INSERT INTO items VALUES ("parka", "size256"); +INSERT INTO items VALUES ("hat", "size256"); + +SELECT * FROM items; + +SELECT * FROM items WHERE size = "size1"; + +SELECT * FROM items WHERE size = "size256"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test new file mode 100644 index 00000000..5dc58df1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +set names utf8mb4; + +CREATE TABLE logs ( + id INT, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (1, json_object('message', repeat('☹', 253))); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test new file mode 100644 index 00000000..f8e658f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test new file mode 100644 index 00000000..342f954b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_drop_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test new file mode 100644 index 00000000..009b519a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_insert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test new file mode 100644 index 00000000..18c624a3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_reindex.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test new file mode 100644 index 00000000..07b987ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test new file mode 100644 index 00000000..ffbe2415 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_add_column.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test new file mode 100644 index 00000000..8e110a23 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_delete.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test new file mode 100644 index 00000000..2b723d46 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_drop_column.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test new file mode 100644 index 00000000..7cb6895a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_insert.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test new file mode 100644 index 00000000..ca9bb7a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_add_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--error 16509 +ALTER TABLE logs ADD INDEX (message); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test new file mode 100644 index 00000000..49bc21c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mariadb_10_2_or_later_create_table_with_index.test @@ -0,0 +1,32 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +--error 16509 +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL, + FULLTEXT INDEX (message) +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test new file mode 100644 index 00000000..c624566c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_mysql_5_7_or_later_add_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +--error ER_ILLEGAL_HA_CREATE_OPTION +ALTER TABLE logs ADD INDEX (message); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test new file mode 100644 index 00000000..76d80420 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_virtual_update.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test new file mode 100644 index 00000000..17a69b3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +CREATE TABLE contents ( + _id INT, + content TEXT NOT NULL, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +INSERT INTO contents (content) VALUES ('first'); +INSERT INTO contents (content) VALUES ('second'); +SELECT _id, content FROM contents; + +DROP TABLE contents; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test new file mode 100644 index 00000000..1d30d0ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +--error ER_CANT_CREATE_TABLE +CREATE TABLE contents ( + _i INT, + content TEXT NOT NULL, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test new file mode 100644 index 00000000..d171d062 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +CREATE TABLE terms ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='default_tokenizer "TokenBigram"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + title TEXT, + FULLTEXT INDEX (title) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, title) VALUES (1, "Mroonga can't build with MySQL X.Y.Z"); + +SELECT * FROM terms ORDER BY name; + +SELECT *, MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score + FROM bugs + WHERE MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE); + +DROP TABLE bugs; +DROP TABLE terms; + +--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 00000000..c23f35ee --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 new file mode 100644 index 00000000..9e128a00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE IF EXISTS mroonga; +--enable_warnings + +CREATE DATABASE mroonga; +USE mroonga; + +CREATE TABLE priorities ( + id INT PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + priority INT COMMENT 'type "priorities"', + INDEX bugs_priority_index (priority) COMMENT 'table "priorities"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, priority) VALUES (1, 10); +INSERT INTO bugs (id, priority) VALUES (2, 3); +INSERT INTO bugs (id, priority) VALUES (3, -2); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +SELECT * + FROM bugs + WHERE priority = 3; + +DROP TABLE bugs; +DROP TABLE priorities; + +DROP DATABASE mroonga; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test new file mode 100644 index 00000000..359dbbda --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag TEXT COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_lz4.test new file mode 100644 index 00000000..f0362241 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..612b2d6a --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_support_zstd.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test new file mode 100644 index 00000000..74b79210 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_support_zstd.test @@ -0,0 +1,37 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/support_libgroonga_zstd.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_ZSTD"' +) 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 00000000..73f15477 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..6d97eb5a --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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/column_groonga_scalar_unsupport_zstd.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test new file mode 100644 index 00000000..b9a5dce5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_unsupport_zstd.test @@ -0,0 +1,37 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/unsupport_libgroonga_zstd.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_ZSTD"' +) 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_with_not_for_mroonga_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test new file mode 100644 index 00000000..bd5894f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag TEXT COMMENT 'It references to tags.name, type "tags"' +) DEFAULT CHARSET=utf8; + +SHOW FULL COLUMNS FROM bugs LIKE 'tag'; + +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test new file mode 100644 index 00000000..1787c111 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL Groonga"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL Mroonga"); +INSERT INTO bugs (id, tags) VALUES (3, "Ruby Rroonga"); + +SELECT * FROM tags ORDER BY SUBSTRING(name, 1, 1) ASC; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test new file mode 100644 index 00000000..29ccc4e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(128) DEFAULT '' COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test new file mode 100644 index 00000000..758f01cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT KEY +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 200); +INSERT INTO items VALUES ("smile", 0); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price = 0; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test new file mode 100644 index 00000000..9e031a3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_json_insert.test @@ -0,0 +1,37 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4; + +INSERT INTO logs VALUES ('{"message": "start"}'); +INSERT INTO logs VALUES ('{"message": "restart"}'); +INSERT INTO logs VALUES ('{"message": "shutdown"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test new file mode 100644 index 00000000..be26045a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + O text, + FULLTEXT INDEX (O) +) DEFAULT CHARSET=cp932; + +INSERT INTO users VALUES ("܂"); +INSERT INTO users VALUES ("Ȃ"); +INSERT INTO users VALUES (""); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--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_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test new file mode 100644 index 00000000..efbaf31f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + 名前 text, + FULLTEXT INDEX (名前) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES ("やまだ"); +INSERT INTO users VALUES ("たなか"); +INSERT INTO users VALUES ("すずき"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--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_set_16_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test new file mode 100644 index 00000000..c1f7fa3d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "white,dark gray"); +INSERT INTO items VALUES ("parka", "chartreuse,orange"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "dark gray,white"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test new file mode 100644 index 00000000..0b02b5e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test @@ -0,0 +1,65 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,lawn green"); +INSERT INTO items VALUES ("parka", "gray,medium blue"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,lawn green"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test new file mode 100644 index 00000000..2dd39e8d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test @@ -0,0 +1,74 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet", + + "dark magenta", + "magenta", + "dark red", + "brown", + "firebrick", + "indian red", + "light coral", + "salmon"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,dark violet"); +INSERT INTO items VALUES ("parka", "green,brown,red"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,dark violet"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test new file mode 100644 index 00000000..117be846 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test @@ -0,0 +1,110 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet", + + "dark magenta", + "magenta", + "dark red", + "brown", + "firebrick", + "indian red", + "light coral", + "salmon", + + "light salmon", + "tomato", + "coral", + "dark salmon", + "rosy brown", + "sienna", + "saddle brown", + "chocolate", + + "peru", + "sandy brown", + "burlywood", + "tan", + "navajo white", + "wheat", + "dark goldenrod", + "goldenrod", + + "light goldenrod", + "pale goldenrod", + "cornsilk", + "dark khaki", + "khaki", + "lemon chiffon", + "dark olive green", + "olive drab", + + "yellow green", + "green yellow", + "light green", + "forest green", + "dark green", + "lime green", + "pale green", + "dark sea green"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white,lawn green,dark violet"); +INSERT INTO items VALUES ("hat", "white,dark violet,yellow green"); +INSERT INTO items VALUES ("parka", "green,brown,red,lime green"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,dark violet,yellow green"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test new file mode 100644 index 00000000..001f4a4a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "dim gray,dark gray"); +INSERT INTO items VALUES ("parka", "white smoke,light gray"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "dim gray,dark gray"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test new file mode 100644 index 00000000..4587be4d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price BIGINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("house", 9223372036854775807); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -9223372036854775808); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 2147483648); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 2147483648; + +SELECT * FROM items WHERE price > 2147483647; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test new file mode 100644 index 00000000..18f52ac0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 2147483647); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -2147483647); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 16777216); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 16777216; + +SELECT * FROM items WHERE price > 16777215; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test new file mode 100644 index 00000000..0d37290f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price MEDIUMINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 8388607); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -8388608); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 32768); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 127; + +SELECT * FROM items WHERE price >= 32768; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test new file mode 100644 index 00000000..ba6b4388 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price SMALLINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -32768); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 20000); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 127; + +SELECT * FROM items WHERE price >= 128; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test new file mode 100644 index 00000000..5978564a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price TINYINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 120); +INSERT INTO items VALUES ("discount", -10); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test new file mode 100644 index 00000000..05afa745 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_fractional_seconds.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + average TIME(6), + max TIME(6), + KEY (average) +) DEFAULT CHARSET UTF8; + +INSERT INTO running_records (title, average, max) + VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); +INSERT INTO running_records (title, average, max) + VALUES ("bad condition", "12:23:34.123456", "838:59:58.999999"); +INSERT INTO running_records (title, average, max) + VALUES ("record failure", "-838:59:59.000000", "-838:59:59.000000"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE average BETWEEN "00:59:59.999999" AND "100:10:10.101010"; + +SELECT * FROM running_records + WHERE average BETWEEN "-838:59:59.000000" AND "01:00:00.000001"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test new file mode 100644 index 00000000..b6de0404 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test @@ -0,0 +1,48 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + average TIME, + max TIME, + KEY (average) +) DEFAULT CHARSET UTF8; + +INSERT INTO running_records (title, average, max) + VALUES ("normal condition", "01:00:00", "01:05:00"); +INSERT INTO running_records (title, average, max) + VALUES ("bad condition", "12:23:34", "838:59:59"); +INSERT INTO running_records (title, average, max) + VALUES ("record failure", "-838:59:59", "-838:59:59"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE average BETWEEN "00:59:59" AND "100:10:10"; + +SELECT * FROM running_records + WHERE average BETWEEN "-838:59:59" AND "01:00:00"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test new file mode 100644 index 00000000..c4f1980a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at TIMESTAMP(6), + updated_at TIMESTAMP(6), + KEY (updated_at) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("clear day", + "2012-01-29 21:51:01.111111", + "2012-01-29 21:51:02.222222"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("rainy day", + "2012-01-30 01:23:45.333", + "2012-01-30 01:23:46.444"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("cloudy day", + "2012-01-31 08:32:10.5555", + "2012-01-31 08:32:11.6666"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test new file mode 100644 index 00000000..1410b4c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', + updated_at TIMESTAMP DEFAULT '2016-04-21 00:00:00', + KEY (updated_at) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("rainy day", "2012-01-30 01:23:45", "2012-01-30 01:23:46"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("cloudy day", "2012-01-31 08:32:10", "2012-01-31 08:32:11"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE updated_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test new file mode 100644 index 00000000..08884ae5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists books; +--enable_warnings + +create table books(title varchar(255), published tinyint); +insert into books values ("MySQL", 1); +insert into books values ("groonga", 1); +insert into books values ("mroonga", 0); + +select count(*) from books where published = 0; +select count(*) from books where published = 1; +select count(*) from books where published != 2; +select count(*) from books where published != 1; + +drop table books; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test new file mode 100644 index 00000000..dee9bcb2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price BIGINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("house", 18446744073709551615); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 9223372036854775808); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 9223372036854775808; + +SELECT * FROM items WHERE price > 9223372036854775807; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test new file mode 100644 index 00000000..be97f2da --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT UNSIGNED +) DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES (317173755057152000); +INSERT INTO ids VALUES (317173755057152002); + +SELECT * FROM ids; + +SELECT * FROM ids WHERE id = 317173755057152000; + +SELECT * FROM ids WHERE id = 317173755057152002; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test new file mode 100644 index 00000000..52c98463 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 4294967295); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 2147483648); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 2147483648; + +SELECT * FROM items WHERE price > 2147483647; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test new file mode 100644 index 00000000..940695ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price MEDIUMINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 16777215); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 8388607); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 8388608; + +SELECT * FROM items WHERE price >= 8388607; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test new file mode 100644 index 00000000..2e941449 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price SMALLINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("note PC", 65535); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 32767); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 32768; + +SELECT * FROM items WHERE price >= 32767; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test new file mode 100644 index 00000000..72d436b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price TINYINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 255); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test new file mode 100644 index 00000000..799fcb29 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + party_year YEAR, + KEY (party_year) +) DEFAULT CHARSET UTF8; + +INSERT INTO aniversary_memos (title, party_year) + VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Wow! Today is the anniversary party day!", "13"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test new file mode 100644 index 00000000..49aa1eaf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + party_year YEAR +) DEFAULT CHARSET UTF8; + +INSERT INTO aniversary_memos (title, party_year) + VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Wow! Today is the anniversary party day!", "13"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test b/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test new file mode 100644 index 00000000..f20499ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/count_star.test @@ -0,0 +1,35 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int PRIMARY KEY +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +SELECT COUNT(*) FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test new file mode 100644 index 00000000..52a1162b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test @@ -0,0 +1,60 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP DATABASE IF EXISTS `master/production`; +DROP DATABASE IF EXISTS `master/development`; +--enable_warnings + +CREATE DATABASE `master/production`; +USE `master/production`; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title) VALUES ("clear day (production)"); +INSERT INTO diaries (title) VALUES ("rainy day (production)"); +INSERT INTO diaries (title) VALUES ("cloudy day (production)"); + +SELECT * FROM diaries; + + +CREATE DATABASE `master/development`; +USE `master/development`; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title) VALUES ("clear day (development)"); +INSERT INTO diaries (title) VALUES ("rainy day (development)"); +INSERT INTO diaries (title) VALUES ("cloudy day (development)"); + +SELECT * FROM diaries; + + +USE test; + +DROP DATABASE `master/production`; +DROP DATABASE `master/development`; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000..51eb67ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test @@ -0,0 +1,149 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# simple test +create table t1 (c1 int); +create table t2 (c1 int); +create table t3 (c1 int); +drop table t1,t2,t3; +create table t1 (c1 int, c2 int, c3 int); +create table t2 (c1 int primary key, c2 int, c3 int); +drop table t1,t2; + +# data type support +create table t1 (c1 bit); +desc t1; +drop table t1; +create table t1 (c1 tinyint); +desc t1; +drop table t1; +create table t1 (c1 smallint); +desc t1; +drop table t1; +create table t1 (c1 mediumint); +desc t1; +drop table t1; +create table t1 (c1 int); +desc t1; +drop table t1; +create table t1 (c1 bigint); +desc t1; +drop table t1; +create table t1 (c1 double); +desc t1; +drop table t1; +create table t1 (c1 float); +desc t1; +drop table t1; +create table t1 (c1 decimal); +desc t1; +drop table t1; +create table t1 (c1 date); +desc t1; +drop table t1; +create table t1 (c1 time); +desc t1; +drop table t1; +create table t1 (c1 timestamp); +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP +desc t1; +drop table t1; +create table t1 (c1 datetime); +desc t1; +drop table t1; +create table t1 (c1 year); +desc t1; +drop table t1; +create table t1 (c1 char(10)); +desc t1; +drop table t1; +create table t1 (c1 varchar(10)); +desc t1; +drop table t1; +create table t1 (c1 binary(10)); +desc t1; +drop table t1; +create table t1 (c1 varbinary(10)); +desc t1; +drop table t1; +create table t1 (c1 tinyblob); +desc t1; +drop table t1; +create table t1 (c1 blob); +desc t1; +drop table t1; +create table t1 (c1 mediumblob); +desc t1; +drop table t1; +create table t1 (c1 longblob); +desc t1; +drop table t1; +create table t1 (c1 tinytext); +desc t1; +drop table t1; +create table t1 (c1 text); +desc t1; +drop table t1; +create table t1 (c1 mediumtext); +desc t1; +drop table t1; +create table t1 (c1 longtext); +desc t1; +drop table t1; +create table t1 (c1 enum("yes","no")); +desc t1; +drop table t1; +create table t1 (c1 set("A","B","AB","O")); +desc t1; +drop table t1; + +# virtual columns +create table t1 (c1 int, `_id` int) engine = mroonga; +desc t1; +drop table t1; + +# error +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_score` float) engine = mroonga; + +# checking for virtual columns +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_id` text) engine = mroonga; +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_id` int, index(`_id`)) engine = mroonga; + +# index for _id +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, primary key (_id)); +create table t1 (_id int, c1 int, primary key (_id) using hash); +drop table t1; +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, unique key (_id)); +create table t1 (_id int, c1 int, unique key (_id) using hash); +drop table t1; +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, key (_id)); +create table t1 (_id int, c1 int, key (_id) using hash); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test new file mode 100644 index 00000000..6bafebd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test new file mode 100644 index 00000000..3baa576a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT FLAGS='COLUMN_VECTOR' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test new file mode 100644 index 00000000..28f0f214 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'groonga_type "tags"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test new file mode 100644 index 00000000..e27f169b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_nonexistent.test @@ -0,0 +1,29 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +--error ER_CANT_CREATE_TABLE +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'groonga_type "Nonexistent"' +) DEFAULT CHARSET=utf8mb4; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test new file mode 100644 index 00000000..a6642872 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) GROONGA_TYPE='tags' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test new file mode 100644 index 00000000..bd4b268b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test new file mode 100644 index 00000000..08792d20 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_nonexistent.test @@ -0,0 +1,29 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +--error ER_CANT_CREATE_TABLE +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'type "Nonexistent"' +) DEFAULT CHARSET=utf8mb4; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test new file mode 100644 index 00000000..8badcf84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED +) DEFAULT CHARSET=utf8 + COMMENT='Free style normal comment'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test new file mode 100644 index 00000000..ade4099a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test new file mode 100644 index 00000000..e0273d17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_comment.test @@ -0,0 +1,39 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 '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_index_flags_index_medium.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test new file mode 100644 index 00000000..d1abc4a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_medium.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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, + content_size INT NOT NULL, + KEY (content_size) COMMENT 'flags "INDEX_MEDIUM"' +) 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_index_small.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test new file mode 100644 index 00000000..a519eca4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_index_small.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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, + is_read BOOL NOT NULL, + KEY (is_read) COMMENT 'flags "INDEX_SMALL"' +) 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_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test new file mode 100644 index 00000000..b5615ff4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_none.test @@ -0,0 +1,39 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 '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_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test new file mode 100644 index 00000000..5524c7ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_flags_parameter.test @@ -0,0 +1,41 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.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, + FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +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_index_flags_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test new file mode 100644 index 00000000..3852ebd1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_none.test @@ -0,0 +1,38 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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_index_flags_with_position_and_with_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test new file mode 100644 index 00000000..f557c5f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_index_flags_with_position_and_with_weight.test @@ -0,0 +1,38 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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_index_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test new file mode 100644 index 00000000..33d1bfda --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_comment.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んだ。"); + +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ふらつく" IN BOOLEAN MODE); +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test new file mode 100644 index 00000000..7b3673ae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_fulltext_index_bin.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んだ。"); + +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ふらつく" IN BOOLEAN MODE); +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test new file mode 100644 index 00000000..4997dbf7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test @@ -0,0 +1,37 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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, + INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +SELECT mroonga_command("dump --dump_plugins no"); + +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_index_normalizer_no_utf8_charset_with_utf8_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test new file mode 100644 index 00000000..5e7c67fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_no_utf8_charset_with_utf8_normalizer.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES latin1; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerMySQLGeneralCI"' +) DEFAULT CHARSET=latin1; + +--error ER_ERROR_ON_WRITE +INSERT INTO diaries VALUES ("2013-04-23", "I drunk a black cookie."); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test new file mode 100644 index 00000000..9bffd2c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_none.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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_index_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test new file mode 100644 index 00000000..489e82ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_parameter.test @@ -0,0 +1,40 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test new file mode 100644 index 00000000..82d68ae5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_comment.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id int PRIMARY KEY AUTO_INCREMENT, + body text, + FULLTEXT INDEX body_index (body) + COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' +) DEFAULT CHARSET utf8; + +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test new file mode 100644 index 00000000..773c740b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_default.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer; +set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +insert into diaries (body) values ("finished Groonga."); +select * from diaries; +select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id; +drop table diaries; +set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test new file mode 100644 index 00000000..f62a6a0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_parser_off.test @@ -0,0 +1,47 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS variables; +--enable_warnings + +CREATE TABLE variables ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + FULLTEXT INDEX (name) COMMENT 'parser "off"' +) DEFAULT CHARSET=utf8; + +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); + +SELECT * FROM variables; +SELECT * FROM variables + WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); + +DROP TABLE variables; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test new file mode 100644 index 00000000..f7add5db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test @@ -0,0 +1,41 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins 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_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test new file mode 100644 index 00000000..2fc98e61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test @@ -0,0 +1,41 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins 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_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test new file mode 100644 index 00000000..aaf60b02 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +SELECT mroonga_command("dump --dump_plugins 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_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test new file mode 100644 index 00000000..0d640c84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_comment.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id int PRIMARY KEY AUTO_INCREMENT, + body text, + FULLTEXT INDEX body_index (body) + COMMENT 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) DEFAULT CHARSET utf8; + +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test new file mode 100644 index 00000000..773c740b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_default.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set @mroonga_default_tokenizer_backup=@@mroonga_default_tokenizer; +set global mroonga_default_tokenizer=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +insert into diaries (body) values ("finished Groonga."); +select * from diaries; +select * from diaries where match(body) against("+start" IN BOOLEAN MODE) order by id; +drop table diaries; +set global mroonga_default_tokenizer=@mroonga_default_tokenizer_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test new file mode 100644 index 00000000..698202a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_off.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS variables; +--enable_warnings + +CREATE TABLE variables ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + FULLTEXT INDEX (name) COMMENT 'tokenizer "off"' +) DEFAULT CHARSET=utf8; + +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +INSERT INTO variables (name) VALUES ("mroonga_default_tokenizer"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); + +SELECT * FROM variables; +SELECT * FROM variables + WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); + +DROP TABLE variables; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test new file mode 100644 index 00000000..1bf4dc10 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_tokenizer_parameter.test @@ -0,0 +1,41 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id int PRIMARY KEY AUTO_INCREMENT, + body text, + FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' +) DEFAULT CHARSET utf8; + +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test new file mode 100644 index 00000000..c4b6fe84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_default.test @@ -0,0 +1,46 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +DROP TABLE IF EXISTS terms; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY +) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test new file mode 100644 index 00000000..42521f1d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_normalizer_hash.test @@ -0,0 +1,47 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test new file mode 100644 index 00000000..dc0996d2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test @@ -0,0 +1,46 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord,TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --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/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test new file mode 100644 index 00000000..ee1da6d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test @@ -0,0 +1,46 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --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/create_table_table_token_filters_stop_word.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test new file mode 100644 index 00000000..87a35657 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_stop_word.test @@ -0,0 +1,53 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +INSERT INTO terms VALUES ("and", true); + +INSERT INTO memos VALUES (1, "Hello"); +INSERT INTO memos VALUES (2, "Hello and Good-bye"); +INSERT INTO memos VALUES (3, "Good-bye"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+\"Hello and\"" IN BOOLEAN MODE); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test new file mode 100644 index 00000000..de2b24cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +select * from t1 where match(c2) against("ki"); +delete from t1 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test new file mode 100644 index 00000000..be739549 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE ids ( + id INT, + KEY (id) +) DEFAULT CHARSET UTF8; + +INSERT INTO ids VALUES(1); +INSERT INTO ids VALUES(2); +INSERT INTO ids VALUES(3); + +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 1; +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 2; +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 3; +SELECT * FROM ids ORDER BY id; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test new file mode 100644 index 00000000..f42651cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +delete from t1 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test new file mode 100644 index 00000000..5bbc7979 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +delete from t1 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test new file mode 100644 index 00000000..b9e23e64 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int, c2 int); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; + +delete from t1 where c1=3; +select * from t1; + +flush tables; + +delete from t1 where c1=2; +select * from t1; + +delete from t1; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test new file mode 100644 index 00000000..056dcae0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS numbers; +--enable_warnings + +CREATE TABLE numbers ( + data BIGINT UNSIGNED +); + +INSERT INTO numbers VALUES(18446744073709551615); + +SELECT * FROM numbers ORDER BY data; + +DELETE FROM numbers WHERE data = 18446744073709551615; +SELECT * FROM numbers ORDER BY data; + +DROP TABLE numbers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test new file mode 100644 index 00000000..f7bc51db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test @@ -0,0 +1,40 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop database if exists groonga; +--enable_warnings + +create database groonga; +drop database groonga; + +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop database groonga; + +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop table t1, t2; +drop database groonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test new file mode 100644 index 00000000..db4a9a03 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_no_table.test @@ -0,0 +1,57 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP DATABASE IF EXISTS another; +--enable_warnings + +CREATE DATABASE another; +USE another; + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + +DROP TABLE diaries; + + +USE test; + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX (title) +); + + +DROP DATABASE another; + +SELECT mroonga_command('object_exist mroonga_operations'); + +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/drop_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000..e672f80f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test @@ -0,0 +1,29 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists alphabet, `with-hyphen`; +--enable_warnings + +create table alphabet (c1 int primary key, c2 int, c3 int); +drop table alphabet; + +create table `with-hyphen` (c1 int primary key, c2 int, c3 int); +drop table `with-hyphen`; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test new file mode 100644 index 00000000..5cb3894a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test @@ -0,0 +1,21 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +flush logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test new file mode 100644 index 00000000..03d05fe1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_add.test @@ -0,0 +1,47 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned +); + +ALTER TABLE articles ADD FOREIGN KEY (comment) REFERENCES comments (comment); + +SHOW CREATE TABLE articles; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles; +DROP TABLE comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test new file mode 100644 index 00000000..d6ef43fa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_alter_drop.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +ALTER TABLE articles DROP FOREIGN KEY comment; + +SHOW CREATE TABLE articles; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles; +DROP TABLE comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test new file mode 100644 index 00000000..4efd2052 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +SHOW CREATE TABLE articles; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles; +DROP TABLE comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test new file mode 100644 index 00000000..37405696 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +--error ER_ROW_IS_REFERENCED_2 +DELETE FROM comments WHERE id = 100; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test new file mode 100644 index 00000000..9322876b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +DELETE FROM comments WHERE id = 200; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test new file mode 100644 index 00000000..283efbd3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test new file mode 100644 index 00000000..4b873f50 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test @@ -0,0 +1,51 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test new file mode 100644 index 00000000..d445731b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_rename.test @@ -0,0 +1,51 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/skip_mariadb_10_1.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS articles; +DROP TABLE IF EXISTS comments; +DROP TABLE IF EXISTS articles2; +DROP TABLE IF EXISTS comments2; +--enable_warnings + +CREATE TABLE comments ( + comment int unsigned PRIMARY KEY, + content text NOT NULL +); + +CREATE TABLE articles ( + content text NOT NULL, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +RENAME TABLE comments TO comments2; +RENAME TABLE articles TO articles2; + +SHOW CREATE TABLE articles2; + +SELECT * FROM information_schema.referential_constraints; + +DROP TABLE articles2; +DROP TABLE comments2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test new file mode 100644 index 00000000..fc3590f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO comments (id, content) VALUES (200, 'Very good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test new file mode 100644 index 00000000..bcba6e75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test @@ -0,0 +1,53 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_5.inc +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_warnings + +CREATE TABLE comments ( + id int unsigned PRIMARY KEY, + content varchar(140) NOT NULL +); + +CREATE TABLE entries ( + content varchar(140) NOT NULL, + comment_id int unsigned, + FOREIGN KEY (comment_id) REFERENCES comments (id) +); + +INSERT INTO comments (id, content) VALUES (100, 'Good entry!'); +INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); +--error ER_NO_REFERENCED_ROW_2 +UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; + +SELECT * FROM entries; +SELECT * FROM comments; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE entries; +DROP TABLE comments; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test new file mode 100644 index 00000000..07470050 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST("" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test new file mode 100644 index 00000000..50cb1282 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("\\(groonga\\)*" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test new file mode 100644 index 00000000..bfe2cdc0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_all.test new file mode 100644 index 00000000..fe904693 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test new file mode 100644 index 00000000..af142c8d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test new file mode 100644 index 00000000..9c04d835 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test new file mode 100644 index 00000000..d1996f54 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test new file mode 100644 index 00000000..a4c90fdd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE) + ORDER BY content; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test new file mode 100644 index 00000000..6ac03531 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE) + ORDER BY content; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test new file mode 100644 index 00000000..24681974 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2015 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE) + ORDER BY content; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test new file mode 100644 index 00000000..3e91ba89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test new file mode 100644 index 00000000..bfe8bb11 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_astarisk.test @@ -0,0 +1,38 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today fi*" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test new file mode 100644 index 00000000..eafacedb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test new file mode 100644 index 00000000..8b7bb2e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test new file mode 100644 index 00000000..3630052a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_operator.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*SS content @ '天気'" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*SS content @ '天気'" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test new file mode 100644 index 00000000..21d53b39 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_syntax_script_selector.test @@ -0,0 +1,50 @@ +# Copyright(C) 2016 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +DROP TABLE IF EXISTS readings; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE readings ( + reading VARCHAR(255) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE items ( + name VARCHAR(255) PRIMARY KEY, + readings TEXT COMMENT 'flags "COLUMN_VECTOR", type "readings"', + FULLTEXT INDEX items_index(readings) COMMENT 'table "readings"' +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES("日本", "ニホン ニッポン"); +INSERT INTO items VALUES("ローマ字", "ローマジ"); +INSERT INTO items VALUES("漢字", "カンジ"); + +SELECT *, MATCH(readings) + AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE) AS score + FROM items + WHERE MATCH(readings) + AGAINST("*SS sub_filter(readings, 'prefix_rk_search(_key, \"niho\")')" in BOOLEAN MODE); + +DROP TABLE items; +DROP TABLE readings; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test new file mode 100644 index 00000000..b8aa91ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test new file mode 100644 index 00000000..30ba517a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test new file mode 100644 index 00000000..96fefd3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test new file mode 100644 index 00000000..2a8e1c19 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test @@ -0,0 +1,63 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + title VARCHAR(255), + tag1 VARCHAR(10), + tag2 VARCHAR(10), + tag3 VARCHAR(10), + tag4 VARCHAR(10), + tag5 VARCHAR(10), + tag6 VARCHAR(10), + tag7 VARCHAR(10), + tag8 VARCHAR(10), + tag9 VARCHAR(10), + tag10 VARCHAR(10), + FULLTEXT INDEX (tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos + VALUES("Groonga", + "tag 1", + "tag 2", + "tag 3", + "tag 4", + "tag 5", + "tag 6", + "tag 7", + "tag 8", + "tag 9", + "tag 10"); + +SELECT title, + MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) + AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE) AS score + FROM memos + WHERE MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) + AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test new file mode 100644 index 00000000..87cd8de6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + category VARCHAR(10), + content TEXT, + FULLTEXT INDEX (title, category, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "日記", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気予報", "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "天気", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, category, content) + AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, category, content) + AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test new file mode 100644 index 00000000..83990fdc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +-- error ER_PARSE_ERROR +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test new file mode 100644 index 00000000..494bf760 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +-- error ER_PARSE_ERROR +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test new file mode 100644 index 00000000..828726d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = "IGNORE"; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test new file mode 100644 index 00000000..d9a0adac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test new file mode 100644 index 00000000..3cf85e35 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su"); +select * from t1 where match(c3) against("ii"); +select * from t1 where match(c3) against("+su" in boolean mode); +select * from t1 where match(c3) against("+ii" in boolean mode); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test new file mode 100644 index 00000000..301a85c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "̕xmR̓VCɂ‚",""); +insert into t1 values(2, "","̕xmR̓VC͕܂"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("xmR"); +select * from t1 where match(c3) against("xmR"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test new file mode 100644 index 00000000..985ce19d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "ٻλŷˤĤ",""); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("ٻλ"); +select * from t1 where match(c3) against("ٻλ"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test new file mode 100644 index 00000000..d1d80170 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山"); +select * from t1 where match(c3) against("富士山"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test new file mode 100644 index 00000000..9492b33b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8mb4; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci, + content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET utf8mb4; + +INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); +INSERT INTO diaries VALUES(2, "Mathmatics", "𝐀𝐁𝐂𝐃𝐄 | U+1D400-U+1D405"); +INSERT INTO diaries VALUES(3, "ひらがな", "あいうえお"); + +SELECT * + FROM diaries + WHERE MATCH (content) AGAINST("ABCDE" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test new file mode 100644 index 00000000..048fcd1c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST(""); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test new file mode 100644 index 00000000..08acc357 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test @@ -0,0 +1,48 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT SQL_CALC_FOUND_ROWS * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SELECT FOUND_ROWS(); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test new file mode 100644 index 00000000..4b113946 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test @@ -0,0 +1,47 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs, tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags", flags "COLUMN_VECTOR"', + FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL groonga"); +INSERT INTO bugs (id, tags) VALUES (3, "mroonga"); + +SELECT * + FROM bugs + WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); + +DROP TABLE bugs, tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test new file mode 100644 index 00000000..1846e37b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title) against("富士山"); +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title) against("富士山"); +select * from diaries; +create fulltext index new_title_index on diaries (title); +select * from diaries where match(title) against("富士山"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test new file mode 100644 index 00000000..c43341f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test @@ -0,0 +1,41 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +drop table t1,t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test new file mode 100644 index 00000000..e133073e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test @@ -0,0 +1,32 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test new file mode 100644 index 00000000..c5199ee5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test new file mode 100644 index 00000000..799b9c81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test new file mode 100644 index 00000000..36dcb6c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test @@ -0,0 +1,49 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; + +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title, content) against("富士山"); + +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title, content) against("富士山"); + +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); + +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test new file mode 100644 index 00000000..d84888f9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +update diaries set title = "チョモランマ" where id = 3; +update diaries set content = "チョモランマと富士山" where id = 1; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test new file mode 100644 index 00000000..7b04e9a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + title text, + body text, + fulltext index title_index (title), + fulltext index body_index (body) +) default charset utf8; + +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); + +select * from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +select *, match(title) against("survey"), match(body) against("groonga") + from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test new file mode 100644 index 00000000..aca6a6a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test @@ -0,0 +1,38 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES("Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES("天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES("富士山", "今日も天気がよくてきれいに見える。"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("*D+ 今日 天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test new file mode 100644 index 00000000..b99abc8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test @@ -0,0 +1,47 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# for "not match against" +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select * from t1 where match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where match(c3) against("+dummy" in boolean mode) order by c1; +select * from t1 where not match(c3) against("+dummy" in boolean mode) order by c1; +select * from t1 where c1 = 4 and not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where c1 <= 4 and not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where c1 > 4 and not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where c2 = 10 and not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where c2 >= 15 and not match(c3) against("+uu" in boolean mode) order by c1; +select * from t1 where c2 < 15 and not match(c3) against("+uu" in boolean mode) order by c1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test new file mode 100644 index 00000000..ad93bdd7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST("Ruby" IN BOOLEAN MODE) OR + MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test new file mode 100644 index 00000000..90b8bc8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_against.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga mroonga" IN BOOLEAN MODE) + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test new file mode 100644 index 00000000..fbcbce13 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_different_match.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + body TEXT, + FULLTEXT KEY (title), + FULLTEXT KEY (body) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga", "I read groonga's tutorial."); +INSERT INTO diaries VALUES("Start mroonga", "I read mroonga's tutorial."); +INSERT INTO diaries VALUES("Start groonga and Ruby", "I installed rroonga."); + +SELECT * FROM diaries; + +SELECT *, MATCH(body) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) + ORDER BY MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test new file mode 100644 index 00000000..a421a31b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_no_where.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test new file mode 100644 index 00000000..3dbaa6bf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_boolean_mode_same_match_against.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_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 00000000..4a3af371 --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..fb45c0c6 --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..8af0e41e --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..6c7eb0a6 --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..917d437d --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 00000000..b4dd8ade --- /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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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/fulltext_two_inner_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test new file mode 100644 index 00000000..538b741f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test @@ -0,0 +1,69 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users, posts, comments; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + id int NOT NULL, + name varchar(50) NOT NULL, + PRIMARY KEY (id), + KEY (name) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE posts ( + id int NOT NULL, + content mediumtext, + user_id int NOT NULL, + PRIMARY KEY (id), + FULLTEXT KEY (content) +) DEFAULT CHARSET=utf8; + +CREATE TABLE comments ( + id int NOT NULL, + user_id int NOT NULL, + post_id int NOT NULL, + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"), + (2, "Bob"), + (3, "Calros"); +INSERT INTO posts VALUES (1, "Hello!", 1), + (2, "World!", 2), + (3, "Great!", 3); +INSERT INTO comments VALUES (1, 1, 1), + (2, 2, 1), + (3, 3, 3); + +SELECT * + FROM comments + INNER JOIN posts + ON posts.id = comments.post_id AND + MATCH (posts.content) AGAINST ("Hello!" IN BOOLEAN MODE) + INNER JOIN users + ON users.id = comments.user_id AND + users.name = "Alice"; + +DROP TABLE users, posts, comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test new file mode 100644 index 00000000..606e0c0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_10_0_no_such_key.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_10_0.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +-- error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test new file mode 100644 index 00000000..311a623b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_5_no_such_key.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_5.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test new file mode 100644 index 00000000..d51636cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_5_6_no_such_key.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_version_5_6.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +-- error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test new file mode 100644 index 00000000..e40a703b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES('It is Groonga'); +INSERT INTO diaries VALUES('It is Mroonga'); + +SELECT mroonga_command('select', + 'table', 'diaries', + 'filter', 'title @ "Groonga"'); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test new file mode 100644 index 00000000..5ba0ca77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT mroonga_command('select diaries --match_columns "title" --query "groonga"'); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test new file mode 100644 index 00000000..720c547c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 `db-1`; +CREATE DATABASE `db-1`; +USE `db-1`; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command('dump --dump_plugins no'); + +DROP TABLE diaries; + +--disable_query_log +USE test; +DROP DATABASE `db-1`; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test new file mode 100644 index 00000000..ee0b4833 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape() AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test new file mode 100644 index 00000000..8023de1d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape(29) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test new file mode 100644 index 00000000..f9cbf025 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape('+-><~*()\"\\:', 29) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test new file mode 100644 index 00000000..9ed61499 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_all.test @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:') AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test new file mode 100644 index 00000000..5d1555cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_custom.test @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:', '()<>~') AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test new file mode 100644 index 00000000..8f0090fd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_join.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS queries; +--enable_warnings + +CREATE TABLE users ( + id INT +); + +CREATE TABLE queries ( + user_id INT, + query TEXT +); + +INSERT INTO users VALUES (1); +INSERT INTO users VALUES (2); +INSERT INTO users VALUES (3); + +INSERT INTO queries VALUES (1, '(a)'); +INSERT INTO queries VALUES (2, '(b)'); +INSERT INTO queries VALUES (3, '(c)'); + +SELECT users.id, mroonga_escape(queries.query) AS escaped_query + FROM queries + LEFT JOIN users ON users.id = queries.user_id + ORDER BY users.id; + +DROP TABLE queries; +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test new file mode 100644 index 00000000..bab9f917 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_match_against.test @@ -0,0 +1,46 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_tokenizer = TokenDelimit; + +SET NAMES utf8mb4; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8mb4; + +INSERT INTO memos VALUES(1, "(Groonga) Installed!"); +INSERT INTO memos VALUES(2, "(Mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(Groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST(mroonga_escape("(groonga)") IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_tokenizer = TokenBigram; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test new file mode 100644 index 00000000..8c7776a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_named.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:' AS query) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test new file mode 100644 index 00000000..ed8e77cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_query_nested.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT mroonga_escape(mroonga_escape('*groonga*')); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test new file mode 100644 index 00000000..d8d97996 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_decimal.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS data; +--enable_warnings + +CREATE TABLE data ( + value DECIMAL(5, 3) +); + +INSERT INTO data VALUES (2.9); + +SELECT mroonga_escape(value AS script) + FROM data; + +DROP TABLE data; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test new file mode 100644 index 00000000..51c1df9d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_integer.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape(-29 AS script) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test new file mode 100644 index 00000000..10859733 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_real.test @@ -0,0 +1,39 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS data; +--enable_warnings + +CREATE TABLE data ( + value REAL +); + +INSERT INTO data VALUES (2.9); + +SELECT mroonga_escape(value AS script) + FROM data; + +DROP TABLE data; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test new file mode 100644 index 00000000..46c3b558 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_script_string.test @@ -0,0 +1,26 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('a\"\\\'z' AS script) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test new file mode 100644 index 00000000..3958782a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test @@ -0,0 +1,45 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS keywords; +--enable_query_log +--enable_warnings + +CREATE TABLE keywords ( + keyword text +); + +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + keyword) AS highlighted + FROM keywords; + +--disable_query_log +DROP TABLE keywords; +--enable_query_log + + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test new file mode 100644 index 00000000..533bf1c2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_japanese.test @@ -0,0 +1,31 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + 'ロック', '更新') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test new file mode 100644 index 00000000..98643876 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test @@ -0,0 +1,25 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + 'Mroonga', 'Groonga') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test new file mode 100644 index 00000000..83e5966d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test @@ -0,0 +1,25 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', + 'mroonga') AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test new file mode 100644 index 00000000..e632f027 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query.test @@ -0,0 +1,31 @@ +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + 'ロック 更新 -ボトルネック' AS query) AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test new file mode 100644 index 00000000..f17aa0f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_query_pragma.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_highlight_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + '*D- +ロック +更新 ボトルネック' AS query) AS highlighted; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test new file mode 100644 index 00000000..07b1273e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_record.test @@ -0,0 +1,55 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); + +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); + +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); + +SELECT mroonga_highlight_html(content, 'Mroonga') AS highlighted + FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test new file mode 100644 index 00000000..b6bced16 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test @@ -0,0 +1,48 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); + +--error ER_CANT_INITIALIZE_UDF +select last_insert_grn_id(1); + +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test new file mode 100644 index 00000000..a287da00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test @@ -0,0 +1,35 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +); + +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test new file mode 100644 index 00000000..acb253a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +); + +SELECT last_insert_id(); +SELECT last_insert_id(10); +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test new file mode 100644 index 00000000..aa2eee53 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test @@ -0,0 +1,24 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_normalize('aBcAbC㍑'); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test new file mode 100644 index 00000000..bb9199f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test @@ -0,0 +1,24 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_normalize('aBcAbC㍑', "NormalizerAuto"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test new file mode 100644 index 00000000..b67ff53a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_record.test @@ -0,0 +1,40 @@ +# Copyright(C) 2015 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('aBcAbC㍑'); + +SELECT mroonga_normalize(content) FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test new file mode 100644 index 00000000..8b0ae025 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_multiple.test @@ -0,0 +1,46 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); +INSERT INTO synonyms VALUES ('Mroonga', 'Mroonga'); +INSERT INTO synonyms VALUES ('Mroonga', 'Groonga MySQL'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test new file mode 100644 index 00000000..400503ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_no_index.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test new file mode 100644 index 00000000..22241f6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_one.test @@ -0,0 +1,44 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + 'Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test new file mode 100644 index 00000000..3627a2c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_query_expand_pragma.test @@ -0,0 +1,45 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--disable_warnings +DROP TABLE IF EXISTS synonyms; +--enable_warnings + +CREATE TABLE synonyms ( + term varchar(255), + synonym varchar(255), + INDEX (term) +); + +INSERT INTO synonyms VALUES ('D+', '[D+]'); +INSERT INTO synonyms VALUES ('Rroonga', 'Rroonga'); +INSERT INTO synonyms VALUES ('Rroonga', 'Groonga Ruby'); + +SELECT mroonga_query_expand('synonyms', + 'term', + 'synonym', + '*D+ Mroonga Rroonga PGroonga') AS query; + +DROP TABLE synonyms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test new file mode 100644 index 00000000..72da393f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa bb cc dd ee >< ff gg hh ii jj kk ll mm nn"); +insert into t1 values(2,20,"nn mm ll kk jj >< ii hh gg ff ee dd cc bb aa"); +insert into t1 values(3,30,"cc dd ee ff gg >< hh ii jj kk ll mm nn oo pp"); +insert into t1 values(4,40,"ee ff gg hh ii >< jj kk ll mm nn oo pp qq rr"); +insert into t1 values(5,50,"AA BB CC DD EE >< FF GG HH II JJ KK LL MM NN"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test new file mode 100644 index 00000000..afaa4368 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "","QX̕xmR̓VCɂ‚"); +insert into t1 values(2, "","QX̕xmR̓VC͕܂"); +insert into t1 values(3, "","29̕xmR̓VCɂ‚"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', 'QX', '', '', 'VC', '', '', 'xmR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', 'QX', '(w1)[', ']', 'VC', '(w2)[', ']', 'xmR', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test new file mode 100644 index 00000000..cd59a216 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "","ٻλŷˤĤ"); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "","29ٻλŷˤĤ"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '', '', '', 'ŷ', '', '', 'ٻλ', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '', '(w1)[', ']', 'ŷ', '(w2)[', ']', 'ٻλ', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test new file mode 100644 index 00000000..a92e651c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test @@ -0,0 +1,45 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS keywords; +--enable_query_log +--enable_warnings + +CREATE TABLE keywords ( + keyword text +); + +INSERT INTO keywords VALUES ('Mroonga'); +INSERT INTO keywords VALUES ('Groonga'); + +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', + keyword) as snippet + FROM keywords; + +--disable_query_log +DROP TABLE keywords; +--enable_query_log + + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test new file mode 100644 index 00000000..fcc5a0fc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_japanese.test @@ -0,0 +1,31 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + 'ロック', '更新') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test new file mode 100644 index 00000000..54953ebe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test @@ -0,0 +1,25 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', + 'Mroonga', 'Groonga') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test new file mode 100644 index 00000000..9aac07a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_snippets.test @@ -0,0 +1,29 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SELECT mroonga_snippet_html('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.', + 'lock') as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test new file mode 100644 index 00000000..d441b0ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query.test @@ -0,0 +1,31 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + 'ロック 更新 -ボトルネック' AS query) as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test new file mode 100644 index 00000000..0aa115d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_query_pragma.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES utf8; + +SELECT mroonga_snippet_html('Mroongaには2つの動作モードがあります。 + +1つが「ストレージモード」で、データストアも検索機能もすべてGroongaを使うモードです。これがデフォルトのモードです。上述の参照ロックフリーなGroongaの性能特性をフルに活かした高速なデータ更新・全文検索・位置情報検索が特長です。一方、トランザクションなどの機能は提供されません。 + +もう1つが「ラッパーモード」で、MyISAMやInnoDBといった他のストレージエンジンに 全文検索機能だけ を追加するモードです。このモードではトランザクションなど他のストレージエンジンがサポートしている機能に加えてGroongaの高速な全文検索機能を利用することができます。一方、Groongaの参照ロックフリーな特性は活かすことができません。また、更新処理は他のストレージエンジンがボトルネックになることが多いでしょう。', + '*D- +ロック +更新 ボトルネック' AS query) as snippet; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test new file mode 100644 index 00000000..c25d140c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_record.test @@ -0,0 +1,55 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +--disable_query_log +DROP TABLE IF EXISTS memos; +--enable_query_log +--enable_warnings + +CREATE TABLE memos ( + content text +); + +INSERT INTO memos VALUES ('Mroonga is a MySQL storage engine based on Groonga, the full text search engine. + +In MySQL 5.1 or later, Pluggable Storage Engine interface is introduced, and we can use custom storage engines easily. So we implement Mroonga, so that we can use Groonga through MySQL. + +By using Mroonga, you can use Groonga with SQL.'); + +INSERT INTO memos VALUES ('Since Tritonn was the modified version of MySQL, we need to build it by ourselves or use binary files provided by Tritonn project, thus we cannot use the official binary files provided by MySQL. + +On the other hand, Mroonga is an independent program (shared library) using Pluggable Storage Engine interface, and we can dynamically load it on MySQL''s official binary. So we can use it more easily than Tritonn.'); + +INSERT INTO memos VALUES ('Mroonga has two running modes. + +One is "storage mode", that is the default mode, and we use Groonga for both storing data and searching. With this mode, you can have full benefits of Groonga described above, like fast data update, lock-free full text search and geolocation search. But it does not support transactions. + +Another one is "wrapper mode", that adds full text search function on other storage engines like MyISAM or InnoDB. With this mode, you can use Groonga''s fast full text search with having the benefits of the storage engine, ex. transaction in InnoDB. But you cannot have benefits from Groonga''s read-lock free characteristic. And you might have the performance bottle neck in the storage engine in updating data.'); + +SELECT mroonga_snippet_html(content, 'Mroonga') as snippet + FROM memos; + +--disable_query_log +DROP TABLE memos; +--enable_query_log + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test new file mode 100644 index 00000000..c6b19acd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test @@ -0,0 +1,28 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--error ER_CANT_INITIALIZE_UDF +SELECT mroonga_snippet("Invalid charset test", 10, 2, "nonexistent_charset", + 1, 0, "...", "...", "charset", "<", ">"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test new file mode 100644 index 00000000..7182dfbc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test @@ -0,0 +1,28 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--error ER_CANT_INITIALIZE_UDF +SELECT mroonga_snippet("Unsuppported charset test", 10, 2, "big5", + 1, 0, "...", "...", "charset", "<", ">"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test new file mode 100644 index 00000000..dfa373dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "あああああ","29日の富士山の天気について"); +insert into t1 values(2, "いいいいい","29日の富士山の天気は分かりません"); +insert into t1 values(3, "ううううう","29日の富士山の天気について"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test new file mode 100644 index 00000000..160fbf53 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test @@ -0,0 +1,36 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + location GEOMETRY NOT NULL +); + +INSERT IGNORE INTO shops VALUES (NULL), (NULL); + +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 new file mode 100644 index 00000000..7b4bd34d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test @@ -0,0 +1,154 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL, + SPATIAL KEY location_index (location) +); + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + 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) + ORDER BY id; + +EXPLAIN +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; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test new file mode 100644 index 00000000..5664bc4b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_bulk_insert_null.test @@ -0,0 +1,37 @@ +# Copyright(C) 2014 Kenji Maruyama +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + location GEOMETRY NOT NULL +); + +--error ER_BAD_NULL_ERROR +INSERT INTO shops VALUES (NULL), (NULL); + +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_strict_sql_mode_contains.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test new file mode 100644 index 00000000..a337ac6a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_strict_sql_mode_contains.test @@ -0,0 +1,152 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL, + SPATIAL KEY location_index (location) +); + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + 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) + ORDER BY id; + +EXPLAIN +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; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test b/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test new file mode 100644 index 00000000..fdb8e205 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/i_s.test @@ -0,0 +1,23 @@ +# Copyright (c) 2019, MariaDB +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +SHOW CREATE TABLE INFORMATION_SCHEMA.MROONGA_STATS; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test new file mode 100644 index 00000000..0b16dfbd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + created_at datetime, + title varchar(256), + KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); + +SELECT * + FROM diaries FORCE INDEX(created_at_key) + WHERE created_at = "2012-10-25 16:18:29"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test new file mode 100644 index 00000000..c27e05a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timer; +--enable_warnings + +CREATE TABLE timer ( + id int PRIMARY KEY, + elapsed time, + KEY elapsed_key(elapsed) +); + +INSERT INTO timer VALUES (1, "00:00:00"); +INSERT INTO timer VALUES (2, "15:11:12"); +INSERT INTO timer VALUES (3, "838:59:59"); +INSERT INTO timer VALUES (4, "-838:59:59"); + +SELECT * + FROM timer FORCE INDEX(elapsed_key) + WHERE elapsed = "-838:59:59"; + +DROP TABLE timer; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test new file mode 100644 index 00000000..c7b57f49 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + created_at timestamp, + title varchar(256), + KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("1970-01-01 12:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-05 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("2038-01-18 15:14:07", "The end"); + +SELECT * + FROM diaries FORCE INDEX(created_at_key) + WHERE created_at = "2012-10-05 16:18:29"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test new file mode 100644 index 00000000..a922bc03 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, index using btree (c2)); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test new file mode 100644 index 00000000..f385fb28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, a int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +select * from t1 where _id = 2; +select * from t1 where _id = 20; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test new file mode 100644 index 00000000..fa22ab1f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test @@ -0,0 +1,40 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 VALUES(null, 100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); +INSERT INTO t1 VALUES(1,100); + +SELECT * FROM t1; +SELECT * FROM t1 WHERE _id = 2; +SELECT * FROM t1 WHERE _id = 20; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test new file mode 100644 index 00000000..0a39b8d4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, a int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +select * from t1 where _id = 2; +select * from t1 where _id = 20; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test new file mode 100644 index 00000000..341873ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, index using hash (c2)); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test new file mode 100644 index 00000000..0f27d333 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_strict_sql_mode_id_primary.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (_id int, a int, PRIMARY KEY (_id) USING HASH); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 VALUES(null, 100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); +--error 1265 +INSERT INTO t1 VALUES(1,100); + +SELECT * FROM t1; +SELECT * FROM t1 WHERE _id = 2; +SELECT * FROM t1 WHERE _id = 20; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test new file mode 100644 index 00000000..9507b395 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + id int primary key auto_increment not null, + name char(30) not null, + score int not null, + index property (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test new file mode 100644 index 00000000..b1095ae0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 SMALLINT, + c2 SMALLINT, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test new file mode 100644 index 00000000..3f43db0c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 BIGINT UNSIGNED, + c2 BIGINT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test new file mode 100644 index 00000000..31e5a791 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 INT UNSIGNED, + c2 INT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test new file mode 100644 index 00000000..9340c784 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 SMALLINT UNSIGNED, + c2 SMALLINT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test new file mode 100644 index 00000000..3787489e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 VARCHAR(10), + c2 VARCHAR(10), + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + ('1999', '12'), + ('2000', '11'), + ('2001', '10'), + ('2002', '09'), + ('2003', '08'), + ('2004', '07'), + ('2005', '06'), + ('2006', '05'), + ('2007', '04'), + ('2008', '03'), + ('2009', '02'), + ('2010', '01'); + +SELECT * FROM t1 WHERE c1 > '2005'; +SELECT * FROM t1 WHERE c1 >= '2005'; +SELECT * FROM t1 WHERE c1 = '2005'; +SELECT * FROM t1 WHERE c1 <= '2005'; +SELECT * FROM t1 WHERE c1 < '2005'; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.test new file mode 100644 index 00000000..e4f07494 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_asc_asc.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + score3 INT, + INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); + +SELECT * + FROM items + WHERE score1 = 2 + ORDER BY score2 ASC, score3 ASC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.test new file mode 100644 index 00000000..1d636391 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_order_by_where_equal_desc_desc.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + score3 INT, + INDEX (score1, score2, score3) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); +INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); +INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); + +SELECT * + FROM items + WHERE score1 = 2 + ORDER BY score2 DESC, score3 DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test new file mode 100644 index 00000000..19fd3c1f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + name char(30) not null, + score int not null, + primary key (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test new file mode 100644 index 00000000..092b9ad9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + name char(30) not null, + score int not null, + primary key (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +select * from scores where name = "Taro Yamada"; +select * from scores where name = "Taro Yamada" and score = 29; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test new file mode 100644 index 00000000..e99db080 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_strict_sql_mode_update.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + name char(30) NOT NULL, + score int NOT NULL, + PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; + +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); + +SELECT * FROM scores; + +--error 1265 +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; + +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test new file mode 100644 index 00000000..e4a38ea0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + name char(30) NOT NULL, + score int NOT NULL, + PRIMARY KEY (name, score) +) DEFAULT CHARSET=utf8; + +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES ("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES ("Taro Yamada", 10); + +SELECT * FROM scores; + +UPDATE scores SET name = "Taro Yamada" + WHERE name = "Jiro Yamada" AND score = 27; + +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test new file mode 100644 index 00000000..171919b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at > "2014-09-11 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test new file mode 100644 index 00000000..67d5c44f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_greater_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at >= "2014-09-11 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test new file mode 100644 index 00000000..b7d0b074 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at < "2014-09-12 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test new file mode 100644 index 00000000..5576bbc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_all_used_less_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at <= "2014-09-12 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test new file mode 100644 index 00000000..13c47b4a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test new file mode 100644 index 00000000..7b890430 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_greater_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test new file mode 100644 index 00000000..60b4cd27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test new file mode 100644 index 00000000..ece1d157 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_have_prefix_less_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (score1, created_at, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(3, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE score1 = 2 AND created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test new file mode 100644 index 00000000..924a0ac2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at > "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test new file mode 100644 index 00000000..8636e5ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_greater_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at >= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test new file mode 100644 index 00000000..73d53693 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at < "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test new file mode 100644 index 00000000..630d60a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_partially_used_no_prefix_less_than_or_equal.test @@ -0,0 +1,45 @@ +# Copyright(C) 2015 Masafumi Yokoyama +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT, + score2 INT, + created_at DATETIME, + INDEX (created_at, score1, score2) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score1, score2, created_at) VALUES(1, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 00:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-01 12:00:00"); +INSERT INTO items (score1, score2, created_at) VALUES(2, 0, "2015-07-02 00:00:00"); + +SELECT * + FROM items + WHERE created_at <= "2015-07-01 12:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test new file mode 100644 index 00000000..e8840b4a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table listing ( + id int primary key auto_increment not null, + last_name char(30) not null, + first_name char(30) not null, + index name (last_name, first_name) +) default charset utf8; +show create table listing; + +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); + +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +drop index name on listing; +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +create index new_name_index on listing (last_name, first_name); +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +drop table listing; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test new file mode 100644 index 00000000..d31762b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + INDEX property (NAME, SCORE) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores; +REPLACE scores (id, name, score) VALUES (3, "Taro Yamada", 28); +SELECT * FROM scores; +SELECT * FROM scores WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test new file mode 100644 index 00000000..5730aaf8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS temperatures; +--enable_warnings + +CREATE TABLE temperatures ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(20), + temperature DOUBLE, + KEY temperature_index(temperature), + KEY multi_index(temperature, title) +); + +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); + +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +DROP TABLE temperatures; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test new file mode 100644 index 00000000..1b7132b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS temperatures; +--enable_warnings + +CREATE TABLE temperatures ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(20), + temperature FLOAT, + KEY temperature_index(temperature), + KEY multi_index(temperature, title) +); + +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); + +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +DROP TABLE temperatures; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test new file mode 100644 index 00000000..332ecfc9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + INDEX property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores; + +SELECT * FROM scores WHERE score = 29; + +SELECT * FROM scores WHERE score = 29 AND name = "Taro Yamada"; + +SELECT * FROM scores WHERE (score >= -12 AND score < 29) AND name = "Taro Yamada"; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test new file mode 100644 index 00000000..bdd3b0c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_max.test @@ -0,0 +1,44 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT NOT NULL, + score2 INT NOT NULL, + INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; + +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); + +SELECT MAX(score2) FROM scores WHERE score1 = 2; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test new file mode 100644 index 00000000..23a16379 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_min.test @@ -0,0 +1,44 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score1 INT NOT NULL, + score2 INT NOT NULL, + INDEX (score1, score2) +) DEFAULT CHARSET=UTF8; + +INSERT INTO scores (score1, score2) VALUES(1, 1); +INSERT INTO scores (score1, score2) VALUES(1, 2); +INSERT INTO scores (score1, score2) VALUES(2, 3); +INSERT INTO scores (score1, score2) VALUES(2, 2); +INSERT INTO scores (score1, score2) VALUES(2, 1); +INSERT INTO scores (score1, score2) VALUES(2, 0); +INSERT INTO scores (score1, score2) VALUES(2, -1); +INSERT INTO scores (score1, score2) VALUES(2, -2); +INSERT INTO scores (score1, score2) VALUES(2, -3); + +SELECT MIN(score2) FROM scores WHERE score1 = 2; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test new file mode 100644 index 00000000..8805771e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table listing ( + id int primary key auto_increment not null, + last_name char(30) not null, + first_name char(30) not null, + index name (last_name, first_name) +) default charset utf8; +show create table listing; +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing; +select * from listing where last_name = "Taro"; +select * from listing where last_name = "Taro" and first_name = "Suzuki"; +select * from listing where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +drop table listing; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test new file mode 100644 index 00000000..fad11187 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists scores; +--enable_warnings + +set names utf8; +create table scores ( + given_name varchar(30) not null, + family_name varchar(30) not null, + score int not null, + primary key property (given_name, family_name, score) +) default charset utf8; +show create table scores; + +insert into scores values("Taro", "Yamada", 29); +insert into scores values("Taro", "Yamada", -12); +insert into scores values("Jiro", "Yamada", 27); +insert into scores values("Taro", "Yamada", 10); + +select * from scores; +select * from scores where given_name = "Taro" and family_name = "Yamada"; +select * from scores where given_name = "Taro" and family_name = "Yamada" and score = 29; +select * from scores where given_name = "Taro" and family_name = "Yamada" and (score >= -12 and score < 29); + +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test new file mode 100644 index 00000000..bf420af0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT IGNORE INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT IGNORE INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = "1000-01-01" AND end = "9999-12-31"; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test new file mode 100644 index 00000000..236ff40c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = "1000-01-02" AND end = "9999-12-31"; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test new file mode 100644 index 00000000..901d55ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-02", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-02"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test new file mode 100644 index 00000000..767fcce9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT IGNORE INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT IGNORE INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test new file mode 100644 index 00000000..fa1b841a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT IGNORE INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT IGNORE INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT IGNORE INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test new file mode 100644 index 00000000..c5147500 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test new file mode 100644 index 00000000..3ccb4249 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-02", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-02"); +INSERT INTO ranges VALUES (4, "1000-01-02", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test new file mode 100644 index 00000000..a6d82c32 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test new file mode 100644 index 00000000..b1e4a3b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test new file mode 100644 index 00000000..dc8cebf7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_insert_delete_insert_invalid_value.test @@ -0,0 +1,40 @@ +# Copyright(C) 2015-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_strict_sql_mode.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT IGNORE INTO ranges VALUES (1, "1990-00-00 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test new file mode 100644 index 00000000..7cb4e219 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test new file mode 100644 index 00000000..e2b1bb0a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-02 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-02 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-02 00:00:00", "9999-12-31 23:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test new file mode 100644 index 00000000..927d8aed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test new file mode 100644 index 00000000..7ae2be84 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int primary key, c2 decimal(65,30), c3 decimal(65,30), unique key uk1(c2,c3)); +insert into t1 values(1,123.456,0.000000000000000000000000000001); +insert into t1 values(2,-123.456,123.456); +insert into t1 values(3,98765432109876543210987654321098765.432109876543210987654321098765,-123.456); +insert into t1 values(4,-98765432109876543210987654321098765.432109876543210987654321098765,98765432109876543210987654321098765.432109876543210987654321098765); +insert into t1 values(5,0.000000000000000000000000000001,-98765432109876543210987654321098765.432109876543210987654321098765); +select c1, c2, c3 from t1 force index(uk1) where c2 = -98765432109876543210987654321098765.432109876543210987654321098765 and c3 = 98765432109876543210987654321098765.432109876543210987654321098765; +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +select c2, c3 from t1 force index(uk1) order by c2, c3; +--error ER_DUP_ENTRY +insert into t1 values(6,123.456,0.000000000000000000000000000001); +delete from t1 where c1 = 1; +insert into t1 values(1,123.456,0.000000000000000000000000000001); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test new file mode 100644 index 00000000..1229d887 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (2, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (3, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (4, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test new file mode 100644 index 00000000..68fbb2ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test new file mode 100644 index 00000000..3ae97526 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test new file mode 100644 index 00000000..20b08342 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test new file mode 100644 index 00000000..0c3315d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (4, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test new file mode 100644 index 00000000..2780a153 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test new file mode 100644 index 00000000..2e827343 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test new file mode 100644 index 00000000..36532836 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp DEFAULT '2016-04-21 00:00:00', + end timestamp DEFAULT '2016-04-22 00:00:00', + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test new file mode 100644 index 00000000..eb0aabde --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(10), c3 varchar(10), unique key uk1(c2,c3)) default charset=utf8 collate utf8_bin; +insert into t1 values(1,'abcde','abc '); +insert into t1 values(2,'abc\0','abcde'); +insert into t1 values(3,'abc','abc\0'); +insert into t1 values(4,'abc ','abc'); +insert into t1 values(5,'abc ','abc '); +select c1, c2, c3 from t1 force index(uk1) where c2 = 'abc ' and c3 = 'abc'; +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +select c2, c3 from t1 force index(uk1) order by c2, c3; +--error ER_DUP_ENTRY +insert into t1 values(6,'abcde','abc '); +delete from t1 where c1 = 1; +insert into t1 values(1,'abcde','abc '); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test new file mode 100644 index 00000000..1d93df36 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, 1901, 2012); +INSERT IGNORE INTO ranges VALUES (2, 1901, 2155); +INSERT IGNORE INTO ranges VALUES (3, 2012, 2155); +INSERT IGNORE INTO ranges VALUES (4, 2155, 1901); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = 1901 AND end = 2155; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test new file mode 100644 index 00000000..5cad0231 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = 1901 AND end = 2155; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test new file mode 100644 index 00000000..9bc8aaf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test new file mode 100644 index 00000000..8090ccc5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, 2012, 2155); +INSERT IGNORE INTO ranges VALUES (2, 1901, 2012); +INSERT IGNORE INTO ranges VALUES (3, 2155, 1901); +INSERT IGNORE INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test new file mode 100644 index 00000000..8927d4bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT IGNORE INTO ranges VALUES (1, 2012, 2155); +INSERT IGNORE INTO ranges VALUES (2, 1901, 2012); +INSERT IGNORE INTO ranges VALUES (3, 2155, 1901); +INSERT IGNORE INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test new file mode 100644 index 00000000..d9d1f458 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test new file mode 100644 index 00000000..1a2b70eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_signed_64bit_time_t.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test new file mode 100644 index 00000000..3ee06c48 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test new file mode 100644 index 00000000..d7f9dd93 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + KEY property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores WHERE score = 29; + +UPDATE scores SET name = "Saburo YAMADA" WHERE id = 3; +SELECT * FROM scores WHERE score = 29; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test new file mode 100644 index 00000000..6efe83ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + id int primary key auto_increment not null, + name char(30) not null, + score int not null, + index property (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test new file mode 100644 index 00000000..bd3d182d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(10) CHARACTER SET latin1 PRIMARY KEY +); + +INSERT INTO ids VALUES('abcdefghij'); +INSERT INTO ids VALUES('klmnopqrst'); +INSERT INTO ids VALUES('uvwxyz0123'); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = 'abcdefghij'; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test new file mode 100644 index 00000000..afc0b9ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(7) CHARACTER SET latin1 COLLATE latin1_bin PRIMARY KEY +); + +INSERT INTO ids VALUES("\0abcdef"); +INSERT INTO ids VALUES("ab\0cdef"); +INSERT INTO ids VALUES("abcd\0ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "ab\0cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test new file mode 100644 index 00000000..ee0887f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(6) CHARACTER SET latin1 PRIMARY KEY +); + +INSERT INTO ids VALUES("abcdef"); +INSERT INTO ids VALUES( "cdef"); +INSERT INTO ids VALUES( "ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test new file mode 100644 index 00000000..455017bf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "cloudy day"); +--error ER_DUP_ENTRY +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "duplicated day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test new file mode 100644 index 00000000..6daeed75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATETIME(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (day, title) + VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test new file mode 100644 index 00000000..9500148e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATETIME PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (day, title) + VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-31 08:32:10", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test new file mode 100644 index 00000000..37ccd1e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS releases; +--enable_warnings + +CREATE TABLE releases ( + version DECIMAL(6, 3) PRIMARY KEY, + message TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); +INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); +INSERT INTO releases (version, message) VALUES (999.999, "the last release!"); + +SELECT * FROM releases; + +SELECT * FROM releases WHERE version BETWEEN "9.000" AND "10.001"; + +DROP TABLE releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test new file mode 100644 index 00000000..477368ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS releases; +--enable_warnings + +CREATE TABLE releases ( + version DECIMAL PRIMARY KEY, + message TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); +INSERT INTO releases (version, message) VALUES (10, "10th release!"); +INSERT INTO releases (version, message) VALUES (999, "the last release!"); + +SELECT * FROM releases; + +SELECT * FROM releases WHERE version BETWEEN "1" AND "10"; + +DROP TABLE releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test new file mode 100644 index 00000000..7db2825f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_fractional_seconds.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + time TIME(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO running_records (time, title) + VALUES ("01:00:00.000001", "normal condition"); +INSERT INTO running_records (time, title) + VALUES ("12:23:34.123456", "bad condition"); +INSERT INTO running_records (time, title) + VALUES ("-838:59:59.000000", "record failure"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE time BETWEEN "00:59:59.999999" AND "12:23:34.123456"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test new file mode 100644 index 00000000..721d6392 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + time TIME PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO running_records (time, title) + VALUES ("01:00:00", "normal condition"); +INSERT INTO running_records (time, title) + VALUES ("12:23:34", "bad condition"); +INSERT INTO running_records (time, title) + VALUES ("-838:59:59", "record failure"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE time BETWEEN "00:59:59" AND "12:23:34"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test new file mode 100644 index 00000000..116f11a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mariadb_5_5.inc +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + time TIMESTAMP(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (time, title) + VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (time, title) + VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (time, title) + VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE time BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test new file mode 100644 index 00000000..67f03299 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + time TIMESTAMP PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-31 08:32:10", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE time BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test new file mode 100644 index 00000000..6d458d78 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id varchar(7) CHARACTER SET latin1 COLLATE latin1_bin PRIMARY KEY +); + +INSERT INTO ids VALUES("\0abcdef"); +INSERT INTO ids VALUES("ab\0cdef"); +INSERT INTO ids VALUES("abcd\0ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "ab\0cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test new file mode 100644 index 00000000..f6bb7dc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + party_year YEAR PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; + +INSERT INTO aniversary_memos (party_year, title) + VALUES ("11", "We need a big cake!"); +INSERT INTO aniversary_memos (party_year, title) + VALUES ("2012", "Invitations are sent."); +INSERT INTO aniversary_memos (party_year, title) + VALUES ("13", "Wow! Today is the anniversary party day!"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_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 00000000..660e4370 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..7abae60f --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..063d2ff7 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..e3d22364 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..0efc5544 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..c356a714 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..b919b5f6 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..43e870a3 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_primary_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test new file mode 100644 index 00000000..c7086421 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id > 1 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test new file mode 100644 index 00000000..dd53c39c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id > 3 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test new file mode 100644 index 00000000..25dfa56f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id >= 2 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test new file mode 100644 index 00000000..b74b2533 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_greater_than_or_equal_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id >= 3 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test new file mode 100644 index 00000000..2848d4eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test new file mode 100644 index 00000000..99854c57 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test new file mode 100644 index 00000000..801d6fd9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test new file mode 100644 index 00000000..c5d2f5cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_primary_less_than_or_equal_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test new file mode 100644 index 00000000..cc37192e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT, + value BIGINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test new file mode 100644 index 00000000..df0bf264 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT UNSIGNED, + value BIGINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test new file mode 100644 index 00000000..df0e9e81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id DOUBLE, + value DOUBLE, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test new file mode 100644 index 00000000..a04f84eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id FLOAT, + value FLOAT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test new file mode 100644 index 00000000..aafb352b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + value INT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test new file mode 100644 index 00000000..d82bcb9c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT UNSIGNED, + value INT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test new file mode 100644 index 00000000..8afe5411 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id MEDIUMINT, + value MEDIUMINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test new file mode 100644 index 00000000..70c89470 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id MEDIUMINT UNSIGNED, + value MEDIUMINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test new file mode 100644 index 00000000..f33b6356 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id SMALLINT, + value SMALLINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test new file mode 100644 index 00000000..4a36ef3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id SMALLINT UNSIGNED, + value SMALLINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test new file mode 100644 index 00000000..40d338d4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id TINYINT, + value TINYINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test new file mode 100644 index 00000000..40e91829 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id TINYINT UNSIGNED, + value TINYINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test new file mode 100644 index 00000000..bbc89e09 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(5), + value VARCHAR(10), + KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test new file mode 100644 index 00000000..8d695b2e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(5), + value VARCHAR(10), + KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; + +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test new file mode 100644 index 00000000..abe68f79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + KEY (id) +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test new file mode 100644 index 00000000..7203b005 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(10), + KEY (id) +); + +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test new file mode 100644 index 00000000..bd286894 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + PRIMARY KEY (id) +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test new file mode 100644 index 00000000..2a166d01 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(10), + PRIMARY KEY (id) +); + +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test new file mode 100644 index 00000000..d67d5849 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_all.test @@ -0,0 +1,39 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int, + UNIQUE KEY (id) +); + +INSERT INTO ids VALUES (1); +DELETE FROM ids; +INSERT INTO ids VALUES (1); + +SELECT * FROM ids; + +-- error ER_DUP_ENTRY +INSERT INTO ids VALUES (1); + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test new file mode 100644 index 00000000..38b281f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test @@ -0,0 +1,37 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"); +DELETE FROM users WHERE id = 1; +INSERT INTO users VALUES (1, "Alice"); + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test new file mode 100644 index 00000000..13bf0eba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"); +-- error ER_DUP_ENTRY +INSERT INTO users VALUES (1, "Bob"); +INSERT INTO users VALUES (2, "Bob"); + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_search_after_duplicated.test new file mode 100644 index 00000000..4f464cca --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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/index_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test new file mode 100644 index 00000000..22aba9b9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test @@ -0,0 +1,36 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES ("Alice"); +INSERT INTO users VALUES ("Bob"); +SELECT * FROM users; + +SELECT * FROM users WHERE name = "aLiCe"; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test new file mode 100644 index 00000000..9d83b461 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + deleted BOOLEAN, + value INT, + INDEX (deleted, value) +); + +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 2); + +SELECT count(*) FROM scores WHERE deleted = FALSE; +UPDATE scores SET deleted = TRUE WHERE value = 1; +SELECT count(*) FROM scores WHERE deleted = FALSE; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test new file mode 100644 index 00000000..84a94b95 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + value INT, + INDEX (value) +); + +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (22); + +SELECT count(*) FROM scores WHERE value >= 20; +UPDATE scores SET value = 11 WHERE value = 21; +SELECT count(*) FROM scores WHERE value >= 20; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test new file mode 100644 index 00000000..2d65b763 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -0,0 +1,22 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE + from information_schema.plugins where plugin_name = "Mroonga"; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test new file mode 100644 index 00000000..d9cb66c8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test @@ -0,0 +1,34 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY +); + +SELECT AUTO_INCREMENT + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "ids"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test new file mode 100644 index 00000000..7723bf65 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test @@ -0,0 +1,34 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT AUTO_INCREMENT PRIMARY KEY +); + +SELECT AUTO_INCREMENT + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "ids"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test new file mode 100644 index 00000000..8a49ed22 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "diaries" AND DATA_LENGTH > 0; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test new file mode 100644 index 00000000..81e98c3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test @@ -0,0 +1,89 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# data types +create table t1 (c1 tinyint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 smallint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 mediumint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 int); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 bigint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 float); +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 double); +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 date); +insert into t1 values("2010/03/26"); +select * from t1; +drop table t1; + +create table t1 (c1 time); +insert into t1 values("11:22:33"); +select * from t1; +drop table t1; + +create table t1 (c1 year); +insert into t1 values("2010"); +select * from t1; +drop table t1; + +create table t1 (c1 datetime); +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +drop table t1; + +# duplicated key error +create table t1 (c1 int primary key, c2 int); +insert into t1 values(1,100); +select * from t1; +--error ER_DUP_ENTRY +insert into t1 values(1,200); +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test new file mode 100644 index 00000000..4d8248b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +skip "This test is too fragile."; + +--source include/not_embedded.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +--error ER_DELAYED_NOT_SUPPORTED +INSERT DELAYED INTO ids (id) VALUES (1); + +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test new file mode 100644 index 00000000..dbeb6ae3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test @@ -0,0 +1,41 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS numbers; +--enable_warnings + +CREATE TABLE numbers ( + id INT, + count INT, + UNIQUE (id) +); + +INSERT INTO numbers (id, count) VALUES (1, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (1, 3) ON DUPLICATE KEY UPDATE count = 4; + +SELECT * FROM numbers; + +INSERT INTO numbers (id, count) VALUES (2, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (2, 3) ON DUPLICATE KEY UPDATE count = 4; + +SELECT * FROM numbers; + +DROP TABLE numbers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test new file mode 100644 index 00000000..9093560f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "clear day") + ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "rainy day") + ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-15", "cloudy day") + ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test new file mode 100644 index 00000000..5d8439f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + day DATE, + title TEXT, + UNIQUE KEY day (day) +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "clear day1") + ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)"; +INSERT INTO diaries (day, title) + 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; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test new file mode 100644 index 00000000..6c68a9ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_virtual_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (c1 int, _id int); +--disable_warnings +SET sql_mode=""; +--enable_warnings +# warning WARN_DATA_TRUNCATED +INSERT INTO t1 (c1,_id) VALUES (1,1); +--disable_warnings +SET sql_mode="STRICT_ALL_TABLES"; +--enable_warnings +# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported +# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. +# We share this test with all MySQL servers. So we use number here. +--error 1265 +INSERT INTO t1 (c1,_id) VALUES (4,1); +SELECT * FROM t1; +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test new file mode 100644 index 00000000..4f5940c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS terms; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE terms ( + content varchar(64) NOT NULL COLLATE 'utf8_unicode_ci', + INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO terms VALUES ('track'); +INSERT INTO terms VALUES ('trackback'); + +SELECT * FROM terms WHERE content LIKE 'TRACK%'; + +DROP TABLE terms; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test new file mode 100644 index 00000000..2ce2ae94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test @@ -0,0 +1,32 @@ +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS counts; +--enable_warnings + +CREATE TABLE counts ( + id INT PRIMARY KEY AUTO_INCREMENT +); + +LOCK TABLES counts READ; +UNLOCK TABLES; + +DROP TABLE counts; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test new file mode 100644 index 00000000..4857286a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_multithread.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX ft(title) +); + +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); + +disable_query_log; +CONNECT (thread2, localhost, root, ,); +CONNECTION thread2; +enable_query_log; + +INSERT INTO diaries VALUES("Happy birthday!"); + +disable_query_log; +DISCONNECT thread2; +CONNECTION default; +enable_query_log; + +SHOW STATUS LIKE 'mroonga_count_skip'; +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test new file mode 100644 index 00000000..d0116e7f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_after_insert_single_thread.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX ft(title) +); + +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); + +SHOW STATUS LIKE 'mroonga_count_skip'; +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test new file mode 100644 index 00000000..d84112b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_disabled.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, "はれ", "天気がよいのは今日までみたい。"); + +SET mroonga_enable_optimization=FALSE; + +SELECT COUNT(*) FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +SET mroonga_enable_optimization=TRUE; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test new file mode 100644 index 00000000..691497be --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_and.test @@ -0,0 +1,44 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT, + age INT, + INDEX (id, age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 28); +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); + +SELECT COUNT(*) FROM users WHERE id = 2 AND age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test new file mode 100644 index 00000000..76675fde --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_between.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); + +SELECT COUNT(*) FROM users WHERE age BETWEEN 28 AND 30; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test new file mode 100644 index 00000000..b422e06e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); + +SELECT COUNT(*) FROM users WHERE age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test new file mode 100644 index 00000000..b59ca7f5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_boolean_mode.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); + +SELECT COUNT(*) FROM memos + WHERE MATCH(content) AGAINST('+Groonga' IN BOOLEAN MODE); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test new file mode 100644 index 00000000..c8de7b95 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_full_text_search_in_natural_language_mode.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos (content) VALUES ('Groonga is good.'); +INSERT INTO memos (content) VALUES ('Groonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga is good.'); +INSERT INTO memos (content) VALUES ('Mroonga is very good.'); +INSERT INTO memos (content) VALUES ('Mroonga uses Groonga.'); + +SELECT COUNT(*) FROM memos + WHERE MATCH(content) AGAINST('Groonga'); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test new file mode 100644 index 00000000..fb5c336c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (1),(2),(3),(4),(5),(6); + +SELECT COUNT(*) FROM users WHERE age > 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test new file mode 100644 index 00000000..c897d8d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_greater_equal.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (1),(2),(3),(4),(5),(6); + +SELECT COUNT(*) FROM users WHERE age >= 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test new file mode 100644 index 00000000..f03156d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); + +SELECT COUNT(*) FROM users WHERE age < 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test new file mode 100644 index 00000000..20863705 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_less_equal.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (27); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (30); +INSERT INTO users (age) VALUES (31); +INSERT INTO users (age) VALUES (32),(33),(34),(35),(36),(37); + +SELECT COUNT(*) FROM users WHERE age <= 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test new file mode 100644 index 00000000..3948d218 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_not_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (28); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); +INSERT INTO users (age) VALUES (29); + +SELECT COUNT(*) FROM users WHERE age <> 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test new file mode 100644 index 00000000..85ee2d45 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_index_view.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, users; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + user_id INT NOT NULL, + title VARCHAR(45) NOT NULL, + KEY (user_id), + FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET=UTF8; + +CREATE TABLE users ( + id INT PRIMARY KEY AUTO_INCREMENT, + name VARCHAR(45) NOT NULL, + INDEX (name) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, name) VALUES (1, "Alice"), (2, "Bob"); +INSERT INTO diaries (user_id, title) VALUES (1, "survey"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (1)"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (2)"); + +CREATE VIEW articles AS + SELECT diaries.user_id AS user_id, + diaries.title AS title, + users.name AS name + FROM diaries, users + WHERE diaries.user_id = users.id; + + +SELECT COUNT(*) FROM articles WHERE name = 'Bob'; + +DROP VIEW articles; +DROP TABLE diaries, users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test new file mode 100644 index 00000000..917d6a1b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_multiple_conditions.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT, + age INT, + INDEX (age) +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, age) VALUES (1, 29); +INSERT INTO users (id, age) VALUES (2, 29); +INSERT INTO users (id, age) VALUES (3, 29); + +SELECT COUNT(*) FROM users WHERE id = 3 AND age = 29; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test new file mode 100644 index 00000000..25d6c734 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_between.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (32),(33),(34),(35),(36),(37); + +SELECT COUNT(*) FROM users WHERE id BETWEEN 2 AND 4; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test new file mode 100644 index 00000000..c0db5729 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id = 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test new file mode 100644 index 00000000..f91cf193 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (-1),(-2),(-3),(-4); + +SELECT COUNT(*) FROM users WHERE id > 3; +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test new file mode 100644 index 00000000..dd374012 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_greater_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); +INSERT INTO users (id) VALUES (-1),(-2),(-3),(-4); + +SELECT COUNT(*) FROM users WHERE id >= 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test new file mode 100644 index 00000000..529dfde6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id < 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test new file mode 100644 index 00000000..d2a863ae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_less_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id <= 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test new file mode 100644 index 00000000..7e8c3180 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_count_skip_primary_key_not_equal.test @@ -0,0 +1,41 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE users ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +INSERT INTO users (id) VALUES (1); +INSERT INTO users (id) VALUES (2); +INSERT INTO users (id) VALUES (3); +INSERT INTO users (id) VALUES (4); +INSERT INTO users (id) VALUES (5); + +SELECT COUNT(*) FROM users WHERE id <> 3; + +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test new file mode 100644 index 00000000..c0dab283 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test @@ -0,0 +1,59 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SET mroonga_enable_optimization=FALSE; + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + month = 11 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +SET mroonga_enable_optimization=TRUE; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test new file mode 100644 index 00000000..ce1f6360 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_multiple_match_againsts.test @@ -0,0 +1,57 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(title), + FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(5, "title 1", "content a"); +INSERT INTO memos VALUES(12, "title 1", "content a"); +INSERT INTO memos VALUES(10, "title 1", "content a"); +INSERT INTO memos VALUES(4, "title 2", "content b"); +INSERT INTO memos VALUES(6, "title 2", "content b"); +INSERT INTO memos VALUES(1, "title 2", "content b"); +INSERT INTO memos VALUES(11, "title 1-a", "content a-1"); +INSERT INTO memos VALUES(3, "title 2-b", "content a-2"); +INSERT INTO memos VALUES(2, "title 2-c", "content a-3"); +INSERT INTO memos VALUES(8, "title 1-a", "content b-1"); +INSERT INTO memos VALUES(9, "title 2-b", "content b-2"); +INSERT INTO memos VALUES(7, "title 2-c", "content b-3"); + +SELECT * FROM memos + WHERE MATCH(title) AGAINST("+1" IN BOOLEAN MODE) AND + MATCH(content) AGAINST("+a" IN BOOLEAN MODE) + ORDER BY id + LIMIT 1,3; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test new file mode 100644 index 00000000..99abc046 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test @@ -0,0 +1,54 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test new file mode 100644 index 00000000..19c2bc40 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_cp932.test @@ -0,0 +1,46 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES CP932; +CREATE TABLE memos ( + ʎq INT UNSIGNED, + e TEXT, + FULLTEXT INDEX(e), + KEY(ʎq) +) DEFAULT CHARSET CP932; + +INSERT INTO memos VALUES(2, "͎RoB"); +INSERT INTO memos VALUES(3, "̓T{eB"); +INSERT INTO memos VALUES(1, "͓VC悭Ă悩B"); + +SELECT * FROM memos + WHERE MATCH(e) AGAINST("" IN BOOLEAN MODE) + ORDER BY ʎq + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test new file mode 100644 index 00000000..9ad4a696 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test new file mode 100644 index 00000000..170e9796 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test new file mode 100644 index 00000000..32555b2a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:34", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:34", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date = "2011-11-11 12:23:34" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test new file mode 100644 index 00000000..9c4c8754 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date > "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test new file mode 100644 index 00000000..375080ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date >= "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test new file mode 100644 index 00000000..cdd4a2ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date < "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test new file mode 100644 index 00000000..b0af56e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date <= "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_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 00000000..e9d1ca29 --- /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 +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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/optimization_order_limit_optimized_enum_name.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test new file mode 100644 index 00000000..3a4f4faa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_name.test @@ -0,0 +1,49 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES utf8; +CREATE TABLE memos ( + id int PRIMARY KEY, + tag ENUM('Groonga', 'Mroonga'), + content TEXT, + FULLTEXT INDEX(content), + KEY(tag), + KEY(id) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND + tag = 'Mroonga' + ORDER BY id LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test new file mode 100644 index 00000000..b8126b3f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_enum_value.test @@ -0,0 +1,49 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES utf8; +CREATE TABLE memos ( + id int PRIMARY KEY, + tag ENUM('Groonga', 'Mroonga'), + content TEXT, + FULLTEXT INDEX(content), + KEY(tag), + KEY(id) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES(1, 'Groonga', 'Groonga is great!'); +INSERT INTO memos VALUES(2, 'Mroonga', 'Mroonga is great!'); +INSERT INTO memos VALUES(3, 'Mroonga', 'Mroonga is a MySQL storage engine.'); +INSERT INTO memos VALUES(4, 'Mroonga', 'Mroonga is based on Groonga.'); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("+Groonga" IN BOOLEAN MODE) AND + tag = 2 + ORDER BY id LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test new file mode 100644 index 00000000..64f5a605 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test new file mode 100644 index 00000000..2fa838ea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED, + content TEXT, + FULLTEXT INDEX(content), + KEY(id) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + id BETWEEN 2 AND 4 + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test new file mode 100644 index 00000000..5981c99f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED, + content TEXT, + FULLTEXT INDEX(content), + KEY(id) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + id BETWEEN 2 AND 6 + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test new file mode 100644 index 00000000..f2158a82 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + month = 11 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test new file mode 100644 index 00000000..856c9f71 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day > 10 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test new file mode 100644 index 00000000..6115bf68 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day >= 10 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test new file mode 100644 index 00000000..f5001bdf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day < 12 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test new file mode 100644 index 00000000..790e8f14 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day <= 12 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test new file mode 100644 index 00000000..2aad7f0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test new file mode 100644 index 00000000..72889f96 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, _id int, key idx1(c2), fulltext index ft(c3)) default charset utf8; +insert into t1 values(1,10,"aa ii uu ee oo",null); +insert into t1 values(2,20,"ka ki ku ke ko",null); +insert into t1 values(3,30,"ii si ii se ii",null); +insert into t1 values(4,40,"ta ti tu te to",null); +insert into t1 values(5,50,"aa ii uu ii oo",null); + +show status like 'mroonga_fast_order_limit'; + +select *, match(c3) against("ii") from t1 order by c1 desc limit 2; + +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test new file mode 100644 index 00000000..c58d7353 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day ASC LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test new file mode 100644 index 00000000..a979e88c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day DESC LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test new file mode 100644 index 00000000..6bf3c6a8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + _id INT, + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(NULL, 3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(NULL, 4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(NULL, 5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(NULL, 6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(NULL, 7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY _id + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test new file mode 100644 index 00000000..bd86c6a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test new file mode 100644 index 00000000..52720370 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT *, MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test new file mode 100644 index 00000000..23bb7103 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time BETWEEN "1:23:31" AND "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test new file mode 100644 index 00000000..2450f8a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time BETWEEN "1:23:31" AND "1:23:43" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test new file mode 100644 index 00000000..46dc7cb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); +INSERT INTO memos VALUES(3, "1:23:34", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:34", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time = "1:23:34" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test new file mode 100644 index 00000000..62acda78 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time > "1:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test new file mode 100644 index 00000000..ee706c5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time >= "1:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test new file mode 100644 index 00000000..01764064 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time < "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test new file mode 100644 index 00000000..51423125 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time <= "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test new file mode 100644 index 00000000..c3456c25 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(title), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + title = "hello" + ORDER BY day LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test new file mode 100644 index 00000000..2ce06201 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰り道", "今日は天気がよくてよかった。"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "はれ", "天気がよいのは今日までみたい。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "初雪", "今日の天気は雪!"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + title = "hello" + ORDER BY day LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test new file mode 100644 index 00000000..c07368fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year BETWEEN "11" AND "2013" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test new file mode 100644 index 00000000..599cc8fa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year BETWEEN "11" AND "2015" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test new file mode 100644 index 00000000..35ce6066 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 1.0 has been released", "11"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 1.11 has been released", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year = "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test new file mode 100644 index 00000000..88bb6a27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year > "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id ASC LIMIT 2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test new file mode 100644 index 00000000..64b9f831 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year >= "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id ASC LIMIT 2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test new file mode 100644 index 00000000..5f3f89fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year < "13" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test new file mode 100644 index 00000000..5db8d96e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year <= "13" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test new file mode 100644 index 00000000..c60a6664 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_insert.test @@ -0,0 +1,52 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_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 00000000..0620de86 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/partition_update.test @@ -0,0 +1,54 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_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 00000000..0f04bd3e --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.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; + +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.000010E.c + +FLUSH TABLES; + +# Error ER_CANT_OPEN_FILE system call error: No such file or directory: failed to open path: +--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 new file mode 100644 index 00000000..854a93a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS geo_replace; +--enable_warnings + +CREATE TABLE geo_replace ( + id INT NOT NULL, + geo GEOMETRY NOT NULL, + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO geo_replace VALUES(1, POINT(100,100)); +SELECT id, ST_AsText(geo) FROM geo_replace; +REPLACE INTO geo_replace VALUES(1, POINT(100,200)); +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, ST_AsText(geo) FROM geo_replace; +UPDATE geo_replace SET geo = POINT(200,300); +SELECT id, ST_AsText(geo) FROM geo_replace; + +DROP TABLE geo_replace; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test new file mode 100644 index 00000000..80b56639 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test @@ -0,0 +1,65 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +# Based on #910. + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS videos_master, videos_groonga; +--enable_warnings + +CREATE TABLE `videos_master` ( + `id` bigint(1) unsigned NOT NULL, + `video_id` varchar(64) NOT NULL, + `description` text, + `tags_unpack` text, + PRIMARY KEY (`video_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `videos_groonga` ( + `id` bigint(1) unsigned NOT NULL, + `video_id` varchar(64) NOT NULL, + `description` text, + `tags_unpack` text, + PRIMARY KEY (`video_id`), + FULLTEXT INDEX (`description`), + FULLTEXT INDEX (`tags_unpack`) +) DEFAULT CHARSET=utf8; + + +INSERT INTO videos_master VALUES (1, "video-1", "My Familly", "familly human"); +INSERT INTO videos_master VALUES (2, "video-2", "My Cat", "family cat"); +REPLACE INTO videos_groonga + SELECT v.id, v.video_id, v.description, NULL + FROM videos_master AS v + WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("cat") FROM videos_groonga + WHERE MATCH(description) AGAINST("cat"); + +INSERT INTO videos_master VALUES (3, "video-3", "My Dog", "family dog"); +REPLACE INTO videos_groonga + SELECT v.id, v.video_id, v.description, NULL + FROM videos_master AS v + WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga + WHERE MATCH(description) AGAINST("my") + ORDER BY id; + +DROP TABLE videos_master, videos_groonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test new file mode 100644 index 00000000..add74ad7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content text, + fulltext index (content) +) default charset utf8; + +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +replace into diaries values(2, "明日の天気は雨みたい。"); +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test new file mode 100644 index 00000000..ef4739f1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content varchar(256), + fulltext index (content) +) default charset utf8; + +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +replace into diaries values(2, "明日の天気は雨みたい。"); +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test new file mode 100644 index 00000000..72d233bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS vector_replace; +DROP TABLE IF EXISTS vector_replace_vec; +--enable_warnings + +CREATE TABLE vector_replace_vec ( + vec CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE vector_replace ( + id INT NOT NULL, + vec TEXT COMMENT 'flags "COLUMN_VECTOR", type "vector_replace_vec"', + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO vector_replace VALUES(1, 'first second third'); +SELECT id, vec FROM vector_replace; +REPLACE INTO vector_replace VALUES(1, 'fourth fifth'); +SELECT id, vec FROM vector_replace; +INSERT INTO vector_replace VALUES(1, 'sixth seventh') ON DUPLICATE KEY UPDATE vec = 'sixth seventh'; +SELECT id, vec FROM vector_replace; +UPDATE vector_replace SET vec = 'eighth nineth tenth'; +SELECT id, vec FROM vector_replace; + +DROP TABLE vector_replace; +DROP TABLE vector_replace_vec; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test new file mode 100644 index 00000000..4e408522 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_without_key.test @@ -0,0 +1,35 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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, ER_NO_DEFAULT_FOR_FIELD +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/select_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test new file mode 100644 index 00000000..47f6e65c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test @@ -0,0 +1,100 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1(c1 int, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); + +select * from t1; +select c1 from t1; +select c2 from t1; +select c3 from t1; + +select * from t1 where c1 <= 3; +select * from t1 where c2 > 40; +select * from t1 where c3 = 300; + + +select * from t1 order by c1; +select * from t1 order by c2 desc; +select * from t1 order by c3, c1; + +drop table t1; + + +create table t1 (c1 int, c2 varchar(100)); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); + +select * from t1; +select * from t1 order by c1; +select * from t1 order by c1 desc; +select * from t1 order by c2; + +drop table t1; + +create table t1 (c1 int, c2 text); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); + +select * from t1; + +drop table t1; + +# ORDER BY with position +create table t1 (c1 int, c2 int, c3 text); +insert into t1 values(1, 20, "hoge"); +insert into t1 values(4, 60, "hogefuga"); +insert into t1 values(2, 50, "fuga"); +insert into t1 values(5, 30, "moge"); +insert into t1 values(3, 40, "mo"); +select * from t1 order by c1 asc; +select * from t1 order by c1 desc; +select * from t1 order by c2 asc; +select * from t1 order by c2 desc; +select * from t1 order by c3 asc; +select * from t1 order by c3 desc; +drop table t1; + +# _id +create table t1 (_id int, c1 int); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +select * from t1; +select * from t1 where _id < 3; +select * from t1 where _id >= 3; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test new file mode 100644 index 00000000..686a9aa2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test @@ -0,0 +1,36 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(16) NOT NULL, + KEY index_name (name) +); + +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); + +SELECT * FROM tags WHERE name = ""; + +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test new file mode 100644 index 00000000..2c40b00e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test @@ -0,0 +1,36 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(16) NOT NULL, + KEY index_name (name) +); + +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); + +SELECT * FROM tags WHERE name != ""; + +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test new file mode 100644 index 00000000..1d8e84a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE users ( + name varchar(40), + age int, + KEY (age) +); + +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); + +SELECT age, COUNT(*) FROM users GROUP BY age; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test new file mode 100644 index 00000000..5d695d6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE users ( + name varchar(40), + age int +); + +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); + +SELECT age, COUNT(*) FROM users GROUP BY age; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test new file mode 100644 index 00000000..8bfecaf7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test @@ -0,0 +1,40 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1(c1 int primary key, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); + +select * from t1 where c1=1; +select * from t1 where c1=2; +select * from t1 where c1=3; +select * from t1 where c1=4; +select * from t1 where c1=5; +select * from t1 where c1=6; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test new file mode 100644 index 00000000..838c01e4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test @@ -0,0 +1,51 @@ +# Copyright(C) 2010 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); + +select * from t1; +select * from t1 force index(idx1) where c2 = 30; +select * from t1 force index(idx1) where c2 = 20; + +insert into t1 values(6,30,"aa bb cc dd ee"); +select * from t1; +select * from t1 force index(idx1) where c2 = 30; + +drop table t1; + +create table t1 (c1 varchar(5) primary key, c2 varchar(5), c3 text, key idx1(c2), fulltext index ft(c3))engine=mroonga; +insert into t1 values('ab','ijk',"aa ii uu ee oo"); +insert into t1 values('bc','ghi',"ka ki ku ke ko"); +insert into t1 values('cd','efg',"sa si su se so"); +insert into t1 values('de','cde',"ta ti tu te to"); +insert into t1 values('ef','abc',"aa ii uu ee oo"); +select * from t1 force index(idx1) where c2 < 'e' order by c1 asc; +select * from t1 force index(idx1) where c2 > 'e' order by c1 asc; +select * from t1 force index(idx1) where c2 between 'c' and 'h' order by c1 asc; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000..81004f9b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int); +show create table t1; +drop table t1; + +create table t1 (c1 int, c2 int); +show create table t1; +drop table t1; + +create table t1 (c1 int primary key, c2 varchar(100)); +show create table t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test new file mode 100644 index 00000000..819a27c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, users; +--enable_warnings + +CREATE TABLE users ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT +) DEFAULT CHARSET UTF8; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + user_id INT UNSIGNED NOT NULL, + title TEXT, + FULLTEXT INDEX (title) +) DEFAULT CHARSET UTF8; + +INSERT INTO users (name) VALUES ("alice"); +INSERT INTO users (name) VALUES ("bob"); +INSERT INTO users (name) VALUES ("carlos"); + +SELECT * FROM users; + +INSERT INTO diaries (user_id, title) VALUES (1, "Hello!"); +INSERT INTO diaries (user_id, title) VALUES (2, "my name is bob"); +INSERT INTO diaries (user_id, title) VALUES (3, "my name is carlos"); + +SELECT * FROM diaries; + +SELECT * FROM users + WHERE id IN (SELECT user_id FROM diaries + WHERE MATCH(title) AGAINST("name")) + ORDER BY id DESC; + +DROP TABLE diaries, users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test new file mode 100644 index 00000000..14aa7f26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TEMPORARY TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); + +SELECT * FROM diaries; + +DROP TEMPORARY TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test new file mode 100644 index 00000000..12adecb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test @@ -0,0 +1,61 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) + ORDER BY id; +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) + ORDER BY id; + +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰り道", "つかれたー"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "初雪", "今年はじめての雪!"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+悪い" IN BOOLEAN MODE) + ORDER BY id; + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test new file mode 100644 index 00000000..c97b0e4e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_binlog_row.test @@ -0,0 +1,38 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET SESSION binlog_format = 'ROW'; + +CREATE TABLE memos ( + title varchar(20) PRIMARY KEY, + content varchar(140) NOT NULL +) COLLATE=utf8mb4_general_ci + DEFAULT CHARSET=utf8mb4; + +INSERT INTO memos (title, content) VALUES ('Mroonga', 'Mroonga is great!'); +SELECT * FROM memos; +UPDATE memos SET content = 'Mroonga is very great!' WHERE title = 'Mroonga'; +SELECT * FROM memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test new file mode 100644 index 00000000..73e57dac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test new file mode 100644 index 00000000..bd1d4537 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +update t1 set c1 = 200 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test new file mode 100644 index 00000000..3e05cd49 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +update t1 set c1 = 200 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test new file mode 100644 index 00000000..02151964 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int, c2 int); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; + +update t1 set c2=c2+100 where c1=1; +select * from t1; +update t1 set c2=c2+100 where c1=2; +select * from t1; +update t1 set c2=c2+100 where c1=3; +select * from t1; + +flush tables; + +update t1 set c1=5, c2=50; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test new file mode 100644 index 00000000..7496f7a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test @@ -0,0 +1,48 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists memos; +--enable_warnings + +create table memos ( + _id int, + content varchar(255), + unique key (_id) using hash +); + +insert into memos values (null, "今夜はさんま。"); +insert into memos values (null, "明日はgroongaをアップデート。"); +insert into memos values (null, "帰りにおだんご。"); +insert into memos values (null, "金曜日は肉の日。"); + +select * from memos; + +insert into memos values (null, "冷蔵庫に牛乳が残り1本。"); +select last_insert_grn_id(); +update memos set content = "冷蔵庫に牛乳はまだたくさんある。" where _id = last_insert_grn_id(); + +select * from memos; + +drop table memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test new file mode 100644 index 00000000..c0f2aece --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test @@ -0,0 +1,49 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# for virtual columns +CREATE TABLE t1 (c1 int, _id int); +INSERT INTO t1 VALUES(1,null); +INSERT INTO t1 VALUES(2,null); +INSERT INTO t1 VALUES(3,null); +SELECT * FROM t1; +--disable_warnings +SET sql_mode=""; +--enable_warnings +# warning WARN_DATA_TRUNCATED +UPDATE t1 SET _id = 10 WHERE c1 = 1; +SELECT * FROM t1; +--disable_warnings +SET sql_mode="STRICT_ALL_TABLES"; +--enable_warnings +# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported +# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. +# We share this test with all MySQL servers. So we use number here. +--error 1265 +UPDATE t1 SET _id = 11 WHERE c1 = 1; +SELECT * FROM t1; +DROP TABLE t1; + +SET sql_mode=DEFAULT; + +--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 00000000..b84e955f --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..bb9eb04b --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..940b4484 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..0da5eed7 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..3c73e214 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 new file mode 100644 index 00000000..9a3b5715 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_database_path_prefix = "test/mroonga.data/"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_database_path_prefix'; +CREATE DATABASE clean_test; +USE clean_test; + +CREATE TABLE counts ( + id INT PRIMARY KEY AUTO_INCREMENT +); + +--file_exists $MYSQLD_DATADIR/test/mroonga.data/clean_test.mrn + +INSERT INTO counts VALUES (NULL); + +SELECT * FROM counts; + +DROP TABLE counts; +DROP DATABASE clean_test; +SET GLOBAL mroonga_database_path_prefix = NULL; + +USE test; + +--rmdir $MYSQLD_DATADIR/test/mroonga.data + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test new file mode 100644 index 00000000..b3bc8815 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_default_parser_backup = @@mroonga_default_parser; +SET GLOBAL mroonga_default_parser = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +SET GLOBAL mroonga_default_parser = @mroonga_default_parser_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test new file mode 100644 index 00000000..46065e41 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_default_parser = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test new file mode 100644 index 00000000..5aec9b4f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_default_tokenizer_backup = @@mroonga_default_tokenizer; +SET GLOBAL mroonga_default_tokenizer = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; +SET GLOBAL mroonga_default_tokenizer = @mroonga_default_tokenizer_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test new file mode 100644 index 00000000..f2ee331e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_tokenizer_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_default_tokenizer = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_tokenizer'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test new file mode 100644 index 00000000..34929331 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; + +set mroonga_dry_write=true; +delete from diaries where id = 1; +select * from diaries; + +set mroonga_dry_write=false; +delete from diaries where id = 1; +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test new file mode 100644 index 00000000..ece2a65d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; + +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; + +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test new file mode 100644 index 00000000..a9b3005f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; + +insert into diaries (body) values ("will start groonga!"); + +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; + +set mroonga_dry_write=false; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test new file mode 100644 index 00000000..2a77a013 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_enable_operations_recording_insert.test @@ -0,0 +1,50 @@ +# Copyright(C) 2017 Naoya Murakami +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + title TEXT +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command('truncate mroonga_operations'); +INSERT INTO diaries VALUES("Unlogged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +SELECT mroonga_command('select mroonga_operations --output_columns _id'); + +SET GLOBAL mroonga_enable_operations_recording = false; +FLUSH TABLES; + +SELECT mroonga_command('truncate mroonga_operations'); +INSERT INTO diaries VALUES("Logged: Research for Mroonga"); +SELECT mroonga_command('load --table mroonga_operations --values "[{}]"'); +SELECT mroonga_command('select mroonga_operations --output_columns _id'); + +DROP TABLE diaries; +SELECT mroonga_command('truncate mroonga_operations'); + +SET GLOBAL mroonga_enable_operations_recording = default; +FLUSH TABLES; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test new file mode 100644 index 00000000..bf9387c8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test @@ -0,0 +1,28 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_version_10_0_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = -1; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test new file mode 100644 index 00000000..1126628d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test @@ -0,0 +1,28 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_version_10_0_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = -2; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test new file mode 100644 index 00000000..aae419e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test @@ -0,0 +1,27 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = 0; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test new file mode 100644 index 00000000..e8eb2952 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test @@ -0,0 +1,27 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = 1000; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +--disable_query_log +SET GLOBAL mroonga_lock_timeout = DEFAULT; +--enable_query_log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test new file mode 100644 index 00000000..b17163c8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_log_file_backup = @@mroonga_log_file; +SET GLOBAL mroonga_log_file = "new-mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +SET GLOBAL mroonga_log_file = @mroonga_log_file_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test new file mode 100644 index 00000000..40000b45 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test @@ -0,0 +1,22 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_log_file = "nonexistent/mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test new file mode 100644 index 00000000..8333ed4b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_log_file = "groonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test new file mode 100644 index 00000000..72de94c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test @@ -0,0 +1,61 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +set @mroonga_log_level_backup=@@mroonga_log_level; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=NONE; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=EMERG; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=ALERT; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=CRIT; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=ERROR; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=WARNING; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=NOTICE; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=INFO; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=DEBUG; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=DUMP; +show global variables like 'mroonga_log_level'; + +--error ER_WRONG_VALUE_FOR_VAR +set global mroonga_log_level=dummy; + +--error ER_GLOBAL_VARIABLE +set session mroonga_log_level=NOTICE; + +set global mroonga_log_level=@mroonga_log_level_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test new file mode 100644 index 00000000..fe026a31 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test @@ -0,0 +1,61 @@ +# Copyright(C) 2012-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +# 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 + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title, tags) VALUES ("Hello Groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello Mroonga!", "mroonga install"); + +disable_query_log; +CONNECT (new_connection, localhost, root, ,); +CONNECTION new_connection; +enable_query_log; + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); + +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("+gr" IN BOOLEAN MODE); + +disable_query_log; +CONNECTION default; +DISCONNECT new_connection; +enable_query_log; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test new file mode 100644 index 00000000..24c5c484 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); + + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +# MySQL <= 5.5 reports wrong a warning. :< +# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. +--disable_warnings +SET mroonga_match_escalation_threshold = -1; +--enable_warnings +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_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 00000000..56117e2b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_global.test @@ -0,0 +1,60 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +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; + +disable_query_log; +CONNECT (new_connection, localhost, root, ,); +CONNECTION new_connection; +enable_query_log; + +EXPLAIN SELECT * FROM ids WHERE id > 5; + +disable_query_log; +CONNECTION default; +DISCONNECT new_connection; +enable_query_log; + +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_mysql_5_7_or_later_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test new file mode 100644 index 00000000..57e2a186 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_global.test @@ -0,0 +1,60 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +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; + +disable_query_log; +CONNECT (new_connection, localhost, root, ,); +CONNECTION new_connection; +enable_query_log; + +EXPLAIN SELECT * FROM ids WHERE id > 5; + +disable_query_log; +CONNECTION default; +DISCONNECT new_connection; +enable_query_log; + +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_mysql_5_7_or_later_not_found_in_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test new file mode 100644 index 00000000..f0f548f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_not_found_in_limit.test @@ -0,0 +1,43 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + INDEX (id) +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +DELETE FROM ids WHERE id < 2; + +SET mroonga_max_n_records_for_estimate = 1; + +EXPLAIN SELECT * FROM ids WHERE id > 0; + +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/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test new file mode 100644 index 00000000..b25e01b7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_mysql_5_7_or_later_session.test @@ -0,0 +1,47 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +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/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test new file mode 100644 index 00000000..79c75308 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_not_found_in_limit.test @@ -0,0 +1,44 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + INDEX (id) +) DEFAULT CHARSET=UTF8; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +INSERT INTO ids VALUES (4),(5),(6),(7); + +DELETE FROM ids WHERE id < 2; + +SET mroonga_max_n_records_for_estimate = 1; + +EXPLAIN SELECT * FROM ids WHERE id > 0; + +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/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 00000000..59af3e6a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_max_n_records_for_estimate_session.test @@ -0,0 +1,47 @@ +# Copyright(C) 2015-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=UTF8; + +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/storage/t/variable_query_log_file_disabled_empty_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test new file mode 100644 index 00000000..57c62b2b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_empty_value.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = ""; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test new file mode 100644 index 00000000..97590b34 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_disabled_null_value.test @@ -0,0 +1,31 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = NULL; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test new file mode 100644 index 00000000..3021fe12 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_empty_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = ""; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test new file mode 100644 index 00000000..f233b7ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_enabled_null_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = NULL; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test new file mode 100644 index 00000000..a98824cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_new_value.test @@ -0,0 +1,33 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# Copyright(C) 2017 Kentaro Hayashi +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test new file mode 100644 index 00000000..faeb90ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_query_log_file_same_value.test @@ -0,0 +1,34 @@ +# Copyright(C) 2014-2017 Kouhei Sutou +# Copyright(C) 2017 Kentaro Hayashi +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; + +SET GLOBAL mroonga_log_file = "groonga-query-log.log"; + +SET GLOBAL mroonga_query_log_file = "groonga-query.log"; +--source ../../include/mroonga/print_groonga_query_log.inc + +SET GLOBAL mroonga_query_log_file = DEFAULT; +SET GLOBAL mroonga_log_file = DEFAULT; + +--remove_file $MYSQLD_DATADIR/groonga-query-log.log + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test new file mode 100644 index 00000000..94e8cb9b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test @@ -0,0 +1,54 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +--disable_warnings +DROP TABLE IF EXISTS document; +DROP TABLE IF EXISTS category; +--enable_warnings + +CREATE TABLE category ( + category CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE document ( + id INT NOT NULL, + title TEXT, + categories TEXT COMMENT 'flags "COLUMN_VECTOR", type "category"', + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; + +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; + +INSERT INTO document VALUES(1, "Mroonga is the fastest search engine", "it database fulltext"); +SELECT id, title, categories FROM document; + +SET GLOBAL mroonga_vector_column_delimiter = ';'; + +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; + +SELECT id, title, categories FROM document; + +DROP TABLE document; +DROP TABLE category; + +SET GLOBAL mroonga_vector_column_delimiter = ' '; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test new file mode 100644 index 00000000..d9795eab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -0,0 +1,22 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +# show variables like 'groonga%'; +show variables like 'mroonga_version'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def b/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def new file mode 100644 index 00000000..f3f211b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def @@ -0,0 +1,2 @@ +create_table_token_filters_index_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does not support token filter yet. diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result new file mode 100644 index 00000000..2be9834c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result new file mode 100644 index 00000000..9628df68 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_cp932.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +ALTER TABLE users +ADD COLUMN O text, +ADD FULLTEXT INDEX (O); +INSERT INTO users (O) VALUES ("܂"); +INSERT INTO users (O) VALUES ("Ȃ"); +INSERT INTO users (O) VALUES (""); +SELECT * FROM users; +id O +1 ܂ +2 Ȃ +3 +SELECT * FROM users +WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); +id O +2 Ȃ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result new file mode 100644 index 00000000..abd2271f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column_multibyte_utf8.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +ALTER TABLE users +ADD COLUMN 名前 text, +ADD FULLTEXT INDEX (名前); +INSERT INTO users (名前) VALUES ("やまだ"); +INSERT INTO users (名前) VALUES ("たなか"); +INSERT INTO users (名前) VALUES ("すずき"); +SELECT * FROM users; +id 名前 +1 やまだ +2 たなか +3 すずき +SELECT * FROM users +WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); +id 名前 +2 たなか +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result new file mode 100644 index 00000000..af302b5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +ALTER TABLE bugs +CHANGE COLUMN +tag +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result new file mode 100644 index 00000000..7197d3a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SELECT table_name, engine, table_comment +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine table_comment +diaries MyISAM +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; +SELECT table_name, engine, table_comment +FROM information_schema.tables +WHERE table_name = 'diaries'; +table_name engine table_comment +diaries Mroonga ENGINE "InnoDB" +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result new file mode 100644 index 00000000..05bd0e4e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT AUTO_INCREMENT PRIMARY KEY, +title VARCHAR(64), +content TEXT, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); +INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); +INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); +ALTER TABLE memos COMMENT='engine "MyISAM"'; +SELECT table_name, table_comment +FROM information_schema.tables +WHERE table_name = 'memos'; +table_name table_comment +memos engine "MyISAM" +SELECT * FROM memos; +id title content +1 Hello I start to write memos! +2 groonga I start to use groonga! +3 mroonga I use mroonga too! +SELECT * FROM memos WHERE MATCH(content) AGAINST("start" IN BOOLEAN MODE); +id title content +1 Hello I start to write memos! +2 groonga I start to use groonga! +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result new file mode 100644 index 00000000..b185bf26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +CREATE FULLTEXT INDEX title_index on diaries (title); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result new file mode 100644 index 00000000..e71132be --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result new file mode 100644 index 00000000..1fefc1d9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result new file mode 100644 index 00000000..d115cefb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result new file mode 100644 index 00000000..47649911 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result new file mode 100644 index 00000000..06e1a12d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +c1 int NOT NULL, +c2 text NOT NULL, +c3 int NOT NULL, +c4 int NOT NULL, +PRIMARY KEY(c1), +KEY idx1(c3,c4), +FULLTEXT KEY ft1(c2) +) COMMENT='ENGINE "MyISAM"' DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +TRUNCATE t1; +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result new file mode 100644 index 00000000..25cb53de --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries DROP COLUMN body; +SELECT * FROM diaries; +id title +1 survey +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; +id title +1 survey +2 groonga (1) +3 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result new file mode 100644 index 00000000..b9a0f545 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result new file mode 100644 index 00000000..341cc4f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE IF NOT EXISTS memos ( +id VARCHAR(45) NOT NULL PRIMARY KEY, +text TEXT NOT NULL, +FULLTEXT KEY (text) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +LOCK TABLES memos WRITE; +ALTER TABLE memos DISABLE KEYS; +INSERT INTO memos +VALUES (00000, 'text0'), +(00001, 'text1'), +(00002, 'text2'); +ALTER TABLE memos ENABLE KEYS; +UNLOCK TABLES; +SELECT * FROM memos; +id text +0 text0 +1 text1 +2 text2 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result new file mode 100644 index 00000000..21f6b908 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result new file mode 100644 index 00000000..2ba4f1b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result new file mode 100644 index 00000000..a1ee9013 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result new file mode 100644 index 00000000..37f03b40 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +ALTER TABLE diaries ADD FULLTEXT INDEX body_index (body); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result new file mode 100644 index 00000000..bfbe96d1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries, memos; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +id title body +1 survey will start groonga! +SELECT * FROM memos +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result new file mode 100644 index 00000000..fa42d4a1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result @@ -0,0 +1,122 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL +) COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +ST_GeomFromText('POINT(139.711517 35.647701)')); +ALTER TABLE shops ADD SPATIAL KEY location_index (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) +26 kazuya POINT(139.760895 35.673508) +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result new file mode 100644 index 00000000..9d45d2fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result @@ -0,0 +1,15 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text +) comment = 'engine "innodb"'; +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +id body +1 started groonga (long text) +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +id body +1 started groonga (long text) +2 sleeping... (short text) +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result new file mode 100644 index 00000000..f0792094 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result @@ -0,0 +1,34 @@ +drop table if exists t1; +show variables like 'log_bin'; +Variable_name Value +log_bin ON +set binlog_format="STATEMENT"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="ROW"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="MIXED"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result new file mode 100644 index 00000000..61122f78 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/check_table_for_upgrade.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id int NOT NULL PRIMARY KEY, +content text, +FULLTEXT INDEX (content) +) COMMENT='engine "InnoDB"'; +INSERT INTO memos VALUES (1, 'Hello MySQL'); +INSERT INTO memos VALUES (2, 'Hello Mroonga'); +CHECK TABLE memos FOR UPGRADE; +Table Op Msg_type Msg_text +test.memos check status OK +FLUSH TABLES; +SELECT * FROM memos +WHERE MATCH(content) AGAINST('+mroonga' IN BOOLEAN MODE); +id content +2 Hello Mroonga +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result new file mode 100644 index 00000000..b1a7c8ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64), +INDEX (tag) COMMENT 'Tag search is required.' +) DEFAULT CHARSET=utf8 +COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tag` (`tag`) COMMENT 'Tag search is required.' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result new file mode 100644 index 00000000..5b379d08 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result new file mode 100644 index 00000000..24c9275b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result new file mode 100644 index 00000000..65a55204 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_drop_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result new file mode 100644 index 00000000..febfd343 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result new file mode 100644 index 00000000..c0d9452f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_reindex.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result new file mode 100644 index 00000000..ae9c244d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_stored_update.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, +FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "shutdown"} "shutdown" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result new file mode 100644 index 00000000..6daeb5e2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_column.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result new file mode 100644 index 00000000..82a46e3f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_fulltext_index.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) +VALUES (1, '{"level": "info", "message": "start server"}'); +ALTER TABLE logs ADD FULLTEXT INDEX (message); +INSERT INTO logs(id, record) +VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) +VALUES (3, '{"level": "warn", "message": "abort server"}'); +SELECT * FROM logs WHERE MATCH(message) AGAINST('+start' IN BOOLEAN MODE); +id record message +2 {"level": "info", "message": "start server"} "start server" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result new file mode 100644 index 00000000..09cd1891 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_add_index.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +level VARCHAR(255) GENERATED ALWAYS AS +(json_unquote(json_extract(`record`, '$.level'))) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) +VALUES (1, '{"level": "info", "message": "start server"}'); +ALTER TABLE logs ADD INDEX (level); +INSERT INTO logs(id, record) +VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) +VALUES (3, '{"level": "warn", "message": "abort server"}'); +SELECT * FROM logs WHERE level = 'info'; +id record level +1 {"level": "info", "message": "start server"} info +2 {"level": "info", "message": "start server"} info +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result new file mode 100644 index 00000000..8c1ceaf1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_delete.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +DELETE FROM logs WHERE id = 1; +SELECT * FROM logs; +id record message +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result new file mode 100644 index 00000000..7d322617 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_drop_column.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +ALTER TABLE logs DROP COLUMN message; +SELECT * FROM logs; +id record +1 {"level": "info", "message": "start"} +2 {"level": "info", "message": "restart"} +3 {"level": "warn", "message": "abort"} +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result new file mode 100644 index 00000000..5a0e63ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_insert.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "restart"} "restart" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result new file mode 100644 index 00000000..2411f7a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_generated_virtual_update.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS logs; +CREATE TABLE logs ( +id INT PRIMARY KEY, +record JSON, +message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; +SELECT * FROM logs; +id record message +1 {"level": "info", "message": "start"} "start" +2 {"level": "info", "message": "shutdown"} "shutdown" +3 {"level": "warn", "message": "abort"} "abort" +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result new file mode 100644 index 00000000..38185f5e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_cp932.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES cp932; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT, +O text, +FULLTEXT INDEX (O) +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +INSERT INTO users (O) VALUES ("܂"); +INSERT INTO users (O) VALUES ("Ȃ"); +INSERT INTO users (O) VALUES (""); +SELECT * FROM users; +id O +1 ܂ +2 Ȃ +3 +SELECT * FROM users +WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); +id O +2 Ȃ +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result new file mode 100644 index 00000000..2d313073 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_multibyte_utf8.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int unsigned PRIMARY KEY AUTO_INCREMENT, +名前 text, +FULLTEXT INDEX (名前) +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +INSERT INTO users (名前) VALUES ("やまだ"); +INSERT INTO users (名前) VALUES ("たなか"); +INSERT INTO users (名前) VALUES ("すずき"); +SELECT * FROM users; +id 名前 +1 やまだ +2 たなか +3 すずき +SELECT * FROM users +WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); +id 名前 +2 たなか +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +mroonga_command("dump --dump_plugins no --dump_records no") +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +table_create users TABLE_HASH_KEY ShortText + +table_create users#@540d@524d TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI + +column_create users#@540d@524d index COLUMN_INDEX|WITH_POSITION users +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result new file mode 100644 index 00000000..26790796 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result new file mode 100644 index 00000000..7822d118 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); +SELECT COUNT(*) FROM ids; +COUNT(*) +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result new file mode 100644 index 00000000..141117f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_mysql_5_7_or_later_with_index.result @@ -0,0 +1,30 @@ +CREATE TABLE diaries_innodb ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; +CREATE TABLE diaries_mroonga ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_innodb NULL index NULL flag 2 NULL 3 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`diaries_innodb` +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_mroonga NULL index NULL flag 2 NULL 3 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`diaries_mroonga` +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result new file mode 100644 index 00000000..1ebd0ba8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result @@ -0,0 +1,26 @@ +CREATE TABLE diaries_innodb ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; +CREATE TABLE diaries_mroonga ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE diaries_innodb index NULL flag 2 NULL # Using index +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE diaries_mroonga index NULL flag 2 NULL # Using index +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000..b3814331 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result @@ -0,0 +1,109 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t3 (c1 int primary key) COMMENT = 'engine "innodb"'; +drop table t1,t2,t3; +create table t1 (c1 int primary key, c2 int, c3 int) COMMENT = 'engine "innodb"'; +drop table t1; +create table t1 (c1 bit primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 bit(1) NO PRI NULL +drop table t1; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 tinyint(4) NO PRI NULL +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 smallint(6) NO PRI NULL +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 mediumint(9) NO PRI NULL +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 int(11) NO PRI NULL +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 bigint(20) NO PRI NULL +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 double NO PRI NULL +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 float NO PRI NULL +drop table t1; +create table t1 (c1 decimal primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 decimal(10,0) NO PRI NULL +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 date NO PRI NULL +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 time NO PRI NULL +drop table t1; +create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 timestamp NO PRI CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 datetime NO PRI NULL +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 year(4) NO PRI NULL +drop table t1; +create table t1 (c1 char(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 char(10) NO PRI NULL +drop table t1; +create table t1 (c1 varchar(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 varchar(10) NO PRI NULL +drop table t1; +create table t1 (c1 binary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 binary(10) NO PRI NULL +drop table t1; +create table t1 (c1 varbinary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 varbinary(10) NO PRI NULL +drop table t1; +create table t1 (c1 enum("yes","no") primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 enum('yes','no') NO PRI NULL +drop table t1; +create table t1 (c1 set("A","B","AB","O") primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 set('A','B','AB','O') NO PRI NULL +drop table t1; +create table t1 (c1 int) COMMENT = 'engine "innodb"'; +ERROR 42000: This table type requires a primary key diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result new file mode 100644 index 00000000..3610ab6f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='Free style normal comment, engine "InnoDB"'; +SELECT mroonga_command("dump --dump_plugins no"); +mroonga_command("dump --dump_plugins no") +table_create bugs TABLE_HASH_KEY ShortText + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result new file mode 100644 index 00000000..6ff4c105 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_comment.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL PRIMARY KEY, +FULLTEXT INDEX (content) COMMENT '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_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result new file mode 100644 index 00000000..9048b677 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_none.result @@ -0,0 +1,9 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL PRIMARY KEY, +FULLTEXT INDEX (content) COMMENT '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_flags_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result new file mode 100644 index 00000000..1c701d0e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_flags_parameter.result @@ -0,0 +1,16 @@ +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL PRIMARY KEY, +FULLTEXT INDEX (content) FLAGS='WITH_POSITION|WITH_WEIGHT' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `content` varchar(64) NOT NULL, + PRIMARY KEY (`content`), + FULLTEXT KEY `content` (`content`) `FLAGS`='WITH_POSITION|WITH_WEIGHT' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +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_index_flags_none.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_index_flags_none.result new file mode 100644 index 00000000..e378ba3b --- /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 00000000..1367a3ad --- /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_normalizer_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result new file mode 100644 index 00000000..1c9bf50f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_comment.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) COMMENT 'normalizer "NormalizerAuto"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +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; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result new file mode 100644 index 00000000..5230963a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index_bin.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` text COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) COMMENT 'normalizer "NormalizerAuto"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ENGINE "InnoDB"' +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; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result new file mode 100644 index 00000000..d3bc05a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_parameter.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) `NORMALIZER`='NormalizerAuto' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +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; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result new file mode 100644 index 00000000..4d9d20dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_parser_comment.result @@ -0,0 +1,25 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +insert into diaries (body) values ("will start Groonga!"); +Warnings: +Warning 1287 'parser' is deprecated and will be removed in a future release. Please use tokenizer instead +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +select * from diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +select * from diaries where match(body) against("+start" in boolean mode) order by id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result new file mode 100644 index 00000000..7f4885fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_multiple_token_filters.result @@ -0,0 +1,22 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result new file mode 100644 index 00000000..2d7c6748 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_one_token_filter.result @@ -0,0 +1,22 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump --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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result new file mode 100644 index 00000000..4626d144 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_parameter.result @@ -0,0 +1,30 @@ +SELECT mroonga_command("plugin_register token_filters/stop_word"); +mroonga_command("plugin_register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL, + `content` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) `TOKEN_FILTERS`='TokenFilterStopWord,TokenFilterStopWord' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +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 + +table_create mroonga_operations TABLE_NO_KEY +column_create mroonga_operations record COLUMN_SCALAR UInt32 +column_create mroonga_operations table COLUMN_SCALAR ShortText +column_create mroonga_operations type COLUMN_SCALAR ShortText + +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_tokenizer_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result new file mode 100644 index 00000000..34e3f88d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_comment.result @@ -0,0 +1,21 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +select * from diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +select * from diaries where match(body) against("+start" in boolean mode) order by id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result new file mode 100644 index 00000000..219d8e08 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_tokenizer_parameter.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id int PRIMARY KEY AUTO_INCREMENT, +body text, +FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8; +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); +SELECT * FROM diaries; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) +ORDER BY id; +id body +1 will start Groonga! +2 starting Groonga... +3 started Groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result new file mode 100644 index 00000000..99053762 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result @@ -0,0 +1,55 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int) COMMENT 'engine = "innodb"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine = "innodb"' +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +4 102 +delete from t1 where c1=3; +select * from t1; +c1 c2 +1 100 +2 101 +4 102 +flush tables; +delete from t1 where c1=2; +select * from t1; +c1 c2 +1 100 +4 102 +delete from t1; +select * from t1; +c1 c2 +drop table t1; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT 'engine = "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +20 ka ki ku ke +delete from t1 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result new file mode 100644 index 00000000..200e978a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100), +FULLTEXT INDEX (name) +) COMMENT 'engine = "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, 'Alice'); +INSERT INTO users VALUES (2, 'Bob'); +INSERT INTO users VALUES (3, 'Chris'); +SELECT * FROM users; +id name +1 Alice +2 Bob +3 Chris +DELETE FROM users; +SELECT * FROM users; +id name +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result new file mode 100644 index 00000000..f7d5b439 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/drop_table_new_connection.result @@ -0,0 +1,13 @@ +CREATE TABLE logs ( +id INT PRIMARY KEY AUTO_INCREMENT, +message TEXT, +FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +USE test; +DROP TABLE logs; +CREATE TABLE logs ( +id INT PRIMARY KEY AUTO_INCREMENT, +message TEXT, +FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +DROP TABLE logs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result new file mode 100644 index 00000000..8614eaa7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); +id title content +3 富士山 今日も天気がよくてきれいに見える。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result new file mode 100644 index 00000000..1ecf18cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title), +FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "富士山", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気 1月1日", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "天気 4月4日", "今日も天気がよくてきれいに見える。"); +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT * FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +id title content +3 天気 4月4日 今日も天気がよくてきれいに見える。 +SELECT 1 FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +1 +1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result new file mode 100644 index 00000000..190105a3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); +id content +6 Yesterday was fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result new file mode 100644 index 00000000..240da5c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); +id content +1 Today is good day. +2 Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result new file mode 100644 index 00000000..6dedd218 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); +id content +1 Today is good day. +3 Yesterday was good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result new file mode 100644 index 00000000..96d92e53 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE) +ORDER BY id; +id content +1 Today is good day. +2 Tomorrow will be good day. +3 Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result new file mode 100644 index 00000000..ee8d8510 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE) +ORDER BY id; +id content +2 Tomorrow will be good day. +3 Today is fine. +4 Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result new file mode 100644 index 00000000..bb940432 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE) +ORDER BY id; +id content +1 Today is good day. +2 Tomorrow will be good day. +4 Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result new file mode 100644 index 00000000..29975d55 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); +id content +1 Today is good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result new file mode 100644 index 00000000..2294308a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); +id content +3 Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result new file mode 100644 index 00000000..b61f0637 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); +id content +1 Today is good day. +2 Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result new file mode 100644 index 00000000..e603cc27 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 12 +3 富士山 今日も天気がよくてきれいに見える。 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result new file mode 100644 index 00000000..6a5dbd5c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 3 +3 富士山 今日も天気がよくてきれいに見える。 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result new file mode 100644 index 00000000..2fe63a68 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT *, MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日の富士山の天気について 3 +3 富士山 今日も天気がよくてきれいに見える。 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result new file mode 100644 index 00000000..b58f4ad3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result @@ -0,0 +1,29 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii"); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result new file mode 100644 index 00000000..d7b64010 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "̕xmR̓VCɂ‚",""); +insert into t1 values(2, "","̕xmR̓VC͕܂"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ̕xmR̓VCɂ‚ +2 ̕xmR̓VC͕܂ +3 dummy dummy +select * from t1 where match(c2) against("xmR"); +c1 c2 c3 +1 ̕xmR̓VCɂ‚ +select * from t1 where match(c3) against("xmR"); +c1 c2 c3 +2 ̕xmR̓VC͕܂ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result new file mode 100644 index 00000000..9aa60690 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms COMMENT = 'engine "innodb"'; +insert into t1 values(1, "ٻλŷˤĤ",""); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ٻλŷˤĤ +2 ٻλŷʬޤ +3 dummy dummy +select * from t1 where match(c2) against("ٻλ"); +c1 c2 c3 +1 ٻλŷˤĤ +select * from t1 where match(c3) against("ٻλ"); +c1 c2 c3 +2 ٻλŷʬޤ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result new file mode 100644 index 00000000..6c73f462 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日の富士山の天気について あああああああ +2 いいいいい 明日の富士山の天気は分かりません +3 dummy dummy +select * from t1 where match(c2) against("富士山"); +c1 c2 c3 +1 明日の富士山の天気について あああああああ +select * from t1 where match(c3) against("富士山"); +c1 c2 c3 +2 いいいいい 明日の富士山の天気は分かりません +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result new file mode 100644 index 00000000..d3bdfca0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +content text, +FULLTEXT INDEX (title) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES (1, "Hello", "はじめました。"); +INSERT INTO diaries VALUES (2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES (3, "富士山", "今日もきれい。"); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +id title content +3 富士山 今日もきれい。 +DROP INDEX title ON diaries; +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +SELECT * FROM diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +CREATE FULLTEXT INDEX new_title_index ON diaries (title); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +id title content +3 富士山 今日もきれい。 +SELECT * FROM diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result new file mode 100644 index 00000000..c25b47c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result @@ -0,0 +1,70 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 values (1, "aa ii uu ee oo"); +insert into t2 values (2, "ka ki ku ke ko"); +insert into t2 values (3, "aa ii ii ii oo"); +insert into t2 values (4, "sa si su se so"); +insert into t2 values (5, "ta ti ii ii to"); +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +5 ta ti ii ii to 349526 +3 aa ii ii ii oo 524289 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +drop table t1,t2; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result new file mode 100644 index 00000000..f4719cbd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result @@ -0,0 +1,17 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result new file mode 100644 index 00000000..9d1e838b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result @@ -0,0 +1,4381 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +fulltext index (title) +) default charset utf8 COMMENT = 'engine "innodb"'; +set autocommit=0; +insert into diaries values(0, "2011-07-14"); +insert into diaries values(1, "2011-07-15"); +insert into diaries values(2, "2011-07-16"); +insert into diaries values(3, "2011-07-17"); +insert into diaries values(4, "2011-07-18"); +insert into diaries values(5, "2011-07-19"); +insert into diaries values(6, "2011-07-20"); +insert into diaries values(7, "2011-07-21"); +insert into diaries values(8, "2011-07-22"); +insert into diaries values(9, "2011-07-23"); +insert into diaries values(10, "2011-07-24"); +insert into diaries values(11, "2011-07-25"); +insert into diaries values(12, "2011-07-26"); +insert into diaries values(13, "2011-07-27"); +insert into diaries values(14, "2011-07-28"); +insert into diaries values(15, "2011-07-29"); +insert into diaries values(16, "2011-07-30"); +insert into diaries values(17, "2011-07-31"); +insert into diaries values(18, "2011-08-01"); +insert into diaries values(19, "2011-08-02"); +insert into diaries values(20, "2011-08-03"); +insert into diaries values(21, "2011-08-04"); +insert into diaries values(22, "2011-08-05"); +insert into diaries values(23, "2011-08-06"); +insert into diaries values(24, "2011-08-07"); +insert into diaries values(25, "2011-08-08"); +insert into diaries values(26, "2011-08-09"); +insert into diaries values(27, "2011-08-10"); +insert into diaries values(28, "2011-08-11"); +insert into diaries values(29, "2011-08-12"); +insert into diaries values(30, "2011-08-13"); +insert into diaries values(31, "2011-08-14"); +insert into diaries values(32, "2011-08-15"); +insert into diaries values(33, "2011-08-16"); +insert into diaries values(34, "2011-08-17"); +insert into diaries values(35, "2011-08-18"); +insert into diaries values(36, "2011-08-19"); +insert into diaries values(37, "2011-08-20"); +insert into diaries values(38, "2011-08-21"); +insert into diaries values(39, "2011-08-22"); +insert into diaries values(40, "2011-08-23"); +insert into diaries values(41, "2011-08-24"); +insert into diaries values(42, "2011-08-25"); +insert into diaries values(43, "2011-08-26"); +insert into diaries values(44, "2011-08-27"); +insert into diaries values(45, "2011-08-28"); +insert into diaries values(46, "2011-08-29"); +insert into diaries values(47, "2011-08-30"); +insert into diaries values(48, "2011-08-31"); +insert into diaries values(49, "2011-09-01"); +insert into diaries values(50, "2011-09-02"); +insert into diaries values(51, "2011-09-03"); +insert into diaries values(52, "2011-09-04"); +insert into diaries values(53, "2011-09-05"); +insert into diaries values(54, "2011-09-06"); +insert into diaries values(55, "2011-09-07"); +insert into diaries values(56, "2011-09-08"); +insert into diaries values(57, "2011-09-09"); +insert into diaries values(58, "2011-09-10"); +insert into diaries values(59, "2011-09-11"); +insert into diaries values(60, "2011-09-12"); +insert into diaries values(61, "2011-09-13"); +insert into diaries values(62, "2011-09-14"); +insert into diaries values(63, "2011-09-15"); +insert into diaries values(64, "2011-09-16"); +insert into diaries values(65, "2011-09-17"); +insert into diaries values(66, "2011-09-18"); +insert into diaries values(67, "2011-09-19"); +insert into diaries values(68, "2011-09-20"); +insert into diaries values(69, "2011-09-21"); +insert into diaries values(70, "2011-09-22"); +insert into diaries values(71, "2011-09-23"); +insert into diaries values(72, "2011-09-24"); +insert into diaries values(73, "2011-09-25"); +insert into diaries values(74, "2011-09-26"); +insert into diaries values(75, "2011-09-27"); +insert into diaries values(76, "2011-09-28"); +insert into diaries values(77, "2011-09-29"); +insert into diaries values(78, "2011-09-30"); +insert into diaries values(79, "2011-10-01"); +insert into diaries values(80, "2011-10-02"); +insert into diaries values(81, "2011-10-03"); +insert into diaries values(82, "2011-10-04"); +insert into diaries values(83, "2011-10-05"); +insert into diaries values(84, "2011-10-06"); +insert into diaries values(85, "2011-10-07"); +insert into diaries values(86, "2011-10-08"); +insert into diaries values(87, "2011-10-09"); +insert into diaries values(88, "2011-10-10"); +insert into diaries values(89, "2011-10-11"); +insert into diaries values(90, "2011-10-12"); +insert into diaries values(91, "2011-10-13"); +insert into diaries values(92, "2011-10-14"); +insert into diaries values(93, "2011-10-15"); +insert into diaries values(94, "2011-10-16"); +insert into diaries values(95, "2011-10-17"); +insert into diaries values(96, "2011-10-18"); +insert into diaries values(97, "2011-10-19"); +insert into diaries values(98, "2011-10-20"); +insert into diaries values(99, "2011-10-21"); +insert into diaries values(100, "2011-10-22"); +insert into diaries values(101, "2011-10-23"); +insert into diaries values(102, "2011-10-24"); +insert into diaries values(103, "2011-10-25"); +insert into diaries values(104, "2011-10-26"); +insert into diaries values(105, "2011-10-27"); +insert into diaries values(106, "2011-10-28"); +insert into diaries values(107, "2011-10-29"); +insert into diaries values(108, "2011-10-30"); +insert into diaries values(109, "2011-10-31"); +insert into diaries values(110, "2011-11-01"); +insert into diaries values(111, "2011-11-02"); +insert into diaries values(112, "2011-11-03"); +insert into diaries values(113, "2011-11-04"); +insert into diaries values(114, "2011-11-05"); +insert into diaries values(115, "2011-11-06"); +insert into diaries values(116, "2011-11-07"); +insert into diaries values(117, "2011-11-08"); +insert into diaries values(118, "2011-11-09"); +insert into diaries values(119, "2011-11-10"); +insert into diaries values(120, "2011-11-11"); +insert into diaries values(121, "2011-11-12"); +insert into diaries values(122, "2011-11-13"); +insert into diaries values(123, "2011-11-14"); +insert into diaries values(124, "2011-11-15"); +insert into diaries values(125, "2011-11-16"); +insert into diaries values(126, "2011-11-17"); +insert into diaries values(127, "2011-11-18"); +insert into diaries values(128, "2011-11-19"); +insert into diaries values(129, "2011-11-20"); +insert into diaries values(130, "2011-11-21"); +insert into diaries values(131, "2011-11-22"); +insert into diaries values(132, "2011-11-23"); +insert into diaries values(133, "2011-11-24"); +insert into diaries values(134, "2011-11-25"); +insert into diaries values(135, "2011-11-26"); +insert into diaries values(136, "2011-11-27"); +insert into diaries values(137, "2011-11-28"); +insert into diaries values(138, "2011-11-29"); +insert into diaries values(139, "2011-11-30"); +insert into diaries values(140, "2011-12-01"); +insert into diaries values(141, "2011-12-02"); +insert into diaries values(142, "2011-12-03"); +insert into diaries values(143, "2011-12-04"); +insert into diaries values(144, "2011-12-05"); +insert into diaries values(145, "2011-12-06"); +insert into diaries values(146, "2011-12-07"); +insert into diaries values(147, "2011-12-08"); +insert into diaries values(148, "2011-12-09"); +insert into diaries values(149, "2011-12-10"); +insert into diaries values(150, "2011-12-11"); +insert into diaries values(151, "2011-12-12"); +insert into diaries values(152, "2011-12-13"); +insert into diaries values(153, "2011-12-14"); +insert into diaries values(154, "2011-12-15"); +insert into diaries values(155, "2011-12-16"); +insert into diaries values(156, "2011-12-17"); +insert into diaries values(157, "2011-12-18"); +insert into diaries values(158, "2011-12-19"); +insert into diaries values(159, "2011-12-20"); +insert into diaries values(160, "2011-12-21"); +insert into diaries values(161, "2011-12-22"); +insert into diaries values(162, "2011-12-23"); +insert into diaries values(163, "2011-12-24"); +insert into diaries values(164, "2011-12-25"); +insert into diaries values(165, "2011-12-26"); +insert into diaries values(166, "2011-12-27"); +insert into diaries values(167, "2011-12-28"); +insert into diaries values(168, "2011-12-29"); +insert into diaries values(169, "2011-12-30"); +insert into diaries values(170, "2011-12-31"); +insert into diaries values(171, "2012-01-01"); +insert into diaries values(172, "2012-01-02"); +insert into diaries values(173, "2012-01-03"); +insert into diaries values(174, "2012-01-04"); +insert into diaries values(175, "2012-01-05"); +insert into diaries values(176, "2012-01-06"); +insert into diaries values(177, "2012-01-07"); +insert into diaries values(178, "2012-01-08"); +insert into diaries values(179, "2012-01-09"); +insert into diaries values(180, "2012-01-10"); +insert into diaries values(181, "2012-01-11"); +insert into diaries values(182, "2012-01-12"); +insert into diaries values(183, "2012-01-13"); +insert into diaries values(184, "2012-01-14"); +insert into diaries values(185, "2012-01-15"); +insert into diaries values(186, "2012-01-16"); +insert into diaries values(187, "2012-01-17"); +insert into diaries values(188, "2012-01-18"); +insert into diaries values(189, "2012-01-19"); +insert into diaries values(190, "2012-01-20"); +insert into diaries values(191, "2012-01-21"); +insert into diaries values(192, "2012-01-22"); +insert into diaries values(193, "2012-01-23"); +insert into diaries values(194, "2012-01-24"); +insert into diaries values(195, "2012-01-25"); +insert into diaries values(196, "2012-01-26"); +insert into diaries values(197, "2012-01-27"); +insert into diaries values(198, "2012-01-28"); +insert into diaries values(199, "2012-01-29"); +insert into diaries values(200, "2012-01-30"); +insert into diaries values(201, "2012-01-31"); +insert into diaries values(202, "2012-02-01"); +insert into diaries values(203, "2012-02-02"); +insert into diaries values(204, "2012-02-03"); +insert into diaries values(205, "2012-02-04"); +insert into diaries values(206, "2012-02-05"); +insert into diaries values(207, "2012-02-06"); +insert into diaries values(208, "2012-02-07"); +insert into diaries values(209, "2012-02-08"); +insert into diaries values(210, "2012-02-09"); +insert into diaries values(211, "2012-02-10"); +insert into diaries values(212, "2012-02-11"); +insert into diaries values(213, "2012-02-12"); +insert into diaries values(214, "2012-02-13"); +insert into diaries values(215, "2012-02-14"); +insert into diaries values(216, "2012-02-15"); +insert into diaries values(217, "2012-02-16"); +insert into diaries values(218, "2012-02-17"); +insert into diaries values(219, "2012-02-18"); +insert into diaries values(220, "2012-02-19"); +insert into diaries values(221, "2012-02-20"); +insert into diaries values(222, "2012-02-21"); +insert into diaries values(223, "2012-02-22"); +insert into diaries values(224, "2012-02-23"); +insert into diaries values(225, "2012-02-24"); +insert into diaries values(226, "2012-02-25"); +insert into diaries values(227, "2012-02-26"); +insert into diaries values(228, "2012-02-27"); +insert into diaries values(229, "2012-02-28"); +insert into diaries values(230, "2012-02-29"); +insert into diaries values(231, "2012-03-01"); +insert into diaries values(232, "2012-03-02"); +insert into diaries values(233, "2012-03-03"); +insert into diaries values(234, "2012-03-04"); +insert into diaries values(235, "2012-03-05"); +insert into diaries values(236, "2012-03-06"); +insert into diaries values(237, "2012-03-07"); +insert into diaries values(238, "2012-03-08"); +insert into diaries values(239, "2012-03-09"); +insert into diaries values(240, "2012-03-10"); +insert into diaries values(241, "2012-03-11"); +insert into diaries values(242, "2012-03-12"); +insert into diaries values(243, "2012-03-13"); +insert into diaries values(244, "2012-03-14"); +insert into diaries values(245, "2012-03-15"); +insert into diaries values(246, "2012-03-16"); +insert into diaries values(247, "2012-03-17"); +insert into diaries values(248, "2012-03-18"); +insert into diaries values(249, "2012-03-19"); +insert into diaries values(250, "2012-03-20"); +insert into diaries values(251, "2012-03-21"); +insert into diaries values(252, "2012-03-22"); +insert into diaries values(253, "2012-03-23"); +insert into diaries values(254, "2012-03-24"); +insert into diaries values(255, "2012-03-25"); +insert into diaries values(256, "2012-03-26"); +insert into diaries values(257, "2012-03-27"); +insert into diaries values(258, "2012-03-28"); +insert into diaries values(259, "2012-03-29"); +insert into diaries values(260, "2012-03-30"); +insert into diaries values(261, "2012-03-31"); +insert into diaries values(262, "2012-04-01"); +insert into diaries values(263, "2012-04-02"); +insert into diaries values(264, "2012-04-03"); +insert into diaries values(265, "2012-04-04"); +insert into diaries values(266, "2012-04-05"); +insert into diaries values(267, "2012-04-06"); +insert into diaries values(268, "2012-04-07"); +insert into diaries values(269, "2012-04-08"); +insert into diaries values(270, "2012-04-09"); +insert into diaries values(271, "2012-04-10"); +insert into diaries values(272, "2012-04-11"); +insert into diaries values(273, "2012-04-12"); +insert into diaries values(274, "2012-04-13"); +insert into diaries values(275, "2012-04-14"); +insert into diaries values(276, "2012-04-15"); +insert into diaries values(277, "2012-04-16"); +insert into diaries values(278, "2012-04-17"); +insert into diaries values(279, "2012-04-18"); +insert into diaries values(280, "2012-04-19"); +insert into diaries values(281, "2012-04-20"); +insert into diaries values(282, "2012-04-21"); +insert into diaries values(283, "2012-04-22"); +insert into diaries values(284, "2012-04-23"); +insert into diaries values(285, "2012-04-24"); +insert into diaries values(286, "2012-04-25"); +insert into diaries values(287, "2012-04-26"); +insert into diaries values(288, "2012-04-27"); +insert into diaries values(289, "2012-04-28"); +insert into diaries values(290, "2012-04-29"); +insert into diaries values(291, "2012-04-30"); +insert into diaries values(292, "2012-05-01"); +insert into diaries values(293, "2012-05-02"); +insert into diaries values(294, "2012-05-03"); +insert into diaries values(295, "2012-05-04"); +insert into diaries values(296, "2012-05-05"); +insert into diaries values(297, "2012-05-06"); +insert into diaries values(298, "2012-05-07"); +insert into diaries values(299, "2012-05-08"); +insert into diaries values(300, "2012-05-09"); +insert into diaries values(301, "2012-05-10"); +insert into diaries values(302, "2012-05-11"); +insert into diaries values(303, "2012-05-12"); +insert into diaries values(304, "2012-05-13"); +insert into diaries values(305, "2012-05-14"); +insert into diaries values(306, "2012-05-15"); +insert into diaries values(307, "2012-05-16"); +insert into diaries values(308, "2012-05-17"); +insert into diaries values(309, "2012-05-18"); +insert into diaries values(310, "2012-05-19"); +insert into diaries values(311, "2012-05-20"); +insert into diaries values(312, "2012-05-21"); +insert into diaries values(313, "2012-05-22"); +insert into diaries values(314, "2012-05-23"); +insert into diaries values(315, "2012-05-24"); +insert into diaries values(316, "2012-05-25"); +insert into diaries values(317, "2012-05-26"); +insert into diaries values(318, "2012-05-27"); +insert into diaries values(319, "2012-05-28"); +insert into diaries values(320, "2012-05-29"); +insert into diaries values(321, "2012-05-30"); +insert into diaries values(322, "2012-05-31"); +insert into diaries values(323, "2012-06-01"); +insert into diaries values(324, "2012-06-02"); +insert into diaries values(325, "2012-06-03"); +insert into diaries values(326, "2012-06-04"); +insert into diaries values(327, "2012-06-05"); +insert into diaries values(328, "2012-06-06"); +insert into diaries values(329, "2012-06-07"); +insert into diaries values(330, "2012-06-08"); +insert into diaries values(331, "2012-06-09"); +insert into diaries values(332, "2012-06-10"); +insert into diaries values(333, "2012-06-11"); +insert into diaries values(334, "2012-06-12"); +insert into diaries values(335, "2012-06-13"); +insert into diaries values(336, "2012-06-14"); +insert into diaries values(337, "2012-06-15"); +insert into diaries values(338, "2012-06-16"); +insert into diaries values(339, "2012-06-17"); +insert into diaries values(340, "2012-06-18"); +insert into diaries values(341, "2012-06-19"); +insert into diaries values(342, "2012-06-20"); +insert into diaries values(343, "2012-06-21"); +insert into diaries values(344, "2012-06-22"); +insert into diaries values(345, "2012-06-23"); +insert into diaries values(346, "2012-06-24"); +insert into diaries values(347, "2012-06-25"); +insert into diaries values(348, "2012-06-26"); +insert into diaries values(349, "2012-06-27"); +insert into diaries values(350, "2012-06-28"); +insert into diaries values(351, "2012-06-29"); +insert into diaries values(352, "2012-06-30"); +insert into diaries values(353, "2012-07-01"); +insert into diaries values(354, "2012-07-02"); +insert into diaries values(355, "2012-07-03"); +insert into diaries values(356, "2012-07-04"); +insert into diaries values(357, "2012-07-05"); +insert into diaries values(358, "2012-07-06"); +insert into diaries values(359, "2012-07-07"); +insert into diaries values(360, "2012-07-08"); +insert into diaries values(361, "2012-07-09"); +insert into diaries values(362, "2012-07-10"); +insert into diaries values(363, "2012-07-11"); +insert into diaries values(364, "2012-07-12"); +insert into diaries values(365, "2012-07-13"); +insert into diaries values(366, "2012-07-14"); +insert into diaries values(367, "2012-07-15"); +insert into diaries values(368, "2012-07-16"); +insert into diaries values(369, "2012-07-17"); +insert into diaries values(370, "2012-07-18"); +insert into diaries values(371, "2012-07-19"); +insert into diaries values(372, "2012-07-20"); +insert into diaries values(373, "2012-07-21"); +insert into diaries values(374, "2012-07-22"); +insert into diaries values(375, "2012-07-23"); +insert into diaries values(376, "2012-07-24"); +insert into diaries values(377, "2012-07-25"); +insert into diaries values(378, "2012-07-26"); +insert into diaries values(379, "2012-07-27"); +insert into diaries values(380, "2012-07-28"); +insert into diaries values(381, "2012-07-29"); +insert into diaries values(382, "2012-07-30"); +insert into diaries values(383, "2012-07-31"); +insert into diaries values(384, "2012-08-01"); +insert into diaries values(385, "2012-08-02"); +insert into diaries values(386, "2012-08-03"); +insert into diaries values(387, "2012-08-04"); +insert into diaries values(388, "2012-08-05"); +insert into diaries values(389, "2012-08-06"); +insert into diaries values(390, "2012-08-07"); +insert into diaries values(391, "2012-08-08"); +insert into diaries values(392, "2012-08-09"); +insert into diaries values(393, "2012-08-10"); +insert into diaries values(394, "2012-08-11"); +insert into diaries values(395, "2012-08-12"); +insert into diaries values(396, "2012-08-13"); +insert into diaries values(397, "2012-08-14"); +insert into diaries values(398, "2012-08-15"); +insert into diaries values(399, "2012-08-16"); +insert into diaries values(400, "2012-08-17"); +insert into diaries values(401, "2012-08-18"); +insert into diaries values(402, "2012-08-19"); +insert into diaries values(403, "2012-08-20"); +insert into diaries values(404, "2012-08-21"); +insert into diaries values(405, "2012-08-22"); +insert into diaries values(406, "2012-08-23"); +insert into diaries values(407, "2012-08-24"); +insert into diaries values(408, "2012-08-25"); +insert into diaries values(409, "2012-08-26"); +insert into diaries values(410, "2012-08-27"); +insert into diaries values(411, "2012-08-28"); +insert into diaries values(412, "2012-08-29"); +insert into diaries values(413, "2012-08-30"); +insert into diaries values(414, "2012-08-31"); +insert into diaries values(415, "2012-09-01"); +insert into diaries values(416, "2012-09-02"); +insert into diaries values(417, "2012-09-03"); +insert into diaries values(418, "2012-09-04"); +insert into diaries values(419, "2012-09-05"); +insert into diaries values(420, "2012-09-06"); +insert into diaries values(421, "2012-09-07"); +insert into diaries values(422, "2012-09-08"); +insert into diaries values(423, "2012-09-09"); +insert into diaries values(424, "2012-09-10"); +insert into diaries values(425, "2012-09-11"); +insert into diaries values(426, "2012-09-12"); +insert into diaries values(427, "2012-09-13"); +insert into diaries values(428, "2012-09-14"); +insert into diaries values(429, "2012-09-15"); +insert into diaries values(430, "2012-09-16"); +insert into diaries values(431, "2012-09-17"); +insert into diaries values(432, "2012-09-18"); +insert into diaries values(433, "2012-09-19"); +insert into diaries values(434, "2012-09-20"); +insert into diaries values(435, "2012-09-21"); +insert into diaries values(436, "2012-09-22"); +insert into diaries values(437, "2012-09-23"); +insert into diaries values(438, "2012-09-24"); +insert into diaries values(439, "2012-09-25"); +insert into diaries values(440, "2012-09-26"); +insert into diaries values(441, "2012-09-27"); +insert into diaries values(442, "2012-09-28"); +insert into diaries values(443, "2012-09-29"); +insert into diaries values(444, "2012-09-30"); +insert into diaries values(445, "2012-10-01"); +insert into diaries values(446, "2012-10-02"); +insert into diaries values(447, "2012-10-03"); +insert into diaries values(448, "2012-10-04"); +insert into diaries values(449, "2012-10-05"); +insert into diaries values(450, "2012-10-06"); +insert into diaries values(451, "2012-10-07"); +insert into diaries values(452, "2012-10-08"); +insert into diaries values(453, "2012-10-09"); +insert into diaries values(454, "2012-10-10"); +insert into diaries values(455, "2012-10-11"); +insert into diaries values(456, "2012-10-12"); +insert into diaries values(457, "2012-10-13"); +insert into diaries values(458, "2012-10-14"); +insert into diaries values(459, "2012-10-15"); +insert into diaries values(460, "2012-10-16"); +insert into diaries values(461, "2012-10-17"); +insert into diaries values(462, "2012-10-18"); +insert into diaries values(463, "2012-10-19"); +insert into diaries values(464, "2012-10-20"); +insert into diaries values(465, "2012-10-21"); +insert into diaries values(466, "2012-10-22"); +insert into diaries values(467, "2012-10-23"); +insert into diaries values(468, "2012-10-24"); +insert into diaries values(469, "2012-10-25"); +insert into diaries values(470, "2012-10-26"); +insert into diaries values(471, "2012-10-27"); +insert into diaries values(472, "2012-10-28"); +insert into diaries values(473, "2012-10-29"); +insert into diaries values(474, "2012-10-30"); +insert into diaries values(475, "2012-10-31"); +insert into diaries values(476, "2012-11-01"); +insert into diaries values(477, "2012-11-02"); +insert into diaries values(478, "2012-11-03"); +insert into diaries values(479, "2012-11-04"); +insert into diaries values(480, "2012-11-05"); +insert into diaries values(481, "2012-11-06"); +insert into diaries values(482, "2012-11-07"); +insert into diaries values(483, "2012-11-08"); +insert into diaries values(484, "2012-11-09"); +insert into diaries values(485, "2012-11-10"); +insert into diaries values(486, "2012-11-11"); +insert into diaries values(487, "2012-11-12"); +insert into diaries values(488, "2012-11-13"); +insert into diaries values(489, "2012-11-14"); +insert into diaries values(490, "2012-11-15"); +insert into diaries values(491, "2012-11-16"); +insert into diaries values(492, "2012-11-17"); +insert into diaries values(493, "2012-11-18"); +insert into diaries values(494, "2012-11-19"); +insert into diaries values(495, "2012-11-20"); +insert into diaries values(496, "2012-11-21"); +insert into diaries values(497, "2012-11-22"); +insert into diaries values(498, "2012-11-23"); +insert into diaries values(499, "2012-11-24"); +insert into diaries values(500, "2012-11-25"); +insert into diaries values(501, "2012-11-26"); +insert into diaries values(502, "2012-11-27"); +insert into diaries values(503, "2012-11-28"); +insert into diaries values(504, "2012-11-29"); +insert into diaries values(505, "2012-11-30"); +insert into diaries values(506, "2012-12-01"); +insert into diaries values(507, "2012-12-02"); +insert into diaries values(508, "2012-12-03"); +insert into diaries values(509, "2012-12-04"); +insert into diaries values(510, "2012-12-05"); +insert into diaries values(511, "2012-12-06"); +insert into diaries values(512, "2012-12-07"); +insert into diaries values(513, "2012-12-08"); +insert into diaries values(514, "2012-12-09"); +insert into diaries values(515, "2012-12-10"); +insert into diaries values(516, "2012-12-11"); +insert into diaries values(517, "2012-12-12"); +insert into diaries values(518, "2012-12-13"); +insert into diaries values(519, "2012-12-14"); +insert into diaries values(520, "2012-12-15"); +insert into diaries values(521, "2012-12-16"); +insert into diaries values(522, "2012-12-17"); +insert into diaries values(523, "2012-12-18"); +insert into diaries values(524, "2012-12-19"); +insert into diaries values(525, "2012-12-20"); +insert into diaries values(526, "2012-12-21"); +insert into diaries values(527, "2012-12-22"); +insert into diaries values(528, "2012-12-23"); +insert into diaries values(529, "2012-12-24"); +insert into diaries values(530, "2012-12-25"); +insert into diaries values(531, "2012-12-26"); +insert into diaries values(532, "2012-12-27"); +insert into diaries values(533, "2012-12-28"); +insert into diaries values(534, "2012-12-29"); +insert into diaries values(535, "2012-12-30"); +insert into diaries values(536, "2012-12-31"); +insert into diaries values(537, "2013-01-01"); +insert into diaries values(538, "2013-01-02"); +insert into diaries values(539, "2013-01-03"); +insert into diaries values(540, "2013-01-04"); +insert into diaries values(541, "2013-01-05"); +insert into diaries values(542, "2013-01-06"); +insert into diaries values(543, "2013-01-07"); +insert into diaries values(544, "2013-01-08"); +insert into diaries values(545, "2013-01-09"); +insert into diaries values(546, "2013-01-10"); +insert into diaries values(547, "2013-01-11"); +insert into diaries values(548, "2013-01-12"); +insert into diaries values(549, "2013-01-13"); +insert into diaries values(550, "2013-01-14"); +insert into diaries values(551, "2013-01-15"); +insert into diaries values(552, "2013-01-16"); +insert into diaries values(553, "2013-01-17"); +insert into diaries values(554, "2013-01-18"); +insert into diaries values(555, "2013-01-19"); +insert into diaries values(556, "2013-01-20"); +insert into diaries values(557, "2013-01-21"); +insert into diaries values(558, "2013-01-22"); +insert into diaries values(559, "2013-01-23"); +insert into diaries values(560, "2013-01-24"); +insert into diaries values(561, "2013-01-25"); +insert into diaries values(562, "2013-01-26"); +insert into diaries values(563, "2013-01-27"); +insert into diaries values(564, "2013-01-28"); +insert into diaries values(565, "2013-01-29"); +insert into diaries values(566, "2013-01-30"); +insert into diaries values(567, "2013-01-31"); +insert into diaries values(568, "2013-02-01"); +insert into diaries values(569, "2013-02-02"); +insert into diaries values(570, "2013-02-03"); +insert into diaries values(571, "2013-02-04"); +insert into diaries values(572, "2013-02-05"); +insert into diaries values(573, "2013-02-06"); +insert into diaries values(574, "2013-02-07"); +insert into diaries values(575, "2013-02-08"); +insert into diaries values(576, "2013-02-09"); +insert into diaries values(577, "2013-02-10"); +insert into diaries values(578, "2013-02-11"); +insert into diaries values(579, "2013-02-12"); +insert into diaries values(580, "2013-02-13"); +insert into diaries values(581, "2013-02-14"); +insert into diaries values(582, "2013-02-15"); +insert into diaries values(583, "2013-02-16"); +insert into diaries values(584, "2013-02-17"); +insert into diaries values(585, "2013-02-18"); +insert into diaries values(586, "2013-02-19"); +insert into diaries values(587, "2013-02-20"); +insert into diaries values(588, "2013-02-21"); +insert into diaries values(589, "2013-02-22"); +insert into diaries values(590, "2013-02-23"); +insert into diaries values(591, "2013-02-24"); +insert into diaries values(592, "2013-02-25"); +insert into diaries values(593, "2013-02-26"); +insert into diaries values(594, "2013-02-27"); +insert into diaries values(595, "2013-02-28"); +insert into diaries values(596, "2013-03-01"); +insert into diaries values(597, "2013-03-02"); +insert into diaries values(598, "2013-03-03"); +insert into diaries values(599, "2013-03-04"); +insert into diaries values(600, "2013-03-05"); +insert into diaries values(601, "2013-03-06"); +insert into diaries values(602, "2013-03-07"); +insert into diaries values(603, "2013-03-08"); +insert into diaries values(604, "2013-03-09"); +insert into diaries values(605, "2013-03-10"); +insert into diaries values(606, "2013-03-11"); +insert into diaries values(607, "2013-03-12"); +insert into diaries values(608, "2013-03-13"); +insert into diaries values(609, "2013-03-14"); +insert into diaries values(610, "2013-03-15"); +insert into diaries values(611, "2013-03-16"); +insert into diaries values(612, "2013-03-17"); +insert into diaries values(613, "2013-03-18"); +insert into diaries values(614, "2013-03-19"); +insert into diaries values(615, "2013-03-20"); +insert into diaries values(616, "2013-03-21"); +insert into diaries values(617, "2013-03-22"); +insert into diaries values(618, "2013-03-23"); +insert into diaries values(619, "2013-03-24"); +insert into diaries values(620, "2013-03-25"); +insert into diaries values(621, "2013-03-26"); +insert into diaries values(622, "2013-03-27"); +insert into diaries values(623, "2013-03-28"); +insert into diaries values(624, "2013-03-29"); +insert into diaries values(625, "2013-03-30"); +insert into diaries values(626, "2013-03-31"); +insert into diaries values(627, "2013-04-01"); +insert into diaries values(628, "2013-04-02"); +insert into diaries values(629, "2013-04-03"); +insert into diaries values(630, "2013-04-04"); +insert into diaries values(631, "2013-04-05"); +insert into diaries values(632, "2013-04-06"); +insert into diaries values(633, "2013-04-07"); +insert into diaries values(634, "2013-04-08"); +insert into diaries values(635, "2013-04-09"); +insert into diaries values(636, "2013-04-10"); +insert into diaries values(637, "2013-04-11"); +insert into diaries values(638, "2013-04-12"); +insert into diaries values(639, "2013-04-13"); +insert into diaries values(640, "2013-04-14"); +insert into diaries values(641, "2013-04-15"); +insert into diaries values(642, "2013-04-16"); +insert into diaries values(643, "2013-04-17"); +insert into diaries values(644, "2013-04-18"); +insert into diaries values(645, "2013-04-19"); +insert into diaries values(646, "2013-04-20"); +insert into diaries values(647, "2013-04-21"); +insert into diaries values(648, "2013-04-22"); +insert into diaries values(649, "2013-04-23"); +insert into diaries values(650, "2013-04-24"); +insert into diaries values(651, "2013-04-25"); +insert into diaries values(652, "2013-04-26"); +insert into diaries values(653, "2013-04-27"); +insert into diaries values(654, "2013-04-28"); +insert into diaries values(655, "2013-04-29"); +insert into diaries values(656, "2013-04-30"); +insert into diaries values(657, "2013-05-01"); +insert into diaries values(658, "2013-05-02"); +insert into diaries values(659, "2013-05-03"); +insert into diaries values(660, "2013-05-04"); +insert into diaries values(661, "2013-05-05"); +insert into diaries values(662, "2013-05-06"); +insert into diaries values(663, "2013-05-07"); +insert into diaries values(664, "2013-05-08"); +insert into diaries values(665, "2013-05-09"); +insert into diaries values(666, "2013-05-10"); +insert into diaries values(667, "2013-05-11"); +insert into diaries values(668, "2013-05-12"); +insert into diaries values(669, "2013-05-13"); +insert into diaries values(670, "2013-05-14"); +insert into diaries values(671, "2013-05-15"); +insert into diaries values(672, "2013-05-16"); +insert into diaries values(673, "2013-05-17"); +insert into diaries values(674, "2013-05-18"); +insert into diaries values(675, "2013-05-19"); +insert into diaries values(676, "2013-05-20"); +insert into diaries values(677, "2013-05-21"); +insert into diaries values(678, "2013-05-22"); +insert into diaries values(679, "2013-05-23"); +insert into diaries values(680, "2013-05-24"); +insert into diaries values(681, "2013-05-25"); +insert into diaries values(682, "2013-05-26"); +insert into diaries values(683, "2013-05-27"); +insert into diaries values(684, "2013-05-28"); +insert into diaries values(685, "2013-05-29"); +insert into diaries values(686, "2013-05-30"); +insert into diaries values(687, "2013-05-31"); +insert into diaries values(688, "2013-06-01"); +insert into diaries values(689, "2013-06-02"); +insert into diaries values(690, "2013-06-03"); +insert into diaries values(691, "2013-06-04"); +insert into diaries values(692, "2013-06-05"); +insert into diaries values(693, "2013-06-06"); +insert into diaries values(694, "2013-06-07"); +insert into diaries values(695, "2013-06-08"); +insert into diaries values(696, "2013-06-09"); +insert into diaries values(697, "2013-06-10"); +insert into diaries values(698, "2013-06-11"); +insert into diaries values(699, "2013-06-12"); +insert into diaries values(700, "2013-06-13"); +insert into diaries values(701, "2013-06-14"); +insert into diaries values(702, "2013-06-15"); +insert into diaries values(703, "2013-06-16"); +insert into diaries values(704, "2013-06-17"); +insert into diaries values(705, "2013-06-18"); +insert into diaries values(706, "2013-06-19"); +insert into diaries values(707, "2013-06-20"); +insert into diaries values(708, "2013-06-21"); +insert into diaries values(709, "2013-06-22"); +insert into diaries values(710, "2013-06-23"); +insert into diaries values(711, "2013-06-24"); +insert into diaries values(712, "2013-06-25"); +insert into diaries values(713, "2013-06-26"); +insert into diaries values(714, "2013-06-27"); +insert into diaries values(715, "2013-06-28"); +insert into diaries values(716, "2013-06-29"); +insert into diaries values(717, "2013-06-30"); +insert into diaries values(718, "2013-07-01"); +insert into diaries values(719, "2013-07-02"); +insert into diaries values(720, "2013-07-03"); +insert into diaries values(721, "2013-07-04"); +insert into diaries values(722, "2013-07-05"); +insert into diaries values(723, "2013-07-06"); +insert into diaries values(724, "2013-07-07"); +insert into diaries values(725, "2013-07-08"); +insert into diaries values(726, "2013-07-09"); +insert into diaries values(727, "2013-07-10"); +insert into diaries values(728, "2013-07-11"); +insert into diaries values(729, "2013-07-12"); +insert into diaries values(730, "2013-07-13"); +insert into diaries values(731, "2013-07-14"); +insert into diaries values(732, "2013-07-15"); +insert into diaries values(733, "2013-07-16"); +insert into diaries values(734, "2013-07-17"); +insert into diaries values(735, "2013-07-18"); +insert into diaries values(736, "2013-07-19"); +insert into diaries values(737, "2013-07-20"); +insert into diaries values(738, "2013-07-21"); +insert into diaries values(739, "2013-07-22"); +insert into diaries values(740, "2013-07-23"); +insert into diaries values(741, "2013-07-24"); +insert into diaries values(742, "2013-07-25"); +insert into diaries values(743, "2013-07-26"); +insert into diaries values(744, "2013-07-27"); +insert into diaries values(745, "2013-07-28"); +insert into diaries values(746, "2013-07-29"); +insert into diaries values(747, "2013-07-30"); +insert into diaries values(748, "2013-07-31"); +insert into diaries values(749, "2013-08-01"); +insert into diaries values(750, "2013-08-02"); +insert into diaries values(751, "2013-08-03"); +insert into diaries values(752, "2013-08-04"); +insert into diaries values(753, "2013-08-05"); +insert into diaries values(754, "2013-08-06"); +insert into diaries values(755, "2013-08-07"); +insert into diaries values(756, "2013-08-08"); +insert into diaries values(757, "2013-08-09"); +insert into diaries values(758, "2013-08-10"); +insert into diaries values(759, "2013-08-11"); +insert into diaries values(760, "2013-08-12"); +insert into diaries values(761, "2013-08-13"); +insert into diaries values(762, "2013-08-14"); +insert into diaries values(763, "2013-08-15"); +insert into diaries values(764, "2013-08-16"); +insert into diaries values(765, "2013-08-17"); +insert into diaries values(766, "2013-08-18"); +insert into diaries values(767, "2013-08-19"); +insert into diaries values(768, "2013-08-20"); +insert into diaries values(769, "2013-08-21"); +insert into diaries values(770, "2013-08-22"); +insert into diaries values(771, "2013-08-23"); +insert into diaries values(772, "2013-08-24"); +insert into diaries values(773, "2013-08-25"); +insert into diaries values(774, "2013-08-26"); +insert into diaries values(775, "2013-08-27"); +insert into diaries values(776, "2013-08-28"); +insert into diaries values(777, "2013-08-29"); +insert into diaries values(778, "2013-08-30"); +insert into diaries values(779, "2013-08-31"); +insert into diaries values(780, "2013-09-01"); +insert into diaries values(781, "2013-09-02"); +insert into diaries values(782, "2013-09-03"); +insert into diaries values(783, "2013-09-04"); +insert into diaries values(784, "2013-09-05"); +insert into diaries values(785, "2013-09-06"); +insert into diaries values(786, "2013-09-07"); +insert into diaries values(787, "2013-09-08"); +insert into diaries values(788, "2013-09-09"); +insert into diaries values(789, "2013-09-10"); +insert into diaries values(790, "2013-09-11"); +insert into diaries values(791, "2013-09-12"); +insert into diaries values(792, "2013-09-13"); +insert into diaries values(793, "2013-09-14"); +insert into diaries values(794, "2013-09-15"); +insert into diaries values(795, "2013-09-16"); +insert into diaries values(796, "2013-09-17"); +insert into diaries values(797, "2013-09-18"); +insert into diaries values(798, "2013-09-19"); +insert into diaries values(799, "2013-09-20"); +insert into diaries values(800, "2013-09-21"); +insert into diaries values(801, "2013-09-22"); +insert into diaries values(802, "2013-09-23"); +insert into diaries values(803, "2013-09-24"); +insert into diaries values(804, "2013-09-25"); +insert into diaries values(805, "2013-09-26"); +insert into diaries values(806, "2013-09-27"); +insert into diaries values(807, "2013-09-28"); +insert into diaries values(808, "2013-09-29"); +insert into diaries values(809, "2013-09-30"); +insert into diaries values(810, "2013-10-01"); +insert into diaries values(811, "2013-10-02"); +insert into diaries values(812, "2013-10-03"); +insert into diaries values(813, "2013-10-04"); +insert into diaries values(814, "2013-10-05"); +insert into diaries values(815, "2013-10-06"); +insert into diaries values(816, "2013-10-07"); +insert into diaries values(817, "2013-10-08"); +insert into diaries values(818, "2013-10-09"); +insert into diaries values(819, "2013-10-10"); +insert into diaries values(820, "2013-10-11"); +insert into diaries values(821, "2013-10-12"); +insert into diaries values(822, "2013-10-13"); +insert into diaries values(823, "2013-10-14"); +insert into diaries values(824, "2013-10-15"); +insert into diaries values(825, "2013-10-16"); +insert into diaries values(826, "2013-10-17"); +insert into diaries values(827, "2013-10-18"); +insert into diaries values(828, "2013-10-19"); +insert into diaries values(829, "2013-10-20"); +insert into diaries values(830, "2013-10-21"); +insert into diaries values(831, "2013-10-22"); +insert into diaries values(832, "2013-10-23"); +insert into diaries values(833, "2013-10-24"); +insert into diaries values(834, "2013-10-25"); +insert into diaries values(835, "2013-10-26"); +insert into diaries values(836, "2013-10-27"); +insert into diaries values(837, "2013-10-28"); +insert into diaries values(838, "2013-10-29"); +insert into diaries values(839, "2013-10-30"); +insert into diaries values(840, "2013-10-31"); +insert into diaries values(841, "2013-11-01"); +insert into diaries values(842, "2013-11-02"); +insert into diaries values(843, "2013-11-03"); +insert into diaries values(844, "2013-11-04"); +insert into diaries values(845, "2013-11-05"); +insert into diaries values(846, "2013-11-06"); +insert into diaries values(847, "2013-11-07"); +insert into diaries values(848, "2013-11-08"); +insert into diaries values(849, "2013-11-09"); +insert into diaries values(850, "2013-11-10"); +insert into diaries values(851, "2013-11-11"); +insert into diaries values(852, "2013-11-12"); +insert into diaries values(853, "2013-11-13"); +insert into diaries values(854, "2013-11-14"); +insert into diaries values(855, "2013-11-15"); +insert into diaries values(856, "2013-11-16"); +insert into diaries values(857, "2013-11-17"); +insert into diaries values(858, "2013-11-18"); +insert into diaries values(859, "2013-11-19"); +insert into diaries values(860, "2013-11-20"); +insert into diaries values(861, "2013-11-21"); +insert into diaries values(862, "2013-11-22"); +insert into diaries values(863, "2013-11-23"); +insert into diaries values(864, "2013-11-24"); +insert into diaries values(865, "2013-11-25"); +insert into diaries values(866, "2013-11-26"); +insert into diaries values(867, "2013-11-27"); +insert into diaries values(868, "2013-11-28"); +insert into diaries values(869, "2013-11-29"); +insert into diaries values(870, "2013-11-30"); +insert into diaries values(871, "2013-12-01"); +insert into diaries values(872, "2013-12-02"); +insert into diaries values(873, "2013-12-03"); +insert into diaries values(874, "2013-12-04"); +insert into diaries values(875, "2013-12-05"); +insert into diaries values(876, "2013-12-06"); +insert into diaries values(877, "2013-12-07"); +insert into diaries values(878, "2013-12-08"); +insert into diaries values(879, "2013-12-09"); +insert into diaries values(880, "2013-12-10"); +insert into diaries values(881, "2013-12-11"); +insert into diaries values(882, "2013-12-12"); +insert into diaries values(883, "2013-12-13"); +insert into diaries values(884, "2013-12-14"); +insert into diaries values(885, "2013-12-15"); +insert into diaries values(886, "2013-12-16"); +insert into diaries values(887, "2013-12-17"); +insert into diaries values(888, "2013-12-18"); +insert into diaries values(889, "2013-12-19"); +insert into diaries values(890, "2013-12-20"); +insert into diaries values(891, "2013-12-21"); +insert into diaries values(892, "2013-12-22"); +insert into diaries values(893, "2013-12-23"); +insert into diaries values(894, "2013-12-24"); +insert into diaries values(895, "2013-12-25"); +insert into diaries values(896, "2013-12-26"); +insert into diaries values(897, "2013-12-27"); +insert into diaries values(898, "2013-12-28"); +insert into diaries values(899, "2013-12-29"); +insert into diaries values(900, "2013-12-30"); +insert into diaries values(901, "2013-12-31"); +insert into diaries values(902, "2014-01-01"); +insert into diaries values(903, "2014-01-02"); +insert into diaries values(904, "2014-01-03"); +insert into diaries values(905, "2014-01-04"); +insert into diaries values(906, "2014-01-05"); +insert into diaries values(907, "2014-01-06"); +insert into diaries values(908, "2014-01-07"); +insert into diaries values(909, "2014-01-08"); +insert into diaries values(910, "2014-01-09"); +insert into diaries values(911, "2014-01-10"); +insert into diaries values(912, "2014-01-11"); +insert into diaries values(913, "2014-01-12"); +insert into diaries values(914, "2014-01-13"); +insert into diaries values(915, "2014-01-14"); +insert into diaries values(916, "2014-01-15"); +insert into diaries values(917, "2014-01-16"); +insert into diaries values(918, "2014-01-17"); +insert into diaries values(919, "2014-01-18"); +insert into diaries values(920, "2014-01-19"); +insert into diaries values(921, "2014-01-20"); +insert into diaries values(922, "2014-01-21"); +insert into diaries values(923, "2014-01-22"); +insert into diaries values(924, "2014-01-23"); +insert into diaries values(925, "2014-01-24"); +insert into diaries values(926, "2014-01-25"); +insert into diaries values(927, "2014-01-26"); +insert into diaries values(928, "2014-01-27"); +insert into diaries values(929, "2014-01-28"); +insert into diaries values(930, "2014-01-29"); +insert into diaries values(931, "2014-01-30"); +insert into diaries values(932, "2014-01-31"); +insert into diaries values(933, "2014-02-01"); +insert into diaries values(934, "2014-02-02"); +insert into diaries values(935, "2014-02-03"); +insert into diaries values(936, "2014-02-04"); +insert into diaries values(937, "2014-02-05"); +insert into diaries values(938, "2014-02-06"); +insert into diaries values(939, "2014-02-07"); +insert into diaries values(940, "2014-02-08"); +insert into diaries values(941, "2014-02-09"); +insert into diaries values(942, "2014-02-10"); +insert into diaries values(943, "2014-02-11"); +insert into diaries values(944, "2014-02-12"); +insert into diaries values(945, "2014-02-13"); +insert into diaries values(946, "2014-02-14"); +insert into diaries values(947, "2014-02-15"); +insert into diaries values(948, "2014-02-16"); +insert into diaries values(949, "2014-02-17"); +insert into diaries values(950, "2014-02-18"); +insert into diaries values(951, "2014-02-19"); +insert into diaries values(952, "2014-02-20"); +insert into diaries values(953, "2014-02-21"); +insert into diaries values(954, "2014-02-22"); +insert into diaries values(955, "2014-02-23"); +insert into diaries values(956, "2014-02-24"); +insert into diaries values(957, "2014-02-25"); +insert into diaries values(958, "2014-02-26"); +insert into diaries values(959, "2014-02-27"); +insert into diaries values(960, "2014-02-28"); +insert into diaries values(961, "2014-03-01"); +insert into diaries values(962, "2014-03-02"); +insert into diaries values(963, "2014-03-03"); +insert into diaries values(964, "2014-03-04"); +insert into diaries values(965, "2014-03-05"); +insert into diaries values(966, "2014-03-06"); +insert into diaries values(967, "2014-03-07"); +insert into diaries values(968, "2014-03-08"); +insert into diaries values(969, "2014-03-09"); +insert into diaries values(970, "2014-03-10"); +insert into diaries values(971, "2014-03-11"); +insert into diaries values(972, "2014-03-12"); +insert into diaries values(973, "2014-03-13"); +insert into diaries values(974, "2014-03-14"); +insert into diaries values(975, "2014-03-15"); +insert into diaries values(976, "2014-03-16"); +insert into diaries values(977, "2014-03-17"); +insert into diaries values(978, "2014-03-18"); +insert into diaries values(979, "2014-03-19"); +insert into diaries values(980, "2014-03-20"); +insert into diaries values(981, "2014-03-21"); +insert into diaries values(982, "2014-03-22"); +insert into diaries values(983, "2014-03-23"); +insert into diaries values(984, "2014-03-24"); +insert into diaries values(985, "2014-03-25"); +insert into diaries values(986, "2014-03-26"); +insert into diaries values(987, "2014-03-27"); +insert into diaries values(988, "2014-03-28"); +insert into diaries values(989, "2014-03-29"); +insert into diaries values(990, "2014-03-30"); +insert into diaries values(991, "2014-03-31"); +insert into diaries values(992, "2014-04-01"); +insert into diaries values(993, "2014-04-02"); +insert into diaries values(994, "2014-04-03"); +insert into diaries values(995, "2014-04-04"); +insert into diaries values(996, "2014-04-05"); +insert into diaries values(997, "2014-04-06"); +insert into diaries values(998, "2014-04-07"); +insert into diaries values(999, "2014-04-08"); +insert into diaries values(1000, "2014-04-09"); +insert into diaries values(1001, "2014-04-10"); +insert into diaries values(1002, "2014-04-11"); +insert into diaries values(1003, "2014-04-12"); +insert into diaries values(1004, "2014-04-13"); +insert into diaries values(1005, "2014-04-14"); +insert into diaries values(1006, "2014-04-15"); +insert into diaries values(1007, "2014-04-16"); +insert into diaries values(1008, "2014-04-17"); +insert into diaries values(1009, "2014-04-18"); +insert into diaries values(1010, "2014-04-19"); +insert into diaries values(1011, "2014-04-20"); +insert into diaries values(1012, "2014-04-21"); +insert into diaries values(1013, "2014-04-22"); +insert into diaries values(1014, "2014-04-23"); +insert into diaries values(1015, "2014-04-24"); +insert into diaries values(1016, "2014-04-25"); +insert into diaries values(1017, "2014-04-26"); +insert into diaries values(1018, "2014-04-27"); +insert into diaries values(1019, "2014-04-28"); +insert into diaries values(1020, "2014-04-29"); +insert into diaries values(1021, "2014-04-30"); +insert into diaries values(1022, "2014-05-01"); +insert into diaries values(1023, "2014-05-02"); +insert into diaries values(1024, "2014-05-03"); +insert into diaries values(1025, "2014-05-04"); +insert into diaries values(1026, "2014-05-05"); +insert into diaries values(1027, "2014-05-06"); +insert into diaries values(1028, "2014-05-07"); +insert into diaries values(1029, "2014-05-08"); +insert into diaries values(1030, "2014-05-09"); +insert into diaries values(1031, "2014-05-10"); +insert into diaries values(1032, "2014-05-11"); +insert into diaries values(1033, "2014-05-12"); +insert into diaries values(1034, "2014-05-13"); +insert into diaries values(1035, "2014-05-14"); +insert into diaries values(1036, "2014-05-15"); +insert into diaries values(1037, "2014-05-16"); +insert into diaries values(1038, "2014-05-17"); +insert into diaries values(1039, "2014-05-18"); +insert into diaries values(1040, "2014-05-19"); +insert into diaries values(1041, "2014-05-20"); +insert into diaries values(1042, "2014-05-21"); +insert into diaries values(1043, "2014-05-22"); +insert into diaries values(1044, "2014-05-23"); +insert into diaries values(1045, "2014-05-24"); +insert into diaries values(1046, "2014-05-25"); +insert into diaries values(1047, "2014-05-26"); +insert into diaries values(1048, "2014-05-27"); +insert into diaries values(1049, "2014-05-28"); +insert into diaries values(1050, "2014-05-29"); +insert into diaries values(1051, "2014-05-30"); +insert into diaries values(1052, "2014-05-31"); +insert into diaries values(1053, "2014-06-01"); +insert into diaries values(1054, "2014-06-02"); +insert into diaries values(1055, "2014-06-03"); +insert into diaries values(1056, "2014-06-04"); +insert into diaries values(1057, "2014-06-05"); +insert into diaries values(1058, "2014-06-06"); +insert into diaries values(1059, "2014-06-07"); +insert into diaries values(1060, "2014-06-08"); +insert into diaries values(1061, "2014-06-09"); +insert into diaries values(1062, "2014-06-10"); +insert into diaries values(1063, "2014-06-11"); +insert into diaries values(1064, "2014-06-12"); +insert into diaries values(1065, "2014-06-13"); +insert into diaries values(1066, "2014-06-14"); +insert into diaries values(1067, "2014-06-15"); +insert into diaries values(1068, "2014-06-16"); +insert into diaries values(1069, "2014-06-17"); +insert into diaries values(1070, "2014-06-18"); +insert into diaries values(1071, "2014-06-19"); +insert into diaries values(1072, "2014-06-20"); +insert into diaries values(1073, "2014-06-21"); +insert into diaries values(1074, "2014-06-22"); +insert into diaries values(1075, "2014-06-23"); +insert into diaries values(1076, "2014-06-24"); +insert into diaries values(1077, "2014-06-25"); +insert into diaries values(1078, "2014-06-26"); +insert into diaries values(1079, "2014-06-27"); +insert into diaries values(1080, "2014-06-28"); +insert into diaries values(1081, "2014-06-29"); +insert into diaries values(1082, "2014-06-30"); +insert into diaries values(1083, "2014-07-01"); +insert into diaries values(1084, "2014-07-02"); +insert into diaries values(1085, "2014-07-03"); +insert into diaries values(1086, "2014-07-04"); +insert into diaries values(1087, "2014-07-05"); +insert into diaries values(1088, "2014-07-06"); +insert into diaries values(1089, "2014-07-07"); +insert into diaries values(1090, "2014-07-08"); +insert into diaries values(1091, "2014-07-09"); +insert into diaries values(1092, "2014-07-10"); +insert into diaries values(1093, "2014-07-11"); +insert into diaries values(1094, "2014-07-12"); +insert into diaries values(1095, "2014-07-13"); +insert into diaries values(1096, "2014-07-14"); +insert into diaries values(1097, "2014-07-15"); +insert into diaries values(1098, "2014-07-16"); +insert into diaries values(1099, "2014-07-17"); +insert into diaries values(1100, "2014-07-18"); +insert into diaries values(1101, "2014-07-19"); +insert into diaries values(1102, "2014-07-20"); +insert into diaries values(1103, "2014-07-21"); +insert into diaries values(1104, "2014-07-22"); +insert into diaries values(1105, "2014-07-23"); +insert into diaries values(1106, "2014-07-24"); +insert into diaries values(1107, "2014-07-25"); +insert into diaries values(1108, "2014-07-26"); +insert into diaries values(1109, "2014-07-27"); +insert into diaries values(1110, "2014-07-28"); +insert into diaries values(1111, "2014-07-29"); +insert into diaries values(1112, "2014-07-30"); +insert into diaries values(1113, "2014-07-31"); +insert into diaries values(1114, "2014-08-01"); +insert into diaries values(1115, "2014-08-02"); +insert into diaries values(1116, "2014-08-03"); +insert into diaries values(1117, "2014-08-04"); +insert into diaries values(1118, "2014-08-05"); +insert into diaries values(1119, "2014-08-06"); +insert into diaries values(1120, "2014-08-07"); +insert into diaries values(1121, "2014-08-08"); +insert into diaries values(1122, "2014-08-09"); +insert into diaries values(1123, "2014-08-10"); +insert into diaries values(1124, "2014-08-11"); +insert into diaries values(1125, "2014-08-12"); +insert into diaries values(1126, "2014-08-13"); +insert into diaries values(1127, "2014-08-14"); +insert into diaries values(1128, "2014-08-15"); +insert into diaries values(1129, "2014-08-16"); +insert into diaries values(1130, "2014-08-17"); +insert into diaries values(1131, "2014-08-18"); +insert into diaries values(1132, "2014-08-19"); +insert into diaries values(1133, "2014-08-20"); +insert into diaries values(1134, "2014-08-21"); +insert into diaries values(1135, "2014-08-22"); +insert into diaries values(1136, "2014-08-23"); +insert into diaries values(1137, "2014-08-24"); +insert into diaries values(1138, "2014-08-25"); +insert into diaries values(1139, "2014-08-26"); +insert into diaries values(1140, "2014-08-27"); +insert into diaries values(1141, "2014-08-28"); +insert into diaries values(1142, "2014-08-29"); +insert into diaries values(1143, "2014-08-30"); +insert into diaries values(1144, "2014-08-31"); +insert into diaries values(1145, "2014-09-01"); +insert into diaries values(1146, "2014-09-02"); +insert into diaries values(1147, "2014-09-03"); +insert into diaries values(1148, "2014-09-04"); +insert into diaries values(1149, "2014-09-05"); +insert into diaries values(1150, "2014-09-06"); +insert into diaries values(1151, "2014-09-07"); +insert into diaries values(1152, "2014-09-08"); +insert into diaries values(1153, "2014-09-09"); +insert into diaries values(1154, "2014-09-10"); +insert into diaries values(1155, "2014-09-11"); +insert into diaries values(1156, "2014-09-12"); +insert into diaries values(1157, "2014-09-13"); +insert into diaries values(1158, "2014-09-14"); +insert into diaries values(1159, "2014-09-15"); +insert into diaries values(1160, "2014-09-16"); +insert into diaries values(1161, "2014-09-17"); +insert into diaries values(1162, "2014-09-18"); +insert into diaries values(1163, "2014-09-19"); +insert into diaries values(1164, "2014-09-20"); +insert into diaries values(1165, "2014-09-21"); +insert into diaries values(1166, "2014-09-22"); +insert into diaries values(1167, "2014-09-23"); +insert into diaries values(1168, "2014-09-24"); +insert into diaries values(1169, "2014-09-25"); +insert into diaries values(1170, "2014-09-26"); +insert into diaries values(1171, "2014-09-27"); +insert into diaries values(1172, "2014-09-28"); +insert into diaries values(1173, "2014-09-29"); +insert into diaries values(1174, "2014-09-30"); +insert into diaries values(1175, "2014-10-01"); +insert into diaries values(1176, "2014-10-02"); +insert into diaries values(1177, "2014-10-03"); +insert into diaries values(1178, "2014-10-04"); +insert into diaries values(1179, "2014-10-05"); +insert into diaries values(1180, "2014-10-06"); +insert into diaries values(1181, "2014-10-07"); +insert into diaries values(1182, "2014-10-08"); +insert into diaries values(1183, "2014-10-09"); +insert into diaries values(1184, "2014-10-10"); +insert into diaries values(1185, "2014-10-11"); +insert into diaries values(1186, "2014-10-12"); +insert into diaries values(1187, "2014-10-13"); +insert into diaries values(1188, "2014-10-14"); +insert into diaries values(1189, "2014-10-15"); +insert into diaries values(1190, "2014-10-16"); +insert into diaries values(1191, "2014-10-17"); +insert into diaries values(1192, "2014-10-18"); +insert into diaries values(1193, "2014-10-19"); +insert into diaries values(1194, "2014-10-20"); +insert into diaries values(1195, "2014-10-21"); +insert into diaries values(1196, "2014-10-22"); +insert into diaries values(1197, "2014-10-23"); +insert into diaries values(1198, "2014-10-24"); +insert into diaries values(1199, "2014-10-25"); +insert into diaries values(1200, "2014-10-26"); +insert into diaries values(1201, "2014-10-27"); +insert into diaries values(1202, "2014-10-28"); +insert into diaries values(1203, "2014-10-29"); +insert into diaries values(1204, "2014-10-30"); +insert into diaries values(1205, "2014-10-31"); +insert into diaries values(1206, "2014-11-01"); +insert into diaries values(1207, "2014-11-02"); +insert into diaries values(1208, "2014-11-03"); +insert into diaries values(1209, "2014-11-04"); +insert into diaries values(1210, "2014-11-05"); +insert into diaries values(1211, "2014-11-06"); +insert into diaries values(1212, "2014-11-07"); +insert into diaries values(1213, "2014-11-08"); +insert into diaries values(1214, "2014-11-09"); +insert into diaries values(1215, "2014-11-10"); +insert into diaries values(1216, "2014-11-11"); +insert into diaries values(1217, "2014-11-12"); +insert into diaries values(1218, "2014-11-13"); +insert into diaries values(1219, "2014-11-14"); +insert into diaries values(1220, "2014-11-15"); +insert into diaries values(1221, "2014-11-16"); +insert into diaries values(1222, "2014-11-17"); +insert into diaries values(1223, "2014-11-18"); +insert into diaries values(1224, "2014-11-19"); +insert into diaries values(1225, "2014-11-20"); +insert into diaries values(1226, "2014-11-21"); +insert into diaries values(1227, "2014-11-22"); +insert into diaries values(1228, "2014-11-23"); +insert into diaries values(1229, "2014-11-24"); +insert into diaries values(1230, "2014-11-25"); +insert into diaries values(1231, "2014-11-26"); +insert into diaries values(1232, "2014-11-27"); +insert into diaries values(1233, "2014-11-28"); +insert into diaries values(1234, "2014-11-29"); +insert into diaries values(1235, "2014-11-30"); +insert into diaries values(1236, "2014-12-01"); +insert into diaries values(1237, "2014-12-02"); +insert into diaries values(1238, "2014-12-03"); +insert into diaries values(1239, "2014-12-04"); +insert into diaries values(1240, "2014-12-05"); +insert into diaries values(1241, "2014-12-06"); +insert into diaries values(1242, "2014-12-07"); +insert into diaries values(1243, "2014-12-08"); +insert into diaries values(1244, "2014-12-09"); +insert into diaries values(1245, "2014-12-10"); +insert into diaries values(1246, "2014-12-11"); +insert into diaries values(1247, "2014-12-12"); +insert into diaries values(1248, "2014-12-13"); +insert into diaries values(1249, "2014-12-14"); +insert into diaries values(1250, "2014-12-15"); +insert into diaries values(1251, "2014-12-16"); +insert into diaries values(1252, "2014-12-17"); +insert into diaries values(1253, "2014-12-18"); +insert into diaries values(1254, "2014-12-19"); +insert into diaries values(1255, "2014-12-20"); +insert into diaries values(1256, "2014-12-21"); +insert into diaries values(1257, "2014-12-22"); +insert into diaries values(1258, "2014-12-23"); +insert into diaries values(1259, "2014-12-24"); +insert into diaries values(1260, "2014-12-25"); +insert into diaries values(1261, "2014-12-26"); +insert into diaries values(1262, "2014-12-27"); +insert into diaries values(1263, "2014-12-28"); +insert into diaries values(1264, "2014-12-29"); +insert into diaries values(1265, "2014-12-30"); +insert into diaries values(1266, "2014-12-31"); +insert into diaries values(1267, "2015-01-01"); +insert into diaries values(1268, "2015-01-02"); +insert into diaries values(1269, "2015-01-03"); +insert into diaries values(1270, "2015-01-04"); +insert into diaries values(1271, "2015-01-05"); +insert into diaries values(1272, "2015-01-06"); +insert into diaries values(1273, "2015-01-07"); +insert into diaries values(1274, "2015-01-08"); +insert into diaries values(1275, "2015-01-09"); +insert into diaries values(1276, "2015-01-10"); +insert into diaries values(1277, "2015-01-11"); +insert into diaries values(1278, "2015-01-12"); +insert into diaries values(1279, "2015-01-13"); +insert into diaries values(1280, "2015-01-14"); +insert into diaries values(1281, "2015-01-15"); +insert into diaries values(1282, "2015-01-16"); +insert into diaries values(1283, "2015-01-17"); +insert into diaries values(1284, "2015-01-18"); +insert into diaries values(1285, "2015-01-19"); +insert into diaries values(1286, "2015-01-20"); +insert into diaries values(1287, "2015-01-21"); +insert into diaries values(1288, "2015-01-22"); +insert into diaries values(1289, "2015-01-23"); +insert into diaries values(1290, "2015-01-24"); +insert into diaries values(1291, "2015-01-25"); +insert into diaries values(1292, "2015-01-26"); +insert into diaries values(1293, "2015-01-27"); +insert into diaries values(1294, "2015-01-28"); +insert into diaries values(1295, "2015-01-29"); +insert into diaries values(1296, "2015-01-30"); +insert into diaries values(1297, "2015-01-31"); +insert into diaries values(1298, "2015-02-01"); +insert into diaries values(1299, "2015-02-02"); +insert into diaries values(1300, "2015-02-03"); +insert into diaries values(1301, "2015-02-04"); +insert into diaries values(1302, "2015-02-05"); +insert into diaries values(1303, "2015-02-06"); +insert into diaries values(1304, "2015-02-07"); +insert into diaries values(1305, "2015-02-08"); +insert into diaries values(1306, "2015-02-09"); +insert into diaries values(1307, "2015-02-10"); +insert into diaries values(1308, "2015-02-11"); +insert into diaries values(1309, "2015-02-12"); +insert into diaries values(1310, "2015-02-13"); +insert into diaries values(1311, "2015-02-14"); +insert into diaries values(1312, "2015-02-15"); +insert into diaries values(1313, "2015-02-16"); +insert into diaries values(1314, "2015-02-17"); +insert into diaries values(1315, "2015-02-18"); +insert into diaries values(1316, "2015-02-19"); +insert into diaries values(1317, "2015-02-20"); +insert into diaries values(1318, "2015-02-21"); +insert into diaries values(1319, "2015-02-22"); +insert into diaries values(1320, "2015-02-23"); +insert into diaries values(1321, "2015-02-24"); +insert into diaries values(1322, "2015-02-25"); +insert into diaries values(1323, "2015-02-26"); +insert into diaries values(1324, "2015-02-27"); +insert into diaries values(1325, "2015-02-28"); +insert into diaries values(1326, "2015-03-01"); +insert into diaries values(1327, "2015-03-02"); +insert into diaries values(1328, "2015-03-03"); +insert into diaries values(1329, "2015-03-04"); +insert into diaries values(1330, "2015-03-05"); +insert into diaries values(1331, "2015-03-06"); +insert into diaries values(1332, "2015-03-07"); +insert into diaries values(1333, "2015-03-08"); +insert into diaries values(1334, "2015-03-09"); +insert into diaries values(1335, "2015-03-10"); +insert into diaries values(1336, "2015-03-11"); +insert into diaries values(1337, "2015-03-12"); +insert into diaries values(1338, "2015-03-13"); +insert into diaries values(1339, "2015-03-14"); +insert into diaries values(1340, "2015-03-15"); +insert into diaries values(1341, "2015-03-16"); +insert into diaries values(1342, "2015-03-17"); +insert into diaries values(1343, "2015-03-18"); +insert into diaries values(1344, "2015-03-19"); +insert into diaries values(1345, "2015-03-20"); +insert into diaries values(1346, "2015-03-21"); +insert into diaries values(1347, "2015-03-22"); +insert into diaries values(1348, "2015-03-23"); +insert into diaries values(1349, "2015-03-24"); +insert into diaries values(1350, "2015-03-25"); +insert into diaries values(1351, "2015-03-26"); +insert into diaries values(1352, "2015-03-27"); +insert into diaries values(1353, "2015-03-28"); +insert into diaries values(1354, "2015-03-29"); +insert into diaries values(1355, "2015-03-30"); +insert into diaries values(1356, "2015-03-31"); +insert into diaries values(1357, "2015-04-01"); +insert into diaries values(1358, "2015-04-02"); +insert into diaries values(1359, "2015-04-03"); +insert into diaries values(1360, "2015-04-04"); +insert into diaries values(1361, "2015-04-05"); +insert into diaries values(1362, "2015-04-06"); +insert into diaries values(1363, "2015-04-07"); +insert into diaries values(1364, "2015-04-08"); +insert into diaries values(1365, "2015-04-09"); +insert into diaries values(1366, "2015-04-10"); +insert into diaries values(1367, "2015-04-11"); +insert into diaries values(1368, "2015-04-12"); +insert into diaries values(1369, "2015-04-13"); +insert into diaries values(1370, "2015-04-14"); +insert into diaries values(1371, "2015-04-15"); +insert into diaries values(1372, "2015-04-16"); +insert into diaries values(1373, "2015-04-17"); +insert into diaries values(1374, "2015-04-18"); +insert into diaries values(1375, "2015-04-19"); +insert into diaries values(1376, "2015-04-20"); +insert into diaries values(1377, "2015-04-21"); +insert into diaries values(1378, "2015-04-22"); +insert into diaries values(1379, "2015-04-23"); +insert into diaries values(1380, "2015-04-24"); +insert into diaries values(1381, "2015-04-25"); +insert into diaries values(1382, "2015-04-26"); +insert into diaries values(1383, "2015-04-27"); +insert into diaries values(1384, "2015-04-28"); +insert into diaries values(1385, "2015-04-29"); +insert into diaries values(1386, "2015-04-30"); +insert into diaries values(1387, "2015-05-01"); +insert into diaries values(1388, "2015-05-02"); +insert into diaries values(1389, "2015-05-03"); +insert into diaries values(1390, "2015-05-04"); +insert into diaries values(1391, "2015-05-05"); +insert into diaries values(1392, "2015-05-06"); +insert into diaries values(1393, "2015-05-07"); +insert into diaries values(1394, "2015-05-08"); +insert into diaries values(1395, "2015-05-09"); +insert into diaries values(1396, "2015-05-10"); +insert into diaries values(1397, "2015-05-11"); +insert into diaries values(1398, "2015-05-12"); +insert into diaries values(1399, "2015-05-13"); +insert into diaries values(1400, "2015-05-14"); +insert into diaries values(1401, "2015-05-15"); +insert into diaries values(1402, "2015-05-16"); +insert into diaries values(1403, "2015-05-17"); +insert into diaries values(1404, "2015-05-18"); +insert into diaries values(1405, "2015-05-19"); +insert into diaries values(1406, "2015-05-20"); +insert into diaries values(1407, "2015-05-21"); +insert into diaries values(1408, "2015-05-22"); +insert into diaries values(1409, "2015-05-23"); +insert into diaries values(1410, "2015-05-24"); +insert into diaries values(1411, "2015-05-25"); +insert into diaries values(1412, "2015-05-26"); +insert into diaries values(1413, "2015-05-27"); +insert into diaries values(1414, "2015-05-28"); +insert into diaries values(1415, "2015-05-29"); +insert into diaries values(1416, "2015-05-30"); +insert into diaries values(1417, "2015-05-31"); +insert into diaries values(1418, "2015-06-01"); +insert into diaries values(1419, "2015-06-02"); +insert into diaries values(1420, "2015-06-03"); +insert into diaries values(1421, "2015-06-04"); +insert into diaries values(1422, "2015-06-05"); +insert into diaries values(1423, "2015-06-06"); +insert into diaries values(1424, "2015-06-07"); +insert into diaries values(1425, "2015-06-08"); +insert into diaries values(1426, "2015-06-09"); +insert into diaries values(1427, "2015-06-10"); +insert into diaries values(1428, "2015-06-11"); +insert into diaries values(1429, "2015-06-12"); +insert into diaries values(1430, "2015-06-13"); +insert into diaries values(1431, "2015-06-14"); +insert into diaries values(1432, "2015-06-15"); +insert into diaries values(1433, "2015-06-16"); +insert into diaries values(1434, "2015-06-17"); +insert into diaries values(1435, "2015-06-18"); +insert into diaries values(1436, "2015-06-19"); +insert into diaries values(1437, "2015-06-20"); +insert into diaries values(1438, "2015-06-21"); +insert into diaries values(1439, "2015-06-22"); +insert into diaries values(1440, "2015-06-23"); +insert into diaries values(1441, "2015-06-24"); +insert into diaries values(1442, "2015-06-25"); +insert into diaries values(1443, "2015-06-26"); +insert into diaries values(1444, "2015-06-27"); +insert into diaries values(1445, "2015-06-28"); +insert into diaries values(1446, "2015-06-29"); +insert into diaries values(1447, "2015-06-30"); +insert into diaries values(1448, "2015-07-01"); +insert into diaries values(1449, "2015-07-02"); +insert into diaries values(1450, "2015-07-03"); +insert into diaries values(1451, "2015-07-04"); +insert into diaries values(1452, "2015-07-05"); +insert into diaries values(1453, "2015-07-06"); +insert into diaries values(1454, "2015-07-07"); +insert into diaries values(1455, "2015-07-08"); +insert into diaries values(1456, "2015-07-09"); +insert into diaries values(1457, "2015-07-10"); +insert into diaries values(1458, "2015-07-11"); +insert into diaries values(1459, "2015-07-12"); +insert into diaries values(1460, "2015-07-13"); +insert into diaries values(1461, "2015-07-14"); +insert into diaries values(1462, "2015-07-15"); +insert into diaries values(1463, "2015-07-16"); +insert into diaries values(1464, "2015-07-17"); +insert into diaries values(1465, "2015-07-18"); +insert into diaries values(1466, "2015-07-19"); +insert into diaries values(1467, "2015-07-20"); +insert into diaries values(1468, "2015-07-21"); +insert into diaries values(1469, "2015-07-22"); +insert into diaries values(1470, "2015-07-23"); +insert into diaries values(1471, "2015-07-24"); +insert into diaries values(1472, "2015-07-25"); +insert into diaries values(1473, "2015-07-26"); +insert into diaries values(1474, "2015-07-27"); +insert into diaries values(1475, "2015-07-28"); +insert into diaries values(1476, "2015-07-29"); +insert into diaries values(1477, "2015-07-30"); +insert into diaries values(1478, "2015-07-31"); +insert into diaries values(1479, "2015-08-01"); +insert into diaries values(1480, "2015-08-02"); +insert into diaries values(1481, "2015-08-03"); +insert into diaries values(1482, "2015-08-04"); +insert into diaries values(1483, "2015-08-05"); +insert into diaries values(1484, "2015-08-06"); +insert into diaries values(1485, "2015-08-07"); +insert into diaries values(1486, "2015-08-08"); +insert into diaries values(1487, "2015-08-09"); +insert into diaries values(1488, "2015-08-10"); +insert into diaries values(1489, "2015-08-11"); +insert into diaries values(1490, "2015-08-12"); +insert into diaries values(1491, "2015-08-13"); +insert into diaries values(1492, "2015-08-14"); +insert into diaries values(1493, "2015-08-15"); +insert into diaries values(1494, "2015-08-16"); +insert into diaries values(1495, "2015-08-17"); +insert into diaries values(1496, "2015-08-18"); +insert into diaries values(1497, "2015-08-19"); +insert into diaries values(1498, "2015-08-20"); +insert into diaries values(1499, "2015-08-21"); +insert into diaries values(1500, "2015-08-22"); +insert into diaries values(1501, "2015-08-23"); +insert into diaries values(1502, "2015-08-24"); +insert into diaries values(1503, "2015-08-25"); +insert into diaries values(1504, "2015-08-26"); +insert into diaries values(1505, "2015-08-27"); +insert into diaries values(1506, "2015-08-28"); +insert into diaries values(1507, "2015-08-29"); +insert into diaries values(1508, "2015-08-30"); +insert into diaries values(1509, "2015-08-31"); +insert into diaries values(1510, "2015-09-01"); +insert into diaries values(1511, "2015-09-02"); +insert into diaries values(1512, "2015-09-03"); +insert into diaries values(1513, "2015-09-04"); +insert into diaries values(1514, "2015-09-05"); +insert into diaries values(1515, "2015-09-06"); +insert into diaries values(1516, "2015-09-07"); +insert into diaries values(1517, "2015-09-08"); +insert into diaries values(1518, "2015-09-09"); +insert into diaries values(1519, "2015-09-10"); +insert into diaries values(1520, "2015-09-11"); +insert into diaries values(1521, "2015-09-12"); +insert into diaries values(1522, "2015-09-13"); +insert into diaries values(1523, "2015-09-14"); +insert into diaries values(1524, "2015-09-15"); +insert into diaries values(1525, "2015-09-16"); +insert into diaries values(1526, "2015-09-17"); +insert into diaries values(1527, "2015-09-18"); +insert into diaries values(1528, "2015-09-19"); +insert into diaries values(1529, "2015-09-20"); +insert into diaries values(1530, "2015-09-21"); +insert into diaries values(1531, "2015-09-22"); +insert into diaries values(1532, "2015-09-23"); +insert into diaries values(1533, "2015-09-24"); +insert into diaries values(1534, "2015-09-25"); +insert into diaries values(1535, "2015-09-26"); +insert into diaries values(1536, "2015-09-27"); +insert into diaries values(1537, "2015-09-28"); +insert into diaries values(1538, "2015-09-29"); +insert into diaries values(1539, "2015-09-30"); +insert into diaries values(1540, "2015-10-01"); +insert into diaries values(1541, "2015-10-02"); +insert into diaries values(1542, "2015-10-03"); +insert into diaries values(1543, "2015-10-04"); +insert into diaries values(1544, "2015-10-05"); +insert into diaries values(1545, "2015-10-06"); +insert into diaries values(1546, "2015-10-07"); +insert into diaries values(1547, "2015-10-08"); +insert into diaries values(1548, "2015-10-09"); +insert into diaries values(1549, "2015-10-10"); +insert into diaries values(1550, "2015-10-11"); +insert into diaries values(1551, "2015-10-12"); +insert into diaries values(1552, "2015-10-13"); +insert into diaries values(1553, "2015-10-14"); +insert into diaries values(1554, "2015-10-15"); +insert into diaries values(1555, "2015-10-16"); +insert into diaries values(1556, "2015-10-17"); +insert into diaries values(1557, "2015-10-18"); +insert into diaries values(1558, "2015-10-19"); +insert into diaries values(1559, "2015-10-20"); +insert into diaries values(1560, "2015-10-21"); +insert into diaries values(1561, "2015-10-22"); +insert into diaries values(1562, "2015-10-23"); +insert into diaries values(1563, "2015-10-24"); +insert into diaries values(1564, "2015-10-25"); +insert into diaries values(1565, "2015-10-26"); +insert into diaries values(1566, "2015-10-27"); +insert into diaries values(1567, "2015-10-28"); +insert into diaries values(1568, "2015-10-29"); +insert into diaries values(1569, "2015-10-30"); +insert into diaries values(1570, "2015-10-31"); +insert into diaries values(1571, "2015-11-01"); +insert into diaries values(1572, "2015-11-02"); +insert into diaries values(1573, "2015-11-03"); +insert into diaries values(1574, "2015-11-04"); +insert into diaries values(1575, "2015-11-05"); +insert into diaries values(1576, "2015-11-06"); +insert into diaries values(1577, "2015-11-07"); +insert into diaries values(1578, "2015-11-08"); +insert into diaries values(1579, "2015-11-09"); +insert into diaries values(1580, "2015-11-10"); +insert into diaries values(1581, "2015-11-11"); +insert into diaries values(1582, "2015-11-12"); +insert into diaries values(1583, "2015-11-13"); +insert into diaries values(1584, "2015-11-14"); +insert into diaries values(1585, "2015-11-15"); +insert into diaries values(1586, "2015-11-16"); +insert into diaries values(1587, "2015-11-17"); +insert into diaries values(1588, "2015-11-18"); +insert into diaries values(1589, "2015-11-19"); +insert into diaries values(1590, "2015-11-20"); +insert into diaries values(1591, "2015-11-21"); +insert into diaries values(1592, "2015-11-22"); +insert into diaries values(1593, "2015-11-23"); +insert into diaries values(1594, "2015-11-24"); +insert into diaries values(1595, "2015-11-25"); +insert into diaries values(1596, "2015-11-26"); +insert into diaries values(1597, "2015-11-27"); +insert into diaries values(1598, "2015-11-28"); +insert into diaries values(1599, "2015-11-29"); +insert into diaries values(1600, "2015-11-30"); +insert into diaries values(1601, "2015-12-01"); +insert into diaries values(1602, "2015-12-02"); +insert into diaries values(1603, "2015-12-03"); +insert into diaries values(1604, "2015-12-04"); +insert into diaries values(1605, "2015-12-05"); +insert into diaries values(1606, "2015-12-06"); +insert into diaries values(1607, "2015-12-07"); +insert into diaries values(1608, "2015-12-08"); +insert into diaries values(1609, "2015-12-09"); +insert into diaries values(1610, "2015-12-10"); +insert into diaries values(1611, "2015-12-11"); +insert into diaries values(1612, "2015-12-12"); +insert into diaries values(1613, "2015-12-13"); +insert into diaries values(1614, "2015-12-14"); +insert into diaries values(1615, "2015-12-15"); +insert into diaries values(1616, "2015-12-16"); +insert into diaries values(1617, "2015-12-17"); +insert into diaries values(1618, "2015-12-18"); +insert into diaries values(1619, "2015-12-19"); +insert into diaries values(1620, "2015-12-20"); +insert into diaries values(1621, "2015-12-21"); +insert into diaries values(1622, "2015-12-22"); +insert into diaries values(1623, "2015-12-23"); +insert into diaries values(1624, "2015-12-24"); +insert into diaries values(1625, "2015-12-25"); +insert into diaries values(1626, "2015-12-26"); +insert into diaries values(1627, "2015-12-27"); +insert into diaries values(1628, "2015-12-28"); +insert into diaries values(1629, "2015-12-29"); +insert into diaries values(1630, "2015-12-30"); +insert into diaries values(1631, "2015-12-31"); +insert into diaries values(1632, "2016-01-01"); +insert into diaries values(1633, "2016-01-02"); +insert into diaries values(1634, "2016-01-03"); +insert into diaries values(1635, "2016-01-04"); +insert into diaries values(1636, "2016-01-05"); +insert into diaries values(1637, "2016-01-06"); +insert into diaries values(1638, "2016-01-07"); +insert into diaries values(1639, "2016-01-08"); +insert into diaries values(1640, "2016-01-09"); +insert into diaries values(1641, "2016-01-10"); +insert into diaries values(1642, "2016-01-11"); +insert into diaries values(1643, "2016-01-12"); +insert into diaries values(1644, "2016-01-13"); +insert into diaries values(1645, "2016-01-14"); +insert into diaries values(1646, "2016-01-15"); +insert into diaries values(1647, "2016-01-16"); +insert into diaries values(1648, "2016-01-17"); +insert into diaries values(1649, "2016-01-18"); +insert into diaries values(1650, "2016-01-19"); +insert into diaries values(1651, "2016-01-20"); +insert into diaries values(1652, "2016-01-21"); +insert into diaries values(1653, "2016-01-22"); +insert into diaries values(1654, "2016-01-23"); +insert into diaries values(1655, "2016-01-24"); +insert into diaries values(1656, "2016-01-25"); +insert into diaries values(1657, "2016-01-26"); +insert into diaries values(1658, "2016-01-27"); +insert into diaries values(1659, "2016-01-28"); +insert into diaries values(1660, "2016-01-29"); +insert into diaries values(1661, "2016-01-30"); +insert into diaries values(1662, "2016-01-31"); +insert into diaries values(1663, "2016-02-01"); +insert into diaries values(1664, "2016-02-02"); +insert into diaries values(1665, "2016-02-03"); +insert into diaries values(1666, "2016-02-04"); +insert into diaries values(1667, "2016-02-05"); +insert into diaries values(1668, "2016-02-06"); +insert into diaries values(1669, "2016-02-07"); +insert into diaries values(1670, "2016-02-08"); +insert into diaries values(1671, "2016-02-09"); +insert into diaries values(1672, "2016-02-10"); +insert into diaries values(1673, "2016-02-11"); +insert into diaries values(1674, "2016-02-12"); +insert into diaries values(1675, "2016-02-13"); +insert into diaries values(1676, "2016-02-14"); +insert into diaries values(1677, "2016-02-15"); +insert into diaries values(1678, "2016-02-16"); +insert into diaries values(1679, "2016-02-17"); +insert into diaries values(1680, "2016-02-18"); +insert into diaries values(1681, "2016-02-19"); +insert into diaries values(1682, "2016-02-20"); +insert into diaries values(1683, "2016-02-21"); +insert into diaries values(1684, "2016-02-22"); +insert into diaries values(1685, "2016-02-23"); +insert into diaries values(1686, "2016-02-24"); +insert into diaries values(1687, "2016-02-25"); +insert into diaries values(1688, "2016-02-26"); +insert into diaries values(1689, "2016-02-27"); +insert into diaries values(1690, "2016-02-28"); +insert into diaries values(1691, "2016-02-29"); +insert into diaries values(1692, "2016-03-01"); +insert into diaries values(1693, "2016-03-02"); +insert into diaries values(1694, "2016-03-03"); +insert into diaries values(1695, "2016-03-04"); +insert into diaries values(1696, "2016-03-05"); +insert into diaries values(1697, "2016-03-06"); +insert into diaries values(1698, "2016-03-07"); +insert into diaries values(1699, "2016-03-08"); +insert into diaries values(1700, "2016-03-09"); +insert into diaries values(1701, "2016-03-10"); +insert into diaries values(1702, "2016-03-11"); +insert into diaries values(1703, "2016-03-12"); +insert into diaries values(1704, "2016-03-13"); +insert into diaries values(1705, "2016-03-14"); +insert into diaries values(1706, "2016-03-15"); +insert into diaries values(1707, "2016-03-16"); +insert into diaries values(1708, "2016-03-17"); +insert into diaries values(1709, "2016-03-18"); +insert into diaries values(1710, "2016-03-19"); +insert into diaries values(1711, "2016-03-20"); +insert into diaries values(1712, "2016-03-21"); +insert into diaries values(1713, "2016-03-22"); +insert into diaries values(1714, "2016-03-23"); +insert into diaries values(1715, "2016-03-24"); +insert into diaries values(1716, "2016-03-25"); +insert into diaries values(1717, "2016-03-26"); +insert into diaries values(1718, "2016-03-27"); +insert into diaries values(1719, "2016-03-28"); +insert into diaries values(1720, "2016-03-29"); +insert into diaries values(1721, "2016-03-30"); +insert into diaries values(1722, "2016-03-31"); +insert into diaries values(1723, "2016-04-01"); +insert into diaries values(1724, "2016-04-02"); +insert into diaries values(1725, "2016-04-03"); +insert into diaries values(1726, "2016-04-04"); +insert into diaries values(1727, "2016-04-05"); +insert into diaries values(1728, "2016-04-06"); +insert into diaries values(1729, "2016-04-07"); +insert into diaries values(1730, "2016-04-08"); +insert into diaries values(1731, "2016-04-09"); +insert into diaries values(1732, "2016-04-10"); +insert into diaries values(1733, "2016-04-11"); +insert into diaries values(1734, "2016-04-12"); +insert into diaries values(1735, "2016-04-13"); +insert into diaries values(1736, "2016-04-14"); +insert into diaries values(1737, "2016-04-15"); +insert into diaries values(1738, "2016-04-16"); +insert into diaries values(1739, "2016-04-17"); +insert into diaries values(1740, "2016-04-18"); +insert into diaries values(1741, "2016-04-19"); +insert into diaries values(1742, "2016-04-20"); +insert into diaries values(1743, "2016-04-21"); +insert into diaries values(1744, "2016-04-22"); +insert into diaries values(1745, "2016-04-23"); +insert into diaries values(1746, "2016-04-24"); +insert into diaries values(1747, "2016-04-25"); +insert into diaries values(1748, "2016-04-26"); +insert into diaries values(1749, "2016-04-27"); +insert into diaries values(1750, "2016-04-28"); +insert into diaries values(1751, "2016-04-29"); +insert into diaries values(1752, "2016-04-30"); +insert into diaries values(1753, "2016-05-01"); +insert into diaries values(1754, "2016-05-02"); +insert into diaries values(1755, "2016-05-03"); +insert into diaries values(1756, "2016-05-04"); +insert into diaries values(1757, "2016-05-05"); +insert into diaries values(1758, "2016-05-06"); +insert into diaries values(1759, "2016-05-07"); +insert into diaries values(1760, "2016-05-08"); +insert into diaries values(1761, "2016-05-09"); +insert into diaries values(1762, "2016-05-10"); +insert into diaries values(1763, "2016-05-11"); +insert into diaries values(1764, "2016-05-12"); +insert into diaries values(1765, "2016-05-13"); +insert into diaries values(1766, "2016-05-14"); +insert into diaries values(1767, "2016-05-15"); +insert into diaries values(1768, "2016-05-16"); +insert into diaries values(1769, "2016-05-17"); +insert into diaries values(1770, "2016-05-18"); +insert into diaries values(1771, "2016-05-19"); +insert into diaries values(1772, "2016-05-20"); +insert into diaries values(1773, "2016-05-21"); +insert into diaries values(1774, "2016-05-22"); +insert into diaries values(1775, "2016-05-23"); +insert into diaries values(1776, "2016-05-24"); +insert into diaries values(1777, "2016-05-25"); +insert into diaries values(1778, "2016-05-26"); +insert into diaries values(1779, "2016-05-27"); +insert into diaries values(1780, "2016-05-28"); +insert into diaries values(1781, "2016-05-29"); +insert into diaries values(1782, "2016-05-30"); +insert into diaries values(1783, "2016-05-31"); +insert into diaries values(1784, "2016-06-01"); +insert into diaries values(1785, "2016-06-02"); +insert into diaries values(1786, "2016-06-03"); +insert into diaries values(1787, "2016-06-04"); +insert into diaries values(1788, "2016-06-05"); +insert into diaries values(1789, "2016-06-06"); +insert into diaries values(1790, "2016-06-07"); +insert into diaries values(1791, "2016-06-08"); +insert into diaries values(1792, "2016-06-09"); +insert into diaries values(1793, "2016-06-10"); +insert into diaries values(1794, "2016-06-11"); +insert into diaries values(1795, "2016-06-12"); +insert into diaries values(1796, "2016-06-13"); +insert into diaries values(1797, "2016-06-14"); +insert into diaries values(1798, "2016-06-15"); +insert into diaries values(1799, "2016-06-16"); +insert into diaries values(1800, "2016-06-17"); +insert into diaries values(1801, "2016-06-18"); +insert into diaries values(1802, "2016-06-19"); +insert into diaries values(1803, "2016-06-20"); +insert into diaries values(1804, "2016-06-21"); +insert into diaries values(1805, "2016-06-22"); +insert into diaries values(1806, "2016-06-23"); +insert into diaries values(1807, "2016-06-24"); +insert into diaries values(1808, "2016-06-25"); +insert into diaries values(1809, "2016-06-26"); +insert into diaries values(1810, "2016-06-27"); +insert into diaries values(1811, "2016-06-28"); +insert into diaries values(1812, "2016-06-29"); +insert into diaries values(1813, "2016-06-30"); +insert into diaries values(1814, "2016-07-01"); +insert into diaries values(1815, "2016-07-02"); +insert into diaries values(1816, "2016-07-03"); +insert into diaries values(1817, "2016-07-04"); +insert into diaries values(1818, "2016-07-05"); +insert into diaries values(1819, "2016-07-06"); +insert into diaries values(1820, "2016-07-07"); +insert into diaries values(1821, "2016-07-08"); +insert into diaries values(1822, "2016-07-09"); +insert into diaries values(1823, "2016-07-10"); +insert into diaries values(1824, "2016-07-11"); +insert into diaries values(1825, "2016-07-12"); +insert into diaries values(1826, "2016-07-13"); +insert into diaries values(1827, "2016-07-14"); +insert into diaries values(1828, "2016-07-15"); +insert into diaries values(1829, "2016-07-16"); +insert into diaries values(1830, "2016-07-17"); +insert into diaries values(1831, "2016-07-18"); +insert into diaries values(1832, "2016-07-19"); +insert into diaries values(1833, "2016-07-20"); +insert into diaries values(1834, "2016-07-21"); +insert into diaries values(1835, "2016-07-22"); +insert into diaries values(1836, "2016-07-23"); +insert into diaries values(1837, "2016-07-24"); +insert into diaries values(1838, "2016-07-25"); +insert into diaries values(1839, "2016-07-26"); +insert into diaries values(1840, "2016-07-27"); +insert into diaries values(1841, "2016-07-28"); +insert into diaries values(1842, "2016-07-29"); +insert into diaries values(1843, "2016-07-30"); +insert into diaries values(1844, "2016-07-31"); +insert into diaries values(1845, "2016-08-01"); +insert into diaries values(1846, "2016-08-02"); +insert into diaries values(1847, "2016-08-03"); +insert into diaries values(1848, "2016-08-04"); +insert into diaries values(1849, "2016-08-05"); +insert into diaries values(1850, "2016-08-06"); +insert into diaries values(1851, "2016-08-07"); +insert into diaries values(1852, "2016-08-08"); +insert into diaries values(1853, "2016-08-09"); +insert into diaries values(1854, "2016-08-10"); +insert into diaries values(1855, "2016-08-11"); +insert into diaries values(1856, "2016-08-12"); +insert into diaries values(1857, "2016-08-13"); +insert into diaries values(1858, "2016-08-14"); +insert into diaries values(1859, "2016-08-15"); +insert into diaries values(1860, "2016-08-16"); +insert into diaries values(1861, "2016-08-17"); +insert into diaries values(1862, "2016-08-18"); +insert into diaries values(1863, "2016-08-19"); +insert into diaries values(1864, "2016-08-20"); +insert into diaries values(1865, "2016-08-21"); +insert into diaries values(1866, "2016-08-22"); +insert into diaries values(1867, "2016-08-23"); +insert into diaries values(1868, "2016-08-24"); +insert into diaries values(1869, "2016-08-25"); +insert into diaries values(1870, "2016-08-26"); +insert into diaries values(1871, "2016-08-27"); +insert into diaries values(1872, "2016-08-28"); +insert into diaries values(1873, "2016-08-29"); +insert into diaries values(1874, "2016-08-30"); +insert into diaries values(1875, "2016-08-31"); +insert into diaries values(1876, "2016-09-01"); +insert into diaries values(1877, "2016-09-02"); +insert into diaries values(1878, "2016-09-03"); +insert into diaries values(1879, "2016-09-04"); +insert into diaries values(1880, "2016-09-05"); +insert into diaries values(1881, "2016-09-06"); +insert into diaries values(1882, "2016-09-07"); +insert into diaries values(1883, "2016-09-08"); +insert into diaries values(1884, "2016-09-09"); +insert into diaries values(1885, "2016-09-10"); +insert into diaries values(1886, "2016-09-11"); +insert into diaries values(1887, "2016-09-12"); +insert into diaries values(1888, "2016-09-13"); +insert into diaries values(1889, "2016-09-14"); +insert into diaries values(1890, "2016-09-15"); +insert into diaries values(1891, "2016-09-16"); +insert into diaries values(1892, "2016-09-17"); +insert into diaries values(1893, "2016-09-18"); +insert into diaries values(1894, "2016-09-19"); +insert into diaries values(1895, "2016-09-20"); +insert into diaries values(1896, "2016-09-21"); +insert into diaries values(1897, "2016-09-22"); +insert into diaries values(1898, "2016-09-23"); +insert into diaries values(1899, "2016-09-24"); +insert into diaries values(1900, "2016-09-25"); +insert into diaries values(1901, "2016-09-26"); +insert into diaries values(1902, "2016-09-27"); +insert into diaries values(1903, "2016-09-28"); +insert into diaries values(1904, "2016-09-29"); +insert into diaries values(1905, "2016-09-30"); +insert into diaries values(1906, "2016-10-01"); +insert into diaries values(1907, "2016-10-02"); +insert into diaries values(1908, "2016-10-03"); +insert into diaries values(1909, "2016-10-04"); +insert into diaries values(1910, "2016-10-05"); +insert into diaries values(1911, "2016-10-06"); +insert into diaries values(1912, "2016-10-07"); +insert into diaries values(1913, "2016-10-08"); +insert into diaries values(1914, "2016-10-09"); +insert into diaries values(1915, "2016-10-10"); +insert into diaries values(1916, "2016-10-11"); +insert into diaries values(1917, "2016-10-12"); +insert into diaries values(1918, "2016-10-13"); +insert into diaries values(1919, "2016-10-14"); +insert into diaries values(1920, "2016-10-15"); +insert into diaries values(1921, "2016-10-16"); +insert into diaries values(1922, "2016-10-17"); +insert into diaries values(1923, "2016-10-18"); +insert into diaries values(1924, "2016-10-19"); +insert into diaries values(1925, "2016-10-20"); +insert into diaries values(1926, "2016-10-21"); +insert into diaries values(1927, "2016-10-22"); +insert into diaries values(1928, "2016-10-23"); +insert into diaries values(1929, "2016-10-24"); +insert into diaries values(1930, "2016-10-25"); +insert into diaries values(1931, "2016-10-26"); +insert into diaries values(1932, "2016-10-27"); +insert into diaries values(1933, "2016-10-28"); +insert into diaries values(1934, "2016-10-29"); +insert into diaries values(1935, "2016-10-30"); +insert into diaries values(1936, "2016-10-31"); +insert into diaries values(1937, "2016-11-01"); +insert into diaries values(1938, "2016-11-02"); +insert into diaries values(1939, "2016-11-03"); +insert into diaries values(1940, "2016-11-04"); +insert into diaries values(1941, "2016-11-05"); +insert into diaries values(1942, "2016-11-06"); +insert into diaries values(1943, "2016-11-07"); +insert into diaries values(1944, "2016-11-08"); +insert into diaries values(1945, "2016-11-09"); +insert into diaries values(1946, "2016-11-10"); +insert into diaries values(1947, "2016-11-11"); +insert into diaries values(1948, "2016-11-12"); +insert into diaries values(1949, "2016-11-13"); +insert into diaries values(1950, "2016-11-14"); +insert into diaries values(1951, "2016-11-15"); +insert into diaries values(1952, "2016-11-16"); +insert into diaries values(1953, "2016-11-17"); +insert into diaries values(1954, "2016-11-18"); +insert into diaries values(1955, "2016-11-19"); +insert into diaries values(1956, "2016-11-20"); +insert into diaries values(1957, "2016-11-21"); +insert into diaries values(1958, "2016-11-22"); +insert into diaries values(1959, "2016-11-23"); +insert into diaries values(1960, "2016-11-24"); +insert into diaries values(1961, "2016-11-25"); +insert into diaries values(1962, "2016-11-26"); +insert into diaries values(1963, "2016-11-27"); +insert into diaries values(1964, "2016-11-28"); +insert into diaries values(1965, "2016-11-29"); +insert into diaries values(1966, "2016-11-30"); +insert into diaries values(1967, "2016-12-01"); +insert into diaries values(1968, "2016-12-02"); +insert into diaries values(1969, "2016-12-03"); +insert into diaries values(1970, "2016-12-04"); +insert into diaries values(1971, "2016-12-05"); +insert into diaries values(1972, "2016-12-06"); +insert into diaries values(1973, "2016-12-07"); +insert into diaries values(1974, "2016-12-08"); +insert into diaries values(1975, "2016-12-09"); +insert into diaries values(1976, "2016-12-10"); +insert into diaries values(1977, "2016-12-11"); +insert into diaries values(1978, "2016-12-12"); +insert into diaries values(1979, "2016-12-13"); +insert into diaries values(1980, "2016-12-14"); +insert into diaries values(1981, "2016-12-15"); +insert into diaries values(1982, "2016-12-16"); +insert into diaries values(1983, "2016-12-17"); +insert into diaries values(1984, "2016-12-18"); +insert into diaries values(1985, "2016-12-19"); +insert into diaries values(1986, "2016-12-20"); +insert into diaries values(1987, "2016-12-21"); +insert into diaries values(1988, "2016-12-22"); +insert into diaries values(1989, "2016-12-23"); +insert into diaries values(1990, "2016-12-24"); +insert into diaries values(1991, "2016-12-25"); +insert into diaries values(1992, "2016-12-26"); +insert into diaries values(1993, "2016-12-27"); +insert into diaries values(1994, "2016-12-28"); +insert into diaries values(1995, "2016-12-29"); +insert into diaries values(1996, "2016-12-30"); +insert into diaries values(1997, "2016-12-31"); +insert into diaries values(1998, "2017-01-01"); +insert into diaries values(1999, "2017-01-02"); +insert into diaries values(2000, "2017-01-03"); +insert into diaries values(2001, "2017-01-04"); +insert into diaries values(2002, "2017-01-05"); +insert into diaries values(2003, "2017-01-06"); +insert into diaries values(2004, "2017-01-07"); +insert into diaries values(2005, "2017-01-08"); +insert into diaries values(2006, "2017-01-09"); +insert into diaries values(2007, "2017-01-10"); +insert into diaries values(2008, "2017-01-11"); +insert into diaries values(2009, "2017-01-12"); +insert into diaries values(2010, "2017-01-13"); +insert into diaries values(2011, "2017-01-14"); +insert into diaries values(2012, "2017-01-15"); +insert into diaries values(2013, "2017-01-16"); +insert into diaries values(2014, "2017-01-17"); +insert into diaries values(2015, "2017-01-18"); +insert into diaries values(2016, "2017-01-19"); +insert into diaries values(2017, "2017-01-20"); +insert into diaries values(2018, "2017-01-21"); +insert into diaries values(2019, "2017-01-22"); +insert into diaries values(2020, "2017-01-23"); +insert into diaries values(2021, "2017-01-24"); +insert into diaries values(2022, "2017-01-25"); +insert into diaries values(2023, "2017-01-26"); +insert into diaries values(2024, "2017-01-27"); +insert into diaries values(2025, "2017-01-28"); +insert into diaries values(2026, "2017-01-29"); +insert into diaries values(2027, "2017-01-30"); +insert into diaries values(2028, "2017-01-31"); +insert into diaries values(2029, "2017-02-01"); +insert into diaries values(2030, "2017-02-02"); +insert into diaries values(2031, "2017-02-03"); +insert into diaries values(2032, "2017-02-04"); +insert into diaries values(2033, "2017-02-05"); +insert into diaries values(2034, "2017-02-06"); +insert into diaries values(2035, "2017-02-07"); +insert into diaries values(2036, "2017-02-08"); +insert into diaries values(2037, "2017-02-09"); +insert into diaries values(2038, "2017-02-10"); +insert into diaries values(2039, "2017-02-11"); +insert into diaries values(2040, "2017-02-12"); +insert into diaries values(2041, "2017-02-13"); +insert into diaries values(2042, "2017-02-14"); +insert into diaries values(2043, "2017-02-15"); +insert into diaries values(2044, "2017-02-16"); +insert into diaries values(2045, "2017-02-17"); +insert into diaries values(2046, "2017-02-18"); +insert into diaries values(2047, "2017-02-19"); +insert into diaries values(2048, "2017-02-20"); +insert into diaries values(2049, "2017-02-21"); +insert into diaries values(2050, "2017-02-22"); +insert into diaries values(2051, "2017-02-23"); +insert into diaries values(2052, "2017-02-24"); +insert into diaries values(2053, "2017-02-25"); +insert into diaries values(2054, "2017-02-26"); +insert into diaries values(2055, "2017-02-27"); +insert into diaries values(2056, "2017-02-28"); +insert into diaries values(2057, "2017-03-01"); +insert into diaries values(2058, "2017-03-02"); +insert into diaries values(2059, "2017-03-03"); +insert into diaries values(2060, "2017-03-04"); +insert into diaries values(2061, "2017-03-05"); +insert into diaries values(2062, "2017-03-06"); +insert into diaries values(2063, "2017-03-07"); +insert into diaries values(2064, "2017-03-08"); +insert into diaries values(2065, "2017-03-09"); +insert into diaries values(2066, "2017-03-10"); +insert into diaries values(2067, "2017-03-11"); +insert into diaries values(2068, "2017-03-12"); +insert into diaries values(2069, "2017-03-13"); +insert into diaries values(2070, "2017-03-14"); +insert into diaries values(2071, "2017-03-15"); +insert into diaries values(2072, "2017-03-16"); +insert into diaries values(2073, "2017-03-17"); +insert into diaries values(2074, "2017-03-18"); +insert into diaries values(2075, "2017-03-19"); +insert into diaries values(2076, "2017-03-20"); +insert into diaries values(2077, "2017-03-21"); +insert into diaries values(2078, "2017-03-22"); +insert into diaries values(2079, "2017-03-23"); +insert into diaries values(2080, "2017-03-24"); +insert into diaries values(2081, "2017-03-25"); +insert into diaries values(2082, "2017-03-26"); +insert into diaries values(2083, "2017-03-27"); +insert into diaries values(2084, "2017-03-28"); +insert into diaries values(2085, "2017-03-29"); +insert into diaries values(2086, "2017-03-30"); +insert into diaries values(2087, "2017-03-31"); +insert into diaries values(2088, "2017-04-01"); +insert into diaries values(2089, "2017-04-02"); +insert into diaries values(2090, "2017-04-03"); +insert into diaries values(2091, "2017-04-04"); +insert into diaries values(2092, "2017-04-05"); +insert into diaries values(2093, "2017-04-06"); +insert into diaries values(2094, "2017-04-07"); +insert into diaries values(2095, "2017-04-08"); +insert into diaries values(2096, "2017-04-09"); +insert into diaries values(2097, "2017-04-10"); +insert into diaries values(2098, "2017-04-11"); +insert into diaries values(2099, "2017-04-12"); +insert into diaries values(2100, "2017-04-13"); +insert into diaries values(2101, "2017-04-14"); +insert into diaries values(2102, "2017-04-15"); +insert into diaries values(2103, "2017-04-16"); +insert into diaries values(2104, "2017-04-17"); +insert into diaries values(2105, "2017-04-18"); +insert into diaries values(2106, "2017-04-19"); +insert into diaries values(2107, "2017-04-20"); +insert into diaries values(2108, "2017-04-21"); +insert into diaries values(2109, "2017-04-22"); +insert into diaries values(2110, "2017-04-23"); +insert into diaries values(2111, "2017-04-24"); +insert into diaries values(2112, "2017-04-25"); +insert into diaries values(2113, "2017-04-26"); +insert into diaries values(2114, "2017-04-27"); +insert into diaries values(2115, "2017-04-28"); +insert into diaries values(2116, "2017-04-29"); +insert into diaries values(2117, "2017-04-30"); +insert into diaries values(2118, "2017-05-01"); +insert into diaries values(2119, "2017-05-02"); +insert into diaries values(2120, "2017-05-03"); +insert into diaries values(2121, "2017-05-04"); +insert into diaries values(2122, "2017-05-05"); +insert into diaries values(2123, "2017-05-06"); +insert into diaries values(2124, "2017-05-07"); +insert into diaries values(2125, "2017-05-08"); +insert into diaries values(2126, "2017-05-09"); +insert into diaries values(2127, "2017-05-10"); +insert into diaries values(2128, "2017-05-11"); +insert into diaries values(2129, "2017-05-12"); +insert into diaries values(2130, "2017-05-13"); +insert into diaries values(2131, "2017-05-14"); +insert into diaries values(2132, "2017-05-15"); +insert into diaries values(2133, "2017-05-16"); +insert into diaries values(2134, "2017-05-17"); +insert into diaries values(2135, "2017-05-18"); +insert into diaries values(2136, "2017-05-19"); +insert into diaries values(2137, "2017-05-20"); +insert into diaries values(2138, "2017-05-21"); +insert into diaries values(2139, "2017-05-22"); +insert into diaries values(2140, "2017-05-23"); +insert into diaries values(2141, "2017-05-24"); +insert into diaries values(2142, "2017-05-25"); +insert into diaries values(2143, "2017-05-26"); +insert into diaries values(2144, "2017-05-27"); +insert into diaries values(2145, "2017-05-28"); +insert into diaries values(2146, "2017-05-29"); +insert into diaries values(2147, "2017-05-30"); +insert into diaries values(2148, "2017-05-31"); +insert into diaries values(2149, "2017-06-01"); +insert into diaries values(2150, "2017-06-02"); +insert into diaries values(2151, "2017-06-03"); +insert into diaries values(2152, "2017-06-04"); +insert into diaries values(2153, "2017-06-05"); +insert into diaries values(2154, "2017-06-06"); +insert into diaries values(2155, "2017-06-07"); +insert into diaries values(2156, "2017-06-08"); +insert into diaries values(2157, "2017-06-09"); +insert into diaries values(2158, "2017-06-10"); +insert into diaries values(2159, "2017-06-11"); +insert into diaries values(2160, "2017-06-12"); +insert into diaries values(2161, "2017-06-13"); +insert into diaries values(2162, "2017-06-14"); +insert into diaries values(2163, "2017-06-15"); +insert into diaries values(2164, "2017-06-16"); +insert into diaries values(2165, "2017-06-17"); +insert into diaries values(2166, "2017-06-18"); +insert into diaries values(2167, "2017-06-19"); +insert into diaries values(2168, "2017-06-20"); +insert into diaries values(2169, "2017-06-21"); +insert into diaries values(2170, "2017-06-22"); +insert into diaries values(2171, "2017-06-23"); +insert into diaries values(2172, "2017-06-24"); +insert into diaries values(2173, "2017-06-25"); +insert into diaries values(2174, "2017-06-26"); +insert into diaries values(2175, "2017-06-27"); +insert into diaries values(2176, "2017-06-28"); +insert into diaries values(2177, "2017-06-29"); +insert into diaries values(2178, "2017-06-30"); +insert into diaries values(2179, "2017-07-01"); +insert into diaries values(2180, "2017-07-02"); +insert into diaries values(2181, "2017-07-03"); +insert into diaries values(2182, "2017-07-04"); +insert into diaries values(2183, "2017-07-05"); +insert into diaries values(2184, "2017-07-06"); +insert into diaries values(2185, "2017-07-07"); +insert into diaries values(2186, "2017-07-08"); +insert into diaries values(2187, "2017-07-09"); +insert into diaries values(2188, "2017-07-10"); +insert into diaries values(2189, "2017-07-11"); +insert into diaries values(2190, "2017-07-12"); +insert into diaries values(2191, "2017-07-13"); +insert into diaries values(2192, "2017-07-14"); +insert into diaries values(2193, "2017-07-15"); +insert into diaries values(2194, "2017-07-16"); +insert into diaries values(2195, "2017-07-17"); +insert into diaries values(2196, "2017-07-18"); +insert into diaries values(2197, "2017-07-19"); +insert into diaries values(2198, "2017-07-20"); +insert into diaries values(2199, "2017-07-21"); +insert into diaries values(2200, "2017-07-22"); +insert into diaries values(2201, "2017-07-23"); +insert into diaries values(2202, "2017-07-24"); +insert into diaries values(2203, "2017-07-25"); +insert into diaries values(2204, "2017-07-26"); +insert into diaries values(2205, "2017-07-27"); +insert into diaries values(2206, "2017-07-28"); +insert into diaries values(2207, "2017-07-29"); +insert into diaries values(2208, "2017-07-30"); +insert into diaries values(2209, "2017-07-31"); +insert into diaries values(2210, "2017-08-01"); +insert into diaries values(2211, "2017-08-02"); +insert into diaries values(2212, "2017-08-03"); +insert into diaries values(2213, "2017-08-04"); +insert into diaries values(2214, "2017-08-05"); +insert into diaries values(2215, "2017-08-06"); +insert into diaries values(2216, "2017-08-07"); +insert into diaries values(2217, "2017-08-08"); +insert into diaries values(2218, "2017-08-09"); +insert into diaries values(2219, "2017-08-10"); +insert into diaries values(2220, "2017-08-11"); +insert into diaries values(2221, "2017-08-12"); +insert into diaries values(2222, "2017-08-13"); +insert into diaries values(2223, "2017-08-14"); +insert into diaries values(2224, "2017-08-15"); +insert into diaries values(2225, "2017-08-16"); +insert into diaries values(2226, "2017-08-17"); +insert into diaries values(2227, "2017-08-18"); +insert into diaries values(2228, "2017-08-19"); +insert into diaries values(2229, "2017-08-20"); +insert into diaries values(2230, "2017-08-21"); +insert into diaries values(2231, "2017-08-22"); +insert into diaries values(2232, "2017-08-23"); +insert into diaries values(2233, "2017-08-24"); +insert into diaries values(2234, "2017-08-25"); +insert into diaries values(2235, "2017-08-26"); +insert into diaries values(2236, "2017-08-27"); +insert into diaries values(2237, "2017-08-28"); +insert into diaries values(2238, "2017-08-29"); +insert into diaries values(2239, "2017-08-30"); +insert into diaries values(2240, "2017-08-31"); +insert into diaries values(2241, "2017-09-01"); +insert into diaries values(2242, "2017-09-02"); +insert into diaries values(2243, "2017-09-03"); +insert into diaries values(2244, "2017-09-04"); +insert into diaries values(2245, "2017-09-05"); +insert into diaries values(2246, "2017-09-06"); +insert into diaries values(2247, "2017-09-07"); +insert into diaries values(2248, "2017-09-08"); +insert into diaries values(2249, "2017-09-09"); +insert into diaries values(2250, "2017-09-10"); +insert into diaries values(2251, "2017-09-11"); +insert into diaries values(2252, "2017-09-12"); +insert into diaries values(2253, "2017-09-13"); +insert into diaries values(2254, "2017-09-14"); +insert into diaries values(2255, "2017-09-15"); +insert into diaries values(2256, "2017-09-16"); +insert into diaries values(2257, "2017-09-17"); +insert into diaries values(2258, "2017-09-18"); +insert into diaries values(2259, "2017-09-19"); +insert into diaries values(2260, "2017-09-20"); +insert into diaries values(2261, "2017-09-21"); +insert into diaries values(2262, "2017-09-22"); +insert into diaries values(2263, "2017-09-23"); +insert into diaries values(2264, "2017-09-24"); +insert into diaries values(2265, "2017-09-25"); +insert into diaries values(2266, "2017-09-26"); +insert into diaries values(2267, "2017-09-27"); +insert into diaries values(2268, "2017-09-28"); +insert into diaries values(2269, "2017-09-29"); +insert into diaries values(2270, "2017-09-30"); +insert into diaries values(2271, "2017-10-01"); +insert into diaries values(2272, "2017-10-02"); +insert into diaries values(2273, "2017-10-03"); +insert into diaries values(2274, "2017-10-04"); +insert into diaries values(2275, "2017-10-05"); +insert into diaries values(2276, "2017-10-06"); +insert into diaries values(2277, "2017-10-07"); +insert into diaries values(2278, "2017-10-08"); +insert into diaries values(2279, "2017-10-09"); +insert into diaries values(2280, "2017-10-10"); +insert into diaries values(2281, "2017-10-11"); +insert into diaries values(2282, "2017-10-12"); +insert into diaries values(2283, "2017-10-13"); +insert into diaries values(2284, "2017-10-14"); +insert into diaries values(2285, "2017-10-15"); +insert into diaries values(2286, "2017-10-16"); +insert into diaries values(2287, "2017-10-17"); +insert into diaries values(2288, "2017-10-18"); +insert into diaries values(2289, "2017-10-19"); +insert into diaries values(2290, "2017-10-20"); +insert into diaries values(2291, "2017-10-21"); +insert into diaries values(2292, "2017-10-22"); +insert into diaries values(2293, "2017-10-23"); +insert into diaries values(2294, "2017-10-24"); +insert into diaries values(2295, "2017-10-25"); +insert into diaries values(2296, "2017-10-26"); +insert into diaries values(2297, "2017-10-27"); +insert into diaries values(2298, "2017-10-28"); +insert into diaries values(2299, "2017-10-29"); +insert into diaries values(2300, "2017-10-30"); +insert into diaries values(2301, "2017-10-31"); +insert into diaries values(2302, "2017-11-01"); +insert into diaries values(2303, "2017-11-02"); +insert into diaries values(2304, "2017-11-03"); +insert into diaries values(2305, "2017-11-04"); +insert into diaries values(2306, "2017-11-05"); +insert into diaries values(2307, "2017-11-06"); +insert into diaries values(2308, "2017-11-07"); +insert into diaries values(2309, "2017-11-08"); +insert into diaries values(2310, "2017-11-09"); +insert into diaries values(2311, "2017-11-10"); +insert into diaries values(2312, "2017-11-11"); +insert into diaries values(2313, "2017-11-12"); +insert into diaries values(2314, "2017-11-13"); +insert into diaries values(2315, "2017-11-14"); +insert into diaries values(2316, "2017-11-15"); +insert into diaries values(2317, "2017-11-16"); +insert into diaries values(2318, "2017-11-17"); +insert into diaries values(2319, "2017-11-18"); +insert into diaries values(2320, "2017-11-19"); +insert into diaries values(2321, "2017-11-20"); +insert into diaries values(2322, "2017-11-21"); +insert into diaries values(2323, "2017-11-22"); +insert into diaries values(2324, "2017-11-23"); +insert into diaries values(2325, "2017-11-24"); +insert into diaries values(2326, "2017-11-25"); +insert into diaries values(2327, "2017-11-26"); +insert into diaries values(2328, "2017-11-27"); +insert into diaries values(2329, "2017-11-28"); +insert into diaries values(2330, "2017-11-29"); +insert into diaries values(2331, "2017-11-30"); +insert into diaries values(2332, "2017-12-01"); +insert into diaries values(2333, "2017-12-02"); +insert into diaries values(2334, "2017-12-03"); +insert into diaries values(2335, "2017-12-04"); +insert into diaries values(2336, "2017-12-05"); +insert into diaries values(2337, "2017-12-06"); +insert into diaries values(2338, "2017-12-07"); +insert into diaries values(2339, "2017-12-08"); +insert into diaries values(2340, "2017-12-09"); +insert into diaries values(2341, "2017-12-10"); +insert into diaries values(2342, "2017-12-11"); +insert into diaries values(2343, "2017-12-12"); +insert into diaries values(2344, "2017-12-13"); +insert into diaries values(2345, "2017-12-14"); +insert into diaries values(2346, "2017-12-15"); +insert into diaries values(2347, "2017-12-16"); +insert into diaries values(2348, "2017-12-17"); +insert into diaries values(2349, "2017-12-18"); +insert into diaries values(2350, "2017-12-19"); +insert into diaries values(2351, "2017-12-20"); +insert into diaries values(2352, "2017-12-21"); +insert into diaries values(2353, "2017-12-22"); +insert into diaries values(2354, "2017-12-23"); +insert into diaries values(2355, "2017-12-24"); +insert into diaries values(2356, "2017-12-25"); +insert into diaries values(2357, "2017-12-26"); +insert into diaries values(2358, "2017-12-27"); +insert into diaries values(2359, "2017-12-28"); +insert into diaries values(2360, "2017-12-29"); +insert into diaries values(2361, "2017-12-30"); +insert into diaries values(2362, "2017-12-31"); +insert into diaries values(2363, "2018-01-01"); +insert into diaries values(2364, "2018-01-02"); +insert into diaries values(2365, "2018-01-03"); +insert into diaries values(2366, "2018-01-04"); +insert into diaries values(2367, "2018-01-05"); +insert into diaries values(2368, "2018-01-06"); +insert into diaries values(2369, "2018-01-07"); +insert into diaries values(2370, "2018-01-08"); +insert into diaries values(2371, "2018-01-09"); +insert into diaries values(2372, "2018-01-10"); +insert into diaries values(2373, "2018-01-11"); +insert into diaries values(2374, "2018-01-12"); +insert into diaries values(2375, "2018-01-13"); +insert into diaries values(2376, "2018-01-14"); +insert into diaries values(2377, "2018-01-15"); +insert into diaries values(2378, "2018-01-16"); +insert into diaries values(2379, "2018-01-17"); +insert into diaries values(2380, "2018-01-18"); +insert into diaries values(2381, "2018-01-19"); +insert into diaries values(2382, "2018-01-20"); +insert into diaries values(2383, "2018-01-21"); +insert into diaries values(2384, "2018-01-22"); +insert into diaries values(2385, "2018-01-23"); +insert into diaries values(2386, "2018-01-24"); +insert into diaries values(2387, "2018-01-25"); +insert into diaries values(2388, "2018-01-26"); +insert into diaries values(2389, "2018-01-27"); +insert into diaries values(2390, "2018-01-28"); +insert into diaries values(2391, "2018-01-29"); +insert into diaries values(2392, "2018-01-30"); +insert into diaries values(2393, "2018-01-31"); +insert into diaries values(2394, "2018-02-01"); +insert into diaries values(2395, "2018-02-02"); +insert into diaries values(2396, "2018-02-03"); +insert into diaries values(2397, "2018-02-04"); +insert into diaries values(2398, "2018-02-05"); +insert into diaries values(2399, "2018-02-06"); +insert into diaries values(2400, "2018-02-07"); +insert into diaries values(2401, "2018-02-08"); +insert into diaries values(2402, "2018-02-09"); +insert into diaries values(2403, "2018-02-10"); +insert into diaries values(2404, "2018-02-11"); +insert into diaries values(2405, "2018-02-12"); +insert into diaries values(2406, "2018-02-13"); +insert into diaries values(2407, "2018-02-14"); +insert into diaries values(2408, "2018-02-15"); +insert into diaries values(2409, "2018-02-16"); +insert into diaries values(2410, "2018-02-17"); +insert into diaries values(2411, "2018-02-18"); +insert into diaries values(2412, "2018-02-19"); +insert into diaries values(2413, "2018-02-20"); +insert into diaries values(2414, "2018-02-21"); +insert into diaries values(2415, "2018-02-22"); +insert into diaries values(2416, "2018-02-23"); +insert into diaries values(2417, "2018-02-24"); +insert into diaries values(2418, "2018-02-25"); +insert into diaries values(2419, "2018-02-26"); +insert into diaries values(2420, "2018-02-27"); +insert into diaries values(2421, "2018-02-28"); +insert into diaries values(2422, "2018-03-01"); +insert into diaries values(2423, "2018-03-02"); +insert into diaries values(2424, "2018-03-03"); +insert into diaries values(2425, "2018-03-04"); +insert into diaries values(2426, "2018-03-05"); +insert into diaries values(2427, "2018-03-06"); +insert into diaries values(2428, "2018-03-07"); +insert into diaries values(2429, "2018-03-08"); +insert into diaries values(2430, "2018-03-09"); +insert into diaries values(2431, "2018-03-10"); +insert into diaries values(2432, "2018-03-11"); +insert into diaries values(2433, "2018-03-12"); +insert into diaries values(2434, "2018-03-13"); +insert into diaries values(2435, "2018-03-14"); +insert into diaries values(2436, "2018-03-15"); +insert into diaries values(2437, "2018-03-16"); +insert into diaries values(2438, "2018-03-17"); +insert into diaries values(2439, "2018-03-18"); +insert into diaries values(2440, "2018-03-19"); +insert into diaries values(2441, "2018-03-20"); +insert into diaries values(2442, "2018-03-21"); +insert into diaries values(2443, "2018-03-22"); +insert into diaries values(2444, "2018-03-23"); +insert into diaries values(2445, "2018-03-24"); +insert into diaries values(2446, "2018-03-25"); +insert into diaries values(2447, "2018-03-26"); +insert into diaries values(2448, "2018-03-27"); +insert into diaries values(2449, "2018-03-28"); +insert into diaries values(2450, "2018-03-29"); +insert into diaries values(2451, "2018-03-30"); +insert into diaries values(2452, "2018-03-31"); +insert into diaries values(2453, "2018-04-01"); +insert into diaries values(2454, "2018-04-02"); +insert into diaries values(2455, "2018-04-03"); +insert into diaries values(2456, "2018-04-04"); +insert into diaries values(2457, "2018-04-05"); +insert into diaries values(2458, "2018-04-06"); +insert into diaries values(2459, "2018-04-07"); +insert into diaries values(2460, "2018-04-08"); +insert into diaries values(2461, "2018-04-09"); +insert into diaries values(2462, "2018-04-10"); +insert into diaries values(2463, "2018-04-11"); +insert into diaries values(2464, "2018-04-12"); +insert into diaries values(2465, "2018-04-13"); +insert into diaries values(2466, "2018-04-14"); +insert into diaries values(2467, "2018-04-15"); +insert into diaries values(2468, "2018-04-16"); +insert into diaries values(2469, "2018-04-17"); +insert into diaries values(2470, "2018-04-18"); +insert into diaries values(2471, "2018-04-19"); +insert into diaries values(2472, "2018-04-20"); +insert into diaries values(2473, "2018-04-21"); +insert into diaries values(2474, "2018-04-22"); +insert into diaries values(2475, "2018-04-23"); +insert into diaries values(2476, "2018-04-24"); +insert into diaries values(2477, "2018-04-25"); +insert into diaries values(2478, "2018-04-26"); +insert into diaries values(2479, "2018-04-27"); +insert into diaries values(2480, "2018-04-28"); +insert into diaries values(2481, "2018-04-29"); +insert into diaries values(2482, "2018-04-30"); +insert into diaries values(2483, "2018-05-01"); +insert into diaries values(2484, "2018-05-02"); +insert into diaries values(2485, "2018-05-03"); +insert into diaries values(2486, "2018-05-04"); +insert into diaries values(2487, "2018-05-05"); +insert into diaries values(2488, "2018-05-06"); +insert into diaries values(2489, "2018-05-07"); +insert into diaries values(2490, "2018-05-08"); +insert into diaries values(2491, "2018-05-09"); +insert into diaries values(2492, "2018-05-10"); +insert into diaries values(2493, "2018-05-11"); +insert into diaries values(2494, "2018-05-12"); +insert into diaries values(2495, "2018-05-13"); +insert into diaries values(2496, "2018-05-14"); +insert into diaries values(2497, "2018-05-15"); +insert into diaries values(2498, "2018-05-16"); +insert into diaries values(2499, "2018-05-17"); +insert into diaries values(2500, "2018-05-18"); +insert into diaries values(2501, "2018-05-19"); +insert into diaries values(2502, "2018-05-20"); +insert into diaries values(2503, "2018-05-21"); +insert into diaries values(2504, "2018-05-22"); +insert into diaries values(2505, "2018-05-23"); +insert into diaries values(2506, "2018-05-24"); +insert into diaries values(2507, "2018-05-25"); +insert into diaries values(2508, "2018-05-26"); +insert into diaries values(2509, "2018-05-27"); +insert into diaries values(2510, "2018-05-28"); +insert into diaries values(2511, "2018-05-29"); +insert into diaries values(2512, "2018-05-30"); +insert into diaries values(2513, "2018-05-31"); +insert into diaries values(2514, "2018-06-01"); +insert into diaries values(2515, "2018-06-02"); +insert into diaries values(2516, "2018-06-03"); +insert into diaries values(2517, "2018-06-04"); +insert into diaries values(2518, "2018-06-05"); +insert into diaries values(2519, "2018-06-06"); +insert into diaries values(2520, "2018-06-07"); +insert into diaries values(2521, "2018-06-08"); +insert into diaries values(2522, "2018-06-09"); +insert into diaries values(2523, "2018-06-10"); +insert into diaries values(2524, "2018-06-11"); +insert into diaries values(2525, "2018-06-12"); +insert into diaries values(2526, "2018-06-13"); +insert into diaries values(2527, "2018-06-14"); +insert into diaries values(2528, "2018-06-15"); +insert into diaries values(2529, "2018-06-16"); +insert into diaries values(2530, "2018-06-17"); +insert into diaries values(2531, "2018-06-18"); +insert into diaries values(2532, "2018-06-19"); +insert into diaries values(2533, "2018-06-20"); +insert into diaries values(2534, "2018-06-21"); +insert into diaries values(2535, "2018-06-22"); +insert into diaries values(2536, "2018-06-23"); +insert into diaries values(2537, "2018-06-24"); +insert into diaries values(2538, "2018-06-25"); +insert into diaries values(2539, "2018-06-26"); +insert into diaries values(2540, "2018-06-27"); +insert into diaries values(2541, "2018-06-28"); +insert into diaries values(2542, "2018-06-29"); +insert into diaries values(2543, "2018-06-30"); +insert into diaries values(2544, "2018-07-01"); +insert into diaries values(2545, "2018-07-02"); +insert into diaries values(2546, "2018-07-03"); +insert into diaries values(2547, "2018-07-04"); +insert into diaries values(2548, "2018-07-05"); +insert into diaries values(2549, "2018-07-06"); +insert into diaries values(2550, "2018-07-07"); +insert into diaries values(2551, "2018-07-08"); +insert into diaries values(2552, "2018-07-09"); +insert into diaries values(2553, "2018-07-10"); +insert into diaries values(2554, "2018-07-11"); +insert into diaries values(2555, "2018-07-12"); +insert into diaries values(2556, "2018-07-13"); +insert into diaries values(2557, "2018-07-14"); +insert into diaries values(2558, "2018-07-15"); +insert into diaries values(2559, "2018-07-16"); +insert into diaries values(2560, "2018-07-17"); +insert into diaries values(2561, "2018-07-18"); +insert into diaries values(2562, "2018-07-19"); +insert into diaries values(2563, "2018-07-20"); +insert into diaries values(2564, "2018-07-21"); +insert into diaries values(2565, "2018-07-22"); +insert into diaries values(2566, "2018-07-23"); +insert into diaries values(2567, "2018-07-24"); +insert into diaries values(2568, "2018-07-25"); +insert into diaries values(2569, "2018-07-26"); +insert into diaries values(2570, "2018-07-27"); +insert into diaries values(2571, "2018-07-28"); +insert into diaries values(2572, "2018-07-29"); +insert into diaries values(2573, "2018-07-30"); +insert into diaries values(2574, "2018-07-31"); +insert into diaries values(2575, "2018-08-01"); +insert into diaries values(2576, "2018-08-02"); +insert into diaries values(2577, "2018-08-03"); +insert into diaries values(2578, "2018-08-04"); +insert into diaries values(2579, "2018-08-05"); +insert into diaries values(2580, "2018-08-06"); +insert into diaries values(2581, "2018-08-07"); +insert into diaries values(2582, "2018-08-08"); +insert into diaries values(2583, "2018-08-09"); +insert into diaries values(2584, "2018-08-10"); +insert into diaries values(2585, "2018-08-11"); +insert into diaries values(2586, "2018-08-12"); +insert into diaries values(2587, "2018-08-13"); +insert into diaries values(2588, "2018-08-14"); +insert into diaries values(2589, "2018-08-15"); +insert into diaries values(2590, "2018-08-16"); +insert into diaries values(2591, "2018-08-17"); +insert into diaries values(2592, "2018-08-18"); +insert into diaries values(2593, "2018-08-19"); +insert into diaries values(2594, "2018-08-20"); +insert into diaries values(2595, "2018-08-21"); +insert into diaries values(2596, "2018-08-22"); +insert into diaries values(2597, "2018-08-23"); +insert into diaries values(2598, "2018-08-24"); +insert into diaries values(2599, "2018-08-25"); +insert into diaries values(2600, "2018-08-26"); +insert into diaries values(2601, "2018-08-27"); +insert into diaries values(2602, "2018-08-28"); +insert into diaries values(2603, "2018-08-29"); +insert into diaries values(2604, "2018-08-30"); +insert into diaries values(2605, "2018-08-31"); +insert into diaries values(2606, "2018-09-01"); +insert into diaries values(2607, "2018-09-02"); +insert into diaries values(2608, "2018-09-03"); +insert into diaries values(2609, "2018-09-04"); +insert into diaries values(2610, "2018-09-05"); +insert into diaries values(2611, "2018-09-06"); +insert into diaries values(2612, "2018-09-07"); +insert into diaries values(2613, "2018-09-08"); +insert into diaries values(2614, "2018-09-09"); +insert into diaries values(2615, "2018-09-10"); +insert into diaries values(2616, "2018-09-11"); +insert into diaries values(2617, "2018-09-12"); +insert into diaries values(2618, "2018-09-13"); +insert into diaries values(2619, "2018-09-14"); +insert into diaries values(2620, "2018-09-15"); +insert into diaries values(2621, "2018-09-16"); +insert into diaries values(2622, "2018-09-17"); +insert into diaries values(2623, "2018-09-18"); +insert into diaries values(2624, "2018-09-19"); +insert into diaries values(2625, "2018-09-20"); +insert into diaries values(2626, "2018-09-21"); +insert into diaries values(2627, "2018-09-22"); +insert into diaries values(2628, "2018-09-23"); +insert into diaries values(2629, "2018-09-24"); +insert into diaries values(2630, "2018-09-25"); +insert into diaries values(2631, "2018-09-26"); +insert into diaries values(2632, "2018-09-27"); +insert into diaries values(2633, "2018-09-28"); +insert into diaries values(2634, "2018-09-29"); +insert into diaries values(2635, "2018-09-30"); +insert into diaries values(2636, "2018-10-01"); +insert into diaries values(2637, "2018-10-02"); +insert into diaries values(2638, "2018-10-03"); +insert into diaries values(2639, "2018-10-04"); +insert into diaries values(2640, "2018-10-05"); +insert into diaries values(2641, "2018-10-06"); +insert into diaries values(2642, "2018-10-07"); +insert into diaries values(2643, "2018-10-08"); +insert into diaries values(2644, "2018-10-09"); +insert into diaries values(2645, "2018-10-10"); +insert into diaries values(2646, "2018-10-11"); +insert into diaries values(2647, "2018-10-12"); +insert into diaries values(2648, "2018-10-13"); +insert into diaries values(2649, "2018-10-14"); +insert into diaries values(2650, "2018-10-15"); +insert into diaries values(2651, "2018-10-16"); +insert into diaries values(2652, "2018-10-17"); +insert into diaries values(2653, "2018-10-18"); +insert into diaries values(2654, "2018-10-19"); +insert into diaries values(2655, "2018-10-20"); +insert into diaries values(2656, "2018-10-21"); +insert into diaries values(2657, "2018-10-22"); +insert into diaries values(2658, "2018-10-23"); +insert into diaries values(2659, "2018-10-24"); +insert into diaries values(2660, "2018-10-25"); +insert into diaries values(2661, "2018-10-26"); +insert into diaries values(2662, "2018-10-27"); +insert into diaries values(2663, "2018-10-28"); +insert into diaries values(2664, "2018-10-29"); +insert into diaries values(2665, "2018-10-30"); +insert into diaries values(2666, "2018-10-31"); +insert into diaries values(2667, "2018-11-01"); +insert into diaries values(2668, "2018-11-02"); +insert into diaries values(2669, "2018-11-03"); +insert into diaries values(2670, "2018-11-04"); +insert into diaries values(2671, "2018-11-05"); +insert into diaries values(2672, "2018-11-06"); +insert into diaries values(2673, "2018-11-07"); +insert into diaries values(2674, "2018-11-08"); +insert into diaries values(2675, "2018-11-09"); +insert into diaries values(2676, "2018-11-10"); +insert into diaries values(2677, "2018-11-11"); +insert into diaries values(2678, "2018-11-12"); +insert into diaries values(2679, "2018-11-13"); +insert into diaries values(2680, "2018-11-14"); +insert into diaries values(2681, "2018-11-15"); +insert into diaries values(2682, "2018-11-16"); +insert into diaries values(2683, "2018-11-17"); +insert into diaries values(2684, "2018-11-18"); +insert into diaries values(2685, "2018-11-19"); +insert into diaries values(2686, "2018-11-20"); +insert into diaries values(2687, "2018-11-21"); +insert into diaries values(2688, "2018-11-22"); +insert into diaries values(2689, "2018-11-23"); +insert into diaries values(2690, "2018-11-24"); +insert into diaries values(2691, "2018-11-25"); +insert into diaries values(2692, "2018-11-26"); +insert into diaries values(2693, "2018-11-27"); +insert into diaries values(2694, "2018-11-28"); +insert into diaries values(2695, "2018-11-29"); +insert into diaries values(2696, "2018-11-30"); +insert into diaries values(2697, "2018-12-01"); +insert into diaries values(2698, "2018-12-02"); +insert into diaries values(2699, "2018-12-03"); +insert into diaries values(2700, "2018-12-04"); +insert into diaries values(2701, "2018-12-05"); +insert into diaries values(2702, "2018-12-06"); +insert into diaries values(2703, "2018-12-07"); +insert into diaries values(2704, "2018-12-08"); +insert into diaries values(2705, "2018-12-09"); +insert into diaries values(2706, "2018-12-10"); +insert into diaries values(2707, "2018-12-11"); +insert into diaries values(2708, "2018-12-12"); +insert into diaries values(2709, "2018-12-13"); +insert into diaries values(2710, "2018-12-14"); +insert into diaries values(2711, "2018-12-15"); +insert into diaries values(2712, "2018-12-16"); +insert into diaries values(2713, "2018-12-17"); +insert into diaries values(2714, "2018-12-18"); +insert into diaries values(2715, "2018-12-19"); +insert into diaries values(2716, "2018-12-20"); +insert into diaries values(2717, "2018-12-21"); +insert into diaries values(2718, "2018-12-22"); +insert into diaries values(2719, "2018-12-23"); +insert into diaries values(2720, "2018-12-24"); +insert into diaries values(2721, "2018-12-25"); +insert into diaries values(2722, "2018-12-26"); +insert into diaries values(2723, "2018-12-27"); +insert into diaries values(2724, "2018-12-28"); +insert into diaries values(2725, "2018-12-29"); +insert into diaries values(2726, "2018-12-30"); +insert into diaries values(2727, "2018-12-31"); +insert into diaries values(2728, "2019-01-01"); +insert into diaries values(2729, "2019-01-02"); +insert into diaries values(2730, "2019-01-03"); +insert into diaries values(2731, "2019-01-04"); +insert into diaries values(2732, "2019-01-05"); +insert into diaries values(2733, "2019-01-06"); +insert into diaries values(2734, "2019-01-07"); +insert into diaries values(2735, "2019-01-08"); +insert into diaries values(2736, "2019-01-09"); +insert into diaries values(2737, "2019-01-10"); +insert into diaries values(2738, "2019-01-11"); +insert into diaries values(2739, "2019-01-12"); +insert into diaries values(2740, "2019-01-13"); +insert into diaries values(2741, "2019-01-14"); +insert into diaries values(2742, "2019-01-15"); +insert into diaries values(2743, "2019-01-16"); +insert into diaries values(2744, "2019-01-17"); +insert into diaries values(2745, "2019-01-18"); +insert into diaries values(2746, "2019-01-19"); +insert into diaries values(2747, "2019-01-20"); +insert into diaries values(2748, "2019-01-21"); +insert into diaries values(2749, "2019-01-22"); +insert into diaries values(2750, "2019-01-23"); +insert into diaries values(2751, "2019-01-24"); +insert into diaries values(2752, "2019-01-25"); +insert into diaries values(2753, "2019-01-26"); +insert into diaries values(2754, "2019-01-27"); +insert into diaries values(2755, "2019-01-28"); +insert into diaries values(2756, "2019-01-29"); +insert into diaries values(2757, "2019-01-30"); +insert into diaries values(2758, "2019-01-31"); +insert into diaries values(2759, "2019-02-01"); +insert into diaries values(2760, "2019-02-02"); +insert into diaries values(2761, "2019-02-03"); +insert into diaries values(2762, "2019-02-04"); +insert into diaries values(2763, "2019-02-05"); +insert into diaries values(2764, "2019-02-06"); +insert into diaries values(2765, "2019-02-07"); +insert into diaries values(2766, "2019-02-08"); +insert into diaries values(2767, "2019-02-09"); +insert into diaries values(2768, "2019-02-10"); +insert into diaries values(2769, "2019-02-11"); +insert into diaries values(2770, "2019-02-12"); +insert into diaries values(2771, "2019-02-13"); +insert into diaries values(2772, "2019-02-14"); +insert into diaries values(2773, "2019-02-15"); +insert into diaries values(2774, "2019-02-16"); +insert into diaries values(2775, "2019-02-17"); +insert into diaries values(2776, "2019-02-18"); +insert into diaries values(2777, "2019-02-19"); +insert into diaries values(2778, "2019-02-20"); +insert into diaries values(2779, "2019-02-21"); +insert into diaries values(2780, "2019-02-22"); +insert into diaries values(2781, "2019-02-23"); +insert into diaries values(2782, "2019-02-24"); +insert into diaries values(2783, "2019-02-25"); +insert into diaries values(2784, "2019-02-26"); +insert into diaries values(2785, "2019-02-27"); +insert into diaries values(2786, "2019-02-28"); +insert into diaries values(2787, "2019-03-01"); +insert into diaries values(2788, "2019-03-02"); +insert into diaries values(2789, "2019-03-03"); +insert into diaries values(2790, "2019-03-04"); +insert into diaries values(2791, "2019-03-05"); +insert into diaries values(2792, "2019-03-06"); +insert into diaries values(2793, "2019-03-07"); +insert into diaries values(2794, "2019-03-08"); +insert into diaries values(2795, "2019-03-09"); +insert into diaries values(2796, "2019-03-10"); +insert into diaries values(2797, "2019-03-11"); +insert into diaries values(2798, "2019-03-12"); +insert into diaries values(2799, "2019-03-13"); +insert into diaries values(2800, "2019-03-14"); +insert into diaries values(2801, "2019-03-15"); +insert into diaries values(2802, "2019-03-16"); +insert into diaries values(2803, "2019-03-17"); +insert into diaries values(2804, "2019-03-18"); +insert into diaries values(2805, "2019-03-19"); +insert into diaries values(2806, "2019-03-20"); +insert into diaries values(2807, "2019-03-21"); +insert into diaries values(2808, "2019-03-22"); +insert into diaries values(2809, "2019-03-23"); +insert into diaries values(2810, "2019-03-24"); +insert into diaries values(2811, "2019-03-25"); +insert into diaries values(2812, "2019-03-26"); +insert into diaries values(2813, "2019-03-27"); +insert into diaries values(2814, "2019-03-28"); +insert into diaries values(2815, "2019-03-29"); +insert into diaries values(2816, "2019-03-30"); +insert into diaries values(2817, "2019-03-31"); +insert into diaries values(2818, "2019-04-01"); +insert into diaries values(2819, "2019-04-02"); +insert into diaries values(2820, "2019-04-03"); +insert into diaries values(2821, "2019-04-04"); +insert into diaries values(2822, "2019-04-05"); +insert into diaries values(2823, "2019-04-06"); +insert into diaries values(2824, "2019-04-07"); +insert into diaries values(2825, "2019-04-08"); +insert into diaries values(2826, "2019-04-09"); +insert into diaries values(2827, "2019-04-10"); +insert into diaries values(2828, "2019-04-11"); +insert into diaries values(2829, "2019-04-12"); +insert into diaries values(2830, "2019-04-13"); +insert into diaries values(2831, "2019-04-14"); +insert into diaries values(2832, "2019-04-15"); +insert into diaries values(2833, "2019-04-16"); +insert into diaries values(2834, "2019-04-17"); +insert into diaries values(2835, "2019-04-18"); +insert into diaries values(2836, "2019-04-19"); +insert into diaries values(2837, "2019-04-20"); +insert into diaries values(2838, "2019-04-21"); +insert into diaries values(2839, "2019-04-22"); +insert into diaries values(2840, "2019-04-23"); +insert into diaries values(2841, "2019-04-24"); +insert into diaries values(2842, "2019-04-25"); +insert into diaries values(2843, "2019-04-26"); +insert into diaries values(2844, "2019-04-27"); +insert into diaries values(2845, "2019-04-28"); +insert into diaries values(2846, "2019-04-29"); +insert into diaries values(2847, "2019-04-30"); +insert into diaries values(2848, "2019-05-01"); +insert into diaries values(2849, "2019-05-02"); +insert into diaries values(2850, "2019-05-03"); +insert into diaries values(2851, "2019-05-04"); +insert into diaries values(2852, "2019-05-05"); +insert into diaries values(2853, "2019-05-06"); +insert into diaries values(2854, "2019-05-07"); +insert into diaries values(2855, "2019-05-08"); +insert into diaries values(2856, "2019-05-09"); +insert into diaries values(2857, "2019-05-10"); +insert into diaries values(2858, "2019-05-11"); +insert into diaries values(2859, "2019-05-12"); +insert into diaries values(2860, "2019-05-13"); +insert into diaries values(2861, "2019-05-14"); +insert into diaries values(2862, "2019-05-15"); +insert into diaries values(2863, "2019-05-16"); +insert into diaries values(2864, "2019-05-17"); +insert into diaries values(2865, "2019-05-18"); +insert into diaries values(2866, "2019-05-19"); +insert into diaries values(2867, "2019-05-20"); +insert into diaries values(2868, "2019-05-21"); +insert into diaries values(2869, "2019-05-22"); +insert into diaries values(2870, "2019-05-23"); +insert into diaries values(2871, "2019-05-24"); +insert into diaries values(2872, "2019-05-25"); +insert into diaries values(2873, "2019-05-26"); +insert into diaries values(2874, "2019-05-27"); +insert into diaries values(2875, "2019-05-28"); +insert into diaries values(2876, "2019-05-29"); +insert into diaries values(2877, "2019-05-30"); +insert into diaries values(2878, "2019-05-31"); +insert into diaries values(2879, "2019-06-01"); +insert into diaries values(2880, "2019-06-02"); +insert into diaries values(2881, "2019-06-03"); +insert into diaries values(2882, "2019-06-04"); +insert into diaries values(2883, "2019-06-05"); +insert into diaries values(2884, "2019-06-06"); +insert into diaries values(2885, "2019-06-07"); +insert into diaries values(2886, "2019-06-08"); +insert into diaries values(2887, "2019-06-09"); +insert into diaries values(2888, "2019-06-10"); +insert into diaries values(2889, "2019-06-11"); +insert into diaries values(2890, "2019-06-12"); +insert into diaries values(2891, "2019-06-13"); +insert into diaries values(2892, "2019-06-14"); +insert into diaries values(2893, "2019-06-15"); +insert into diaries values(2894, "2019-06-16"); +insert into diaries values(2895, "2019-06-17"); +insert into diaries values(2896, "2019-06-18"); +insert into diaries values(2897, "2019-06-19"); +insert into diaries values(2898, "2019-06-20"); +insert into diaries values(2899, "2019-06-21"); +insert into diaries values(2900, "2019-06-22"); +insert into diaries values(2901, "2019-06-23"); +insert into diaries values(2902, "2019-06-24"); +insert into diaries values(2903, "2019-06-25"); +insert into diaries values(2904, "2019-06-26"); +insert into diaries values(2905, "2019-06-27"); +insert into diaries values(2906, "2019-06-28"); +insert into diaries values(2907, "2019-06-29"); +insert into diaries values(2908, "2019-06-30"); +insert into diaries values(2909, "2019-07-01"); +insert into diaries values(2910, "2019-07-02"); +insert into diaries values(2911, "2019-07-03"); +insert into diaries values(2912, "2019-07-04"); +insert into diaries values(2913, "2019-07-05"); +insert into diaries values(2914, "2019-07-06"); +insert into diaries values(2915, "2019-07-07"); +insert into diaries values(2916, "2019-07-08"); +insert into diaries values(2917, "2019-07-09"); +insert into diaries values(2918, "2019-07-10"); +insert into diaries values(2919, "2019-07-11"); +insert into diaries values(2920, "2019-07-12"); +insert into diaries values(2921, "2019-07-13"); +insert into diaries values(2922, "2019-07-14"); +insert into diaries values(2923, "2019-07-15"); +insert into diaries values(2924, "2019-07-16"); +insert into diaries values(2925, "2019-07-17"); +insert into diaries values(2926, "2019-07-18"); +insert into diaries values(2927, "2019-07-19"); +insert into diaries values(2928, "2019-07-20"); +insert into diaries values(2929, "2019-07-21"); +insert into diaries values(2930, "2019-07-22"); +insert into diaries values(2931, "2019-07-23"); +insert into diaries values(2932, "2019-07-24"); +insert into diaries values(2933, "2019-07-25"); +insert into diaries values(2934, "2019-07-26"); +insert into diaries values(2935, "2019-07-27"); +insert into diaries values(2936, "2019-07-28"); +insert into diaries values(2937, "2019-07-29"); +insert into diaries values(2938, "2019-07-30"); +insert into diaries values(2939, "2019-07-31"); +insert into diaries values(2940, "2019-08-01"); +insert into diaries values(2941, "2019-08-02"); +insert into diaries values(2942, "2019-08-03"); +insert into diaries values(2943, "2019-08-04"); +insert into diaries values(2944, "2019-08-05"); +insert into diaries values(2945, "2019-08-06"); +insert into diaries values(2946, "2019-08-07"); +insert into diaries values(2947, "2019-08-08"); +insert into diaries values(2948, "2019-08-09"); +insert into diaries values(2949, "2019-08-10"); +insert into diaries values(2950, "2019-08-11"); +insert into diaries values(2951, "2019-08-12"); +insert into diaries values(2952, "2019-08-13"); +insert into diaries values(2953, "2019-08-14"); +insert into diaries values(2954, "2019-08-15"); +insert into diaries values(2955, "2019-08-16"); +insert into diaries values(2956, "2019-08-17"); +insert into diaries values(2957, "2019-08-18"); +insert into diaries values(2958, "2019-08-19"); +insert into diaries values(2959, "2019-08-20"); +insert into diaries values(2960, "2019-08-21"); +insert into diaries values(2961, "2019-08-22"); +insert into diaries values(2962, "2019-08-23"); +insert into diaries values(2963, "2019-08-24"); +insert into diaries values(2964, "2019-08-25"); +insert into diaries values(2965, "2019-08-26"); +insert into diaries values(2966, "2019-08-27"); +insert into diaries values(2967, "2019-08-28"); +insert into diaries values(2968, "2019-08-29"); +insert into diaries values(2969, "2019-08-30"); +insert into diaries values(2970, "2019-08-31"); +insert into diaries values(2971, "2019-09-01"); +insert into diaries values(2972, "2019-09-02"); +insert into diaries values(2973, "2019-09-03"); +insert into diaries values(2974, "2019-09-04"); +insert into diaries values(2975, "2019-09-05"); +insert into diaries values(2976, "2019-09-06"); +insert into diaries values(2977, "2019-09-07"); +insert into diaries values(2978, "2019-09-08"); +insert into diaries values(2979, "2019-09-09"); +insert into diaries values(2980, "2019-09-10"); +insert into diaries values(2981, "2019-09-11"); +insert into diaries values(2982, "2019-09-12"); +insert into diaries values(2983, "2019-09-13"); +insert into diaries values(2984, "2019-09-14"); +insert into diaries values(2985, "2019-09-15"); +insert into diaries values(2986, "2019-09-16"); +insert into diaries values(2987, "2019-09-17"); +insert into diaries values(2988, "2019-09-18"); +insert into diaries values(2989, "2019-09-19"); +insert into diaries values(2990, "2019-09-20"); +insert into diaries values(2991, "2019-09-21"); +insert into diaries values(2992, "2019-09-22"); +insert into diaries values(2993, "2019-09-23"); +insert into diaries values(2994, "2019-09-24"); +insert into diaries values(2995, "2019-09-25"); +insert into diaries values(2996, "2019-09-26"); +insert into diaries values(2997, "2019-09-27"); +insert into diaries values(2998, "2019-09-28"); +insert into diaries values(2999, "2019-09-29"); +insert into diaries values(3000, "2019-09-30"); +insert into diaries values(3001, "2019-10-01"); +insert into diaries values(3002, "2019-10-02"); +insert into diaries values(3003, "2019-10-03"); +insert into diaries values(3004, "2019-10-04"); +insert into diaries values(3005, "2019-10-05"); +insert into diaries values(3006, "2019-10-06"); +insert into diaries values(3007, "2019-10-07"); +insert into diaries values(3008, "2019-10-08"); +insert into diaries values(3009, "2019-10-09"); +insert into diaries values(3010, "2019-10-10"); +insert into diaries values(3011, "2019-10-11"); +insert into diaries values(3012, "2019-10-12"); +insert into diaries values(3013, "2019-10-13"); +insert into diaries values(3014, "2019-10-14"); +insert into diaries values(3015, "2019-10-15"); +insert into diaries values(3016, "2019-10-16"); +insert into diaries values(3017, "2019-10-17"); +insert into diaries values(3018, "2019-10-18"); +insert into diaries values(3019, "2019-10-19"); +insert into diaries values(3020, "2019-10-20"); +insert into diaries values(3021, "2019-10-21"); +insert into diaries values(3022, "2019-10-22"); +insert into diaries values(3023, "2019-10-23"); +insert into diaries values(3024, "2019-10-24"); +insert into diaries values(3025, "2019-10-25"); +insert into diaries values(3026, "2019-10-26"); +insert into diaries values(3027, "2019-10-27"); +insert into diaries values(3028, "2019-10-28"); +insert into diaries values(3029, "2019-10-29"); +insert into diaries values(3030, "2019-10-30"); +insert into diaries values(3031, "2019-10-31"); +insert into diaries values(3032, "2019-11-01"); +insert into diaries values(3033, "2019-11-02"); +insert into diaries values(3034, "2019-11-03"); +insert into diaries values(3035, "2019-11-04"); +insert into diaries values(3036, "2019-11-05"); +insert into diaries values(3037, "2019-11-06"); +insert into diaries values(3038, "2019-11-07"); +insert into diaries values(3039, "2019-11-08"); +insert into diaries values(3040, "2019-11-09"); +insert into diaries values(3041, "2019-11-10"); +insert into diaries values(3042, "2019-11-11"); +insert into diaries values(3043, "2019-11-12"); +insert into diaries values(3044, "2019-11-13"); +insert into diaries values(3045, "2019-11-14"); +insert into diaries values(3046, "2019-11-15"); +insert into diaries values(3047, "2019-11-16"); +insert into diaries values(3048, "2019-11-17"); +insert into diaries values(3049, "2019-11-18"); +insert into diaries values(3050, "2019-11-19"); +insert into diaries values(3051, "2019-11-20"); +insert into diaries values(3052, "2019-11-21"); +insert into diaries values(3053, "2019-11-22"); +insert into diaries values(3054, "2019-11-23"); +insert into diaries values(3055, "2019-11-24"); +insert into diaries values(3056, "2019-11-25"); +insert into diaries values(3057, "2019-11-26"); +insert into diaries values(3058, "2019-11-27"); +insert into diaries values(3059, "2019-11-28"); +insert into diaries values(3060, "2019-11-29"); +insert into diaries values(3061, "2019-11-30"); +insert into diaries values(3062, "2019-12-01"); +insert into diaries values(3063, "2019-12-02"); +insert into diaries values(3064, "2019-12-03"); +insert into diaries values(3065, "2019-12-04"); +insert into diaries values(3066, "2019-12-05"); +insert into diaries values(3067, "2019-12-06"); +insert into diaries values(3068, "2019-12-07"); +insert into diaries values(3069, "2019-12-08"); +insert into diaries values(3070, "2019-12-09"); +insert into diaries values(3071, "2019-12-10"); +insert into diaries values(3072, "2019-12-11"); +insert into diaries values(3073, "2019-12-12"); +insert into diaries values(3074, "2019-12-13"); +insert into diaries values(3075, "2019-12-14"); +insert into diaries values(3076, "2019-12-15"); +insert into diaries values(3077, "2019-12-16"); +insert into diaries values(3078, "2019-12-17"); +insert into diaries values(3079, "2019-12-18"); +insert into diaries values(3080, "2019-12-19"); +insert into diaries values(3081, "2019-12-20"); +insert into diaries values(3082, "2019-12-21"); +insert into diaries values(3083, "2019-12-22"); +insert into diaries values(3084, "2019-12-23"); +insert into diaries values(3085, "2019-12-24"); +insert into diaries values(3086, "2019-12-25"); +insert into diaries values(3087, "2019-12-26"); +insert into diaries values(3088, "2019-12-27"); +insert into diaries values(3089, "2019-12-28"); +insert into diaries values(3090, "2019-12-29"); +insert into diaries values(3091, "2019-12-30"); +insert into diaries values(3092, "2019-12-31"); +insert into diaries values(3093, "2020-01-01"); +insert into diaries values(3094, "2020-01-02"); +insert into diaries values(3095, "2020-01-03"); +insert into diaries values(3096, "2020-01-04"); +insert into diaries values(3097, "2020-01-05"); +insert into diaries values(3098, "2020-01-06"); +insert into diaries values(3099, "2020-01-07"); +insert into diaries values(3100, "2020-01-08"); +insert into diaries values(3101, "2020-01-09"); +insert into diaries values(3102, "2020-01-10"); +insert into diaries values(3103, "2020-01-11"); +insert into diaries values(3104, "2020-01-12"); +insert into diaries values(3105, "2020-01-13"); +insert into diaries values(3106, "2020-01-14"); +insert into diaries values(3107, "2020-01-15"); +insert into diaries values(3108, "2020-01-16"); +insert into diaries values(3109, "2020-01-17"); +insert into diaries values(3110, "2020-01-18"); +insert into diaries values(3111, "2020-01-19"); +insert into diaries values(3112, "2020-01-20"); +insert into diaries values(3113, "2020-01-21"); +insert into diaries values(3114, "2020-01-22"); +insert into diaries values(3115, "2020-01-23"); +insert into diaries values(3116, "2020-01-24"); +insert into diaries values(3117, "2020-01-25"); +insert into diaries values(3118, "2020-01-26"); +insert into diaries values(3119, "2020-01-27"); +insert into diaries values(3120, "2020-01-28"); +insert into diaries values(3121, "2020-01-29"); +insert into diaries values(3122, "2020-01-30"); +insert into diaries values(3123, "2020-01-31"); +insert into diaries values(3124, "2020-02-01"); +insert into diaries values(3125, "2020-02-02"); +insert into diaries values(3126, "2020-02-03"); +insert into diaries values(3127, "2020-02-04"); +insert into diaries values(3128, "2020-02-05"); +insert into diaries values(3129, "2020-02-06"); +insert into diaries values(3130, "2020-02-07"); +insert into diaries values(3131, "2020-02-08"); +insert into diaries values(3132, "2020-02-09"); +insert into diaries values(3133, "2020-02-10"); +insert into diaries values(3134, "2020-02-11"); +insert into diaries values(3135, "2020-02-12"); +insert into diaries values(3136, "2020-02-13"); +insert into diaries values(3137, "2020-02-14"); +insert into diaries values(3138, "2020-02-15"); +insert into diaries values(3139, "2020-02-16"); +insert into diaries values(3140, "2020-02-17"); +insert into diaries values(3141, "2020-02-18"); +insert into diaries values(3142, "2020-02-19"); +insert into diaries values(3143, "2020-02-20"); +insert into diaries values(3144, "2020-02-21"); +insert into diaries values(3145, "2020-02-22"); +insert into diaries values(3146, "2020-02-23"); +insert into diaries values(3147, "2020-02-24"); +insert into diaries values(3148, "2020-02-25"); +insert into diaries values(3149, "2020-02-26"); +insert into diaries values(3150, "2020-02-27"); +insert into diaries values(3151, "2020-02-28"); +insert into diaries values(3152, "2020-02-29"); +insert into diaries values(3153, "2020-03-01"); +insert into diaries values(3154, "2020-03-02"); +insert into diaries values(3155, "2020-03-03"); +insert into diaries values(3156, "2020-03-04"); +insert into diaries values(3157, "2020-03-05"); +insert into diaries values(3158, "2020-03-06"); +insert into diaries values(3159, "2020-03-07"); +insert into diaries values(3160, "2020-03-08"); +insert into diaries values(3161, "2020-03-09"); +insert into diaries values(3162, "2020-03-10"); +insert into diaries values(3163, "2020-03-11"); +insert into diaries values(3164, "2020-03-12"); +insert into diaries values(3165, "2020-03-13"); +insert into diaries values(3166, "2020-03-14"); +insert into diaries values(3167, "2020-03-15"); +insert into diaries values(3168, "2020-03-16"); +insert into diaries values(3169, "2020-03-17"); +insert into diaries values(3170, "2020-03-18"); +insert into diaries values(3171, "2020-03-19"); +insert into diaries values(3172, "2020-03-20"); +insert into diaries values(3173, "2020-03-21"); +insert into diaries values(3174, "2020-03-22"); +insert into diaries values(3175, "2020-03-23"); +insert into diaries values(3176, "2020-03-24"); +insert into diaries values(3177, "2020-03-25"); +insert into diaries values(3178, "2020-03-26"); +insert into diaries values(3179, "2020-03-27"); +insert into diaries values(3180, "2020-03-28"); +insert into diaries values(3181, "2020-03-29"); +insert into diaries values(3182, "2020-03-30"); +insert into diaries values(3183, "2020-03-31"); +insert into diaries values(3184, "2020-04-01"); +insert into diaries values(3185, "2020-04-02"); +insert into diaries values(3186, "2020-04-03"); +insert into diaries values(3187, "2020-04-04"); +insert into diaries values(3188, "2020-04-05"); +insert into diaries values(3189, "2020-04-06"); +insert into diaries values(3190, "2020-04-07"); +insert into diaries values(3191, "2020-04-08"); +insert into diaries values(3192, "2020-04-09"); +insert into diaries values(3193, "2020-04-10"); +insert into diaries values(3194, "2020-04-11"); +insert into diaries values(3195, "2020-04-12"); +insert into diaries values(3196, "2020-04-13"); +insert into diaries values(3197, "2020-04-14"); +insert into diaries values(3198, "2020-04-15"); +insert into diaries values(3199, "2020-04-16"); +insert into diaries values(3200, "2020-04-17"); +insert into diaries values(3201, "2020-04-18"); +insert into diaries values(3202, "2020-04-19"); +insert into diaries values(3203, "2020-04-20"); +insert into diaries values(3204, "2020-04-21"); +insert into diaries values(3205, "2020-04-22"); +insert into diaries values(3206, "2020-04-23"); +insert into diaries values(3207, "2020-04-24"); +insert into diaries values(3208, "2020-04-25"); +insert into diaries values(3209, "2020-04-26"); +insert into diaries values(3210, "2020-04-27"); +insert into diaries values(3211, "2020-04-28"); +insert into diaries values(3212, "2020-04-29"); +insert into diaries values(3213, "2020-04-30"); +insert into diaries values(3214, "2020-05-01"); +insert into diaries values(3215, "2020-05-02"); +insert into diaries values(3216, "2020-05-03"); +insert into diaries values(3217, "2020-05-04"); +insert into diaries values(3218, "2020-05-05"); +insert into diaries values(3219, "2020-05-06"); +insert into diaries values(3220, "2020-05-07"); +insert into diaries values(3221, "2020-05-08"); +insert into diaries values(3222, "2020-05-09"); +insert into diaries values(3223, "2020-05-10"); +insert into diaries values(3224, "2020-05-11"); +insert into diaries values(3225, "2020-05-12"); +insert into diaries values(3226, "2020-05-13"); +insert into diaries values(3227, "2020-05-14"); +insert into diaries values(3228, "2020-05-15"); +insert into diaries values(3229, "2020-05-16"); +insert into diaries values(3230, "2020-05-17"); +insert into diaries values(3231, "2020-05-18"); +insert into diaries values(3232, "2020-05-19"); +insert into diaries values(3233, "2020-05-20"); +insert into diaries values(3234, "2020-05-21"); +insert into diaries values(3235, "2020-05-22"); +insert into diaries values(3236, "2020-05-23"); +insert into diaries values(3237, "2020-05-24"); +insert into diaries values(3238, "2020-05-25"); +insert into diaries values(3239, "2020-05-26"); +insert into diaries values(3240, "2020-05-27"); +insert into diaries values(3241, "2020-05-28"); +insert into diaries values(3242, "2020-05-29"); +insert into diaries values(3243, "2020-05-30"); +insert into diaries values(3244, "2020-05-31"); +insert into diaries values(3245, "2020-06-01"); +insert into diaries values(3246, "2020-06-02"); +insert into diaries values(3247, "2020-06-03"); +insert into diaries values(3248, "2020-06-04"); +insert into diaries values(3249, "2020-06-05"); +insert into diaries values(3250, "2020-06-06"); +insert into diaries values(3251, "2020-06-07"); +insert into diaries values(3252, "2020-06-08"); +insert into diaries values(3253, "2020-06-09"); +insert into diaries values(3254, "2020-06-10"); +insert into diaries values(3255, "2020-06-11"); +insert into diaries values(3256, "2020-06-12"); +insert into diaries values(3257, "2020-06-13"); +insert into diaries values(3258, "2020-06-14"); +insert into diaries values(3259, "2020-06-15"); +insert into diaries values(3260, "2020-06-16"); +insert into diaries values(3261, "2020-06-17"); +insert into diaries values(3262, "2020-06-18"); +insert into diaries values(3263, "2020-06-19"); +insert into diaries values(3264, "2020-06-20"); +insert into diaries values(3265, "2020-06-21"); +insert into diaries values(3266, "2020-06-22"); +insert into diaries values(3267, "2020-06-23"); +insert into diaries values(3268, "2020-06-24"); +insert into diaries values(3269, "2020-06-25"); +insert into diaries values(3270, "2020-06-26"); +insert into diaries values(3271, "2020-06-27"); +insert into diaries values(3272, "2020-06-28"); +insert into diaries values(3273, "2020-06-29"); +insert into diaries values(3274, "2020-06-30"); +insert into diaries values(3275, "2020-07-01"); +insert into diaries values(3276, "2020-07-02"); +insert into diaries values(3277, "2020-07-03"); +insert into diaries values(3278, "2020-07-04"); +insert into diaries values(3279, "2020-07-05"); +insert into diaries values(3280, "2020-07-06"); +insert into diaries values(3281, "2020-07-07"); +insert into diaries values(3282, "2020-07-08"); +insert into diaries values(3283, "2020-07-09"); +insert into diaries values(3284, "2020-07-10"); +insert into diaries values(3285, "2020-07-11"); +insert into diaries values(3286, "2020-07-12"); +insert into diaries values(3287, "2020-07-13"); +insert into diaries values(3288, "2020-07-14"); +insert into diaries values(3289, "2020-07-15"); +insert into diaries values(3290, "2020-07-16"); +insert into diaries values(3291, "2020-07-17"); +insert into diaries values(3292, "2020-07-18"); +insert into diaries values(3293, "2020-07-19"); +insert into diaries values(3294, "2020-07-20"); +insert into diaries values(3295, "2020-07-21"); +insert into diaries values(3296, "2020-07-22"); +insert into diaries values(3297, "2020-07-23"); +insert into diaries values(3298, "2020-07-24"); +insert into diaries values(3299, "2020-07-25"); +insert into diaries values(3300, "2020-07-26"); +insert into diaries values(3301, "2020-07-27"); +insert into diaries values(3302, "2020-07-28"); +insert into diaries values(3303, "2020-07-29"); +insert into diaries values(3304, "2020-07-30"); +insert into diaries values(3305, "2020-07-31"); +insert into diaries values(3306, "2020-08-01"); +insert into diaries values(3307, "2020-08-02"); +insert into diaries values(3308, "2020-08-03"); +insert into diaries values(3309, "2020-08-04"); +insert into diaries values(3310, "2020-08-05"); +insert into diaries values(3311, "2020-08-06"); +insert into diaries values(3312, "2020-08-07"); +insert into diaries values(3313, "2020-08-08"); +insert into diaries values(3314, "2020-08-09"); +insert into diaries values(3315, "2020-08-10"); +insert into diaries values(3316, "2020-08-11"); +insert into diaries values(3317, "2020-08-12"); +insert into diaries values(3318, "2020-08-13"); +insert into diaries values(3319, "2020-08-14"); +insert into diaries values(3320, "2020-08-15"); +insert into diaries values(3321, "2020-08-16"); +insert into diaries values(3322, "2020-08-17"); +insert into diaries values(3323, "2020-08-18"); +insert into diaries values(3324, "2020-08-19"); +insert into diaries values(3325, "2020-08-20"); +insert into diaries values(3326, "2020-08-21"); +insert into diaries values(3327, "2020-08-22"); +insert into diaries values(3328, "2020-08-23"); +insert into diaries values(3329, "2020-08-24"); +insert into diaries values(3330, "2020-08-25"); +insert into diaries values(3331, "2020-08-26"); +insert into diaries values(3332, "2020-08-27"); +insert into diaries values(3333, "2020-08-28"); +insert into diaries values(3334, "2020-08-29"); +insert into diaries values(3335, "2020-08-30"); +insert into diaries values(3336, "2020-08-31"); +insert into diaries values(3337, "2020-09-01"); +insert into diaries values(3338, "2020-09-02"); +insert into diaries values(3339, "2020-09-03"); +insert into diaries values(3340, "2020-09-04"); +insert into diaries values(3341, "2020-09-05"); +insert into diaries values(3342, "2020-09-06"); +insert into diaries values(3343, "2020-09-07"); +insert into diaries values(3344, "2020-09-08"); +insert into diaries values(3345, "2020-09-09"); +insert into diaries values(3346, "2020-09-10"); +insert into diaries values(3347, "2020-09-11"); +insert into diaries values(3348, "2020-09-12"); +insert into diaries values(3349, "2020-09-13"); +insert into diaries values(3350, "2020-09-14"); +insert into diaries values(3351, "2020-09-15"); +insert into diaries values(3352, "2020-09-16"); +insert into diaries values(3353, "2020-09-17"); +insert into diaries values(3354, "2020-09-18"); +insert into diaries values(3355, "2020-09-19"); +insert into diaries values(3356, "2020-09-20"); +insert into diaries values(3357, "2020-09-21"); +insert into diaries values(3358, "2020-09-22"); +insert into diaries values(3359, "2020-09-23"); +insert into diaries values(3360, "2020-09-24"); +insert into diaries values(3361, "2020-09-25"); +insert into diaries values(3362, "2020-09-26"); +insert into diaries values(3363, "2020-09-27"); +insert into diaries values(3364, "2020-09-28"); +insert into diaries values(3365, "2020-09-29"); +insert into diaries values(3366, "2020-09-30"); +insert into diaries values(3367, "2020-10-01"); +insert into diaries values(3368, "2020-10-02"); +insert into diaries values(3369, "2020-10-03"); +insert into diaries values(3370, "2020-10-04"); +insert into diaries values(3371, "2020-10-05"); +insert into diaries values(3372, "2020-10-06"); +insert into diaries values(3373, "2020-10-07"); +insert into diaries values(3374, "2020-10-08"); +insert into diaries values(3375, "2020-10-09"); +insert into diaries values(3376, "2020-10-10"); +insert into diaries values(3377, "2020-10-11"); +insert into diaries values(3378, "2020-10-12"); +insert into diaries values(3379, "2020-10-13"); +insert into diaries values(3380, "2020-10-14"); +insert into diaries values(3381, "2020-10-15"); +insert into diaries values(3382, "2020-10-16"); +insert into diaries values(3383, "2020-10-17"); +insert into diaries values(3384, "2020-10-18"); +insert into diaries values(3385, "2020-10-19"); +insert into diaries values(3386, "2020-10-20"); +insert into diaries values(3387, "2020-10-21"); +insert into diaries values(3388, "2020-10-22"); +insert into diaries values(3389, "2020-10-23"); +insert into diaries values(3390, "2020-10-24"); +insert into diaries values(3391, "2020-10-25"); +insert into diaries values(3392, "2020-10-26"); +insert into diaries values(3393, "2020-10-27"); +insert into diaries values(3394, "2020-10-28"); +insert into diaries values(3395, "2020-10-29"); +insert into diaries values(3396, "2020-10-30"); +insert into diaries values(3397, "2020-10-31"); +insert into diaries values(3398, "2020-11-01"); +insert into diaries values(3399, "2020-11-02"); +insert into diaries values(3400, "2020-11-03"); +insert into diaries values(3401, "2020-11-04"); +insert into diaries values(3402, "2020-11-05"); +insert into diaries values(3403, "2020-11-06"); +insert into diaries values(3404, "2020-11-07"); +insert into diaries values(3405, "2020-11-08"); +insert into diaries values(3406, "2020-11-09"); +insert into diaries values(3407, "2020-11-10"); +insert into diaries values(3408, "2020-11-11"); +insert into diaries values(3409, "2020-11-12"); +insert into diaries values(3410, "2020-11-13"); +insert into diaries values(3411, "2020-11-14"); +insert into diaries values(3412, "2020-11-15"); +insert into diaries values(3413, "2020-11-16"); +insert into diaries values(3414, "2020-11-17"); +insert into diaries values(3415, "2020-11-18"); +insert into diaries values(3416, "2020-11-19"); +insert into diaries values(3417, "2020-11-20"); +insert into diaries values(3418, "2020-11-21"); +insert into diaries values(3419, "2020-11-22"); +insert into diaries values(3420, "2020-11-23"); +insert into diaries values(3421, "2020-11-24"); +insert into diaries values(3422, "2020-11-25"); +insert into diaries values(3423, "2020-11-26"); +insert into diaries values(3424, "2020-11-27"); +insert into diaries values(3425, "2020-11-28"); +insert into diaries values(3426, "2020-11-29"); +insert into diaries values(3427, "2020-11-30"); +insert into diaries values(3428, "2020-12-01"); +insert into diaries values(3429, "2020-12-02"); +insert into diaries values(3430, "2020-12-03"); +insert into diaries values(3431, "2020-12-04"); +insert into diaries values(3432, "2020-12-05"); +insert into diaries values(3433, "2020-12-06"); +insert into diaries values(3434, "2020-12-07"); +insert into diaries values(3435, "2020-12-08"); +insert into diaries values(3436, "2020-12-09"); +insert into diaries values(3437, "2020-12-10"); +insert into diaries values(3438, "2020-12-11"); +insert into diaries values(3439, "2020-12-12"); +insert into diaries values(3440, "2020-12-13"); +insert into diaries values(3441, "2020-12-14"); +insert into diaries values(3442, "2020-12-15"); +insert into diaries values(3443, "2020-12-16"); +insert into diaries values(3444, "2020-12-17"); +insert into diaries values(3445, "2020-12-18"); +insert into diaries values(3446, "2020-12-19"); +insert into diaries values(3447, "2020-12-20"); +insert into diaries values(3448, "2020-12-21"); +insert into diaries values(3449, "2020-12-22"); +insert into diaries values(3450, "2020-12-23"); +insert into diaries values(3451, "2020-12-24"); +insert into diaries values(3452, "2020-12-25"); +insert into diaries values(3453, "2020-12-26"); +insert into diaries values(3454, "2020-12-27"); +insert into diaries values(3455, "2020-12-28"); +insert into diaries values(3456, "2020-12-29"); +insert into diaries values(3457, "2020-12-30"); +insert into diaries values(3458, "2020-12-31"); +insert into diaries values(3459, "2021-01-01"); +insert into diaries values(3460, "2021-01-02"); +insert into diaries values(3461, "2021-01-03"); +insert into diaries values(3462, "2021-01-04"); +insert into diaries values(3463, "2021-01-05"); +insert into diaries values(3464, "2021-01-06"); +insert into diaries values(3465, "2021-01-07"); +insert into diaries values(3466, "2021-01-08"); +insert into diaries values(3467, "2021-01-09"); +insert into diaries values(3468, "2021-01-10"); +insert into diaries values(3469, "2021-01-11"); +insert into diaries values(3470, "2021-01-12"); +insert into diaries values(3471, "2021-01-13"); +insert into diaries values(3472, "2021-01-14"); +insert into diaries values(3473, "2021-01-15"); +insert into diaries values(3474, "2021-01-16"); +insert into diaries values(3475, "2021-01-17"); +insert into diaries values(3476, "2021-01-18"); +insert into diaries values(3477, "2021-01-19"); +insert into diaries values(3478, "2021-01-20"); +insert into diaries values(3479, "2021-01-21"); +insert into diaries values(3480, "2021-01-22"); +insert into diaries values(3481, "2021-01-23"); +insert into diaries values(3482, "2021-01-24"); +insert into diaries values(3483, "2021-01-25"); +insert into diaries values(3484, "2021-01-26"); +insert into diaries values(3485, "2021-01-27"); +insert into diaries values(3486, "2021-01-28"); +insert into diaries values(3487, "2021-01-29"); +insert into diaries values(3488, "2021-01-30"); +insert into diaries values(3489, "2021-01-31"); +insert into diaries values(3490, "2021-02-01"); +insert into diaries values(3491, "2021-02-02"); +insert into diaries values(3492, "2021-02-03"); +insert into diaries values(3493, "2021-02-04"); +insert into diaries values(3494, "2021-02-05"); +insert into diaries values(3495, "2021-02-06"); +insert into diaries values(3496, "2021-02-07"); +insert into diaries values(3497, "2021-02-08"); +insert into diaries values(3498, "2021-02-09"); +insert into diaries values(3499, "2021-02-10"); +insert into diaries values(3500, "2021-02-11"); +insert into diaries values(3501, "2021-02-12"); +insert into diaries values(3502, "2021-02-13"); +insert into diaries values(3503, "2021-02-14"); +insert into diaries values(3504, "2021-02-15"); +insert into diaries values(3505, "2021-02-16"); +insert into diaries values(3506, "2021-02-17"); +insert into diaries values(3507, "2021-02-18"); +insert into diaries values(3508, "2021-02-19"); +insert into diaries values(3509, "2021-02-20"); +insert into diaries values(3510, "2021-02-21"); +insert into diaries values(3511, "2021-02-22"); +insert into diaries values(3512, "2021-02-23"); +insert into diaries values(3513, "2021-02-24"); +insert into diaries values(3514, "2021-02-25"); +insert into diaries values(3515, "2021-02-26"); +insert into diaries values(3516, "2021-02-27"); +insert into diaries values(3517, "2021-02-28"); +insert into diaries values(3518, "2021-03-01"); +insert into diaries values(3519, "2021-03-02"); +insert into diaries values(3520, "2021-03-03"); +insert into diaries values(3521, "2021-03-04"); +insert into diaries values(3522, "2021-03-05"); +insert into diaries values(3523, "2021-03-06"); +insert into diaries values(3524, "2021-03-07"); +insert into diaries values(3525, "2021-03-08"); +insert into diaries values(3526, "2021-03-09"); +insert into diaries values(3527, "2021-03-10"); +insert into diaries values(3528, "2021-03-11"); +insert into diaries values(3529, "2021-03-12"); +insert into diaries values(3530, "2021-03-13"); +insert into diaries values(3531, "2021-03-14"); +insert into diaries values(3532, "2021-03-15"); +insert into diaries values(3533, "2021-03-16"); +insert into diaries values(3534, "2021-03-17"); +insert into diaries values(3535, "2021-03-18"); +insert into diaries values(3536, "2021-03-19"); +insert into diaries values(3537, "2021-03-20"); +insert into diaries values(3538, "2021-03-21"); +insert into diaries values(3539, "2021-03-22"); +insert into diaries values(3540, "2021-03-23"); +insert into diaries values(3541, "2021-03-24"); +insert into diaries values(3542, "2021-03-25"); +insert into diaries values(3543, "2021-03-26"); +insert into diaries values(3544, "2021-03-27"); +insert into diaries values(3545, "2021-03-28"); +insert into diaries values(3546, "2021-03-29"); +insert into diaries values(3547, "2021-03-30"); +insert into diaries values(3548, "2021-03-31"); +insert into diaries values(3549, "2021-04-01"); +insert into diaries values(3550, "2021-04-02"); +insert into diaries values(3551, "2021-04-03"); +insert into diaries values(3552, "2021-04-04"); +insert into diaries values(3553, "2021-04-05"); +insert into diaries values(3554, "2021-04-06"); +insert into diaries values(3555, "2021-04-07"); +insert into diaries values(3556, "2021-04-08"); +insert into diaries values(3557, "2021-04-09"); +insert into diaries values(3558, "2021-04-10"); +insert into diaries values(3559, "2021-04-11"); +insert into diaries values(3560, "2021-04-12"); +insert into diaries values(3561, "2021-04-13"); +insert into diaries values(3562, "2021-04-14"); +insert into diaries values(3563, "2021-04-15"); +insert into diaries values(3564, "2021-04-16"); +insert into diaries values(3565, "2021-04-17"); +insert into diaries values(3566, "2021-04-18"); +insert into diaries values(3567, "2021-04-19"); +insert into diaries values(3568, "2021-04-20"); +insert into diaries values(3569, "2021-04-21"); +insert into diaries values(3570, "2021-04-22"); +insert into diaries values(3571, "2021-04-23"); +insert into diaries values(3572, "2021-04-24"); +insert into diaries values(3573, "2021-04-25"); +insert into diaries values(3574, "2021-04-26"); +insert into diaries values(3575, "2021-04-27"); +insert into diaries values(3576, "2021-04-28"); +insert into diaries values(3577, "2021-04-29"); +insert into diaries values(3578, "2021-04-30"); +insert into diaries values(3579, "2021-05-01"); +insert into diaries values(3580, "2021-05-02"); +insert into diaries values(3581, "2021-05-03"); +insert into diaries values(3582, "2021-05-04"); +insert into diaries values(3583, "2021-05-05"); +insert into diaries values(3584, "2021-05-06"); +insert into diaries values(3585, "2021-05-07"); +insert into diaries values(3586, "2021-05-08"); +insert into diaries values(3587, "2021-05-09"); +insert into diaries values(3588, "2021-05-10"); +insert into diaries values(3589, "2021-05-11"); +insert into diaries values(3590, "2021-05-12"); +insert into diaries values(3591, "2021-05-13"); +insert into diaries values(3592, "2021-05-14"); +insert into diaries values(3593, "2021-05-15"); +insert into diaries values(3594, "2021-05-16"); +insert into diaries values(3595, "2021-05-17"); +insert into diaries values(3596, "2021-05-18"); +insert into diaries values(3597, "2021-05-19"); +insert into diaries values(3598, "2021-05-20"); +insert into diaries values(3599, "2021-05-21"); +insert into diaries values(3600, "2021-05-22"); +insert into diaries values(3601, "2021-05-23"); +insert into diaries values(3602, "2021-05-24"); +insert into diaries values(3603, "2021-05-25"); +insert into diaries values(3604, "2021-05-26"); +insert into diaries values(3605, "2021-05-27"); +insert into diaries values(3606, "2021-05-28"); +insert into diaries values(3607, "2021-05-29"); +insert into diaries values(3608, "2021-05-30"); +insert into diaries values(3609, "2021-05-31"); +insert into diaries values(3610, "2021-06-01"); +insert into diaries values(3611, "2021-06-02"); +insert into diaries values(3612, "2021-06-03"); +insert into diaries values(3613, "2021-06-04"); +insert into diaries values(3614, "2021-06-05"); +insert into diaries values(3615, "2021-06-06"); +insert into diaries values(3616, "2021-06-07"); +insert into diaries values(3617, "2021-06-08"); +insert into diaries values(3618, "2021-06-09"); +insert into diaries values(3619, "2021-06-10"); +insert into diaries values(3620, "2021-06-11"); +insert into diaries values(3621, "2021-06-12"); +insert into diaries values(3622, "2021-06-13"); +insert into diaries values(3623, "2021-06-14"); +insert into diaries values(3624, "2021-06-15"); +insert into diaries values(3625, "2021-06-16"); +insert into diaries values(3626, "2021-06-17"); +insert into diaries values(3627, "2021-06-18"); +insert into diaries values(3628, "2021-06-19"); +insert into diaries values(3629, "2021-06-20"); +insert into diaries values(3630, "2021-06-21"); +insert into diaries values(3631, "2021-06-22"); +insert into diaries values(3632, "2021-06-23"); +insert into diaries values(3633, "2021-06-24"); +insert into diaries values(3634, "2021-06-25"); +insert into diaries values(3635, "2021-06-26"); +insert into diaries values(3636, "2021-06-27"); +insert into diaries values(3637, "2021-06-28"); +insert into diaries values(3638, "2021-06-29"); +insert into diaries values(3639, "2021-06-30"); +insert into diaries values(3640, "2021-07-01"); +insert into diaries values(3641, "2021-07-02"); +insert into diaries values(3642, "2021-07-03"); +insert into diaries values(3643, "2021-07-04"); +insert into diaries values(3644, "2021-07-05"); +insert into diaries values(3645, "2021-07-06"); +insert into diaries values(3646, "2021-07-07"); +insert into diaries values(3647, "2021-07-08"); +insert into diaries values(3648, "2021-07-09"); +insert into diaries values(3649, "2021-07-10"); +insert into diaries values(3650, "2021-07-11"); +insert into diaries values(3651, "2021-07-12"); +insert into diaries values(3652, "2021-07-13"); +insert into diaries values(3653, "2021-07-14"); +insert into diaries values(3654, "2021-07-15"); +insert into diaries values(3655, "2021-07-16"); +insert into diaries values(3656, "2021-07-17"); +insert into diaries values(3657, "2021-07-18"); +insert into diaries values(3658, "2021-07-19"); +insert into diaries values(3659, "2021-07-20"); +insert into diaries values(3660, "2021-07-21"); +insert into diaries values(3661, "2021-07-22"); +insert into diaries values(3662, "2021-07-23"); +insert into diaries values(3663, "2021-07-24"); +insert into diaries values(3664, "2021-07-25"); +insert into diaries values(3665, "2021-07-26"); +insert into diaries values(3666, "2021-07-27"); +insert into diaries values(3667, "2021-07-28"); +insert into diaries values(3668, "2021-07-29"); +insert into diaries values(3669, "2021-07-30"); +insert into diaries values(3670, "2021-07-31"); +insert into diaries values(3671, "2021-08-01"); +insert into diaries values(3672, "2021-08-02"); +insert into diaries values(3673, "2021-08-03"); +insert into diaries values(3674, "2021-08-04"); +insert into diaries values(3675, "2021-08-05"); +insert into diaries values(3676, "2021-08-06"); +insert into diaries values(3677, "2021-08-07"); +insert into diaries values(3678, "2021-08-08"); +insert into diaries values(3679, "2021-08-09"); +insert into diaries values(3680, "2021-08-10"); +insert into diaries values(3681, "2021-08-11"); +insert into diaries values(3682, "2021-08-12"); +insert into diaries values(3683, "2021-08-13"); +insert into diaries values(3684, "2021-08-14"); +insert into diaries values(3685, "2021-08-15"); +insert into diaries values(3686, "2021-08-16"); +insert into diaries values(3687, "2021-08-17"); +insert into diaries values(3688, "2021-08-18"); +insert into diaries values(3689, "2021-08-19"); +insert into diaries values(3690, "2021-08-20"); +insert into diaries values(3691, "2021-08-21"); +insert into diaries values(3692, "2021-08-22"); +insert into diaries values(3693, "2021-08-23"); +insert into diaries values(3694, "2021-08-24"); +insert into diaries values(3695, "2021-08-25"); +insert into diaries values(3696, "2021-08-26"); +insert into diaries values(3697, "2021-08-27"); +insert into diaries values(3698, "2021-08-28"); +insert into diaries values(3699, "2021-08-29"); +insert into diaries values(3700, "2021-08-30"); +insert into diaries values(3701, "2021-08-31"); +insert into diaries values(3702, "2021-09-01"); +insert into diaries values(3703, "2021-09-02"); +insert into diaries values(3704, "2021-09-03"); +insert into diaries values(3705, "2021-09-04"); +insert into diaries values(3706, "2021-09-05"); +insert into diaries values(3707, "2021-09-06"); +insert into diaries values(3708, "2021-09-07"); +insert into diaries values(3709, "2021-09-08"); +insert into diaries values(3710, "2021-09-09"); +insert into diaries values(3711, "2021-09-10"); +insert into diaries values(3712, "2021-09-11"); +insert into diaries values(3713, "2021-09-12"); +insert into diaries values(3714, "2021-09-13"); +insert into diaries values(3715, "2021-09-14"); +insert into diaries values(3716, "2021-09-15"); +insert into diaries values(3717, "2021-09-16"); +insert into diaries values(3718, "2021-09-17"); +insert into diaries values(3719, "2021-09-18"); +insert into diaries values(3720, "2021-09-19"); +insert into diaries values(3721, "2021-09-20"); +insert into diaries values(3722, "2021-09-21"); +insert into diaries values(3723, "2021-09-22"); +insert into diaries values(3724, "2021-09-23"); +insert into diaries values(3725, "2021-09-24"); +insert into diaries values(3726, "2021-09-25"); +insert into diaries values(3727, "2021-09-26"); +insert into diaries values(3728, "2021-09-27"); +insert into diaries values(3729, "2021-09-28"); +insert into diaries values(3730, "2021-09-29"); +insert into diaries values(3731, "2021-09-30"); +insert into diaries values(3732, "2021-10-01"); +insert into diaries values(3733, "2021-10-02"); +insert into diaries values(3734, "2021-10-03"); +insert into diaries values(3735, "2021-10-04"); +insert into diaries values(3736, "2021-10-05"); +insert into diaries values(3737, "2021-10-06"); +insert into diaries values(3738, "2021-10-07"); +insert into diaries values(3739, "2021-10-08"); +insert into diaries values(3740, "2021-10-09"); +insert into diaries values(3741, "2021-10-10"); +insert into diaries values(3742, "2021-10-11"); +insert into diaries values(3743, "2021-10-12"); +insert into diaries values(3744, "2021-10-13"); +insert into diaries values(3745, "2021-10-14"); +insert into diaries values(3746, "2021-10-15"); +insert into diaries values(3747, "2021-10-16"); +insert into diaries values(3748, "2021-10-17"); +insert into diaries values(3749, "2021-10-18"); +insert into diaries values(3750, "2021-10-19"); +insert into diaries values(3751, "2021-10-20"); +insert into diaries values(3752, "2021-10-21"); +insert into diaries values(3753, "2021-10-22"); +insert into diaries values(3754, "2021-10-23"); +insert into diaries values(3755, "2021-10-24"); +insert into diaries values(3756, "2021-10-25"); +insert into diaries values(3757, "2021-10-26"); +insert into diaries values(3758, "2021-10-27"); +insert into diaries values(3759, "2021-10-28"); +insert into diaries values(3760, "2021-10-29"); +insert into diaries values(3761, "2021-10-30"); +insert into diaries values(3762, "2021-10-31"); +insert into diaries values(3763, "2021-11-01"); +insert into diaries values(3764, "2021-11-02"); +insert into diaries values(3765, "2021-11-03"); +insert into diaries values(3766, "2021-11-04"); +insert into diaries values(3767, "2021-11-05"); +insert into diaries values(3768, "2021-11-06"); +insert into diaries values(3769, "2021-11-07"); +insert into diaries values(3770, "2021-11-08"); +insert into diaries values(3771, "2021-11-09"); +insert into diaries values(3772, "2021-11-10"); +insert into diaries values(3773, "2021-11-11"); +insert into diaries values(3774, "2021-11-12"); +insert into diaries values(3775, "2021-11-13"); +insert into diaries values(3776, "2021-11-14"); +insert into diaries values(3777, "2021-11-15"); +insert into diaries values(3778, "2021-11-16"); +insert into diaries values(3779, "2021-11-17"); +insert into diaries values(3780, "2021-11-18"); +insert into diaries values(3781, "2021-11-19"); +insert into diaries values(3782, "2021-11-20"); +insert into diaries values(3783, "2021-11-21"); +insert into diaries values(3784, "2021-11-22"); +insert into diaries values(3785, "2021-11-23"); +insert into diaries values(3786, "2021-11-24"); +insert into diaries values(3787, "2021-11-25"); +insert into diaries values(3788, "2021-11-26"); +insert into diaries values(3789, "2021-11-27"); +insert into diaries values(3790, "2021-11-28"); +insert into diaries values(3791, "2021-11-29"); +insert into diaries values(3792, "2021-11-30"); +insert into diaries values(3793, "2021-12-01"); +insert into diaries values(3794, "2021-12-02"); +insert into diaries values(3795, "2021-12-03"); +insert into diaries values(3796, "2021-12-04"); +insert into diaries values(3797, "2021-12-05"); +insert into diaries values(3798, "2021-12-06"); +insert into diaries values(3799, "2021-12-07"); +insert into diaries values(3800, "2021-12-08"); +insert into diaries values(3801, "2021-12-09"); +insert into diaries values(3802, "2021-12-10"); +insert into diaries values(3803, "2021-12-11"); +insert into diaries values(3804, "2021-12-12"); +insert into diaries values(3805, "2021-12-13"); +insert into diaries values(3806, "2021-12-14"); +insert into diaries values(3807, "2021-12-15"); +insert into diaries values(3808, "2021-12-16"); +insert into diaries values(3809, "2021-12-17"); +insert into diaries values(3810, "2021-12-18"); +insert into diaries values(3811, "2021-12-19"); +insert into diaries values(3812, "2021-12-20"); +insert into diaries values(3813, "2021-12-21"); +insert into diaries values(3814, "2021-12-22"); +insert into diaries values(3815, "2021-12-23"); +insert into diaries values(3816, "2021-12-24"); +insert into diaries values(3817, "2021-12-25"); +insert into diaries values(3818, "2021-12-26"); +insert into diaries values(3819, "2021-12-27"); +insert into diaries values(3820, "2021-12-28"); +insert into diaries values(3821, "2021-12-29"); +insert into diaries values(3822, "2021-12-30"); +insert into diaries values(3823, "2021-12-31"); +insert into diaries values(3824, "2022-01-01"); +insert into diaries values(3825, "2022-01-02"); +insert into diaries values(3826, "2022-01-03"); +insert into diaries values(3827, "2022-01-04"); +insert into diaries values(3828, "2022-01-05"); +insert into diaries values(3829, "2022-01-06"); +insert into diaries values(3830, "2022-01-07"); +insert into diaries values(3831, "2022-01-08"); +insert into diaries values(3832, "2022-01-09"); +insert into diaries values(3833, "2022-01-10"); +insert into diaries values(3834, "2022-01-11"); +insert into diaries values(3835, "2022-01-12"); +insert into diaries values(3836, "2022-01-13"); +insert into diaries values(3837, "2022-01-14"); +insert into diaries values(3838, "2022-01-15"); +insert into diaries values(3839, "2022-01-16"); +insert into diaries values(3840, "2022-01-17"); +insert into diaries values(3841, "2022-01-18"); +insert into diaries values(3842, "2022-01-19"); +insert into diaries values(3843, "2022-01-20"); +insert into diaries values(3844, "2022-01-21"); +insert into diaries values(3845, "2022-01-22"); +insert into diaries values(3846, "2022-01-23"); +insert into diaries values(3847, "2022-01-24"); +insert into diaries values(3848, "2022-01-25"); +insert into diaries values(3849, "2022-01-26"); +insert into diaries values(3850, "2022-01-27"); +insert into diaries values(3851, "2022-01-28"); +insert into diaries values(3852, "2022-01-29"); +insert into diaries values(3853, "2022-01-30"); +insert into diaries values(3854, "2022-01-31"); +insert into diaries values(3855, "2022-02-01"); +insert into diaries values(3856, "2022-02-02"); +insert into diaries values(3857, "2022-02-03"); +insert into diaries values(3858, "2022-02-04"); +insert into diaries values(3859, "2022-02-05"); +insert into diaries values(3860, "2022-02-06"); +insert into diaries values(3861, "2022-02-07"); +insert into diaries values(3862, "2022-02-08"); +insert into diaries values(3863, "2022-02-09"); +insert into diaries values(3864, "2022-02-10"); +insert into diaries values(3865, "2022-02-11"); +insert into diaries values(3866, "2022-02-12"); +insert into diaries values(3867, "2022-02-13"); +insert into diaries values(3868, "2022-02-14"); +insert into diaries values(3869, "2022-02-15"); +insert into diaries values(3870, "2022-02-16"); +insert into diaries values(3871, "2022-02-17"); +insert into diaries values(3872, "2022-02-18"); +insert into diaries values(3873, "2022-02-19"); +insert into diaries values(3874, "2022-02-20"); +insert into diaries values(3875, "2022-02-21"); +insert into diaries values(3876, "2022-02-22"); +insert into diaries values(3877, "2022-02-23"); +insert into diaries values(3878, "2022-02-24"); +insert into diaries values(3879, "2022-02-25"); +insert into diaries values(3880, "2022-02-26"); +insert into diaries values(3881, "2022-02-27"); +insert into diaries values(3882, "2022-02-28"); +insert into diaries values(3883, "2022-03-01"); +insert into diaries values(3884, "2022-03-02"); +insert into diaries values(3885, "2022-03-03"); +insert into diaries values(3886, "2022-03-04"); +insert into diaries values(3887, "2022-03-05"); +insert into diaries values(3888, "2022-03-06"); +insert into diaries values(3889, "2022-03-07"); +insert into diaries values(3890, "2022-03-08"); +insert into diaries values(3891, "2022-03-09"); +insert into diaries values(3892, "2022-03-10"); +insert into diaries values(3893, "2022-03-11"); +insert into diaries values(3894, "2022-03-12"); +insert into diaries values(3895, "2022-03-13"); +insert into diaries values(3896, "2022-03-14"); +insert into diaries values(3897, "2022-03-15"); +insert into diaries values(3898, "2022-03-16"); +insert into diaries values(3899, "2022-03-17"); +insert into diaries values(3900, "2022-03-18"); +insert into diaries values(3901, "2022-03-19"); +insert into diaries values(3902, "2022-03-20"); +insert into diaries values(3903, "2022-03-21"); +insert into diaries values(3904, "2022-03-22"); +insert into diaries values(3905, "2022-03-23"); +insert into diaries values(3906, "2022-03-24"); +insert into diaries values(3907, "2022-03-25"); +insert into diaries values(3908, "2022-03-26"); +insert into diaries values(3909, "2022-03-27"); +insert into diaries values(3910, "2022-03-28"); +insert into diaries values(3911, "2022-03-29"); +insert into diaries values(3912, "2022-03-30"); +insert into diaries values(3913, "2022-03-31"); +insert into diaries values(3914, "2022-04-01"); +insert into diaries values(3915, "2022-04-02"); +insert into diaries values(3916, "2022-04-03"); +insert into diaries values(3917, "2022-04-04"); +insert into diaries values(3918, "2022-04-05"); +insert into diaries values(3919, "2022-04-06"); +insert into diaries values(3920, "2022-04-07"); +insert into diaries values(3921, "2022-04-08"); +insert into diaries values(3922, "2022-04-09"); +insert into diaries values(3923, "2022-04-10"); +insert into diaries values(3924, "2022-04-11"); +insert into diaries values(3925, "2022-04-12"); +insert into diaries values(3926, "2022-04-13"); +insert into diaries values(3927, "2022-04-14"); +insert into diaries values(3928, "2022-04-15"); +insert into diaries values(3929, "2022-04-16"); +insert into diaries values(3930, "2022-04-17"); +insert into diaries values(3931, "2022-04-18"); +insert into diaries values(3932, "2022-04-19"); +insert into diaries values(3933, "2022-04-20"); +insert into diaries values(3934, "2022-04-21"); +insert into diaries values(3935, "2022-04-22"); +insert into diaries values(3936, "2022-04-23"); +insert into diaries values(3937, "2022-04-24"); +insert into diaries values(3938, "2022-04-25"); +insert into diaries values(3939, "2022-04-26"); +insert into diaries values(3940, "2022-04-27"); +insert into diaries values(3941, "2022-04-28"); +insert into diaries values(3942, "2022-04-29"); +insert into diaries values(3943, "2022-04-30"); +insert into diaries values(3944, "2022-05-01"); +insert into diaries values(3945, "2022-05-02"); +insert into diaries values(3946, "2022-05-03"); +insert into diaries values(3947, "2022-05-04"); +insert into diaries values(3948, "2022-05-05"); +insert into diaries values(3949, "2022-05-06"); +insert into diaries values(3950, "2022-05-07"); +insert into diaries values(3951, "2022-05-08"); +insert into diaries values(3952, "2022-05-09"); +insert into diaries values(3953, "2022-05-10"); +insert into diaries values(3954, "2022-05-11"); +insert into diaries values(3955, "2022-05-12"); +insert into diaries values(3956, "2022-05-13"); +insert into diaries values(3957, "2022-05-14"); +insert into diaries values(3958, "2022-05-15"); +insert into diaries values(3959, "2022-05-16"); +insert into diaries values(3960, "2022-05-17"); +insert into diaries values(3961, "2022-05-18"); +insert into diaries values(3962, "2022-05-19"); +insert into diaries values(3963, "2022-05-20"); +insert into diaries values(3964, "2022-05-21"); +insert into diaries values(3965, "2022-05-22"); +insert into diaries values(3966, "2022-05-23"); +insert into diaries values(3967, "2022-05-24"); +insert into diaries values(3968, "2022-05-25"); +insert into diaries values(3969, "2022-05-26"); +insert into diaries values(3970, "2022-05-27"); +insert into diaries values(3971, "2022-05-28"); +insert into diaries values(3972, "2022-05-29"); +insert into diaries values(3973, "2022-05-30"); +insert into diaries values(3974, "2022-05-31"); +insert into diaries values(3975, "2022-06-01"); +insert into diaries values(3976, "2022-06-02"); +insert into diaries values(3977, "2022-06-03"); +insert into diaries values(3978, "2022-06-04"); +insert into diaries values(3979, "2022-06-05"); +insert into diaries values(3980, "2022-06-06"); +insert into diaries values(3981, "2022-06-07"); +insert into diaries values(3982, "2022-06-08"); +insert into diaries values(3983, "2022-06-09"); +insert into diaries values(3984, "2022-06-10"); +insert into diaries values(3985, "2022-06-11"); +insert into diaries values(3986, "2022-06-12"); +insert into diaries values(3987, "2022-06-13"); +insert into diaries values(3988, "2022-06-14"); +insert into diaries values(3989, "2022-06-15"); +insert into diaries values(3990, "2022-06-16"); +insert into diaries values(3991, "2022-06-17"); +insert into diaries values(3992, "2022-06-18"); +insert into diaries values(3993, "2022-06-19"); +insert into diaries values(3994, "2022-06-20"); +insert into diaries values(3995, "2022-06-21"); +insert into diaries values(3996, "2022-06-22"); +insert into diaries values(3997, "2022-06-23"); +insert into diaries values(3998, "2022-06-24"); +insert into diaries values(3999, "2022-06-25"); +insert into diaries values(4000, "2022-06-26"); +insert into diaries values(4001, "2022-06-27"); +insert into diaries values(4002, "2022-06-28"); +insert into diaries values(4003, "2022-06-29"); +insert into diaries values(4004, "2022-06-30"); +insert into diaries values(4005, "2022-07-01"); +insert into diaries values(4006, "2022-07-02"); +insert into diaries values(4007, "2022-07-03"); +insert into diaries values(4008, "2022-07-04"); +insert into diaries values(4009, "2022-07-05"); +insert into diaries values(4010, "2022-07-06"); +insert into diaries values(4011, "2022-07-07"); +insert into diaries values(4012, "2022-07-08"); +insert into diaries values(4013, "2022-07-09"); +insert into diaries values(4014, "2022-07-10"); +insert into diaries values(4015, "2022-07-11"); +insert into diaries values(4016, "2022-07-12"); +insert into diaries values(4017, "2022-07-13"); +insert into diaries values(4018, "2022-07-14"); +insert into diaries values(4019, "2022-07-15"); +insert into diaries values(4020, "2022-07-16"); +insert into diaries values(4021, "2022-07-17"); +insert into diaries values(4022, "2022-07-18"); +insert into diaries values(4023, "2022-07-19"); +insert into diaries values(4024, "2022-07-20"); +insert into diaries values(4025, "2022-07-21"); +insert into diaries values(4026, "2022-07-22"); +insert into diaries values(4027, "2022-07-23"); +insert into diaries values(4028, "2022-07-24"); +insert into diaries values(4029, "2022-07-25"); +insert into diaries values(4030, "2022-07-26"); +insert into diaries values(4031, "2022-07-27"); +insert into diaries values(4032, "2022-07-28"); +insert into diaries values(4033, "2022-07-29"); +insert into diaries values(4034, "2022-07-30"); +insert into diaries values(4035, "2022-07-31"); +insert into diaries values(4036, "2022-08-01"); +insert into diaries values(4037, "2022-08-02"); +insert into diaries values(4038, "2022-08-03"); +insert into diaries values(4039, "2022-08-04"); +insert into diaries values(4040, "2022-08-05"); +insert into diaries values(4041, "2022-08-06"); +insert into diaries values(4042, "2022-08-07"); +insert into diaries values(4043, "2022-08-08"); +insert into diaries values(4044, "2022-08-09"); +insert into diaries values(4045, "2022-08-10"); +insert into diaries values(4046, "2022-08-11"); +insert into diaries values(4047, "2022-08-12"); +insert into diaries values(4048, "2022-08-13"); +insert into diaries values(4049, "2022-08-14"); +insert into diaries values(4050, "2022-08-15"); +insert into diaries values(4051, "2022-08-16"); +insert into diaries values(4052, "2022-08-17"); +insert into diaries values(4053, "2022-08-18"); +insert into diaries values(4054, "2022-08-19"); +insert into diaries values(4055, "2022-08-20"); +insert into diaries values(4056, "2022-08-21"); +insert into diaries values(4057, "2022-08-22"); +insert into diaries values(4058, "2022-08-23"); +insert into diaries values(4059, "2022-08-24"); +insert into diaries values(4060, "2022-08-25"); +insert into diaries values(4061, "2022-08-26"); +insert into diaries values(4062, "2022-08-27"); +insert into diaries values(4063, "2022-08-28"); +insert into diaries values(4064, "2022-08-29"); +insert into diaries values(4065, "2022-08-30"); +insert into diaries values(4066, "2022-08-31"); +insert into diaries values(4067, "2022-09-01"); +insert into diaries values(4068, "2022-09-02"); +insert into diaries values(4069, "2022-09-03"); +insert into diaries values(4070, "2022-09-04"); +insert into diaries values(4071, "2022-09-05"); +insert into diaries values(4072, "2022-09-06"); +insert into diaries values(4073, "2022-09-07"); +insert into diaries values(4074, "2022-09-08"); +insert into diaries values(4075, "2022-09-09"); +insert into diaries values(4076, "2022-09-10"); +insert into diaries values(4077, "2022-09-11"); +insert into diaries values(4078, "2022-09-12"); +insert into diaries values(4079, "2022-09-13"); +insert into diaries values(4080, "2022-09-14"); +insert into diaries values(4081, "2022-09-15"); +insert into diaries values(4082, "2022-09-16"); +insert into diaries values(4083, "2022-09-17"); +insert into diaries values(4084, "2022-09-18"); +insert into diaries values(4085, "2022-09-19"); +insert into diaries values(4086, "2022-09-20"); +insert into diaries values(4087, "2022-09-21"); +insert into diaries values(4088, "2022-09-22"); +insert into diaries values(4089, "2022-09-23"); +insert into diaries values(4090, "2022-09-24"); +insert into diaries values(4091, "2022-09-25"); +insert into diaries values(4092, "2022-09-26"); +insert into diaries values(4093, "2022-09-27"); +insert into diaries values(4094, "2022-09-28"); +insert into diaries values(4095, "2022-09-29"); +commit; +set autocommit=1; +select * from diaries where match(title) against("2022-09-0") order by id; +id title +3824 2022-01-01 +3825 2022-01-02 +3826 2022-01-03 +3827 2022-01-04 +3828 2022-01-05 +3829 2022-01-06 +3830 2022-01-07 +3831 2022-01-08 +3832 2022-01-09 +3833 2022-01-10 +3834 2022-01-11 +3835 2022-01-12 +3836 2022-01-13 +3837 2022-01-14 +3838 2022-01-15 +3839 2022-01-16 +3840 2022-01-17 +3841 2022-01-18 +3842 2022-01-19 +3843 2022-01-20 +3844 2022-01-21 +3845 2022-01-22 +3846 2022-01-23 +3847 2022-01-24 +3848 2022-01-25 +3849 2022-01-26 +3850 2022-01-27 +3851 2022-01-28 +3852 2022-01-29 +3853 2022-01-30 +3854 2022-01-31 +3855 2022-02-01 +3856 2022-02-02 +3857 2022-02-03 +3858 2022-02-04 +3859 2022-02-05 +3860 2022-02-06 +3861 2022-02-07 +3862 2022-02-08 +3863 2022-02-09 +3864 2022-02-10 +3865 2022-02-11 +3866 2022-02-12 +3867 2022-02-13 +3868 2022-02-14 +3869 2022-02-15 +3870 2022-02-16 +3871 2022-02-17 +3872 2022-02-18 +3873 2022-02-19 +3874 2022-02-20 +3875 2022-02-21 +3876 2022-02-22 +3877 2022-02-23 +3878 2022-02-24 +3879 2022-02-25 +3880 2022-02-26 +3881 2022-02-27 +3882 2022-02-28 +3883 2022-03-01 +3884 2022-03-02 +3885 2022-03-03 +3886 2022-03-04 +3887 2022-03-05 +3888 2022-03-06 +3889 2022-03-07 +3890 2022-03-08 +3891 2022-03-09 +3892 2022-03-10 +3893 2022-03-11 +3894 2022-03-12 +3895 2022-03-13 +3896 2022-03-14 +3897 2022-03-15 +3898 2022-03-16 +3899 2022-03-17 +3900 2022-03-18 +3901 2022-03-19 +3902 2022-03-20 +3903 2022-03-21 +3904 2022-03-22 +3905 2022-03-23 +3906 2022-03-24 +3907 2022-03-25 +3908 2022-03-26 +3909 2022-03-27 +3910 2022-03-28 +3911 2022-03-29 +3912 2022-03-30 +3913 2022-03-31 +3914 2022-04-01 +3915 2022-04-02 +3916 2022-04-03 +3917 2022-04-04 +3918 2022-04-05 +3919 2022-04-06 +3920 2022-04-07 +3921 2022-04-08 +3922 2022-04-09 +3923 2022-04-10 +3924 2022-04-11 +3925 2022-04-12 +3926 2022-04-13 +3927 2022-04-14 +3928 2022-04-15 +3929 2022-04-16 +3930 2022-04-17 +3931 2022-04-18 +3932 2022-04-19 +3933 2022-04-20 +3934 2022-04-21 +3935 2022-04-22 +3936 2022-04-23 +3937 2022-04-24 +3938 2022-04-25 +3939 2022-04-26 +3940 2022-04-27 +3941 2022-04-28 +3942 2022-04-29 +3943 2022-04-30 +3944 2022-05-01 +3945 2022-05-02 +3946 2022-05-03 +3947 2022-05-04 +3948 2022-05-05 +3949 2022-05-06 +3950 2022-05-07 +3951 2022-05-08 +3952 2022-05-09 +3953 2022-05-10 +3954 2022-05-11 +3955 2022-05-12 +3956 2022-05-13 +3957 2022-05-14 +3958 2022-05-15 +3959 2022-05-16 +3960 2022-05-17 +3961 2022-05-18 +3962 2022-05-19 +3963 2022-05-20 +3964 2022-05-21 +3965 2022-05-22 +3966 2022-05-23 +3967 2022-05-24 +3968 2022-05-25 +3969 2022-05-26 +3970 2022-05-27 +3971 2022-05-28 +3972 2022-05-29 +3973 2022-05-30 +3974 2022-05-31 +3975 2022-06-01 +3976 2022-06-02 +3977 2022-06-03 +3978 2022-06-04 +3979 2022-06-05 +3980 2022-06-06 +3981 2022-06-07 +3982 2022-06-08 +3983 2022-06-09 +3984 2022-06-10 +3985 2022-06-11 +3986 2022-06-12 +3987 2022-06-13 +3988 2022-06-14 +3989 2022-06-15 +3990 2022-06-16 +3991 2022-06-17 +3992 2022-06-18 +3993 2022-06-19 +3994 2022-06-20 +3995 2022-06-21 +3996 2022-06-22 +3997 2022-06-23 +3998 2022-06-24 +3999 2022-06-25 +4000 2022-06-26 +4001 2022-06-27 +4002 2022-06-28 +4003 2022-06-29 +4004 2022-06-30 +4005 2022-07-01 +4006 2022-07-02 +4007 2022-07-03 +4008 2022-07-04 +4009 2022-07-05 +4010 2022-07-06 +4011 2022-07-07 +4012 2022-07-08 +4013 2022-07-09 +4014 2022-07-10 +4015 2022-07-11 +4016 2022-07-12 +4017 2022-07-13 +4018 2022-07-14 +4019 2022-07-15 +4020 2022-07-16 +4021 2022-07-17 +4022 2022-07-18 +4023 2022-07-19 +4024 2022-07-20 +4025 2022-07-21 +4026 2022-07-22 +4027 2022-07-23 +4028 2022-07-24 +4029 2022-07-25 +4030 2022-07-26 +4031 2022-07-27 +4032 2022-07-28 +4033 2022-07-29 +4034 2022-07-30 +4035 2022-07-31 +4036 2022-08-01 +4037 2022-08-02 +4038 2022-08-03 +4039 2022-08-04 +4040 2022-08-05 +4041 2022-08-06 +4042 2022-08-07 +4043 2022-08-08 +4044 2022-08-09 +4045 2022-08-10 +4046 2022-08-11 +4047 2022-08-12 +4048 2022-08-13 +4049 2022-08-14 +4050 2022-08-15 +4051 2022-08-16 +4052 2022-08-17 +4053 2022-08-18 +4054 2022-08-19 +4055 2022-08-20 +4056 2022-08-21 +4057 2022-08-22 +4058 2022-08-23 +4059 2022-08-24 +4060 2022-08-25 +4061 2022-08-26 +4062 2022-08-27 +4063 2022-08-28 +4064 2022-08-29 +4065 2022-08-30 +4066 2022-08-31 +4067 2022-09-01 +4068 2022-09-02 +4069 2022-09-03 +4070 2022-09-04 +4071 2022-09-05 +4072 2022-09-06 +4073 2022-09-07 +4074 2022-09-08 +4075 2022-09-09 +4076 2022-09-10 +4077 2022-09-11 +4078 2022-09-12 +4079 2022-09-13 +4080 2022-09-14 +4081 2022-09-15 +4082 2022-09-16 +4083 2022-09-17 +4084 2022-09-18 +4085 2022-09-19 +4086 2022-09-20 +4087 2022-09-21 +4088 2022-09-22 +4089 2022-09-23 +4090 2022-09-24 +4091 2022-09-25 +4092 2022-09-26 +4093 2022-09-27 +4094 2022-09-28 +4095 2022-09-29 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result new file mode 100644 index 00000000..def5db40 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_matched_order.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS texts; +SET NAMES UTF8; +CREATE TABLE texts ( +id INT PRIMARY KEY, +matched TEXT, +not_matched TEXT, +FULLTEXT KEY (matched), +FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); +SELECT id, +matched, +not_matched, +MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), +MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +FROM texts +WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) +ORDER BY MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE), +id; +id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +1 Hello1 World1 1 0 +2 Hello2 World2 1 0 +3 Hello3 World3 1 0 +DROP TABLE texts; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result new file mode 100644 index 00000000..39ab80ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_have_where_no_order.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS texts; +SET NAMES UTF8; +CREATE TABLE texts ( +id INT PRIMARY KEY, +matched TEXT, +not_matched TEXT, +FULLTEXT KEY (matched), +FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); +SELECT * +FROM (SELECT id, +matched, +not_matched, +MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), +MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +FROM texts +WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)) +AS searched_texts +ORDER BY id; +id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +1 Hello1 World1 1 0 +2 Hello2 World2 1 0 +3 Hello3 World3 1 0 +DROP TABLE texts; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result new file mode 100644 index 00000000..f619e467 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_matched_and_not_matched_no_where_both_order.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS texts; +SET NAMES UTF8; +CREATE TABLE texts ( +id INT PRIMARY KEY, +matched TEXT, +not_matched TEXT, +FULLTEXT KEY (matched), +FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); +SELECT id, +matched, +not_matched, +MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), +MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +FROM texts +ORDER BY MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), +MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE), +id; +id matched not_matched MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) +1 Hello1 World1 1 0 +2 Hello2 World2 1 0 +3 Hello3 World3 1 0 +DROP TABLE texts; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result new file mode 100644 index 00000000..fbdf241b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result @@ -0,0 +1,23 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(content) against("富士山"); +id title content +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result new file mode 100644 index 00000000..074d1991 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result @@ -0,0 +1,29 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もきれい。 +select * from diaries where match(content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result new file mode 100644 index 00000000..756a7021 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result @@ -0,0 +1,31 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +drop index title on diaries; +select * from diaries where match(title, content) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +select * from diaries; +id title content +1 Hello はじめました。 +2 天気 明日の富士山の天気について +3 富士山 今日もきれい。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result new file mode 100644 index 00000000..db869eaa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result @@ -0,0 +1,26 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +update diaries set title = "チョモランマ" where id = 3; +update diaries set content = "チョモランマと富士山" where id = 1; +select * from diaries where match(title, content) against("富士山"); +id title content +1 Hello チョモランマと富士山 +2 天気 明日の富士山の天気について +select * from diaries where match(title) against("富士山"); +id title content +select * from diaries where match(content) against("富士山"); +id title content +1 Hello チョモランマと富士山 +2 天気 明日の富士山の天気について +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result new file mode 100644 index 00000000..7121e510 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result @@ -0,0 +1,23 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +title text, +body text, +fulltext index title_index (title), +fulltext index body_index (body) +) comment = 'engine "innodb"' default charset utf8; +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); +select * from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body +1 survey will start groonga! +select *, match(title) against("survey"), match(body) against("groonga") +from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body match(title) against("survey") match(body) against("groonga") +1 survey will start groonga! 1048577 149797 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result new file mode 100644 index 00000000..90376bdf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result @@ -0,0 +1,194 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su") order by c1; +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii") order by c1; +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode) order by c1; +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode) order by c1; +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日の富士山の天気について あああああああ +2 いいいいい 明日の富士山の天気は分かりません +3 dummy dummy +select * from t1 where match(c2) against("富士山") order by c1; +c1 c2 c3 +1 明日の富士山の天気について あああああああ +select * from t1 where match(c3) against("富士山") order by c1; +c1 c2 c3 +2 いいいいい 明日の富士山の天気は分かりません +drop table t1; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +5 ta ti ii ii to 349526 +3 aa ii ii ii oo 524289 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +drop table t1,t2; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1; +c1 c2 c3 match(c3) against("uu") +1 10 aa ii uu ee oo 131073 +3 10 aa ii uu ee oo 131073 +5 20 aa ii uu ee oo 131073 +7 20 aa ii uu ee oo 131073 +select * from t1 where not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +c1 c2 c3 match(c3) against("dummy") +select * from t1 where not match(c3) against("dummy"); +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("uu"); +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result new file mode 100644 index 00000000..4646aad6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result @@ -0,0 +1,68 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1; +c1 c2 c3 match(c3) against("uu") +1 10 aa ii uu ee oo 131073 +3 10 aa ii uu ee oo 131073 +5 20 aa ii uu ee oo 131073 +7 20 aa ii uu ee oo 131073 +select * from t1 where not match(c3) against("uu") order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy") order by c1; +c1 c2 c3 match(c3) against("dummy") +select * from t1 where not match(c3) against("dummy") order by c1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("uu") order by c1; +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("uu") order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("uu") order by c1; +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("uu") order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("uu") order by c1; +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("uu") order by c1; +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result new file mode 100644 index 00000000..f79798ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE ft( +a INT DEFAULT 0, +b TEXT, +c TEXT, +PRIMARY KEY(a), +FULLTEXT KEY ftx1(b), +FULLTEXT KEY ftx2(c) +)ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; +INSERT INTO ft VALUES(1,'aaaaa','abcde'); +INSERT INTO ft VALUES(2,'bbbbb','bcdef'); +INSERT INTO ft VALUES(3,'ccccc','cdefg'); +INSERT INTO ft VALUES(4,'ddddd','defgh'); +INSERT INTO ft VALUES(5,'eeeee','efghi'); +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +2 bbbbb bcdef +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +2 bbbbb bcdef +SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +DROP TABLE ft; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result new file mode 100644 index 00000000..3ee15c63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +START TRANSACTION; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +USE test; +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +COMMIT; +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result new file mode 100644 index 00000000..d31d5454 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +SELECT last_insert_id(); +last_insert_id() +0 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result new file mode 100644 index 00000000..39791b93 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +SELECT last_insert_id(); +last_insert_id() +0 +SELECT last_insert_id(10); +last_insert_id(10) +10 +SELECT last_insert_id(); +last_insert_id() +10 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result new file mode 100644 index 00000000..550554ea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result @@ -0,0 +1,160 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +insert into shops (name, location) +values ('nezu-no-taiyaki', +ST_GeomFromText('POINT(139.762573 35.720253)')); +insert into shops (name, location) +values ('taiyaki-kataoka', +ST_GeomFromText('POINT(139.715591 35.712521)')); +insert into shops (name, location) +values ('soba-taiyaki-ku', +ST_GeomFromText('POINT(139.659088 35.683712)')); +insert into shops (name, location) +values ('kuruma', +ST_GeomFromText('POINT(139.706207 35.721516)')); +insert into shops (name, location) +values ('hirose-ya', +ST_GeomFromText('POINT(139.685608 35.714844)')); +insert into shops (name, location) +values ('sazare', +ST_GeomFromText('POINT(139.685043 35.714653)')); +insert into shops (name, location) +values ('omede-taiyaki', +ST_GeomFromText('POINT(139.817154 35.700516)')); +insert into shops (name, location) +values ('onaga-ya', +ST_GeomFromText('POINT(139.81105 35.698254)')); +insert into shops (name, location) +values ('shiro-ya', +ST_GeomFromText('POINT(139.638611 35.705517)')); +insert into shops (name, location) +values ('fuji-ya', +ST_GeomFromText('POINT(139.637115 35.703938)')); +insert into shops (name, location) +values ('miyoshi', +ST_GeomFromText('POINT(139.537323 35.644539)')); +insert into shops (name, location) +values ('juju-ya', +ST_GeomFromText('POINT(139.695755 35.628922)')); +insert into shops (name, location) +values ('tatsumi-ya', +ST_GeomFromText('POINT(139.638657 35.665501)')); +insert into shops (name, location) +values ('tetsuji', +ST_GeomFromText('POINT(139.76857 35.680912)')); +insert into shops (name, location) +values ('gazuma-ya', +ST_GeomFromText('POINT(139.647598 35.700817)')); +insert into shops (name, location) +values ('honma-mon', +ST_GeomFromText('POINT(139.652573 35.722736)')); +insert into shops (name, location) +values ('naniwa-ya', +ST_GeomFromText('POINT(139.796234 35.730061)')); +insert into shops (name, location) +values ('kuro-dai', +ST_GeomFromText('POINT(139.704834 35.650345)')); +insert into shops (name, location) +values ('daruma', +ST_GeomFromText('POINT(139.770599 35.681461)')); +insert into shops (name, location) +values ('yanagi-ya', +ST_GeomFromText('POINT(139.783981 35.685341)')); +insert into shops (name, location) +values ('sharaku', +ST_GeomFromText('POINT(139.794846 35.716969)')); +insert into shops (name, location) +values ('takane', +ST_GeomFromText('POINT(139.560913 35.698601)')); +insert into shops (name, location) +values ('chiyoda', +ST_GeomFromText('POINT(139.652817 35.642601)')); +insert into shops (name, location) +values ('da-ka-po', +ST_GeomFromText('POINT(139.727356 35.627346)')); +insert into shops (name, location) +values ('matsushima-ya', +ST_GeomFromText('POINT(139.737381 35.640556)')); +insert into shops (name, location) +values ('kazuya', +ST_GeomFromText('POINT(139.760895 35.673508)')); +insert into shops (name, location) +values ('furuya-kogane-an', +ST_GeomFromText('POINT(139.676071 35.680603)')); +insert into shops (name, location) +values ('hachi-no-ie', +ST_GeomFromText('POINT(139.668106 35.608021)')); +insert into shops (name, location) +values ('azuki-chan', +ST_GeomFromText('POINT(139.673203 35.64151)')); +insert into shops (name, location) +values ('kuriko-an', +ST_GeomFromText('POINT(139.796829 35.712013)')); +insert into shops (name, location) +values ('yume-no-aru-machi-no-taiyaki-ya-san', +ST_GeomFromText('POINT(139.712524 35.616199)')); +insert into shops (name, location) +values ('naze-ya', +ST_GeomFromText('POINT(139.665833 35.609039)')); +insert into shops (name, location) +values ('sanoki-ya', +ST_GeomFromText('POINT(139.770721 35.66592)')); +insert into shops (name, location) +values ('shigeta', +ST_GeomFromText('POINT(139.780273 35.672626)')); +insert into shops (name, location) +values ('nishimi-ya', +ST_GeomFromText('POINT(139.774628 35.671825)')); +insert into shops (name, location) +values ('hiiragi', +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) +3 soba-taiyaki-ku POINT(139.659088 35.683712) +4 kuruma POINT(139.706207 35.721516) +5 hirose-ya POINT(139.685608 35.714844) +6 sazare POINT(139.685043 35.714653) +7 omede-taiyaki POINT(139.817154 35.700516) +8 onaga-ya POINT(139.81105 35.698254) +9 shiro-ya POINT(139.638611 35.705517) +10 fuji-ya POINT(139.637115 35.703938) +11 miyoshi POINT(139.537323 35.644539) +12 juju-ya POINT(139.695755 35.628922) +13 tatsumi-ya POINT(139.638657 35.665501) +14 tetsuji POINT(139.76857 35.680912) +15 gazuma-ya POINT(139.647598 35.700817) +16 honma-mon POINT(139.652573 35.722736) +17 naniwa-ya POINT(139.796234 35.730061) +18 kuro-dai POINT(139.704834 35.650345) +19 daruma POINT(139.770599 35.681461) +20 yanagi-ya POINT(139.783981 35.685341) +21 sharaku POINT(139.794846 35.716969) +22 takane POINT(139.560913 35.698601) +23 chiyoda POINT(139.652817 35.642601) +24 da-ka-po POINT(139.727356 35.627346) +25 matsushima-ya POINT(139.737381 35.640556) +26 kazuya POINT(139.760895 35.673508) +27 furuya-kogane-an POINT(139.676071 35.680603) +28 hachi-no-ie POINT(139.668106 35.608021) +29 azuki-chan POINT(139.673203 35.64151) +30 kuriko-an POINT(139.796829 35.712013) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.712524 35.616199) +32 naze-ya POINT(139.665833 35.609039) +33 sanoki-ya POINT(139.770721 35.66592) +34 shigeta POINT(139.780273 35.672626) +35 nishimi-ya POINT(139.774628 35.671825) +36 hiiragi POINT(139.711517 35.647701) +select id, name, 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) +26 kazuya POINT(139.760895 35.673508) +drop table shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result new file mode 100644 index 00000000..615d185f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result @@ -0,0 +1,22 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +insert into shops (name, location) +values ('sazare', +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(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, 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 new file mode 100644 index 00000000..adfb53e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result @@ -0,0 +1,27 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +insert into shops (name, location) +values ('sazare', +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, 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 = ST_GeomFromText('POINT(139.66116 35.57566)') +where name = 'sazare'; +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, 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/index_force_index_not_used.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result new file mode 100644 index 00000000..3fbc85ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET UTF8 COMMENT = 'engine "InnoDB"'; +SELECT COUNT(*) FROM ids FORCE INDEX(PRIMARY); +COUNT(*) +0 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result new file mode 100644 index 00000000..93c05bff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result @@ -0,0 +1,78 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26"); +select * from t1; +c1 +2010-03-26 +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("11:22:33"); +select * from t1; +c1 +11:22:33 +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010"); +select * from t1; +c1 +2010 +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +c1 +2010-03-26 11:22:33 +drop table t1; +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +select * from t1; +c1 c2 +1 100 +insert into t1 values(1,200); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1; +c1 c2 +1 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result new file mode 100644 index 00000000..552cf586 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result @@ -0,0 +1,22 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content text, +fulltext index (content) +) default charset utf8 comment = 'engine "innodb"'; +LOCK TABLE diaries WRITE; +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); +UNLOCK TABLES; +select * from diaries; +id content +1 今日からはじめました。 +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +select * from diaries where match(content) against("天気"); +id content +2 明日の富士山の天気について +3 今日も天気がよくてきれいに見える。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result new file mode 100644 index 00000000..f0ceb937 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +date TIMESTAMP NOT NULL, +title VARCHAR(100) NOT NULL, +content TEXT NOT NULL, +PRIMARY KEY (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` varchar(100) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`date`,`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "MyISAM"' +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +SELECT * FROM diaries; +date title content +2012-03-04 00:00:00 cloudy day Today is cloudy day... +2012-03-04 00:00:00 shopping I buy a new shirt. +2012-03-05 00:00:00 rainy day Today is rainy day... +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy new shoes.") +ON DUPLICATE KEY UPDATE date = "2012-03-03", +content = "I buy a new hat."; +SELECT * FROM diaries; +date title content +2012-03-04 00:00:00 cloudy day Today is cloudy day... +2012-03-03 00:00:00 shopping I buy a new hat. +2012-03-05 00:00:00 rainy day Today is rainy day... +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result new file mode 100644 index 00000000..97428b76 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +date TIMESTAMP NOT NULL, +title VARCHAR(100) NOT NULL, +content TEXT NOT NULL, +UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` varchar(100) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `date` (`date`,`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "MyISAM"' +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +SELECT * FROM diaries; +id date title content +1 2012-03-04 00:00:00 cloudy day Today is cloudy day... +2 2012-03-04 00:00:00 shopping I buy a new shirt. +3 2012-03-05 00:00:00 rainy day Today is rainy day... +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy new shoes.") +ON DUPLICATE KEY UPDATE date = "2012-03-03", +content = "I buy a new hat."; +SELECT * FROM diaries; +id date title content +1 2012-03-04 00:00:00 cloudy day Today is cloudy day... +2 2012-03-03 00:00:00 shopping I buy a new hat. +3 2012-03-05 00:00:00 rainy day Today is rainy day... +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result new file mode 100644 index 00000000..aa7a32db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS integers; +SET optimizer_switch='mrr_cost_based=off'; +CREATE TABLE integers ( +id INT PRIMARY KEY AUTO_INCREMENT, +value INT, +KEY (value) +) COMMENT='engine "InnoDB"'; +INSERT INTO integers (value) VALUES (0), (1), (2), (3); +EXPLAIN SELECT * FROM integers +WHERE value IN (0, 2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE integers range value value 5 NULL 2 Using where; Using MRR +SELECT * FROM integers +WHERE value IN (0, 2); +id value +1 0 +3 2 +DROP TABLE integers; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result new file mode 100644 index 00000000..bf1e67b9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_mysql_5_7_or_later_disk_sweep.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS integers; +SET optimizer_switch='mrr_cost_based=off'; +CREATE TABLE integers ( +id INT PRIMARY KEY AUTO_INCREMENT, +value INT, +KEY (value) +) COMMENT='engine "InnoDB"'; +INSERT INTO integers (value) VALUES (0), (1), (2), (3); +EXPLAIN SELECT * FROM integers +WHERE value IN (0, 2); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE integers NULL range value value 5 NULL 2 100.00 Using where; Using MRR +Warnings: +Note 1003 /* select#1 */ select `test`.`integers`.`id` AS `id`,`test`.`integers`.`value` AS `value` from `test`.`integers` where (`test`.`integers`.`value` in (0,2)) +SELECT * FROM integers +WHERE value IN (0, 2); +id value +1 0 +3 2 +DROP TABLE integers; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result new file mode 100644 index 00000000..66070060 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result @@ -0,0 +1,53 @@ +drop table if exists t1; +flush status; +create table t1 ( +c1 int primary key, +c2 int, +c3 text, +key idx1(c2), +fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") desc; +c3 match(c3) against("ii") +ii si ii se ii 524289 +aa ii uu ii oo 349526 +aa ii uu ee oo 174763 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") desc limit 1, 1; +c3 match(c3) against("ii") +aa ii uu ii oo 349526 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii"); +c3 match(c3) against("ii") +aa ii uu ee oo 174763 +aa ii uu ii oo 349526 +ii si ii se ii 524289 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") limit 1; +c3 match(c3) against("ii") +aa ii uu ee oo 174763 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 2 +select count(*) from t1 where match(c3) against("ii") limit 1; +count(*) +3 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_direction.result new file mode 100644 index 00000000..9dd3e6ea --- /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_no_where_clause.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result new file mode 100644 index 00000000..b31d2ee5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result @@ -0,0 +1,24 @@ +drop table if exists t1; +flush status; +create table t1 ( +c1 int primary key, +c2 int, +c3 text, +key idx1(c2), +fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select *, match(c3) against("ii") from t1 order by c1 desc limit 1; +c1 c2 c3 match(c3) against("ii") +5 50 aa ii uu ii oo 349526 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/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 00000000..eb5e04fc --- /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/performance_schema.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result new file mode 100644 index 00000000..c9af869f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/performance_schema.result @@ -0,0 +1,22 @@ +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 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 new file mode 100644 index 00000000..8258a03b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result @@ -0,0 +1,31 @@ +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) +) COMMENT = 'engine "innodb"' 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"); +id title body +2 groonga (1) starting groonga... +FLUSH TABLES; +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +ERROR HY000: mroonga: failed to open table: +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +repair_test.diaries repair status OK +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +DROP TABLE diaries; +DROP DATABASE repair_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result new file mode 100644 index 00000000..cca7aee9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result @@ -0,0 +1,31 @@ +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) +) COMMENT = 'engine "innodb"' 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"); +id title body +2 groonga (1) starting groonga... +FLUSH TABLES; +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +ERROR HY000: system call error: No such file or directory: failed to open path: +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +repair_test.diaries repair status OK +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +DROP TABLE diaries; +DROP DATABASE repair_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result new file mode 100644 index 00000000..d66b463d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result @@ -0,0 +1,14 @@ +DROP TEMPORARY TABLE IF EXISTS diaries; +CREATE TEMPORARY TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); +SELECT * FROM diaries; +id title +1 clear day +2 rainy day +3 cloudy day +DROP TEMPORARY TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result new file mode 100644 index 00000000..54afac7a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result @@ -0,0 +1,28 @@ +SET @tmp_query_cache_size = @@query_cache_size; +SET GLOBAL query_cache_size = 1048576; +DROP TABLE IF EXISTS simple_table; +CREATE TABLE simple_table ( +id INT PRIMARY KEY +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE simple_table; +Table Create Table +simple_table CREATE TABLE `simple_table` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO simple_table (id) VALUES (1),(2); +USE test; +START TRANSACTION; +INSERT INTO simple_table (id) VALUES (3); +SELECT * FROM simple_table; +id +1 +2 +COMMIT; +SELECT * FROM simple_table; +id +1 +2 +3 +DROP TABLE simple_table; +SET GLOBAL query_cache_size = @tmp_query_cache_size; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result new file mode 100644 index 00000000..8c61d9e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +1 survey will start groonga! +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +DELETE FROM diaries WHERE id = 1; +Warnings: +Warning 1026 failed to get record ID for deleting from groonga: key=<\0001> +SELECT * FROM diaries; +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result new file mode 100644 index 00000000..0a424e77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +1 survey will start groonga! +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +UPDATE diaries SET title = "survey day!" WHERE id = 1; +SELECT * FROM diaries; +id title body +1 survey day! will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +1 survey day! will start groonga! +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result new file mode 100644 index 00000000..296f87ad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +2 2011 11 10 天気 明日の富士山の天気について +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +1 2011 11 9 Hello 今日からはじめました。 +3 2011 11 11 富士山 今日も天気がよくてきれいに見える。 +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +id year month day title content +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰り道", "つかれたー"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "初雪", "今年はじめての雪!"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 11 帰り道 つかれたー +2 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +3 2011 12 2 初雪 今年はじめての雪! +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("+悪い" IN BOOLEAN MODE) +ORDER BY id; +id year month day title content +2 2011 12 1 久しぶり 天気が悪いからずっと留守番。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result new file mode 100644 index 00000000..655d2424 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result @@ -0,0 +1,33 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +20 ta ti tu te +30 sa si su se +select * from t1 where match(c2) against("ti"); +c1 c2 +20 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +update t1 set c1=40 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +40 ta ti tu te +select * from t1 where match(c2) against("ti"); +c1 c2 +40 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result new file mode 100644 index 00000000..5506f6b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result @@ -0,0 +1,36 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +update t1 set c2=c2+100 where c1=1; +select * from t1; +c1 c2 +1 200 +2 101 +3 102 +update t1 set c2=c2+100 where c1=2; +select * from t1; +c1 c2 +1 200 +2 201 +3 102 +update t1 set c2=c2+100 where c1=3; +select * from t1; +c1 c2 +1 200 +2 201 +3 202 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result new file mode 100644 index 00000000..ccc28a0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result @@ -0,0 +1,45 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +set mroonga_dry_write=true; +delete from diaries where id = 2; +select * from diaries; +id body +1 will start groonga! +3 started groonga. +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +3 started groonga. +set mroonga_dry_write=false; +delete from diaries where id = 3; +select * from diaries; +id body +1 will start groonga! +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +insert into diaries (id, body) values (2, "sleeping..."); +select * from diaries; +id body +1 will start groonga! +2 sleeping... +select * from diaries where match (body) against ("starting"); +id body +2 sleeping... +select * from diaries where match (body) against ("started"); +id body +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result new file mode 100644 index 00000000..a9bdd38f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result @@ -0,0 +1,34 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +3 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result new file mode 100644 index 00000000..b2fe4607 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result @@ -0,0 +1,31 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries (body) values ("will start groonga!"); +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 starting groonga... +select * from diaries where match (body) against ("will"); +id body +1 starting groonga... +select * from diaries where match (body) against ("starting"); +id body +set mroonga_dry_write=false; +update diaries set body = "started groonga." where id = 1; +select * from diaries; +id body +1 started groonga. +select * from diaries where match (body) against ("will"); +id body +1 started groonga. +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +1 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result new file mode 100644 index 00000000..9405879f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) 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 ("gr" IN BOOLEAN MODE); +id title tags +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 +SET GLOBAL mroonga_match_escalation_threshold = DEFAULT; +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result new file mode 100644 index 00000000..fa2da48c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +SET mroonga_match_escalation_threshold = -1; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt b/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt new file mode 100644 index 00000000..d5a1e519 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt @@ -0,0 +1 @@ +--loose-plugin-load-add=$HA_MROONGA_SO --loose-plugin-mroonga=ON diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm new file mode 100644 index 00000000..7e4f8c17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm @@ -0,0 +1,23 @@ +package My::Suite::Mroonga; + +@ISA = qw(My::Suite); + +return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or + $::mysqld_variables{'mroonga'} eq "ON"; + +sub is_default { not $::opt_embedded_server } + +my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql'; +my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins'; + +if (-d $groonga_normalizer_mysql_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_dir; +} +elsif (-d $groonga_normalizer_mysql_install_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_install_dir; +} + +bless { }; + diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test new file mode 100644 index 00000000..92e48bb1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test new file mode 100644 index 00000000..21e80a74 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; +ALTER TABLE users + ADD COLUMN O text, + ADD FULLTEXT INDEX (O); + +INSERT INTO users (O) VALUES ("܂"); +INSERT INTO users (O) VALUES ("Ȃ"); +INSERT INTO users (O) VALUES (""); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test new file mode 100644 index 00000000..f98d0e0d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test @@ -0,0 +1,54 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; +ALTER TABLE users + ADD COLUMN 名前 text, + ADD FULLTEXT INDEX (名前); + +INSERT INTO users (名前) VALUES ("やまだ"); +INSERT INTO users (名前) VALUES ("たなか"); +INSERT INTO users (名前) VALUES ("すずき"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test new file mode 100644 index 00000000..024da5ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +ALTER TABLE bugs + CHANGE COLUMN + tag + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test new file mode 100644 index 00000000..fc0379f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test @@ -0,0 +1,59 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SELECT table_name, engine, table_comment + FROM information_schema.tables + WHERE table_name = 'diaries'; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; +SELECT table_name, engine, table_comment + FROM information_schema.tables + WHERE table_name = 'diaries'; + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test new file mode 100644 index 00000000..ff54f1b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(64), + content TEXT, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); +INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); +INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); + +ALTER TABLE memos COMMENT='engine "MyISAM"'; +SELECT table_name, table_comment + FROM information_schema.tables + WHERE table_name = 'memos'; + +SELECT * FROM memos; +SELECT * FROM memos WHERE MATCH(content) AGAINST("start" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test new file mode 100644 index 00000000..80d3ee72 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + WHERE MATCH (title) AGAINST ("富士山"); + +CREATE FULLTEXT INDEX title_index on diaries (title); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test new file mode 100644 index 00000000..867ca370 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test new file mode 100644 index 00000000..4bf97aac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test new file mode 100644 index 00000000..0eccfded --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test new file mode 100644 index 00000000..76cce0c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test @@ -0,0 +1,48 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test new file mode 100644 index 00000000..de1af71d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + c1 int NOT NULL, + c2 text NOT NULL, + c3 int NOT NULL, + c4 int NOT NULL, + PRIMARY KEY(c1), + KEY idx1(c3,c4), + FULLTEXT KEY ft1(c2) +) COMMENT='ENGINE "MyISAM"' DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +TRUNCATE t1; +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test new file mode 100644 index 00000000..9a8c9722 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries DROP COLUMN body; +SELECT * FROM diaries; + +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test new file mode 100644 index 00000000..84409307 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test new file mode 100644 index 00000000..1532c916 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE IF NOT EXISTS memos ( + id VARCHAR(45) NOT NULL PRIMARY KEY, + text TEXT NOT NULL, + FULLTEXT KEY (text) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +LOCK TABLES memos WRITE; +ALTER TABLE memos DISABLE KEYS; + +INSERT INTO memos + VALUES (00000, 'text0'), + (00001, 'text1'), + (00002, 'text2'); + +ALTER TABLE memos ENABLE KEYS; +UNLOCK TABLES; + +SELECT * FROM memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test new file mode 100644 index 00000000..78707797 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test new file mode 100644 index 00000000..2427353a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test new file mode 100644 index 00000000..7c3c7176 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test new file mode 100644 index 00000000..95220759 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test @@ -0,0 +1,54 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD FULLTEXT INDEX body_index (body); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test new file mode 100644 index 00000000..46c57f05 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, memos; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +SELECT * FROM memos + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test new file mode 100644 index 00000000..727557f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test @@ -0,0 +1,149 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL +) COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + ST_GeomFromText('POINT(139.711517 35.647701)')); + +ALTER TABLE shops ADD SPATIAL KEY location_index (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); + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test new file mode 100644 index 00000000..e8cd2585 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text +) comment = 'engine "innodb"'; +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test new file mode 100644 index 00000000..328d2f7d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test @@ -0,0 +1,55 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +show variables like 'log_bin'; + +set binlog_format="STATEMENT"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="ROW"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="MIXED"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test new file mode 100644 index 00000000..f846cce7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/check_table_for_upgrade.test @@ -0,0 +1,44 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id int NOT NULL PRIMARY KEY, + content text, + FULLTEXT INDEX (content) +) COMMENT='engine "InnoDB"'; + +INSERT INTO memos VALUES (1, 'Hello MySQL'); +INSERT INTO memos VALUES (2, 'Hello Mroonga'); + +CHECK TABLE memos FOR UPGRADE; + +FLUSH TABLES; + +SELECT * FROM memos + WHERE MATCH(content) AGAINST('+mroonga' IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test new file mode 100644 index 00000000..3213693e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64), + INDEX (tag) COMMENT 'Tag search is required.' +) DEFAULT CHARSET=utf8 + COMMENT='engine "InnoDB"'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test new file mode 100644 index 00000000..b1c5a80c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_add_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED; +ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"'; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test new file mode 100644 index 00000000..5ee4c000 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_delete.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test new file mode 100644 index 00000000..4193b268 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_drop_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test new file mode 100644 index 00000000..bcea1738 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_insert.test @@ -0,0 +1,41 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test new file mode 100644 index 00000000..130d41d1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_reindex.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DISABLE KEYS; +ALTER TABLE logs ENABLE KEYS; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("ar" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test new file mode 100644 index 00000000..77562cb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_stored_update.test @@ -0,0 +1,43 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED, + FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs WHERE MATCH(message) AGAINST("hut" IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test new file mode 100644 index 00000000..68567b80 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); + +ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL; + +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test new file mode 100644 index 00000000..ebf7213b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_fulltext_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2017 Naoya Murakami +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mariadb_10_2_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) + VALUES (1, '{"level": "info", "message": "start server"}'); + +ALTER TABLE logs ADD FULLTEXT INDEX (message); + +INSERT INTO logs(id, record) + VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) + VALUES (3, '{"level": "warn", "message": "abort server"}'); + +SELECT * FROM logs WHERE MATCH(message) AGAINST('+start' IN BOOLEAN MODE); + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test new file mode 100644 index 00000000..c5719ff7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_add_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2017 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + level VARCHAR(255) GENERATED ALWAYS AS + (json_unquote(json_extract(`record`, '$.level'))) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) + VALUES (1, '{"level": "info", "message": "start server"}'); + +ALTER TABLE logs ADD INDEX (level); + +INSERT INTO logs(id, record) + VALUES (2, '{"level": "info", "message": "start server"}'); +INSERT INTO logs(id, record) + VALUES (3, '{"level": "warn", "message": "abort server"}'); + +SELECT * FROM logs WHERE level = 'info'; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test new file mode 100644 index 00000000..df371534 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +DELETE FROM logs WHERE id = 1; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test new file mode 100644 index 00000000..b025fd79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_drop_column.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +ALTER TABLE logs DROP COLUMN message; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test new file mode 100644 index 00000000..4ef127f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_insert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test new file mode 100644 index 00000000..fe9b662b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_generated_virtual_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2017 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_version_5_7_or_later.inc +--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS logs; +--enable_warnings + +CREATE TABLE logs ( + id INT PRIMARY KEY, + record JSON, + message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) VIRTUAL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}'); +INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}'); +INSERT INTO logs(id, record) VALUES (3, '{"level": "warn", "message": "abort"}'); + +UPDATE logs SET record = '{"level": "info", "message": "shutdown"}' WHERE id = 2; + +SELECT * FROM logs; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test new file mode 100644 index 00000000..5898e377 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES cp932; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT, + O text, + FULLTEXT INDEX (O) +) DEFAULT CHARSET=cp932 COMMENT='Engine "InnoDB"'; + +INSERT INTO users (O) VALUES ("܂"); +INSERT INTO users (O) VALUES ("Ȃ"); +INSERT INTO users (O) VALUES (""); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (O) AGAINST ('+Ȃ' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test new file mode 100644 index 00000000..c646a1d2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test @@ -0,0 +1,53 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SET NAMES utf8; + +CREATE TABLE users ( + id int unsigned PRIMARY KEY AUTO_INCREMENT, + 名前 text, + FULLTEXT INDEX (名前) +) DEFAULT CHARSET=utf8 COMMENT='Engine "InnoDB"'; + +INSERT INTO users (名前) VALUES ("やまだ"); +INSERT INTO users (名前) VALUES ("たなか"); +INSERT INTO users (名前) VALUES ("すずき"); + +SELECT * FROM users; + +SELECT * FROM users + WHERE MATCH (名前) AGAINST ('+たなか' IN BOOLEAN MODE); + +SELECT mroonga_command("dump --dump_plugins no --dump_records no"); + +DROP TABLE users; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test new file mode 100644 index 00000000..802f5beb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test new file mode 100644 index 00000000..de9e8108 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star.test @@ -0,0 +1,36 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +INSERT INTO ids VALUES (1); +INSERT INTO ids VALUES (2); +INSERT INTO ids VALUES (3); + +SELECT COUNT(*) FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test new file mode 100644 index 00000000..9a082c69 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_mysql_5_7_or_later_with_index.test @@ -0,0 +1,55 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE diaries_innodb ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; + +CREATE TABLE diaries_mroonga ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); + +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); + +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; + +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test new file mode 100644 index 00000000..dce0899e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test @@ -0,0 +1,57 @@ +# Copyright(C) 2011-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE diaries_innodb ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; + +CREATE TABLE diaries_mroonga ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); + +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); + +-- replace_column 9 # +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +-- replace_column 9 # +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; + +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000..997410b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test @@ -0,0 +1,101 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# simple test +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t3 (c1 int primary key) COMMENT = 'engine "innodb"'; +drop table t1,t2,t3; +create table t1 (c1 int primary key, c2 int, c3 int) COMMENT = 'engine "innodb"'; +drop table t1; + +# data type support +create table t1 (c1 bit primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 decimal primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP +desc t1; +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 char(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 varchar(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 binary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 varbinary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 enum("yes","no") primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 set("A","B","AB","O") primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; + +# error test +--error ER_REQUIRES_PRIMARY_KEY +create table t1 (c1 int) COMMENT = 'engine "innodb"'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test new file mode 100644 index 00000000..e6dd9908 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='Free style normal comment, engine "InnoDB"'; + +SELECT mroonga_command("dump --dump_plugins no"); + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test new file mode 100644 index 00000000..e5c66243 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_comment.test @@ -0,0 +1,40 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 '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_flags_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test new file mode 100644 index 00000000..e8b57a93 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_none.test @@ -0,0 +1,40 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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 '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_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test new file mode 100644 index 00000000..ca536cc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_flags_parameter.test @@ -0,0 +1,42 @@ +# Copyright(C) 2015 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--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) FLAGS='WITH_POSITION|WITH_WEIGHT' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +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_none.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_index_flags_none.test new file mode 100644 index 00000000..0b02780d --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..aa0737f4 --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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_normalizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test new file mode 100644 index 00000000..b393c59a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_comment.test @@ -0,0 +1,40 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test new file mode 100644 index 00000000..000d2d5b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index_bin.test @@ -0,0 +1,40 @@ +# Copyright(C) 2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test new file mode 100644 index 00000000..354d27c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_parameter.test @@ -0,0 +1,41 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) NORMALIZER='NormalizerAuto' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES (1, "1日の消費㌍は約2000㌔㌍"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test new file mode 100644 index 00000000..064685d2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_parser_comment.test @@ -0,0 +1,38 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) + comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +select * from diaries; +select * from diaries where match(body) against("+start" in boolean mode) order by id; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test new file mode 100644 index 00000000..45c75817 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins 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_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test new file mode 100644 index 00000000..64732efd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump --dump_plugins 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_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test new file mode 100644 index 00000000..3fb0caea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test @@ -0,0 +1,46 @@ +# Copyright(C) 2014 Naoya Murakami +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_groonga_plugin_register.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("plugin_register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) TOKEN_FILTERS='TokenFilterStopWord,TokenFilterStopWord' +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +SHOW CREATE TABLE memos; + +SELECT mroonga_command("dump --dump_plugins 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_tokenizer_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test new file mode 100644 index 00000000..29233d01 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_comment.test @@ -0,0 +1,37 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) + comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +insert into diaries (body) values ("will start Groonga!"); +insert into diaries (body) values ("starting Groonga..."); +insert into diaries (body) values ("started Groonga."); +select * from diaries; +select * from diaries where match(body) against("+start" in boolean mode) order by id; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test new file mode 100644 index 00000000..072ad450 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_tokenizer_parameter.test @@ -0,0 +1,42 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mariadb.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id int PRIMARY KEY AUTO_INCREMENT, + body text, + FULLTEXT INDEX body_index (body) TOKENIZER='TokenBigramSplitSymbolAlphaDigit' +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET utf8; + +INSERT INTO diaries (body) VALUES ("will start Groonga!"); +INSERT INTO diaries (body) VALUES ("starting Groonga..."); +INSERT INTO diaries (body) VALUES ("started Groonga."); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("+start" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test new file mode 100644 index 00000000..9491ba7f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test @@ -0,0 +1,59 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int) COMMENT 'engine = "innodb"'; +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; + +delete from t1 where c1=3; +select * from t1; + +flush tables; + +delete from t1 where c1=2; +select * from t1; + +delete from t1; +select * from t1; + +drop table t1; + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT 'engine = "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +select * from t1 where match(c2) against("ki"); +delete from t1 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test new file mode 100644 index 00000000..50ebec44 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100), + FULLTEXT INDEX (name) +) COMMENT 'engine = "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, 'Alice'); +INSERT INTO users VALUES (2, 'Bob'); +INSERT INTO users VALUES (3, 'Chris'); + +SELECT * FROM users; + +DELETE FROM users; + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.test new file mode 100644 index 00000000..5e761376 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/drop_table_new_connection.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/not_embedded.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +CREATE TABLE logs ( + id INT PRIMARY KEY AUTO_INCREMENT, + message TEXT, + FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +disable_query_log; +CONNECT(drop_connection, localhost, root); +enable_query_log; + +USE test; +DROP TABLE logs; + +disable_query_log; +CONNECTION default; +enable_query_log; + +CREATE TABLE logs ( + id INT PRIMARY KEY AUTO_INCREMENT, + message TEXT, + FULLTEXT INDEX (message) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +DROP TABLE logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test new file mode 100644 index 00000000..92c6b3fd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test new file mode 100644 index 00000000..5acbbe5c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title), + FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "富士山", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気 1月1日", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "天気 4月4日", "今日も天気がよくてきれいに見える。"); + +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +SELECT 1 FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test new file mode 100644 index 00000000..bbd8223b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test new file mode 100644 index 00000000..d49e7e92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test new file mode 100644 index 00000000..2f90b965 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test new file mode 100644 index 00000000..dffbb6e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test new file mode 100644 index 00000000..310ca900 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test new file mode 100644 index 00000000..cd65c792 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE) + ORDER BY id; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test new file mode 100644 index 00000000..3c8145f1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test new file mode 100644 index 00000000..f7e45706 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test new file mode 100644 index 00000000..94069f9a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test new file mode 100644 index 00000000..5c36b04b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test new file mode 100644 index 00000000..a8ee6cf3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test new file mode 100644 index 00000000..63379dcd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test new file mode 100644 index 00000000..5f42b534 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test @@ -0,0 +1,38 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su"); +select * from t1 where match(c3) against("ii"); +select * from t1 where match(c3) against("+su" in boolean mode); +select * from t1 where match(c3) against("+ii" in boolean mode); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test new file mode 100644 index 00000000..b7b5ccf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "̕xmR̓VCɂ‚",""); +insert into t1 values(2, "","̕xmR̓VC͕܂"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("xmR"); +select * from t1 where match(c3) against("xmR"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test new file mode 100644 index 00000000..afe22027 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms COMMENT = 'engine "innodb"'; +insert into t1 values(1, "ٻλŷˤĤ",""); +insert into t1 values(2, "","ٻλŷʬޤ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("ٻλ"); +select * from t1 where match(c3) against("ٻλ"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test new file mode 100644 index 00000000..d013abb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山"); +select * from t1 where match(c3) against("富士山"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test new file mode 100644 index 00000000..e6f3d811 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + content text, + FULLTEXT INDEX (title) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES (1, "Hello", "はじめました。"); +INSERT INTO diaries VALUES (2, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES (3, "富士山", "今日もきれい。"); + +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); + +DROP INDEX title ON diaries; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +SELECT * FROM diaries; + +CREATE FULLTEXT INDEX new_title_index ON diaries (title); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test new file mode 100644 index 00000000..38adadea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test @@ -0,0 +1,51 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 values (1, "aa ii uu ee oo"); +insert into t2 values (2, "ka ki ku ke ko"); +insert into t2 values (3, "aa ii ii ii oo"); +insert into t2 values (4, "sa si su se so"); +insert into t2 values (5, "ta ti ii ii to"); +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +drop table t1,t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test new file mode 100644 index 00000000..b8e55db4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test @@ -0,0 +1,34 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test new file mode 100644 index 00000000..a036a521 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test @@ -0,0 +1,4135 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + fulltext index (title) +) default charset utf8 COMMENT = 'engine "innodb"'; + +set autocommit=0; +insert into diaries values(0, "2011-07-14"); +insert into diaries values(1, "2011-07-15"); +insert into diaries values(2, "2011-07-16"); +insert into diaries values(3, "2011-07-17"); +insert into diaries values(4, "2011-07-18"); +insert into diaries values(5, "2011-07-19"); +insert into diaries values(6, "2011-07-20"); +insert into diaries values(7, "2011-07-21"); +insert into diaries values(8, "2011-07-22"); +insert into diaries values(9, "2011-07-23"); +insert into diaries values(10, "2011-07-24"); +insert into diaries values(11, "2011-07-25"); +insert into diaries values(12, "2011-07-26"); +insert into diaries values(13, "2011-07-27"); +insert into diaries values(14, "2011-07-28"); +insert into diaries values(15, "2011-07-29"); +insert into diaries values(16, "2011-07-30"); +insert into diaries values(17, "2011-07-31"); +insert into diaries values(18, "2011-08-01"); +insert into diaries values(19, "2011-08-02"); +insert into diaries values(20, "2011-08-03"); +insert into diaries values(21, "2011-08-04"); +insert into diaries values(22, "2011-08-05"); +insert into diaries values(23, "2011-08-06"); +insert into diaries values(24, "2011-08-07"); +insert into diaries values(25, "2011-08-08"); +insert into diaries values(26, "2011-08-09"); +insert into diaries values(27, "2011-08-10"); +insert into diaries values(28, "2011-08-11"); +insert into diaries values(29, "2011-08-12"); +insert into diaries values(30, "2011-08-13"); +insert into diaries values(31, "2011-08-14"); +insert into diaries values(32, "2011-08-15"); +insert into diaries values(33, "2011-08-16"); +insert into diaries values(34, "2011-08-17"); +insert into diaries values(35, "2011-08-18"); +insert into diaries values(36, "2011-08-19"); +insert into diaries values(37, "2011-08-20"); +insert into diaries values(38, "2011-08-21"); +insert into diaries values(39, "2011-08-22"); +insert into diaries values(40, "2011-08-23"); +insert into diaries values(41, "2011-08-24"); +insert into diaries values(42, "2011-08-25"); +insert into diaries values(43, "2011-08-26"); +insert into diaries values(44, "2011-08-27"); +insert into diaries values(45, "2011-08-28"); +insert into diaries values(46, "2011-08-29"); +insert into diaries values(47, "2011-08-30"); +insert into diaries values(48, "2011-08-31"); +insert into diaries values(49, "2011-09-01"); +insert into diaries values(50, "2011-09-02"); +insert into diaries values(51, "2011-09-03"); +insert into diaries values(52, "2011-09-04"); +insert into diaries values(53, "2011-09-05"); +insert into diaries values(54, "2011-09-06"); +insert into diaries values(55, "2011-09-07"); +insert into diaries values(56, "2011-09-08"); +insert into diaries values(57, "2011-09-09"); +insert into diaries values(58, "2011-09-10"); +insert into diaries values(59, "2011-09-11"); +insert into diaries values(60, "2011-09-12"); +insert into diaries values(61, "2011-09-13"); +insert into diaries values(62, "2011-09-14"); +insert into diaries values(63, "2011-09-15"); +insert into diaries values(64, "2011-09-16"); +insert into diaries values(65, "2011-09-17"); +insert into diaries values(66, "2011-09-18"); +insert into diaries values(67, "2011-09-19"); +insert into diaries values(68, "2011-09-20"); +insert into diaries values(69, "2011-09-21"); +insert into diaries values(70, "2011-09-22"); +insert into diaries values(71, "2011-09-23"); +insert into diaries values(72, "2011-09-24"); +insert into diaries values(73, "2011-09-25"); +insert into diaries values(74, "2011-09-26"); +insert into diaries values(75, "2011-09-27"); +insert into diaries values(76, "2011-09-28"); +insert into diaries values(77, "2011-09-29"); +insert into diaries values(78, "2011-09-30"); +insert into diaries values(79, "2011-10-01"); +insert into diaries values(80, "2011-10-02"); +insert into diaries values(81, "2011-10-03"); +insert into diaries values(82, "2011-10-04"); +insert into diaries values(83, "2011-10-05"); +insert into diaries values(84, "2011-10-06"); +insert into diaries values(85, "2011-10-07"); +insert into diaries values(86, "2011-10-08"); +insert into diaries values(87, "2011-10-09"); +insert into diaries values(88, "2011-10-10"); +insert into diaries values(89, "2011-10-11"); +insert into diaries values(90, "2011-10-12"); +insert into diaries values(91, "2011-10-13"); +insert into diaries values(92, "2011-10-14"); +insert into diaries values(93, "2011-10-15"); +insert into diaries values(94, "2011-10-16"); +insert into diaries values(95, "2011-10-17"); +insert into diaries values(96, "2011-10-18"); +insert into diaries values(97, "2011-10-19"); +insert into diaries values(98, "2011-10-20"); +insert into diaries values(99, "2011-10-21"); +insert into diaries values(100, "2011-10-22"); +insert into diaries values(101, "2011-10-23"); +insert into diaries values(102, "2011-10-24"); +insert into diaries values(103, "2011-10-25"); +insert into diaries values(104, "2011-10-26"); +insert into diaries values(105, "2011-10-27"); +insert into diaries values(106, "2011-10-28"); +insert into diaries values(107, "2011-10-29"); +insert into diaries values(108, "2011-10-30"); +insert into diaries values(109, "2011-10-31"); +insert into diaries values(110, "2011-11-01"); +insert into diaries values(111, "2011-11-02"); +insert into diaries values(112, "2011-11-03"); +insert into diaries values(113, "2011-11-04"); +insert into diaries values(114, "2011-11-05"); +insert into diaries values(115, "2011-11-06"); +insert into diaries values(116, "2011-11-07"); +insert into diaries values(117, "2011-11-08"); +insert into diaries values(118, "2011-11-09"); +insert into diaries values(119, "2011-11-10"); +insert into diaries values(120, "2011-11-11"); +insert into diaries values(121, "2011-11-12"); +insert into diaries values(122, "2011-11-13"); +insert into diaries values(123, "2011-11-14"); +insert into diaries values(124, "2011-11-15"); +insert into diaries values(125, "2011-11-16"); +insert into diaries values(126, "2011-11-17"); +insert into diaries values(127, "2011-11-18"); +insert into diaries values(128, "2011-11-19"); +insert into diaries values(129, "2011-11-20"); +insert into diaries values(130, "2011-11-21"); +insert into diaries values(131, "2011-11-22"); +insert into diaries values(132, "2011-11-23"); +insert into diaries values(133, "2011-11-24"); +insert into diaries values(134, "2011-11-25"); +insert into diaries values(135, "2011-11-26"); +insert into diaries values(136, "2011-11-27"); +insert into diaries values(137, "2011-11-28"); +insert into diaries values(138, "2011-11-29"); +insert into diaries values(139, "2011-11-30"); +insert into diaries values(140, "2011-12-01"); +insert into diaries values(141, "2011-12-02"); +insert into diaries values(142, "2011-12-03"); +insert into diaries values(143, "2011-12-04"); +insert into diaries values(144, "2011-12-05"); +insert into diaries values(145, "2011-12-06"); +insert into diaries values(146, "2011-12-07"); +insert into diaries values(147, "2011-12-08"); +insert into diaries values(148, "2011-12-09"); +insert into diaries values(149, "2011-12-10"); +insert into diaries values(150, "2011-12-11"); +insert into diaries values(151, "2011-12-12"); +insert into diaries values(152, "2011-12-13"); +insert into diaries values(153, "2011-12-14"); +insert into diaries values(154, "2011-12-15"); +insert into diaries values(155, "2011-12-16"); +insert into diaries values(156, "2011-12-17"); +insert into diaries values(157, "2011-12-18"); +insert into diaries values(158, "2011-12-19"); +insert into diaries values(159, "2011-12-20"); +insert into diaries values(160, "2011-12-21"); +insert into diaries values(161, "2011-12-22"); +insert into diaries values(162, "2011-12-23"); +insert into diaries values(163, "2011-12-24"); +insert into diaries values(164, "2011-12-25"); +insert into diaries values(165, "2011-12-26"); +insert into diaries values(166, "2011-12-27"); +insert into diaries values(167, "2011-12-28"); +insert into diaries values(168, "2011-12-29"); +insert into diaries values(169, "2011-12-30"); +insert into diaries values(170, "2011-12-31"); +insert into diaries values(171, "2012-01-01"); +insert into diaries values(172, "2012-01-02"); +insert into diaries values(173, "2012-01-03"); +insert into diaries values(174, "2012-01-04"); +insert into diaries values(175, "2012-01-05"); +insert into diaries values(176, "2012-01-06"); +insert into diaries values(177, "2012-01-07"); +insert into diaries values(178, "2012-01-08"); +insert into diaries values(179, "2012-01-09"); +insert into diaries values(180, "2012-01-10"); +insert into diaries values(181, "2012-01-11"); +insert into diaries values(182, "2012-01-12"); +insert into diaries values(183, "2012-01-13"); +insert into diaries values(184, "2012-01-14"); +insert into diaries values(185, "2012-01-15"); +insert into diaries values(186, "2012-01-16"); +insert into diaries values(187, "2012-01-17"); +insert into diaries values(188, "2012-01-18"); +insert into diaries values(189, "2012-01-19"); +insert into diaries values(190, "2012-01-20"); +insert into diaries values(191, "2012-01-21"); +insert into diaries values(192, "2012-01-22"); +insert into diaries values(193, "2012-01-23"); +insert into diaries values(194, "2012-01-24"); +insert into diaries values(195, "2012-01-25"); +insert into diaries values(196, "2012-01-26"); +insert into diaries values(197, "2012-01-27"); +insert into diaries values(198, "2012-01-28"); +insert into diaries values(199, "2012-01-29"); +insert into diaries values(200, "2012-01-30"); +insert into diaries values(201, "2012-01-31"); +insert into diaries values(202, "2012-02-01"); +insert into diaries values(203, "2012-02-02"); +insert into diaries values(204, "2012-02-03"); +insert into diaries values(205, "2012-02-04"); +insert into diaries values(206, "2012-02-05"); +insert into diaries values(207, "2012-02-06"); +insert into diaries values(208, "2012-02-07"); +insert into diaries values(209, "2012-02-08"); +insert into diaries values(210, "2012-02-09"); +insert into diaries values(211, "2012-02-10"); +insert into diaries values(212, "2012-02-11"); +insert into diaries values(213, "2012-02-12"); +insert into diaries values(214, "2012-02-13"); +insert into diaries values(215, "2012-02-14"); +insert into diaries values(216, "2012-02-15"); +insert into diaries values(217, "2012-02-16"); +insert into diaries values(218, "2012-02-17"); +insert into diaries values(219, "2012-02-18"); +insert into diaries values(220, "2012-02-19"); +insert into diaries values(221, "2012-02-20"); +insert into diaries values(222, "2012-02-21"); +insert into diaries values(223, "2012-02-22"); +insert into diaries values(224, "2012-02-23"); +insert into diaries values(225, "2012-02-24"); +insert into diaries values(226, "2012-02-25"); +insert into diaries values(227, "2012-02-26"); +insert into diaries values(228, "2012-02-27"); +insert into diaries values(229, "2012-02-28"); +insert into diaries values(230, "2012-02-29"); +insert into diaries values(231, "2012-03-01"); +insert into diaries values(232, "2012-03-02"); +insert into diaries values(233, "2012-03-03"); +insert into diaries values(234, "2012-03-04"); +insert into diaries values(235, "2012-03-05"); +insert into diaries values(236, "2012-03-06"); +insert into diaries values(237, "2012-03-07"); +insert into diaries values(238, "2012-03-08"); +insert into diaries values(239, "2012-03-09"); +insert into diaries values(240, "2012-03-10"); +insert into diaries values(241, "2012-03-11"); +insert into diaries values(242, "2012-03-12"); +insert into diaries values(243, "2012-03-13"); +insert into diaries values(244, "2012-03-14"); +insert into diaries values(245, "2012-03-15"); +insert into diaries values(246, "2012-03-16"); +insert into diaries values(247, "2012-03-17"); +insert into diaries values(248, "2012-03-18"); +insert into diaries values(249, "2012-03-19"); +insert into diaries values(250, "2012-03-20"); +insert into diaries values(251, "2012-03-21"); +insert into diaries values(252, "2012-03-22"); +insert into diaries values(253, "2012-03-23"); +insert into diaries values(254, "2012-03-24"); +insert into diaries values(255, "2012-03-25"); +insert into diaries values(256, "2012-03-26"); +insert into diaries values(257, "2012-03-27"); +insert into diaries values(258, "2012-03-28"); +insert into diaries values(259, "2012-03-29"); +insert into diaries values(260, "2012-03-30"); +insert into diaries values(261, "2012-03-31"); +insert into diaries values(262, "2012-04-01"); +insert into diaries values(263, "2012-04-02"); +insert into diaries values(264, "2012-04-03"); +insert into diaries values(265, "2012-04-04"); +insert into diaries values(266, "2012-04-05"); +insert into diaries values(267, "2012-04-06"); +insert into diaries values(268, "2012-04-07"); +insert into diaries values(269, "2012-04-08"); +insert into diaries values(270, "2012-04-09"); +insert into diaries values(271, "2012-04-10"); +insert into diaries values(272, "2012-04-11"); +insert into diaries values(273, "2012-04-12"); +insert into diaries values(274, "2012-04-13"); +insert into diaries values(275, "2012-04-14"); +insert into diaries values(276, "2012-04-15"); +insert into diaries values(277, "2012-04-16"); +insert into diaries values(278, "2012-04-17"); +insert into diaries values(279, "2012-04-18"); +insert into diaries values(280, "2012-04-19"); +insert into diaries values(281, "2012-04-20"); +insert into diaries values(282, "2012-04-21"); +insert into diaries values(283, "2012-04-22"); +insert into diaries values(284, "2012-04-23"); +insert into diaries values(285, "2012-04-24"); +insert into diaries values(286, "2012-04-25"); +insert into diaries values(287, "2012-04-26"); +insert into diaries values(288, "2012-04-27"); +insert into diaries values(289, "2012-04-28"); +insert into diaries values(290, "2012-04-29"); +insert into diaries values(291, "2012-04-30"); +insert into diaries values(292, "2012-05-01"); +insert into diaries values(293, "2012-05-02"); +insert into diaries values(294, "2012-05-03"); +insert into diaries values(295, "2012-05-04"); +insert into diaries values(296, "2012-05-05"); +insert into diaries values(297, "2012-05-06"); +insert into diaries values(298, "2012-05-07"); +insert into diaries values(299, "2012-05-08"); +insert into diaries values(300, "2012-05-09"); +insert into diaries values(301, "2012-05-10"); +insert into diaries values(302, "2012-05-11"); +insert into diaries values(303, "2012-05-12"); +insert into diaries values(304, "2012-05-13"); +insert into diaries values(305, "2012-05-14"); +insert into diaries values(306, "2012-05-15"); +insert into diaries values(307, "2012-05-16"); +insert into diaries values(308, "2012-05-17"); +insert into diaries values(309, "2012-05-18"); +insert into diaries values(310, "2012-05-19"); +insert into diaries values(311, "2012-05-20"); +insert into diaries values(312, "2012-05-21"); +insert into diaries values(313, "2012-05-22"); +insert into diaries values(314, "2012-05-23"); +insert into diaries values(315, "2012-05-24"); +insert into diaries values(316, "2012-05-25"); +insert into diaries values(317, "2012-05-26"); +insert into diaries values(318, "2012-05-27"); +insert into diaries values(319, "2012-05-28"); +insert into diaries values(320, "2012-05-29"); +insert into diaries values(321, "2012-05-30"); +insert into diaries values(322, "2012-05-31"); +insert into diaries values(323, "2012-06-01"); +insert into diaries values(324, "2012-06-02"); +insert into diaries values(325, "2012-06-03"); +insert into diaries values(326, "2012-06-04"); +insert into diaries values(327, "2012-06-05"); +insert into diaries values(328, "2012-06-06"); +insert into diaries values(329, "2012-06-07"); +insert into diaries values(330, "2012-06-08"); +insert into diaries values(331, "2012-06-09"); +insert into diaries values(332, "2012-06-10"); +insert into diaries values(333, "2012-06-11"); +insert into diaries values(334, "2012-06-12"); +insert into diaries values(335, "2012-06-13"); +insert into diaries values(336, "2012-06-14"); +insert into diaries values(337, "2012-06-15"); +insert into diaries values(338, "2012-06-16"); +insert into diaries values(339, "2012-06-17"); +insert into diaries values(340, "2012-06-18"); +insert into diaries values(341, "2012-06-19"); +insert into diaries values(342, "2012-06-20"); +insert into diaries values(343, "2012-06-21"); +insert into diaries values(344, "2012-06-22"); +insert into diaries values(345, "2012-06-23"); +insert into diaries values(346, "2012-06-24"); +insert into diaries values(347, "2012-06-25"); +insert into diaries values(348, "2012-06-26"); +insert into diaries values(349, "2012-06-27"); +insert into diaries values(350, "2012-06-28"); +insert into diaries values(351, "2012-06-29"); +insert into diaries values(352, "2012-06-30"); +insert into diaries values(353, "2012-07-01"); +insert into diaries values(354, "2012-07-02"); +insert into diaries values(355, "2012-07-03"); +insert into diaries values(356, "2012-07-04"); +insert into diaries values(357, "2012-07-05"); +insert into diaries values(358, "2012-07-06"); +insert into diaries values(359, "2012-07-07"); +insert into diaries values(360, "2012-07-08"); +insert into diaries values(361, "2012-07-09"); +insert into diaries values(362, "2012-07-10"); +insert into diaries values(363, "2012-07-11"); +insert into diaries values(364, "2012-07-12"); +insert into diaries values(365, "2012-07-13"); +insert into diaries values(366, "2012-07-14"); +insert into diaries values(367, "2012-07-15"); +insert into diaries values(368, "2012-07-16"); +insert into diaries values(369, "2012-07-17"); +insert into diaries values(370, "2012-07-18"); +insert into diaries values(371, "2012-07-19"); +insert into diaries values(372, "2012-07-20"); +insert into diaries values(373, "2012-07-21"); +insert into diaries values(374, "2012-07-22"); +insert into diaries values(375, "2012-07-23"); +insert into diaries values(376, "2012-07-24"); +insert into diaries values(377, "2012-07-25"); +insert into diaries values(378, "2012-07-26"); +insert into diaries values(379, "2012-07-27"); +insert into diaries values(380, "2012-07-28"); +insert into diaries values(381, "2012-07-29"); +insert into diaries values(382, "2012-07-30"); +insert into diaries values(383, "2012-07-31"); +insert into diaries values(384, "2012-08-01"); +insert into diaries values(385, "2012-08-02"); +insert into diaries values(386, "2012-08-03"); +insert into diaries values(387, "2012-08-04"); +insert into diaries values(388, "2012-08-05"); +insert into diaries values(389, "2012-08-06"); +insert into diaries values(390, "2012-08-07"); +insert into diaries values(391, "2012-08-08"); +insert into diaries values(392, "2012-08-09"); +insert into diaries values(393, "2012-08-10"); +insert into diaries values(394, "2012-08-11"); +insert into diaries values(395, "2012-08-12"); +insert into diaries values(396, "2012-08-13"); +insert into diaries values(397, "2012-08-14"); +insert into diaries values(398, "2012-08-15"); +insert into diaries values(399, "2012-08-16"); +insert into diaries values(400, "2012-08-17"); +insert into diaries values(401, "2012-08-18"); +insert into diaries values(402, "2012-08-19"); +insert into diaries values(403, "2012-08-20"); +insert into diaries values(404, "2012-08-21"); +insert into diaries values(405, "2012-08-22"); +insert into diaries values(406, "2012-08-23"); +insert into diaries values(407, "2012-08-24"); +insert into diaries values(408, "2012-08-25"); +insert into diaries values(409, "2012-08-26"); +insert into diaries values(410, "2012-08-27"); +insert into diaries values(411, "2012-08-28"); +insert into diaries values(412, "2012-08-29"); +insert into diaries values(413, "2012-08-30"); +insert into diaries values(414, "2012-08-31"); +insert into diaries values(415, "2012-09-01"); +insert into diaries values(416, "2012-09-02"); +insert into diaries values(417, "2012-09-03"); +insert into diaries values(418, "2012-09-04"); +insert into diaries values(419, "2012-09-05"); +insert into diaries values(420, "2012-09-06"); +insert into diaries values(421, "2012-09-07"); +insert into diaries values(422, "2012-09-08"); +insert into diaries values(423, "2012-09-09"); +insert into diaries values(424, "2012-09-10"); +insert into diaries values(425, "2012-09-11"); +insert into diaries values(426, "2012-09-12"); +insert into diaries values(427, "2012-09-13"); +insert into diaries values(428, "2012-09-14"); +insert into diaries values(429, "2012-09-15"); +insert into diaries values(430, "2012-09-16"); +insert into diaries values(431, "2012-09-17"); +insert into diaries values(432, "2012-09-18"); +insert into diaries values(433, "2012-09-19"); +insert into diaries values(434, "2012-09-20"); +insert into diaries values(435, "2012-09-21"); +insert into diaries values(436, "2012-09-22"); +insert into diaries values(437, "2012-09-23"); +insert into diaries values(438, "2012-09-24"); +insert into diaries values(439, "2012-09-25"); +insert into diaries values(440, "2012-09-26"); +insert into diaries values(441, "2012-09-27"); +insert into diaries values(442, "2012-09-28"); +insert into diaries values(443, "2012-09-29"); +insert into diaries values(444, "2012-09-30"); +insert into diaries values(445, "2012-10-01"); +insert into diaries values(446, "2012-10-02"); +insert into diaries values(447, "2012-10-03"); +insert into diaries values(448, "2012-10-04"); +insert into diaries values(449, "2012-10-05"); +insert into diaries values(450, "2012-10-06"); +insert into diaries values(451, "2012-10-07"); +insert into diaries values(452, "2012-10-08"); +insert into diaries values(453, "2012-10-09"); +insert into diaries values(454, "2012-10-10"); +insert into diaries values(455, "2012-10-11"); +insert into diaries values(456, "2012-10-12"); +insert into diaries values(457, "2012-10-13"); +insert into diaries values(458, "2012-10-14"); +insert into diaries values(459, "2012-10-15"); +insert into diaries values(460, "2012-10-16"); +insert into diaries values(461, "2012-10-17"); +insert into diaries values(462, "2012-10-18"); +insert into diaries values(463, "2012-10-19"); +insert into diaries values(464, "2012-10-20"); +insert into diaries values(465, "2012-10-21"); +insert into diaries values(466, "2012-10-22"); +insert into diaries values(467, "2012-10-23"); +insert into diaries values(468, "2012-10-24"); +insert into diaries values(469, "2012-10-25"); +insert into diaries values(470, "2012-10-26"); +insert into diaries values(471, "2012-10-27"); +insert into diaries values(472, "2012-10-28"); +insert into diaries values(473, "2012-10-29"); +insert into diaries values(474, "2012-10-30"); +insert into diaries values(475, "2012-10-31"); +insert into diaries values(476, "2012-11-01"); +insert into diaries values(477, "2012-11-02"); +insert into diaries values(478, "2012-11-03"); +insert into diaries values(479, "2012-11-04"); +insert into diaries values(480, "2012-11-05"); +insert into diaries values(481, "2012-11-06"); +insert into diaries values(482, "2012-11-07"); +insert into diaries values(483, "2012-11-08"); +insert into diaries values(484, "2012-11-09"); +insert into diaries values(485, "2012-11-10"); +insert into diaries values(486, "2012-11-11"); +insert into diaries values(487, "2012-11-12"); +insert into diaries values(488, "2012-11-13"); +insert into diaries values(489, "2012-11-14"); +insert into diaries values(490, "2012-11-15"); +insert into diaries values(491, "2012-11-16"); +insert into diaries values(492, "2012-11-17"); +insert into diaries values(493, "2012-11-18"); +insert into diaries values(494, "2012-11-19"); +insert into diaries values(495, "2012-11-20"); +insert into diaries values(496, "2012-11-21"); +insert into diaries values(497, "2012-11-22"); +insert into diaries values(498, "2012-11-23"); +insert into diaries values(499, "2012-11-24"); +insert into diaries values(500, "2012-11-25"); +insert into diaries values(501, "2012-11-26"); +insert into diaries values(502, "2012-11-27"); +insert into diaries values(503, "2012-11-28"); +insert into diaries values(504, "2012-11-29"); +insert into diaries values(505, "2012-11-30"); +insert into diaries values(506, "2012-12-01"); +insert into diaries values(507, "2012-12-02"); +insert into diaries values(508, "2012-12-03"); +insert into diaries values(509, "2012-12-04"); +insert into diaries values(510, "2012-12-05"); +insert into diaries values(511, "2012-12-06"); +insert into diaries values(512, "2012-12-07"); +insert into diaries values(513, "2012-12-08"); +insert into diaries values(514, "2012-12-09"); +insert into diaries values(515, "2012-12-10"); +insert into diaries values(516, "2012-12-11"); +insert into diaries values(517, "2012-12-12"); +insert into diaries values(518, "2012-12-13"); +insert into diaries values(519, "2012-12-14"); +insert into diaries values(520, "2012-12-15"); +insert into diaries values(521, "2012-12-16"); +insert into diaries values(522, "2012-12-17"); +insert into diaries values(523, "2012-12-18"); +insert into diaries values(524, "2012-12-19"); +insert into diaries values(525, "2012-12-20"); +insert into diaries values(526, "2012-12-21"); +insert into diaries values(527, "2012-12-22"); +insert into diaries values(528, "2012-12-23"); +insert into diaries values(529, "2012-12-24"); +insert into diaries values(530, "2012-12-25"); +insert into diaries values(531, "2012-12-26"); +insert into diaries values(532, "2012-12-27"); +insert into diaries values(533, "2012-12-28"); +insert into diaries values(534, "2012-12-29"); +insert into diaries values(535, "2012-12-30"); +insert into diaries values(536, "2012-12-31"); +insert into diaries values(537, "2013-01-01"); +insert into diaries values(538, "2013-01-02"); +insert into diaries values(539, "2013-01-03"); +insert into diaries values(540, "2013-01-04"); +insert into diaries values(541, "2013-01-05"); +insert into diaries values(542, "2013-01-06"); +insert into diaries values(543, "2013-01-07"); +insert into diaries values(544, "2013-01-08"); +insert into diaries values(545, "2013-01-09"); +insert into diaries values(546, "2013-01-10"); +insert into diaries values(547, "2013-01-11"); +insert into diaries values(548, "2013-01-12"); +insert into diaries values(549, "2013-01-13"); +insert into diaries values(550, "2013-01-14"); +insert into diaries values(551, "2013-01-15"); +insert into diaries values(552, "2013-01-16"); +insert into diaries values(553, "2013-01-17"); +insert into diaries values(554, "2013-01-18"); +insert into diaries values(555, "2013-01-19"); +insert into diaries values(556, "2013-01-20"); +insert into diaries values(557, "2013-01-21"); +insert into diaries values(558, "2013-01-22"); +insert into diaries values(559, "2013-01-23"); +insert into diaries values(560, "2013-01-24"); +insert into diaries values(561, "2013-01-25"); +insert into diaries values(562, "2013-01-26"); +insert into diaries values(563, "2013-01-27"); +insert into diaries values(564, "2013-01-28"); +insert into diaries values(565, "2013-01-29"); +insert into diaries values(566, "2013-01-30"); +insert into diaries values(567, "2013-01-31"); +insert into diaries values(568, "2013-02-01"); +insert into diaries values(569, "2013-02-02"); +insert into diaries values(570, "2013-02-03"); +insert into diaries values(571, "2013-02-04"); +insert into diaries values(572, "2013-02-05"); +insert into diaries values(573, "2013-02-06"); +insert into diaries values(574, "2013-02-07"); +insert into diaries values(575, "2013-02-08"); +insert into diaries values(576, "2013-02-09"); +insert into diaries values(577, "2013-02-10"); +insert into diaries values(578, "2013-02-11"); +insert into diaries values(579, "2013-02-12"); +insert into diaries values(580, "2013-02-13"); +insert into diaries values(581, "2013-02-14"); +insert into diaries values(582, "2013-02-15"); +insert into diaries values(583, "2013-02-16"); +insert into diaries values(584, "2013-02-17"); +insert into diaries values(585, "2013-02-18"); +insert into diaries values(586, "2013-02-19"); +insert into diaries values(587, "2013-02-20"); +insert into diaries values(588, "2013-02-21"); +insert into diaries values(589, "2013-02-22"); +insert into diaries values(590, "2013-02-23"); +insert into diaries values(591, "2013-02-24"); +insert into diaries values(592, "2013-02-25"); +insert into diaries values(593, "2013-02-26"); +insert into diaries values(594, "2013-02-27"); +insert into diaries values(595, "2013-02-28"); +insert into diaries values(596, "2013-03-01"); +insert into diaries values(597, "2013-03-02"); +insert into diaries values(598, "2013-03-03"); +insert into diaries values(599, "2013-03-04"); +insert into diaries values(600, "2013-03-05"); +insert into diaries values(601, "2013-03-06"); +insert into diaries values(602, "2013-03-07"); +insert into diaries values(603, "2013-03-08"); +insert into diaries values(604, "2013-03-09"); +insert into diaries values(605, "2013-03-10"); +insert into diaries values(606, "2013-03-11"); +insert into diaries values(607, "2013-03-12"); +insert into diaries values(608, "2013-03-13"); +insert into diaries values(609, "2013-03-14"); +insert into diaries values(610, "2013-03-15"); +insert into diaries values(611, "2013-03-16"); +insert into diaries values(612, "2013-03-17"); +insert into diaries values(613, "2013-03-18"); +insert into diaries values(614, "2013-03-19"); +insert into diaries values(615, "2013-03-20"); +insert into diaries values(616, "2013-03-21"); +insert into diaries values(617, "2013-03-22"); +insert into diaries values(618, "2013-03-23"); +insert into diaries values(619, "2013-03-24"); +insert into diaries values(620, "2013-03-25"); +insert into diaries values(621, "2013-03-26"); +insert into diaries values(622, "2013-03-27"); +insert into diaries values(623, "2013-03-28"); +insert into diaries values(624, "2013-03-29"); +insert into diaries values(625, "2013-03-30"); +insert into diaries values(626, "2013-03-31"); +insert into diaries values(627, "2013-04-01"); +insert into diaries values(628, "2013-04-02"); +insert into diaries values(629, "2013-04-03"); +insert into diaries values(630, "2013-04-04"); +insert into diaries values(631, "2013-04-05"); +insert into diaries values(632, "2013-04-06"); +insert into diaries values(633, "2013-04-07"); +insert into diaries values(634, "2013-04-08"); +insert into diaries values(635, "2013-04-09"); +insert into diaries values(636, "2013-04-10"); +insert into diaries values(637, "2013-04-11"); +insert into diaries values(638, "2013-04-12"); +insert into diaries values(639, "2013-04-13"); +insert into diaries values(640, "2013-04-14"); +insert into diaries values(641, "2013-04-15"); +insert into diaries values(642, "2013-04-16"); +insert into diaries values(643, "2013-04-17"); +insert into diaries values(644, "2013-04-18"); +insert into diaries values(645, "2013-04-19"); +insert into diaries values(646, "2013-04-20"); +insert into diaries values(647, "2013-04-21"); +insert into diaries values(648, "2013-04-22"); +insert into diaries values(649, "2013-04-23"); +insert into diaries values(650, "2013-04-24"); +insert into diaries values(651, "2013-04-25"); +insert into diaries values(652, "2013-04-26"); +insert into diaries values(653, "2013-04-27"); +insert into diaries values(654, "2013-04-28"); +insert into diaries values(655, "2013-04-29"); +insert into diaries values(656, "2013-04-30"); +insert into diaries values(657, "2013-05-01"); +insert into diaries values(658, "2013-05-02"); +insert into diaries values(659, "2013-05-03"); +insert into diaries values(660, "2013-05-04"); +insert into diaries values(661, "2013-05-05"); +insert into diaries values(662, "2013-05-06"); +insert into diaries values(663, "2013-05-07"); +insert into diaries values(664, "2013-05-08"); +insert into diaries values(665, "2013-05-09"); +insert into diaries values(666, "2013-05-10"); +insert into diaries values(667, "2013-05-11"); +insert into diaries values(668, "2013-05-12"); +insert into diaries values(669, "2013-05-13"); +insert into diaries values(670, "2013-05-14"); +insert into diaries values(671, "2013-05-15"); +insert into diaries values(672, "2013-05-16"); +insert into diaries values(673, "2013-05-17"); +insert into diaries values(674, "2013-05-18"); +insert into diaries values(675, "2013-05-19"); +insert into diaries values(676, "2013-05-20"); +insert into diaries values(677, "2013-05-21"); +insert into diaries values(678, "2013-05-22"); +insert into diaries values(679, "2013-05-23"); +insert into diaries values(680, "2013-05-24"); +insert into diaries values(681, "2013-05-25"); +insert into diaries values(682, "2013-05-26"); +insert into diaries values(683, "2013-05-27"); +insert into diaries values(684, "2013-05-28"); +insert into diaries values(685, "2013-05-29"); +insert into diaries values(686, "2013-05-30"); +insert into diaries values(687, "2013-05-31"); +insert into diaries values(688, "2013-06-01"); +insert into diaries values(689, "2013-06-02"); +insert into diaries values(690, "2013-06-03"); +insert into diaries values(691, "2013-06-04"); +insert into diaries values(692, "2013-06-05"); +insert into diaries values(693, "2013-06-06"); +insert into diaries values(694, "2013-06-07"); +insert into diaries values(695, "2013-06-08"); +insert into diaries values(696, "2013-06-09"); +insert into diaries values(697, "2013-06-10"); +insert into diaries values(698, "2013-06-11"); +insert into diaries values(699, "2013-06-12"); +insert into diaries values(700, "2013-06-13"); +insert into diaries values(701, "2013-06-14"); +insert into diaries values(702, "2013-06-15"); +insert into diaries values(703, "2013-06-16"); +insert into diaries values(704, "2013-06-17"); +insert into diaries values(705, "2013-06-18"); +insert into diaries values(706, "2013-06-19"); +insert into diaries values(707, "2013-06-20"); +insert into diaries values(708, "2013-06-21"); +insert into diaries values(709, "2013-06-22"); +insert into diaries values(710, "2013-06-23"); +insert into diaries values(711, "2013-06-24"); +insert into diaries values(712, "2013-06-25"); +insert into diaries values(713, "2013-06-26"); +insert into diaries values(714, "2013-06-27"); +insert into diaries values(715, "2013-06-28"); +insert into diaries values(716, "2013-06-29"); +insert into diaries values(717, "2013-06-30"); +insert into diaries values(718, "2013-07-01"); +insert into diaries values(719, "2013-07-02"); +insert into diaries values(720, "2013-07-03"); +insert into diaries values(721, "2013-07-04"); +insert into diaries values(722, "2013-07-05"); +insert into diaries values(723, "2013-07-06"); +insert into diaries values(724, "2013-07-07"); +insert into diaries values(725, "2013-07-08"); +insert into diaries values(726, "2013-07-09"); +insert into diaries values(727, "2013-07-10"); +insert into diaries values(728, "2013-07-11"); +insert into diaries values(729, "2013-07-12"); +insert into diaries values(730, "2013-07-13"); +insert into diaries values(731, "2013-07-14"); +insert into diaries values(732, "2013-07-15"); +insert into diaries values(733, "2013-07-16"); +insert into diaries values(734, "2013-07-17"); +insert into diaries values(735, "2013-07-18"); +insert into diaries values(736, "2013-07-19"); +insert into diaries values(737, "2013-07-20"); +insert into diaries values(738, "2013-07-21"); +insert into diaries values(739, "2013-07-22"); +insert into diaries values(740, "2013-07-23"); +insert into diaries values(741, "2013-07-24"); +insert into diaries values(742, "2013-07-25"); +insert into diaries values(743, "2013-07-26"); +insert into diaries values(744, "2013-07-27"); +insert into diaries values(745, "2013-07-28"); +insert into diaries values(746, "2013-07-29"); +insert into diaries values(747, "2013-07-30"); +insert into diaries values(748, "2013-07-31"); +insert into diaries values(749, "2013-08-01"); +insert into diaries values(750, "2013-08-02"); +insert into diaries values(751, "2013-08-03"); +insert into diaries values(752, "2013-08-04"); +insert into diaries values(753, "2013-08-05"); +insert into diaries values(754, "2013-08-06"); +insert into diaries values(755, "2013-08-07"); +insert into diaries values(756, "2013-08-08"); +insert into diaries values(757, "2013-08-09"); +insert into diaries values(758, "2013-08-10"); +insert into diaries values(759, "2013-08-11"); +insert into diaries values(760, "2013-08-12"); +insert into diaries values(761, "2013-08-13"); +insert into diaries values(762, "2013-08-14"); +insert into diaries values(763, "2013-08-15"); +insert into diaries values(764, "2013-08-16"); +insert into diaries values(765, "2013-08-17"); +insert into diaries values(766, "2013-08-18"); +insert into diaries values(767, "2013-08-19"); +insert into diaries values(768, "2013-08-20"); +insert into diaries values(769, "2013-08-21"); +insert into diaries values(770, "2013-08-22"); +insert into diaries values(771, "2013-08-23"); +insert into diaries values(772, "2013-08-24"); +insert into diaries values(773, "2013-08-25"); +insert into diaries values(774, "2013-08-26"); +insert into diaries values(775, "2013-08-27"); +insert into diaries values(776, "2013-08-28"); +insert into diaries values(777, "2013-08-29"); +insert into diaries values(778, "2013-08-30"); +insert into diaries values(779, "2013-08-31"); +insert into diaries values(780, "2013-09-01"); +insert into diaries values(781, "2013-09-02"); +insert into diaries values(782, "2013-09-03"); +insert into diaries values(783, "2013-09-04"); +insert into diaries values(784, "2013-09-05"); +insert into diaries values(785, "2013-09-06"); +insert into diaries values(786, "2013-09-07"); +insert into diaries values(787, "2013-09-08"); +insert into diaries values(788, "2013-09-09"); +insert into diaries values(789, "2013-09-10"); +insert into diaries values(790, "2013-09-11"); +insert into diaries values(791, "2013-09-12"); +insert into diaries values(792, "2013-09-13"); +insert into diaries values(793, "2013-09-14"); +insert into diaries values(794, "2013-09-15"); +insert into diaries values(795, "2013-09-16"); +insert into diaries values(796, "2013-09-17"); +insert into diaries values(797, "2013-09-18"); +insert into diaries values(798, "2013-09-19"); +insert into diaries values(799, "2013-09-20"); +insert into diaries values(800, "2013-09-21"); +insert into diaries values(801, "2013-09-22"); +insert into diaries values(802, "2013-09-23"); +insert into diaries values(803, "2013-09-24"); +insert into diaries values(804, "2013-09-25"); +insert into diaries values(805, "2013-09-26"); +insert into diaries values(806, "2013-09-27"); +insert into diaries values(807, "2013-09-28"); +insert into diaries values(808, "2013-09-29"); +insert into diaries values(809, "2013-09-30"); +insert into diaries values(810, "2013-10-01"); +insert into diaries values(811, "2013-10-02"); +insert into diaries values(812, "2013-10-03"); +insert into diaries values(813, "2013-10-04"); +insert into diaries values(814, "2013-10-05"); +insert into diaries values(815, "2013-10-06"); +insert into diaries values(816, "2013-10-07"); +insert into diaries values(817, "2013-10-08"); +insert into diaries values(818, "2013-10-09"); +insert into diaries values(819, "2013-10-10"); +insert into diaries values(820, "2013-10-11"); +insert into diaries values(821, "2013-10-12"); +insert into diaries values(822, "2013-10-13"); +insert into diaries values(823, "2013-10-14"); +insert into diaries values(824, "2013-10-15"); +insert into diaries values(825, "2013-10-16"); +insert into diaries values(826, "2013-10-17"); +insert into diaries values(827, "2013-10-18"); +insert into diaries values(828, "2013-10-19"); +insert into diaries values(829, "2013-10-20"); +insert into diaries values(830, "2013-10-21"); +insert into diaries values(831, "2013-10-22"); +insert into diaries values(832, "2013-10-23"); +insert into diaries values(833, "2013-10-24"); +insert into diaries values(834, "2013-10-25"); +insert into diaries values(835, "2013-10-26"); +insert into diaries values(836, "2013-10-27"); +insert into diaries values(837, "2013-10-28"); +insert into diaries values(838, "2013-10-29"); +insert into diaries values(839, "2013-10-30"); +insert into diaries values(840, "2013-10-31"); +insert into diaries values(841, "2013-11-01"); +insert into diaries values(842, "2013-11-02"); +insert into diaries values(843, "2013-11-03"); +insert into diaries values(844, "2013-11-04"); +insert into diaries values(845, "2013-11-05"); +insert into diaries values(846, "2013-11-06"); +insert into diaries values(847, "2013-11-07"); +insert into diaries values(848, "2013-11-08"); +insert into diaries values(849, "2013-11-09"); +insert into diaries values(850, "2013-11-10"); +insert into diaries values(851, "2013-11-11"); +insert into diaries values(852, "2013-11-12"); +insert into diaries values(853, "2013-11-13"); +insert into diaries values(854, "2013-11-14"); +insert into diaries values(855, "2013-11-15"); +insert into diaries values(856, "2013-11-16"); +insert into diaries values(857, "2013-11-17"); +insert into diaries values(858, "2013-11-18"); +insert into diaries values(859, "2013-11-19"); +insert into diaries values(860, "2013-11-20"); +insert into diaries values(861, "2013-11-21"); +insert into diaries values(862, "2013-11-22"); +insert into diaries values(863, "2013-11-23"); +insert into diaries values(864, "2013-11-24"); +insert into diaries values(865, "2013-11-25"); +insert into diaries values(866, "2013-11-26"); +insert into diaries values(867, "2013-11-27"); +insert into diaries values(868, "2013-11-28"); +insert into diaries values(869, "2013-11-29"); +insert into diaries values(870, "2013-11-30"); +insert into diaries values(871, "2013-12-01"); +insert into diaries values(872, "2013-12-02"); +insert into diaries values(873, "2013-12-03"); +insert into diaries values(874, "2013-12-04"); +insert into diaries values(875, "2013-12-05"); +insert into diaries values(876, "2013-12-06"); +insert into diaries values(877, "2013-12-07"); +insert into diaries values(878, "2013-12-08"); +insert into diaries values(879, "2013-12-09"); +insert into diaries values(880, "2013-12-10"); +insert into diaries values(881, "2013-12-11"); +insert into diaries values(882, "2013-12-12"); +insert into diaries values(883, "2013-12-13"); +insert into diaries values(884, "2013-12-14"); +insert into diaries values(885, "2013-12-15"); +insert into diaries values(886, "2013-12-16"); +insert into diaries values(887, "2013-12-17"); +insert into diaries values(888, "2013-12-18"); +insert into diaries values(889, "2013-12-19"); +insert into diaries values(890, "2013-12-20"); +insert into diaries values(891, "2013-12-21"); +insert into diaries values(892, "2013-12-22"); +insert into diaries values(893, "2013-12-23"); +insert into diaries values(894, "2013-12-24"); +insert into diaries values(895, "2013-12-25"); +insert into diaries values(896, "2013-12-26"); +insert into diaries values(897, "2013-12-27"); +insert into diaries values(898, "2013-12-28"); +insert into diaries values(899, "2013-12-29"); +insert into diaries values(900, "2013-12-30"); +insert into diaries values(901, "2013-12-31"); +insert into diaries values(902, "2014-01-01"); +insert into diaries values(903, "2014-01-02"); +insert into diaries values(904, "2014-01-03"); +insert into diaries values(905, "2014-01-04"); +insert into diaries values(906, "2014-01-05"); +insert into diaries values(907, "2014-01-06"); +insert into diaries values(908, "2014-01-07"); +insert into diaries values(909, "2014-01-08"); +insert into diaries values(910, "2014-01-09"); +insert into diaries values(911, "2014-01-10"); +insert into diaries values(912, "2014-01-11"); +insert into diaries values(913, "2014-01-12"); +insert into diaries values(914, "2014-01-13"); +insert into diaries values(915, "2014-01-14"); +insert into diaries values(916, "2014-01-15"); +insert into diaries values(917, "2014-01-16"); +insert into diaries values(918, "2014-01-17"); +insert into diaries values(919, "2014-01-18"); +insert into diaries values(920, "2014-01-19"); +insert into diaries values(921, "2014-01-20"); +insert into diaries values(922, "2014-01-21"); +insert into diaries values(923, "2014-01-22"); +insert into diaries values(924, "2014-01-23"); +insert into diaries values(925, "2014-01-24"); +insert into diaries values(926, "2014-01-25"); +insert into diaries values(927, "2014-01-26"); +insert into diaries values(928, "2014-01-27"); +insert into diaries values(929, "2014-01-28"); +insert into diaries values(930, "2014-01-29"); +insert into diaries values(931, "2014-01-30"); +insert into diaries values(932, "2014-01-31"); +insert into diaries values(933, "2014-02-01"); +insert into diaries values(934, "2014-02-02"); +insert into diaries values(935, "2014-02-03"); +insert into diaries values(936, "2014-02-04"); +insert into diaries values(937, "2014-02-05"); +insert into diaries values(938, "2014-02-06"); +insert into diaries values(939, "2014-02-07"); +insert into diaries values(940, "2014-02-08"); +insert into diaries values(941, "2014-02-09"); +insert into diaries values(942, "2014-02-10"); +insert into diaries values(943, "2014-02-11"); +insert into diaries values(944, "2014-02-12"); +insert into diaries values(945, "2014-02-13"); +insert into diaries values(946, "2014-02-14"); +insert into diaries values(947, "2014-02-15"); +insert into diaries values(948, "2014-02-16"); +insert into diaries values(949, "2014-02-17"); +insert into diaries values(950, "2014-02-18"); +insert into diaries values(951, "2014-02-19"); +insert into diaries values(952, "2014-02-20"); +insert into diaries values(953, "2014-02-21"); +insert into diaries values(954, "2014-02-22"); +insert into diaries values(955, "2014-02-23"); +insert into diaries values(956, "2014-02-24"); +insert into diaries values(957, "2014-02-25"); +insert into diaries values(958, "2014-02-26"); +insert into diaries values(959, "2014-02-27"); +insert into diaries values(960, "2014-02-28"); +insert into diaries values(961, "2014-03-01"); +insert into diaries values(962, "2014-03-02"); +insert into diaries values(963, "2014-03-03"); +insert into diaries values(964, "2014-03-04"); +insert into diaries values(965, "2014-03-05"); +insert into diaries values(966, "2014-03-06"); +insert into diaries values(967, "2014-03-07"); +insert into diaries values(968, "2014-03-08"); +insert into diaries values(969, "2014-03-09"); +insert into diaries values(970, "2014-03-10"); +insert into diaries values(971, "2014-03-11"); +insert into diaries values(972, "2014-03-12"); +insert into diaries values(973, "2014-03-13"); +insert into diaries values(974, "2014-03-14"); +insert into diaries values(975, "2014-03-15"); +insert into diaries values(976, "2014-03-16"); +insert into diaries values(977, "2014-03-17"); +insert into diaries values(978, "2014-03-18"); +insert into diaries values(979, "2014-03-19"); +insert into diaries values(980, "2014-03-20"); +insert into diaries values(981, "2014-03-21"); +insert into diaries values(982, "2014-03-22"); +insert into diaries values(983, "2014-03-23"); +insert into diaries values(984, "2014-03-24"); +insert into diaries values(985, "2014-03-25"); +insert into diaries values(986, "2014-03-26"); +insert into diaries values(987, "2014-03-27"); +insert into diaries values(988, "2014-03-28"); +insert into diaries values(989, "2014-03-29"); +insert into diaries values(990, "2014-03-30"); +insert into diaries values(991, "2014-03-31"); +insert into diaries values(992, "2014-04-01"); +insert into diaries values(993, "2014-04-02"); +insert into diaries values(994, "2014-04-03"); +insert into diaries values(995, "2014-04-04"); +insert into diaries values(996, "2014-04-05"); +insert into diaries values(997, "2014-04-06"); +insert into diaries values(998, "2014-04-07"); +insert into diaries values(999, "2014-04-08"); +insert into diaries values(1000, "2014-04-09"); +insert into diaries values(1001, "2014-04-10"); +insert into diaries values(1002, "2014-04-11"); +insert into diaries values(1003, "2014-04-12"); +insert into diaries values(1004, "2014-04-13"); +insert into diaries values(1005, "2014-04-14"); +insert into diaries values(1006, "2014-04-15"); +insert into diaries values(1007, "2014-04-16"); +insert into diaries values(1008, "2014-04-17"); +insert into diaries values(1009, "2014-04-18"); +insert into diaries values(1010, "2014-04-19"); +insert into diaries values(1011, "2014-04-20"); +insert into diaries values(1012, "2014-04-21"); +insert into diaries values(1013, "2014-04-22"); +insert into diaries values(1014, "2014-04-23"); +insert into diaries values(1015, "2014-04-24"); +insert into diaries values(1016, "2014-04-25"); +insert into diaries values(1017, "2014-04-26"); +insert into diaries values(1018, "2014-04-27"); +insert into diaries values(1019, "2014-04-28"); +insert into diaries values(1020, "2014-04-29"); +insert into diaries values(1021, "2014-04-30"); +insert into diaries values(1022, "2014-05-01"); +insert into diaries values(1023, "2014-05-02"); +insert into diaries values(1024, "2014-05-03"); +insert into diaries values(1025, "2014-05-04"); +insert into diaries values(1026, "2014-05-05"); +insert into diaries values(1027, "2014-05-06"); +insert into diaries values(1028, "2014-05-07"); +insert into diaries values(1029, "2014-05-08"); +insert into diaries values(1030, "2014-05-09"); +insert into diaries values(1031, "2014-05-10"); +insert into diaries values(1032, "2014-05-11"); +insert into diaries values(1033, "2014-05-12"); +insert into diaries values(1034, "2014-05-13"); +insert into diaries values(1035, "2014-05-14"); +insert into diaries values(1036, "2014-05-15"); +insert into diaries values(1037, "2014-05-16"); +insert into diaries values(1038, "2014-05-17"); +insert into diaries values(1039, "2014-05-18"); +insert into diaries values(1040, "2014-05-19"); +insert into diaries values(1041, "2014-05-20"); +insert into diaries values(1042, "2014-05-21"); +insert into diaries values(1043, "2014-05-22"); +insert into diaries values(1044, "2014-05-23"); +insert into diaries values(1045, "2014-05-24"); +insert into diaries values(1046, "2014-05-25"); +insert into diaries values(1047, "2014-05-26"); +insert into diaries values(1048, "2014-05-27"); +insert into diaries values(1049, "2014-05-28"); +insert into diaries values(1050, "2014-05-29"); +insert into diaries values(1051, "2014-05-30"); +insert into diaries values(1052, "2014-05-31"); +insert into diaries values(1053, "2014-06-01"); +insert into diaries values(1054, "2014-06-02"); +insert into diaries values(1055, "2014-06-03"); +insert into diaries values(1056, "2014-06-04"); +insert into diaries values(1057, "2014-06-05"); +insert into diaries values(1058, "2014-06-06"); +insert into diaries values(1059, "2014-06-07"); +insert into diaries values(1060, "2014-06-08"); +insert into diaries values(1061, "2014-06-09"); +insert into diaries values(1062, "2014-06-10"); +insert into diaries values(1063, "2014-06-11"); +insert into diaries values(1064, "2014-06-12"); +insert into diaries values(1065, "2014-06-13"); +insert into diaries values(1066, "2014-06-14"); +insert into diaries values(1067, "2014-06-15"); +insert into diaries values(1068, "2014-06-16"); +insert into diaries values(1069, "2014-06-17"); +insert into diaries values(1070, "2014-06-18"); +insert into diaries values(1071, "2014-06-19"); +insert into diaries values(1072, "2014-06-20"); +insert into diaries values(1073, "2014-06-21"); +insert into diaries values(1074, "2014-06-22"); +insert into diaries values(1075, "2014-06-23"); +insert into diaries values(1076, "2014-06-24"); +insert into diaries values(1077, "2014-06-25"); +insert into diaries values(1078, "2014-06-26"); +insert into diaries values(1079, "2014-06-27"); +insert into diaries values(1080, "2014-06-28"); +insert into diaries values(1081, "2014-06-29"); +insert into diaries values(1082, "2014-06-30"); +insert into diaries values(1083, "2014-07-01"); +insert into diaries values(1084, "2014-07-02"); +insert into diaries values(1085, "2014-07-03"); +insert into diaries values(1086, "2014-07-04"); +insert into diaries values(1087, "2014-07-05"); +insert into diaries values(1088, "2014-07-06"); +insert into diaries values(1089, "2014-07-07"); +insert into diaries values(1090, "2014-07-08"); +insert into diaries values(1091, "2014-07-09"); +insert into diaries values(1092, "2014-07-10"); +insert into diaries values(1093, "2014-07-11"); +insert into diaries values(1094, "2014-07-12"); +insert into diaries values(1095, "2014-07-13"); +insert into diaries values(1096, "2014-07-14"); +insert into diaries values(1097, "2014-07-15"); +insert into diaries values(1098, "2014-07-16"); +insert into diaries values(1099, "2014-07-17"); +insert into diaries values(1100, "2014-07-18"); +insert into diaries values(1101, "2014-07-19"); +insert into diaries values(1102, "2014-07-20"); +insert into diaries values(1103, "2014-07-21"); +insert into diaries values(1104, "2014-07-22"); +insert into diaries values(1105, "2014-07-23"); +insert into diaries values(1106, "2014-07-24"); +insert into diaries values(1107, "2014-07-25"); +insert into diaries values(1108, "2014-07-26"); +insert into diaries values(1109, "2014-07-27"); +insert into diaries values(1110, "2014-07-28"); +insert into diaries values(1111, "2014-07-29"); +insert into diaries values(1112, "2014-07-30"); +insert into diaries values(1113, "2014-07-31"); +insert into diaries values(1114, "2014-08-01"); +insert into diaries values(1115, "2014-08-02"); +insert into diaries values(1116, "2014-08-03"); +insert into diaries values(1117, "2014-08-04"); +insert into diaries values(1118, "2014-08-05"); +insert into diaries values(1119, "2014-08-06"); +insert into diaries values(1120, "2014-08-07"); +insert into diaries values(1121, "2014-08-08"); +insert into diaries values(1122, "2014-08-09"); +insert into diaries values(1123, "2014-08-10"); +insert into diaries values(1124, "2014-08-11"); +insert into diaries values(1125, "2014-08-12"); +insert into diaries values(1126, "2014-08-13"); +insert into diaries values(1127, "2014-08-14"); +insert into diaries values(1128, "2014-08-15"); +insert into diaries values(1129, "2014-08-16"); +insert into diaries values(1130, "2014-08-17"); +insert into diaries values(1131, "2014-08-18"); +insert into diaries values(1132, "2014-08-19"); +insert into diaries values(1133, "2014-08-20"); +insert into diaries values(1134, "2014-08-21"); +insert into diaries values(1135, "2014-08-22"); +insert into diaries values(1136, "2014-08-23"); +insert into diaries values(1137, "2014-08-24"); +insert into diaries values(1138, "2014-08-25"); +insert into diaries values(1139, "2014-08-26"); +insert into diaries values(1140, "2014-08-27"); +insert into diaries values(1141, "2014-08-28"); +insert into diaries values(1142, "2014-08-29"); +insert into diaries values(1143, "2014-08-30"); +insert into diaries values(1144, "2014-08-31"); +insert into diaries values(1145, "2014-09-01"); +insert into diaries values(1146, "2014-09-02"); +insert into diaries values(1147, "2014-09-03"); +insert into diaries values(1148, "2014-09-04"); +insert into diaries values(1149, "2014-09-05"); +insert into diaries values(1150, "2014-09-06"); +insert into diaries values(1151, "2014-09-07"); +insert into diaries values(1152, "2014-09-08"); +insert into diaries values(1153, "2014-09-09"); +insert into diaries values(1154, "2014-09-10"); +insert into diaries values(1155, "2014-09-11"); +insert into diaries values(1156, "2014-09-12"); +insert into diaries values(1157, "2014-09-13"); +insert into diaries values(1158, "2014-09-14"); +insert into diaries values(1159, "2014-09-15"); +insert into diaries values(1160, "2014-09-16"); +insert into diaries values(1161, "2014-09-17"); +insert into diaries values(1162, "2014-09-18"); +insert into diaries values(1163, "2014-09-19"); +insert into diaries values(1164, "2014-09-20"); +insert into diaries values(1165, "2014-09-21"); +insert into diaries values(1166, "2014-09-22"); +insert into diaries values(1167, "2014-09-23"); +insert into diaries values(1168, "2014-09-24"); +insert into diaries values(1169, "2014-09-25"); +insert into diaries values(1170, "2014-09-26"); +insert into diaries values(1171, "2014-09-27"); +insert into diaries values(1172, "2014-09-28"); +insert into diaries values(1173, "2014-09-29"); +insert into diaries values(1174, "2014-09-30"); +insert into diaries values(1175, "2014-10-01"); +insert into diaries values(1176, "2014-10-02"); +insert into diaries values(1177, "2014-10-03"); +insert into diaries values(1178, "2014-10-04"); +insert into diaries values(1179, "2014-10-05"); +insert into diaries values(1180, "2014-10-06"); +insert into diaries values(1181, "2014-10-07"); +insert into diaries values(1182, "2014-10-08"); +insert into diaries values(1183, "2014-10-09"); +insert into diaries values(1184, "2014-10-10"); +insert into diaries values(1185, "2014-10-11"); +insert into diaries values(1186, "2014-10-12"); +insert into diaries values(1187, "2014-10-13"); +insert into diaries values(1188, "2014-10-14"); +insert into diaries values(1189, "2014-10-15"); +insert into diaries values(1190, "2014-10-16"); +insert into diaries values(1191, "2014-10-17"); +insert into diaries values(1192, "2014-10-18"); +insert into diaries values(1193, "2014-10-19"); +insert into diaries values(1194, "2014-10-20"); +insert into diaries values(1195, "2014-10-21"); +insert into diaries values(1196, "2014-10-22"); +insert into diaries values(1197, "2014-10-23"); +insert into diaries values(1198, "2014-10-24"); +insert into diaries values(1199, "2014-10-25"); +insert into diaries values(1200, "2014-10-26"); +insert into diaries values(1201, "2014-10-27"); +insert into diaries values(1202, "2014-10-28"); +insert into diaries values(1203, "2014-10-29"); +insert into diaries values(1204, "2014-10-30"); +insert into diaries values(1205, "2014-10-31"); +insert into diaries values(1206, "2014-11-01"); +insert into diaries values(1207, "2014-11-02"); +insert into diaries values(1208, "2014-11-03"); +insert into diaries values(1209, "2014-11-04"); +insert into diaries values(1210, "2014-11-05"); +insert into diaries values(1211, "2014-11-06"); +insert into diaries values(1212, "2014-11-07"); +insert into diaries values(1213, "2014-11-08"); +insert into diaries values(1214, "2014-11-09"); +insert into diaries values(1215, "2014-11-10"); +insert into diaries values(1216, "2014-11-11"); +insert into diaries values(1217, "2014-11-12"); +insert into diaries values(1218, "2014-11-13"); +insert into diaries values(1219, "2014-11-14"); +insert into diaries values(1220, "2014-11-15"); +insert into diaries values(1221, "2014-11-16"); +insert into diaries values(1222, "2014-11-17"); +insert into diaries values(1223, "2014-11-18"); +insert into diaries values(1224, "2014-11-19"); +insert into diaries values(1225, "2014-11-20"); +insert into diaries values(1226, "2014-11-21"); +insert into diaries values(1227, "2014-11-22"); +insert into diaries values(1228, "2014-11-23"); +insert into diaries values(1229, "2014-11-24"); +insert into diaries values(1230, "2014-11-25"); +insert into diaries values(1231, "2014-11-26"); +insert into diaries values(1232, "2014-11-27"); +insert into diaries values(1233, "2014-11-28"); +insert into diaries values(1234, "2014-11-29"); +insert into diaries values(1235, "2014-11-30"); +insert into diaries values(1236, "2014-12-01"); +insert into diaries values(1237, "2014-12-02"); +insert into diaries values(1238, "2014-12-03"); +insert into diaries values(1239, "2014-12-04"); +insert into diaries values(1240, "2014-12-05"); +insert into diaries values(1241, "2014-12-06"); +insert into diaries values(1242, "2014-12-07"); +insert into diaries values(1243, "2014-12-08"); +insert into diaries values(1244, "2014-12-09"); +insert into diaries values(1245, "2014-12-10"); +insert into diaries values(1246, "2014-12-11"); +insert into diaries values(1247, "2014-12-12"); +insert into diaries values(1248, "2014-12-13"); +insert into diaries values(1249, "2014-12-14"); +insert into diaries values(1250, "2014-12-15"); +insert into diaries values(1251, "2014-12-16"); +insert into diaries values(1252, "2014-12-17"); +insert into diaries values(1253, "2014-12-18"); +insert into diaries values(1254, "2014-12-19"); +insert into diaries values(1255, "2014-12-20"); +insert into diaries values(1256, "2014-12-21"); +insert into diaries values(1257, "2014-12-22"); +insert into diaries values(1258, "2014-12-23"); +insert into diaries values(1259, "2014-12-24"); +insert into diaries values(1260, "2014-12-25"); +insert into diaries values(1261, "2014-12-26"); +insert into diaries values(1262, "2014-12-27"); +insert into diaries values(1263, "2014-12-28"); +insert into diaries values(1264, "2014-12-29"); +insert into diaries values(1265, "2014-12-30"); +insert into diaries values(1266, "2014-12-31"); +insert into diaries values(1267, "2015-01-01"); +insert into diaries values(1268, "2015-01-02"); +insert into diaries values(1269, "2015-01-03"); +insert into diaries values(1270, "2015-01-04"); +insert into diaries values(1271, "2015-01-05"); +insert into diaries values(1272, "2015-01-06"); +insert into diaries values(1273, "2015-01-07"); +insert into diaries values(1274, "2015-01-08"); +insert into diaries values(1275, "2015-01-09"); +insert into diaries values(1276, "2015-01-10"); +insert into diaries values(1277, "2015-01-11"); +insert into diaries values(1278, "2015-01-12"); +insert into diaries values(1279, "2015-01-13"); +insert into diaries values(1280, "2015-01-14"); +insert into diaries values(1281, "2015-01-15"); +insert into diaries values(1282, "2015-01-16"); +insert into diaries values(1283, "2015-01-17"); +insert into diaries values(1284, "2015-01-18"); +insert into diaries values(1285, "2015-01-19"); +insert into diaries values(1286, "2015-01-20"); +insert into diaries values(1287, "2015-01-21"); +insert into diaries values(1288, "2015-01-22"); +insert into diaries values(1289, "2015-01-23"); +insert into diaries values(1290, "2015-01-24"); +insert into diaries values(1291, "2015-01-25"); +insert into diaries values(1292, "2015-01-26"); +insert into diaries values(1293, "2015-01-27"); +insert into diaries values(1294, "2015-01-28"); +insert into diaries values(1295, "2015-01-29"); +insert into diaries values(1296, "2015-01-30"); +insert into diaries values(1297, "2015-01-31"); +insert into diaries values(1298, "2015-02-01"); +insert into diaries values(1299, "2015-02-02"); +insert into diaries values(1300, "2015-02-03"); +insert into diaries values(1301, "2015-02-04"); +insert into diaries values(1302, "2015-02-05"); +insert into diaries values(1303, "2015-02-06"); +insert into diaries values(1304, "2015-02-07"); +insert into diaries values(1305, "2015-02-08"); +insert into diaries values(1306, "2015-02-09"); +insert into diaries values(1307, "2015-02-10"); +insert into diaries values(1308, "2015-02-11"); +insert into diaries values(1309, "2015-02-12"); +insert into diaries values(1310, "2015-02-13"); +insert into diaries values(1311, "2015-02-14"); +insert into diaries values(1312, "2015-02-15"); +insert into diaries values(1313, "2015-02-16"); +insert into diaries values(1314, "2015-02-17"); +insert into diaries values(1315, "2015-02-18"); +insert into diaries values(1316, "2015-02-19"); +insert into diaries values(1317, "2015-02-20"); +insert into diaries values(1318, "2015-02-21"); +insert into diaries values(1319, "2015-02-22"); +insert into diaries values(1320, "2015-02-23"); +insert into diaries values(1321, "2015-02-24"); +insert into diaries values(1322, "2015-02-25"); +insert into diaries values(1323, "2015-02-26"); +insert into diaries values(1324, "2015-02-27"); +insert into diaries values(1325, "2015-02-28"); +insert into diaries values(1326, "2015-03-01"); +insert into diaries values(1327, "2015-03-02"); +insert into diaries values(1328, "2015-03-03"); +insert into diaries values(1329, "2015-03-04"); +insert into diaries values(1330, "2015-03-05"); +insert into diaries values(1331, "2015-03-06"); +insert into diaries values(1332, "2015-03-07"); +insert into diaries values(1333, "2015-03-08"); +insert into diaries values(1334, "2015-03-09"); +insert into diaries values(1335, "2015-03-10"); +insert into diaries values(1336, "2015-03-11"); +insert into diaries values(1337, "2015-03-12"); +insert into diaries values(1338, "2015-03-13"); +insert into diaries values(1339, "2015-03-14"); +insert into diaries values(1340, "2015-03-15"); +insert into diaries values(1341, "2015-03-16"); +insert into diaries values(1342, "2015-03-17"); +insert into diaries values(1343, "2015-03-18"); +insert into diaries values(1344, "2015-03-19"); +insert into diaries values(1345, "2015-03-20"); +insert into diaries values(1346, "2015-03-21"); +insert into diaries values(1347, "2015-03-22"); +insert into diaries values(1348, "2015-03-23"); +insert into diaries values(1349, "2015-03-24"); +insert into diaries values(1350, "2015-03-25"); +insert into diaries values(1351, "2015-03-26"); +insert into diaries values(1352, "2015-03-27"); +insert into diaries values(1353, "2015-03-28"); +insert into diaries values(1354, "2015-03-29"); +insert into diaries values(1355, "2015-03-30"); +insert into diaries values(1356, "2015-03-31"); +insert into diaries values(1357, "2015-04-01"); +insert into diaries values(1358, "2015-04-02"); +insert into diaries values(1359, "2015-04-03"); +insert into diaries values(1360, "2015-04-04"); +insert into diaries values(1361, "2015-04-05"); +insert into diaries values(1362, "2015-04-06"); +insert into diaries values(1363, "2015-04-07"); +insert into diaries values(1364, "2015-04-08"); +insert into diaries values(1365, "2015-04-09"); +insert into diaries values(1366, "2015-04-10"); +insert into diaries values(1367, "2015-04-11"); +insert into diaries values(1368, "2015-04-12"); +insert into diaries values(1369, "2015-04-13"); +insert into diaries values(1370, "2015-04-14"); +insert into diaries values(1371, "2015-04-15"); +insert into diaries values(1372, "2015-04-16"); +insert into diaries values(1373, "2015-04-17"); +insert into diaries values(1374, "2015-04-18"); +insert into diaries values(1375, "2015-04-19"); +insert into diaries values(1376, "2015-04-20"); +insert into diaries values(1377, "2015-04-21"); +insert into diaries values(1378, "2015-04-22"); +insert into diaries values(1379, "2015-04-23"); +insert into diaries values(1380, "2015-04-24"); +insert into diaries values(1381, "2015-04-25"); +insert into diaries values(1382, "2015-04-26"); +insert into diaries values(1383, "2015-04-27"); +insert into diaries values(1384, "2015-04-28"); +insert into diaries values(1385, "2015-04-29"); +insert into diaries values(1386, "2015-04-30"); +insert into diaries values(1387, "2015-05-01"); +insert into diaries values(1388, "2015-05-02"); +insert into diaries values(1389, "2015-05-03"); +insert into diaries values(1390, "2015-05-04"); +insert into diaries values(1391, "2015-05-05"); +insert into diaries values(1392, "2015-05-06"); +insert into diaries values(1393, "2015-05-07"); +insert into diaries values(1394, "2015-05-08"); +insert into diaries values(1395, "2015-05-09"); +insert into diaries values(1396, "2015-05-10"); +insert into diaries values(1397, "2015-05-11"); +insert into diaries values(1398, "2015-05-12"); +insert into diaries values(1399, "2015-05-13"); +insert into diaries values(1400, "2015-05-14"); +insert into diaries values(1401, "2015-05-15"); +insert into diaries values(1402, "2015-05-16"); +insert into diaries values(1403, "2015-05-17"); +insert into diaries values(1404, "2015-05-18"); +insert into diaries values(1405, "2015-05-19"); +insert into diaries values(1406, "2015-05-20"); +insert into diaries values(1407, "2015-05-21"); +insert into diaries values(1408, "2015-05-22"); +insert into diaries values(1409, "2015-05-23"); +insert into diaries values(1410, "2015-05-24"); +insert into diaries values(1411, "2015-05-25"); +insert into diaries values(1412, "2015-05-26"); +insert into diaries values(1413, "2015-05-27"); +insert into diaries values(1414, "2015-05-28"); +insert into diaries values(1415, "2015-05-29"); +insert into diaries values(1416, "2015-05-30"); +insert into diaries values(1417, "2015-05-31"); +insert into diaries values(1418, "2015-06-01"); +insert into diaries values(1419, "2015-06-02"); +insert into diaries values(1420, "2015-06-03"); +insert into diaries values(1421, "2015-06-04"); +insert into diaries values(1422, "2015-06-05"); +insert into diaries values(1423, "2015-06-06"); +insert into diaries values(1424, "2015-06-07"); +insert into diaries values(1425, "2015-06-08"); +insert into diaries values(1426, "2015-06-09"); +insert into diaries values(1427, "2015-06-10"); +insert into diaries values(1428, "2015-06-11"); +insert into diaries values(1429, "2015-06-12"); +insert into diaries values(1430, "2015-06-13"); +insert into diaries values(1431, "2015-06-14"); +insert into diaries values(1432, "2015-06-15"); +insert into diaries values(1433, "2015-06-16"); +insert into diaries values(1434, "2015-06-17"); +insert into diaries values(1435, "2015-06-18"); +insert into diaries values(1436, "2015-06-19"); +insert into diaries values(1437, "2015-06-20"); +insert into diaries values(1438, "2015-06-21"); +insert into diaries values(1439, "2015-06-22"); +insert into diaries values(1440, "2015-06-23"); +insert into diaries values(1441, "2015-06-24"); +insert into diaries values(1442, "2015-06-25"); +insert into diaries values(1443, "2015-06-26"); +insert into diaries values(1444, "2015-06-27"); +insert into diaries values(1445, "2015-06-28"); +insert into diaries values(1446, "2015-06-29"); +insert into diaries values(1447, "2015-06-30"); +insert into diaries values(1448, "2015-07-01"); +insert into diaries values(1449, "2015-07-02"); +insert into diaries values(1450, "2015-07-03"); +insert into diaries values(1451, "2015-07-04"); +insert into diaries values(1452, "2015-07-05"); +insert into diaries values(1453, "2015-07-06"); +insert into diaries values(1454, "2015-07-07"); +insert into diaries values(1455, "2015-07-08"); +insert into diaries values(1456, "2015-07-09"); +insert into diaries values(1457, "2015-07-10"); +insert into diaries values(1458, "2015-07-11"); +insert into diaries values(1459, "2015-07-12"); +insert into diaries values(1460, "2015-07-13"); +insert into diaries values(1461, "2015-07-14"); +insert into diaries values(1462, "2015-07-15"); +insert into diaries values(1463, "2015-07-16"); +insert into diaries values(1464, "2015-07-17"); +insert into diaries values(1465, "2015-07-18"); +insert into diaries values(1466, "2015-07-19"); +insert into diaries values(1467, "2015-07-20"); +insert into diaries values(1468, "2015-07-21"); +insert into diaries values(1469, "2015-07-22"); +insert into diaries values(1470, "2015-07-23"); +insert into diaries values(1471, "2015-07-24"); +insert into diaries values(1472, "2015-07-25"); +insert into diaries values(1473, "2015-07-26"); +insert into diaries values(1474, "2015-07-27"); +insert into diaries values(1475, "2015-07-28"); +insert into diaries values(1476, "2015-07-29"); +insert into diaries values(1477, "2015-07-30"); +insert into diaries values(1478, "2015-07-31"); +insert into diaries values(1479, "2015-08-01"); +insert into diaries values(1480, "2015-08-02"); +insert into diaries values(1481, "2015-08-03"); +insert into diaries values(1482, "2015-08-04"); +insert into diaries values(1483, "2015-08-05"); +insert into diaries values(1484, "2015-08-06"); +insert into diaries values(1485, "2015-08-07"); +insert into diaries values(1486, "2015-08-08"); +insert into diaries values(1487, "2015-08-09"); +insert into diaries values(1488, "2015-08-10"); +insert into diaries values(1489, "2015-08-11"); +insert into diaries values(1490, "2015-08-12"); +insert into diaries values(1491, "2015-08-13"); +insert into diaries values(1492, "2015-08-14"); +insert into diaries values(1493, "2015-08-15"); +insert into diaries values(1494, "2015-08-16"); +insert into diaries values(1495, "2015-08-17"); +insert into diaries values(1496, "2015-08-18"); +insert into diaries values(1497, "2015-08-19"); +insert into diaries values(1498, "2015-08-20"); +insert into diaries values(1499, "2015-08-21"); +insert into diaries values(1500, "2015-08-22"); +insert into diaries values(1501, "2015-08-23"); +insert into diaries values(1502, "2015-08-24"); +insert into diaries values(1503, "2015-08-25"); +insert into diaries values(1504, "2015-08-26"); +insert into diaries values(1505, "2015-08-27"); +insert into diaries values(1506, "2015-08-28"); +insert into diaries values(1507, "2015-08-29"); +insert into diaries values(1508, "2015-08-30"); +insert into diaries values(1509, "2015-08-31"); +insert into diaries values(1510, "2015-09-01"); +insert into diaries values(1511, "2015-09-02"); +insert into diaries values(1512, "2015-09-03"); +insert into diaries values(1513, "2015-09-04"); +insert into diaries values(1514, "2015-09-05"); +insert into diaries values(1515, "2015-09-06"); +insert into diaries values(1516, "2015-09-07"); +insert into diaries values(1517, "2015-09-08"); +insert into diaries values(1518, "2015-09-09"); +insert into diaries values(1519, "2015-09-10"); +insert into diaries values(1520, "2015-09-11"); +insert into diaries values(1521, "2015-09-12"); +insert into diaries values(1522, "2015-09-13"); +insert into diaries values(1523, "2015-09-14"); +insert into diaries values(1524, "2015-09-15"); +insert into diaries values(1525, "2015-09-16"); +insert into diaries values(1526, "2015-09-17"); +insert into diaries values(1527, "2015-09-18"); +insert into diaries values(1528, "2015-09-19"); +insert into diaries values(1529, "2015-09-20"); +insert into diaries values(1530, "2015-09-21"); +insert into diaries values(1531, "2015-09-22"); +insert into diaries values(1532, "2015-09-23"); +insert into diaries values(1533, "2015-09-24"); +insert into diaries values(1534, "2015-09-25"); +insert into diaries values(1535, "2015-09-26"); +insert into diaries values(1536, "2015-09-27"); +insert into diaries values(1537, "2015-09-28"); +insert into diaries values(1538, "2015-09-29"); +insert into diaries values(1539, "2015-09-30"); +insert into diaries values(1540, "2015-10-01"); +insert into diaries values(1541, "2015-10-02"); +insert into diaries values(1542, "2015-10-03"); +insert into diaries values(1543, "2015-10-04"); +insert into diaries values(1544, "2015-10-05"); +insert into diaries values(1545, "2015-10-06"); +insert into diaries values(1546, "2015-10-07"); +insert into diaries values(1547, "2015-10-08"); +insert into diaries values(1548, "2015-10-09"); +insert into diaries values(1549, "2015-10-10"); +insert into diaries values(1550, "2015-10-11"); +insert into diaries values(1551, "2015-10-12"); +insert into diaries values(1552, "2015-10-13"); +insert into diaries values(1553, "2015-10-14"); +insert into diaries values(1554, "2015-10-15"); +insert into diaries values(1555, "2015-10-16"); +insert into diaries values(1556, "2015-10-17"); +insert into diaries values(1557, "2015-10-18"); +insert into diaries values(1558, "2015-10-19"); +insert into diaries values(1559, "2015-10-20"); +insert into diaries values(1560, "2015-10-21"); +insert into diaries values(1561, "2015-10-22"); +insert into diaries values(1562, "2015-10-23"); +insert into diaries values(1563, "2015-10-24"); +insert into diaries values(1564, "2015-10-25"); +insert into diaries values(1565, "2015-10-26"); +insert into diaries values(1566, "2015-10-27"); +insert into diaries values(1567, "2015-10-28"); +insert into diaries values(1568, "2015-10-29"); +insert into diaries values(1569, "2015-10-30"); +insert into diaries values(1570, "2015-10-31"); +insert into diaries values(1571, "2015-11-01"); +insert into diaries values(1572, "2015-11-02"); +insert into diaries values(1573, "2015-11-03"); +insert into diaries values(1574, "2015-11-04"); +insert into diaries values(1575, "2015-11-05"); +insert into diaries values(1576, "2015-11-06"); +insert into diaries values(1577, "2015-11-07"); +insert into diaries values(1578, "2015-11-08"); +insert into diaries values(1579, "2015-11-09"); +insert into diaries values(1580, "2015-11-10"); +insert into diaries values(1581, "2015-11-11"); +insert into diaries values(1582, "2015-11-12"); +insert into diaries values(1583, "2015-11-13"); +insert into diaries values(1584, "2015-11-14"); +insert into diaries values(1585, "2015-11-15"); +insert into diaries values(1586, "2015-11-16"); +insert into diaries values(1587, "2015-11-17"); +insert into diaries values(1588, "2015-11-18"); +insert into diaries values(1589, "2015-11-19"); +insert into diaries values(1590, "2015-11-20"); +insert into diaries values(1591, "2015-11-21"); +insert into diaries values(1592, "2015-11-22"); +insert into diaries values(1593, "2015-11-23"); +insert into diaries values(1594, "2015-11-24"); +insert into diaries values(1595, "2015-11-25"); +insert into diaries values(1596, "2015-11-26"); +insert into diaries values(1597, "2015-11-27"); +insert into diaries values(1598, "2015-11-28"); +insert into diaries values(1599, "2015-11-29"); +insert into diaries values(1600, "2015-11-30"); +insert into diaries values(1601, "2015-12-01"); +insert into diaries values(1602, "2015-12-02"); +insert into diaries values(1603, "2015-12-03"); +insert into diaries values(1604, "2015-12-04"); +insert into diaries values(1605, "2015-12-05"); +insert into diaries values(1606, "2015-12-06"); +insert into diaries values(1607, "2015-12-07"); +insert into diaries values(1608, "2015-12-08"); +insert into diaries values(1609, "2015-12-09"); +insert into diaries values(1610, "2015-12-10"); +insert into diaries values(1611, "2015-12-11"); +insert into diaries values(1612, "2015-12-12"); +insert into diaries values(1613, "2015-12-13"); +insert into diaries values(1614, "2015-12-14"); +insert into diaries values(1615, "2015-12-15"); +insert into diaries values(1616, "2015-12-16"); +insert into diaries values(1617, "2015-12-17"); +insert into diaries values(1618, "2015-12-18"); +insert into diaries values(1619, "2015-12-19"); +insert into diaries values(1620, "2015-12-20"); +insert into diaries values(1621, "2015-12-21"); +insert into diaries values(1622, "2015-12-22"); +insert into diaries values(1623, "2015-12-23"); +insert into diaries values(1624, "2015-12-24"); +insert into diaries values(1625, "2015-12-25"); +insert into diaries values(1626, "2015-12-26"); +insert into diaries values(1627, "2015-12-27"); +insert into diaries values(1628, "2015-12-28"); +insert into diaries values(1629, "2015-12-29"); +insert into diaries values(1630, "2015-12-30"); +insert into diaries values(1631, "2015-12-31"); +insert into diaries values(1632, "2016-01-01"); +insert into diaries values(1633, "2016-01-02"); +insert into diaries values(1634, "2016-01-03"); +insert into diaries values(1635, "2016-01-04"); +insert into diaries values(1636, "2016-01-05"); +insert into diaries values(1637, "2016-01-06"); +insert into diaries values(1638, "2016-01-07"); +insert into diaries values(1639, "2016-01-08"); +insert into diaries values(1640, "2016-01-09"); +insert into diaries values(1641, "2016-01-10"); +insert into diaries values(1642, "2016-01-11"); +insert into diaries values(1643, "2016-01-12"); +insert into diaries values(1644, "2016-01-13"); +insert into diaries values(1645, "2016-01-14"); +insert into diaries values(1646, "2016-01-15"); +insert into diaries values(1647, "2016-01-16"); +insert into diaries values(1648, "2016-01-17"); +insert into diaries values(1649, "2016-01-18"); +insert into diaries values(1650, "2016-01-19"); +insert into diaries values(1651, "2016-01-20"); +insert into diaries values(1652, "2016-01-21"); +insert into diaries values(1653, "2016-01-22"); +insert into diaries values(1654, "2016-01-23"); +insert into diaries values(1655, "2016-01-24"); +insert into diaries values(1656, "2016-01-25"); +insert into diaries values(1657, "2016-01-26"); +insert into diaries values(1658, "2016-01-27"); +insert into diaries values(1659, "2016-01-28"); +insert into diaries values(1660, "2016-01-29"); +insert into diaries values(1661, "2016-01-30"); +insert into diaries values(1662, "2016-01-31"); +insert into diaries values(1663, "2016-02-01"); +insert into diaries values(1664, "2016-02-02"); +insert into diaries values(1665, "2016-02-03"); +insert into diaries values(1666, "2016-02-04"); +insert into diaries values(1667, "2016-02-05"); +insert into diaries values(1668, "2016-02-06"); +insert into diaries values(1669, "2016-02-07"); +insert into diaries values(1670, "2016-02-08"); +insert into diaries values(1671, "2016-02-09"); +insert into diaries values(1672, "2016-02-10"); +insert into diaries values(1673, "2016-02-11"); +insert into diaries values(1674, "2016-02-12"); +insert into diaries values(1675, "2016-02-13"); +insert into diaries values(1676, "2016-02-14"); +insert into diaries values(1677, "2016-02-15"); +insert into diaries values(1678, "2016-02-16"); +insert into diaries values(1679, "2016-02-17"); +insert into diaries values(1680, "2016-02-18"); +insert into diaries values(1681, "2016-02-19"); +insert into diaries values(1682, "2016-02-20"); +insert into diaries values(1683, "2016-02-21"); +insert into diaries values(1684, "2016-02-22"); +insert into diaries values(1685, "2016-02-23"); +insert into diaries values(1686, "2016-02-24"); +insert into diaries values(1687, "2016-02-25"); +insert into diaries values(1688, "2016-02-26"); +insert into diaries values(1689, "2016-02-27"); +insert into diaries values(1690, "2016-02-28"); +insert into diaries values(1691, "2016-02-29"); +insert into diaries values(1692, "2016-03-01"); +insert into diaries values(1693, "2016-03-02"); +insert into diaries values(1694, "2016-03-03"); +insert into diaries values(1695, "2016-03-04"); +insert into diaries values(1696, "2016-03-05"); +insert into diaries values(1697, "2016-03-06"); +insert into diaries values(1698, "2016-03-07"); +insert into diaries values(1699, "2016-03-08"); +insert into diaries values(1700, "2016-03-09"); +insert into diaries values(1701, "2016-03-10"); +insert into diaries values(1702, "2016-03-11"); +insert into diaries values(1703, "2016-03-12"); +insert into diaries values(1704, "2016-03-13"); +insert into diaries values(1705, "2016-03-14"); +insert into diaries values(1706, "2016-03-15"); +insert into diaries values(1707, "2016-03-16"); +insert into diaries values(1708, "2016-03-17"); +insert into diaries values(1709, "2016-03-18"); +insert into diaries values(1710, "2016-03-19"); +insert into diaries values(1711, "2016-03-20"); +insert into diaries values(1712, "2016-03-21"); +insert into diaries values(1713, "2016-03-22"); +insert into diaries values(1714, "2016-03-23"); +insert into diaries values(1715, "2016-03-24"); +insert into diaries values(1716, "2016-03-25"); +insert into diaries values(1717, "2016-03-26"); +insert into diaries values(1718, "2016-03-27"); +insert into diaries values(1719, "2016-03-28"); +insert into diaries values(1720, "2016-03-29"); +insert into diaries values(1721, "2016-03-30"); +insert into diaries values(1722, "2016-03-31"); +insert into diaries values(1723, "2016-04-01"); +insert into diaries values(1724, "2016-04-02"); +insert into diaries values(1725, "2016-04-03"); +insert into diaries values(1726, "2016-04-04"); +insert into diaries values(1727, "2016-04-05"); +insert into diaries values(1728, "2016-04-06"); +insert into diaries values(1729, "2016-04-07"); +insert into diaries values(1730, "2016-04-08"); +insert into diaries values(1731, "2016-04-09"); +insert into diaries values(1732, "2016-04-10"); +insert into diaries values(1733, "2016-04-11"); +insert into diaries values(1734, "2016-04-12"); +insert into diaries values(1735, "2016-04-13"); +insert into diaries values(1736, "2016-04-14"); +insert into diaries values(1737, "2016-04-15"); +insert into diaries values(1738, "2016-04-16"); +insert into diaries values(1739, "2016-04-17"); +insert into diaries values(1740, "2016-04-18"); +insert into diaries values(1741, "2016-04-19"); +insert into diaries values(1742, "2016-04-20"); +insert into diaries values(1743, "2016-04-21"); +insert into diaries values(1744, "2016-04-22"); +insert into diaries values(1745, "2016-04-23"); +insert into diaries values(1746, "2016-04-24"); +insert into diaries values(1747, "2016-04-25"); +insert into diaries values(1748, "2016-04-26"); +insert into diaries values(1749, "2016-04-27"); +insert into diaries values(1750, "2016-04-28"); +insert into diaries values(1751, "2016-04-29"); +insert into diaries values(1752, "2016-04-30"); +insert into diaries values(1753, "2016-05-01"); +insert into diaries values(1754, "2016-05-02"); +insert into diaries values(1755, "2016-05-03"); +insert into diaries values(1756, "2016-05-04"); +insert into diaries values(1757, "2016-05-05"); +insert into diaries values(1758, "2016-05-06"); +insert into diaries values(1759, "2016-05-07"); +insert into diaries values(1760, "2016-05-08"); +insert into diaries values(1761, "2016-05-09"); +insert into diaries values(1762, "2016-05-10"); +insert into diaries values(1763, "2016-05-11"); +insert into diaries values(1764, "2016-05-12"); +insert into diaries values(1765, "2016-05-13"); +insert into diaries values(1766, "2016-05-14"); +insert into diaries values(1767, "2016-05-15"); +insert into diaries values(1768, "2016-05-16"); +insert into diaries values(1769, "2016-05-17"); +insert into diaries values(1770, "2016-05-18"); +insert into diaries values(1771, "2016-05-19"); +insert into diaries values(1772, "2016-05-20"); +insert into diaries values(1773, "2016-05-21"); +insert into diaries values(1774, "2016-05-22"); +insert into diaries values(1775, "2016-05-23"); +insert into diaries values(1776, "2016-05-24"); +insert into diaries values(1777, "2016-05-25"); +insert into diaries values(1778, "2016-05-26"); +insert into diaries values(1779, "2016-05-27"); +insert into diaries values(1780, "2016-05-28"); +insert into diaries values(1781, "2016-05-29"); +insert into diaries values(1782, "2016-05-30"); +insert into diaries values(1783, "2016-05-31"); +insert into diaries values(1784, "2016-06-01"); +insert into diaries values(1785, "2016-06-02"); +insert into diaries values(1786, "2016-06-03"); +insert into diaries values(1787, "2016-06-04"); +insert into diaries values(1788, "2016-06-05"); +insert into diaries values(1789, "2016-06-06"); +insert into diaries values(1790, "2016-06-07"); +insert into diaries values(1791, "2016-06-08"); +insert into diaries values(1792, "2016-06-09"); +insert into diaries values(1793, "2016-06-10"); +insert into diaries values(1794, "2016-06-11"); +insert into diaries values(1795, "2016-06-12"); +insert into diaries values(1796, "2016-06-13"); +insert into diaries values(1797, "2016-06-14"); +insert into diaries values(1798, "2016-06-15"); +insert into diaries values(1799, "2016-06-16"); +insert into diaries values(1800, "2016-06-17"); +insert into diaries values(1801, "2016-06-18"); +insert into diaries values(1802, "2016-06-19"); +insert into diaries values(1803, "2016-06-20"); +insert into diaries values(1804, "2016-06-21"); +insert into diaries values(1805, "2016-06-22"); +insert into diaries values(1806, "2016-06-23"); +insert into diaries values(1807, "2016-06-24"); +insert into diaries values(1808, "2016-06-25"); +insert into diaries values(1809, "2016-06-26"); +insert into diaries values(1810, "2016-06-27"); +insert into diaries values(1811, "2016-06-28"); +insert into diaries values(1812, "2016-06-29"); +insert into diaries values(1813, "2016-06-30"); +insert into diaries values(1814, "2016-07-01"); +insert into diaries values(1815, "2016-07-02"); +insert into diaries values(1816, "2016-07-03"); +insert into diaries values(1817, "2016-07-04"); +insert into diaries values(1818, "2016-07-05"); +insert into diaries values(1819, "2016-07-06"); +insert into diaries values(1820, "2016-07-07"); +insert into diaries values(1821, "2016-07-08"); +insert into diaries values(1822, "2016-07-09"); +insert into diaries values(1823, "2016-07-10"); +insert into diaries values(1824, "2016-07-11"); +insert into diaries values(1825, "2016-07-12"); +insert into diaries values(1826, "2016-07-13"); +insert into diaries values(1827, "2016-07-14"); +insert into diaries values(1828, "2016-07-15"); +insert into diaries values(1829, "2016-07-16"); +insert into diaries values(1830, "2016-07-17"); +insert into diaries values(1831, "2016-07-18"); +insert into diaries values(1832, "2016-07-19"); +insert into diaries values(1833, "2016-07-20"); +insert into diaries values(1834, "2016-07-21"); +insert into diaries values(1835, "2016-07-22"); +insert into diaries values(1836, "2016-07-23"); +insert into diaries values(1837, "2016-07-24"); +insert into diaries values(1838, "2016-07-25"); +insert into diaries values(1839, "2016-07-26"); +insert into diaries values(1840, "2016-07-27"); +insert into diaries values(1841, "2016-07-28"); +insert into diaries values(1842, "2016-07-29"); +insert into diaries values(1843, "2016-07-30"); +insert into diaries values(1844, "2016-07-31"); +insert into diaries values(1845, "2016-08-01"); +insert into diaries values(1846, "2016-08-02"); +insert into diaries values(1847, "2016-08-03"); +insert into diaries values(1848, "2016-08-04"); +insert into diaries values(1849, "2016-08-05"); +insert into diaries values(1850, "2016-08-06"); +insert into diaries values(1851, "2016-08-07"); +insert into diaries values(1852, "2016-08-08"); +insert into diaries values(1853, "2016-08-09"); +insert into diaries values(1854, "2016-08-10"); +insert into diaries values(1855, "2016-08-11"); +insert into diaries values(1856, "2016-08-12"); +insert into diaries values(1857, "2016-08-13"); +insert into diaries values(1858, "2016-08-14"); +insert into diaries values(1859, "2016-08-15"); +insert into diaries values(1860, "2016-08-16"); +insert into diaries values(1861, "2016-08-17"); +insert into diaries values(1862, "2016-08-18"); +insert into diaries values(1863, "2016-08-19"); +insert into diaries values(1864, "2016-08-20"); +insert into diaries values(1865, "2016-08-21"); +insert into diaries values(1866, "2016-08-22"); +insert into diaries values(1867, "2016-08-23"); +insert into diaries values(1868, "2016-08-24"); +insert into diaries values(1869, "2016-08-25"); +insert into diaries values(1870, "2016-08-26"); +insert into diaries values(1871, "2016-08-27"); +insert into diaries values(1872, "2016-08-28"); +insert into diaries values(1873, "2016-08-29"); +insert into diaries values(1874, "2016-08-30"); +insert into diaries values(1875, "2016-08-31"); +insert into diaries values(1876, "2016-09-01"); +insert into diaries values(1877, "2016-09-02"); +insert into diaries values(1878, "2016-09-03"); +insert into diaries values(1879, "2016-09-04"); +insert into diaries values(1880, "2016-09-05"); +insert into diaries values(1881, "2016-09-06"); +insert into diaries values(1882, "2016-09-07"); +insert into diaries values(1883, "2016-09-08"); +insert into diaries values(1884, "2016-09-09"); +insert into diaries values(1885, "2016-09-10"); +insert into diaries values(1886, "2016-09-11"); +insert into diaries values(1887, "2016-09-12"); +insert into diaries values(1888, "2016-09-13"); +insert into diaries values(1889, "2016-09-14"); +insert into diaries values(1890, "2016-09-15"); +insert into diaries values(1891, "2016-09-16"); +insert into diaries values(1892, "2016-09-17"); +insert into diaries values(1893, "2016-09-18"); +insert into diaries values(1894, "2016-09-19"); +insert into diaries values(1895, "2016-09-20"); +insert into diaries values(1896, "2016-09-21"); +insert into diaries values(1897, "2016-09-22"); +insert into diaries values(1898, "2016-09-23"); +insert into diaries values(1899, "2016-09-24"); +insert into diaries values(1900, "2016-09-25"); +insert into diaries values(1901, "2016-09-26"); +insert into diaries values(1902, "2016-09-27"); +insert into diaries values(1903, "2016-09-28"); +insert into diaries values(1904, "2016-09-29"); +insert into diaries values(1905, "2016-09-30"); +insert into diaries values(1906, "2016-10-01"); +insert into diaries values(1907, "2016-10-02"); +insert into diaries values(1908, "2016-10-03"); +insert into diaries values(1909, "2016-10-04"); +insert into diaries values(1910, "2016-10-05"); +insert into diaries values(1911, "2016-10-06"); +insert into diaries values(1912, "2016-10-07"); +insert into diaries values(1913, "2016-10-08"); +insert into diaries values(1914, "2016-10-09"); +insert into diaries values(1915, "2016-10-10"); +insert into diaries values(1916, "2016-10-11"); +insert into diaries values(1917, "2016-10-12"); +insert into diaries values(1918, "2016-10-13"); +insert into diaries values(1919, "2016-10-14"); +insert into diaries values(1920, "2016-10-15"); +insert into diaries values(1921, "2016-10-16"); +insert into diaries values(1922, "2016-10-17"); +insert into diaries values(1923, "2016-10-18"); +insert into diaries values(1924, "2016-10-19"); +insert into diaries values(1925, "2016-10-20"); +insert into diaries values(1926, "2016-10-21"); +insert into diaries values(1927, "2016-10-22"); +insert into diaries values(1928, "2016-10-23"); +insert into diaries values(1929, "2016-10-24"); +insert into diaries values(1930, "2016-10-25"); +insert into diaries values(1931, "2016-10-26"); +insert into diaries values(1932, "2016-10-27"); +insert into diaries values(1933, "2016-10-28"); +insert into diaries values(1934, "2016-10-29"); +insert into diaries values(1935, "2016-10-30"); +insert into diaries values(1936, "2016-10-31"); +insert into diaries values(1937, "2016-11-01"); +insert into diaries values(1938, "2016-11-02"); +insert into diaries values(1939, "2016-11-03"); +insert into diaries values(1940, "2016-11-04"); +insert into diaries values(1941, "2016-11-05"); +insert into diaries values(1942, "2016-11-06"); +insert into diaries values(1943, "2016-11-07"); +insert into diaries values(1944, "2016-11-08"); +insert into diaries values(1945, "2016-11-09"); +insert into diaries values(1946, "2016-11-10"); +insert into diaries values(1947, "2016-11-11"); +insert into diaries values(1948, "2016-11-12"); +insert into diaries values(1949, "2016-11-13"); +insert into diaries values(1950, "2016-11-14"); +insert into diaries values(1951, "2016-11-15"); +insert into diaries values(1952, "2016-11-16"); +insert into diaries values(1953, "2016-11-17"); +insert into diaries values(1954, "2016-11-18"); +insert into diaries values(1955, "2016-11-19"); +insert into diaries values(1956, "2016-11-20"); +insert into diaries values(1957, "2016-11-21"); +insert into diaries values(1958, "2016-11-22"); +insert into diaries values(1959, "2016-11-23"); +insert into diaries values(1960, "2016-11-24"); +insert into diaries values(1961, "2016-11-25"); +insert into diaries values(1962, "2016-11-26"); +insert into diaries values(1963, "2016-11-27"); +insert into diaries values(1964, "2016-11-28"); +insert into diaries values(1965, "2016-11-29"); +insert into diaries values(1966, "2016-11-30"); +insert into diaries values(1967, "2016-12-01"); +insert into diaries values(1968, "2016-12-02"); +insert into diaries values(1969, "2016-12-03"); +insert into diaries values(1970, "2016-12-04"); +insert into diaries values(1971, "2016-12-05"); +insert into diaries values(1972, "2016-12-06"); +insert into diaries values(1973, "2016-12-07"); +insert into diaries values(1974, "2016-12-08"); +insert into diaries values(1975, "2016-12-09"); +insert into diaries values(1976, "2016-12-10"); +insert into diaries values(1977, "2016-12-11"); +insert into diaries values(1978, "2016-12-12"); +insert into diaries values(1979, "2016-12-13"); +insert into diaries values(1980, "2016-12-14"); +insert into diaries values(1981, "2016-12-15"); +insert into diaries values(1982, "2016-12-16"); +insert into diaries values(1983, "2016-12-17"); +insert into diaries values(1984, "2016-12-18"); +insert into diaries values(1985, "2016-12-19"); +insert into diaries values(1986, "2016-12-20"); +insert into diaries values(1987, "2016-12-21"); +insert into diaries values(1988, "2016-12-22"); +insert into diaries values(1989, "2016-12-23"); +insert into diaries values(1990, "2016-12-24"); +insert into diaries values(1991, "2016-12-25"); +insert into diaries values(1992, "2016-12-26"); +insert into diaries values(1993, "2016-12-27"); +insert into diaries values(1994, "2016-12-28"); +insert into diaries values(1995, "2016-12-29"); +insert into diaries values(1996, "2016-12-30"); +insert into diaries values(1997, "2016-12-31"); +insert into diaries values(1998, "2017-01-01"); +insert into diaries values(1999, "2017-01-02"); +insert into diaries values(2000, "2017-01-03"); +insert into diaries values(2001, "2017-01-04"); +insert into diaries values(2002, "2017-01-05"); +insert into diaries values(2003, "2017-01-06"); +insert into diaries values(2004, "2017-01-07"); +insert into diaries values(2005, "2017-01-08"); +insert into diaries values(2006, "2017-01-09"); +insert into diaries values(2007, "2017-01-10"); +insert into diaries values(2008, "2017-01-11"); +insert into diaries values(2009, "2017-01-12"); +insert into diaries values(2010, "2017-01-13"); +insert into diaries values(2011, "2017-01-14"); +insert into diaries values(2012, "2017-01-15"); +insert into diaries values(2013, "2017-01-16"); +insert into diaries values(2014, "2017-01-17"); +insert into diaries values(2015, "2017-01-18"); +insert into diaries values(2016, "2017-01-19"); +insert into diaries values(2017, "2017-01-20"); +insert into diaries values(2018, "2017-01-21"); +insert into diaries values(2019, "2017-01-22"); +insert into diaries values(2020, "2017-01-23"); +insert into diaries values(2021, "2017-01-24"); +insert into diaries values(2022, "2017-01-25"); +insert into diaries values(2023, "2017-01-26"); +insert into diaries values(2024, "2017-01-27"); +insert into diaries values(2025, "2017-01-28"); +insert into diaries values(2026, "2017-01-29"); +insert into diaries values(2027, "2017-01-30"); +insert into diaries values(2028, "2017-01-31"); +insert into diaries values(2029, "2017-02-01"); +insert into diaries values(2030, "2017-02-02"); +insert into diaries values(2031, "2017-02-03"); +insert into diaries values(2032, "2017-02-04"); +insert into diaries values(2033, "2017-02-05"); +insert into diaries values(2034, "2017-02-06"); +insert into diaries values(2035, "2017-02-07"); +insert into diaries values(2036, "2017-02-08"); +insert into diaries values(2037, "2017-02-09"); +insert into diaries values(2038, "2017-02-10"); +insert into diaries values(2039, "2017-02-11"); +insert into diaries values(2040, "2017-02-12"); +insert into diaries values(2041, "2017-02-13"); +insert into diaries values(2042, "2017-02-14"); +insert into diaries values(2043, "2017-02-15"); +insert into diaries values(2044, "2017-02-16"); +insert into diaries values(2045, "2017-02-17"); +insert into diaries values(2046, "2017-02-18"); +insert into diaries values(2047, "2017-02-19"); +insert into diaries values(2048, "2017-02-20"); +insert into diaries values(2049, "2017-02-21"); +insert into diaries values(2050, "2017-02-22"); +insert into diaries values(2051, "2017-02-23"); +insert into diaries values(2052, "2017-02-24"); +insert into diaries values(2053, "2017-02-25"); +insert into diaries values(2054, "2017-02-26"); +insert into diaries values(2055, "2017-02-27"); +insert into diaries values(2056, "2017-02-28"); +insert into diaries values(2057, "2017-03-01"); +insert into diaries values(2058, "2017-03-02"); +insert into diaries values(2059, "2017-03-03"); +insert into diaries values(2060, "2017-03-04"); +insert into diaries values(2061, "2017-03-05"); +insert into diaries values(2062, "2017-03-06"); +insert into diaries values(2063, "2017-03-07"); +insert into diaries values(2064, "2017-03-08"); +insert into diaries values(2065, "2017-03-09"); +insert into diaries values(2066, "2017-03-10"); +insert into diaries values(2067, "2017-03-11"); +insert into diaries values(2068, "2017-03-12"); +insert into diaries values(2069, "2017-03-13"); +insert into diaries values(2070, "2017-03-14"); +insert into diaries values(2071, "2017-03-15"); +insert into diaries values(2072, "2017-03-16"); +insert into diaries values(2073, "2017-03-17"); +insert into diaries values(2074, "2017-03-18"); +insert into diaries values(2075, "2017-03-19"); +insert into diaries values(2076, "2017-03-20"); +insert into diaries values(2077, "2017-03-21"); +insert into diaries values(2078, "2017-03-22"); +insert into diaries values(2079, "2017-03-23"); +insert into diaries values(2080, "2017-03-24"); +insert into diaries values(2081, "2017-03-25"); +insert into diaries values(2082, "2017-03-26"); +insert into diaries values(2083, "2017-03-27"); +insert into diaries values(2084, "2017-03-28"); +insert into diaries values(2085, "2017-03-29"); +insert into diaries values(2086, "2017-03-30"); +insert into diaries values(2087, "2017-03-31"); +insert into diaries values(2088, "2017-04-01"); +insert into diaries values(2089, "2017-04-02"); +insert into diaries values(2090, "2017-04-03"); +insert into diaries values(2091, "2017-04-04"); +insert into diaries values(2092, "2017-04-05"); +insert into diaries values(2093, "2017-04-06"); +insert into diaries values(2094, "2017-04-07"); +insert into diaries values(2095, "2017-04-08"); +insert into diaries values(2096, "2017-04-09"); +insert into diaries values(2097, "2017-04-10"); +insert into diaries values(2098, "2017-04-11"); +insert into diaries values(2099, "2017-04-12"); +insert into diaries values(2100, "2017-04-13"); +insert into diaries values(2101, "2017-04-14"); +insert into diaries values(2102, "2017-04-15"); +insert into diaries values(2103, "2017-04-16"); +insert into diaries values(2104, "2017-04-17"); +insert into diaries values(2105, "2017-04-18"); +insert into diaries values(2106, "2017-04-19"); +insert into diaries values(2107, "2017-04-20"); +insert into diaries values(2108, "2017-04-21"); +insert into diaries values(2109, "2017-04-22"); +insert into diaries values(2110, "2017-04-23"); +insert into diaries values(2111, "2017-04-24"); +insert into diaries values(2112, "2017-04-25"); +insert into diaries values(2113, "2017-04-26"); +insert into diaries values(2114, "2017-04-27"); +insert into diaries values(2115, "2017-04-28"); +insert into diaries values(2116, "2017-04-29"); +insert into diaries values(2117, "2017-04-30"); +insert into diaries values(2118, "2017-05-01"); +insert into diaries values(2119, "2017-05-02"); +insert into diaries values(2120, "2017-05-03"); +insert into diaries values(2121, "2017-05-04"); +insert into diaries values(2122, "2017-05-05"); +insert into diaries values(2123, "2017-05-06"); +insert into diaries values(2124, "2017-05-07"); +insert into diaries values(2125, "2017-05-08"); +insert into diaries values(2126, "2017-05-09"); +insert into diaries values(2127, "2017-05-10"); +insert into diaries values(2128, "2017-05-11"); +insert into diaries values(2129, "2017-05-12"); +insert into diaries values(2130, "2017-05-13"); +insert into diaries values(2131, "2017-05-14"); +insert into diaries values(2132, "2017-05-15"); +insert into diaries values(2133, "2017-05-16"); +insert into diaries values(2134, "2017-05-17"); +insert into diaries values(2135, "2017-05-18"); +insert into diaries values(2136, "2017-05-19"); +insert into diaries values(2137, "2017-05-20"); +insert into diaries values(2138, "2017-05-21"); +insert into diaries values(2139, "2017-05-22"); +insert into diaries values(2140, "2017-05-23"); +insert into diaries values(2141, "2017-05-24"); +insert into diaries values(2142, "2017-05-25"); +insert into diaries values(2143, "2017-05-26"); +insert into diaries values(2144, "2017-05-27"); +insert into diaries values(2145, "2017-05-28"); +insert into diaries values(2146, "2017-05-29"); +insert into diaries values(2147, "2017-05-30"); +insert into diaries values(2148, "2017-05-31"); +insert into diaries values(2149, "2017-06-01"); +insert into diaries values(2150, "2017-06-02"); +insert into diaries values(2151, "2017-06-03"); +insert into diaries values(2152, "2017-06-04"); +insert into diaries values(2153, "2017-06-05"); +insert into diaries values(2154, "2017-06-06"); +insert into diaries values(2155, "2017-06-07"); +insert into diaries values(2156, "2017-06-08"); +insert into diaries values(2157, "2017-06-09"); +insert into diaries values(2158, "2017-06-10"); +insert into diaries values(2159, "2017-06-11"); +insert into diaries values(2160, "2017-06-12"); +insert into diaries values(2161, "2017-06-13"); +insert into diaries values(2162, "2017-06-14"); +insert into diaries values(2163, "2017-06-15"); +insert into diaries values(2164, "2017-06-16"); +insert into diaries values(2165, "2017-06-17"); +insert into diaries values(2166, "2017-06-18"); +insert into diaries values(2167, "2017-06-19"); +insert into diaries values(2168, "2017-06-20"); +insert into diaries values(2169, "2017-06-21"); +insert into diaries values(2170, "2017-06-22"); +insert into diaries values(2171, "2017-06-23"); +insert into diaries values(2172, "2017-06-24"); +insert into diaries values(2173, "2017-06-25"); +insert into diaries values(2174, "2017-06-26"); +insert into diaries values(2175, "2017-06-27"); +insert into diaries values(2176, "2017-06-28"); +insert into diaries values(2177, "2017-06-29"); +insert into diaries values(2178, "2017-06-30"); +insert into diaries values(2179, "2017-07-01"); +insert into diaries values(2180, "2017-07-02"); +insert into diaries values(2181, "2017-07-03"); +insert into diaries values(2182, "2017-07-04"); +insert into diaries values(2183, "2017-07-05"); +insert into diaries values(2184, "2017-07-06"); +insert into diaries values(2185, "2017-07-07"); +insert into diaries values(2186, "2017-07-08"); +insert into diaries values(2187, "2017-07-09"); +insert into diaries values(2188, "2017-07-10"); +insert into diaries values(2189, "2017-07-11"); +insert into diaries values(2190, "2017-07-12"); +insert into diaries values(2191, "2017-07-13"); +insert into diaries values(2192, "2017-07-14"); +insert into diaries values(2193, "2017-07-15"); +insert into diaries values(2194, "2017-07-16"); +insert into diaries values(2195, "2017-07-17"); +insert into diaries values(2196, "2017-07-18"); +insert into diaries values(2197, "2017-07-19"); +insert into diaries values(2198, "2017-07-20"); +insert into diaries values(2199, "2017-07-21"); +insert into diaries values(2200, "2017-07-22"); +insert into diaries values(2201, "2017-07-23"); +insert into diaries values(2202, "2017-07-24"); +insert into diaries values(2203, "2017-07-25"); +insert into diaries values(2204, "2017-07-26"); +insert into diaries values(2205, "2017-07-27"); +insert into diaries values(2206, "2017-07-28"); +insert into diaries values(2207, "2017-07-29"); +insert into diaries values(2208, "2017-07-30"); +insert into diaries values(2209, "2017-07-31"); +insert into diaries values(2210, "2017-08-01"); +insert into diaries values(2211, "2017-08-02"); +insert into diaries values(2212, "2017-08-03"); +insert into diaries values(2213, "2017-08-04"); +insert into diaries values(2214, "2017-08-05"); +insert into diaries values(2215, "2017-08-06"); +insert into diaries values(2216, "2017-08-07"); +insert into diaries values(2217, "2017-08-08"); +insert into diaries values(2218, "2017-08-09"); +insert into diaries values(2219, "2017-08-10"); +insert into diaries values(2220, "2017-08-11"); +insert into diaries values(2221, "2017-08-12"); +insert into diaries values(2222, "2017-08-13"); +insert into diaries values(2223, "2017-08-14"); +insert into diaries values(2224, "2017-08-15"); +insert into diaries values(2225, "2017-08-16"); +insert into diaries values(2226, "2017-08-17"); +insert into diaries values(2227, "2017-08-18"); +insert into diaries values(2228, "2017-08-19"); +insert into diaries values(2229, "2017-08-20"); +insert into diaries values(2230, "2017-08-21"); +insert into diaries values(2231, "2017-08-22"); +insert into diaries values(2232, "2017-08-23"); +insert into diaries values(2233, "2017-08-24"); +insert into diaries values(2234, "2017-08-25"); +insert into diaries values(2235, "2017-08-26"); +insert into diaries values(2236, "2017-08-27"); +insert into diaries values(2237, "2017-08-28"); +insert into diaries values(2238, "2017-08-29"); +insert into diaries values(2239, "2017-08-30"); +insert into diaries values(2240, "2017-08-31"); +insert into diaries values(2241, "2017-09-01"); +insert into diaries values(2242, "2017-09-02"); +insert into diaries values(2243, "2017-09-03"); +insert into diaries values(2244, "2017-09-04"); +insert into diaries values(2245, "2017-09-05"); +insert into diaries values(2246, "2017-09-06"); +insert into diaries values(2247, "2017-09-07"); +insert into diaries values(2248, "2017-09-08"); +insert into diaries values(2249, "2017-09-09"); +insert into diaries values(2250, "2017-09-10"); +insert into diaries values(2251, "2017-09-11"); +insert into diaries values(2252, "2017-09-12"); +insert into diaries values(2253, "2017-09-13"); +insert into diaries values(2254, "2017-09-14"); +insert into diaries values(2255, "2017-09-15"); +insert into diaries values(2256, "2017-09-16"); +insert into diaries values(2257, "2017-09-17"); +insert into diaries values(2258, "2017-09-18"); +insert into diaries values(2259, "2017-09-19"); +insert into diaries values(2260, "2017-09-20"); +insert into diaries values(2261, "2017-09-21"); +insert into diaries values(2262, "2017-09-22"); +insert into diaries values(2263, "2017-09-23"); +insert into diaries values(2264, "2017-09-24"); +insert into diaries values(2265, "2017-09-25"); +insert into diaries values(2266, "2017-09-26"); +insert into diaries values(2267, "2017-09-27"); +insert into diaries values(2268, "2017-09-28"); +insert into diaries values(2269, "2017-09-29"); +insert into diaries values(2270, "2017-09-30"); +insert into diaries values(2271, "2017-10-01"); +insert into diaries values(2272, "2017-10-02"); +insert into diaries values(2273, "2017-10-03"); +insert into diaries values(2274, "2017-10-04"); +insert into diaries values(2275, "2017-10-05"); +insert into diaries values(2276, "2017-10-06"); +insert into diaries values(2277, "2017-10-07"); +insert into diaries values(2278, "2017-10-08"); +insert into diaries values(2279, "2017-10-09"); +insert into diaries values(2280, "2017-10-10"); +insert into diaries values(2281, "2017-10-11"); +insert into diaries values(2282, "2017-10-12"); +insert into diaries values(2283, "2017-10-13"); +insert into diaries values(2284, "2017-10-14"); +insert into diaries values(2285, "2017-10-15"); +insert into diaries values(2286, "2017-10-16"); +insert into diaries values(2287, "2017-10-17"); +insert into diaries values(2288, "2017-10-18"); +insert into diaries values(2289, "2017-10-19"); +insert into diaries values(2290, "2017-10-20"); +insert into diaries values(2291, "2017-10-21"); +insert into diaries values(2292, "2017-10-22"); +insert into diaries values(2293, "2017-10-23"); +insert into diaries values(2294, "2017-10-24"); +insert into diaries values(2295, "2017-10-25"); +insert into diaries values(2296, "2017-10-26"); +insert into diaries values(2297, "2017-10-27"); +insert into diaries values(2298, "2017-10-28"); +insert into diaries values(2299, "2017-10-29"); +insert into diaries values(2300, "2017-10-30"); +insert into diaries values(2301, "2017-10-31"); +insert into diaries values(2302, "2017-11-01"); +insert into diaries values(2303, "2017-11-02"); +insert into diaries values(2304, "2017-11-03"); +insert into diaries values(2305, "2017-11-04"); +insert into diaries values(2306, "2017-11-05"); +insert into diaries values(2307, "2017-11-06"); +insert into diaries values(2308, "2017-11-07"); +insert into diaries values(2309, "2017-11-08"); +insert into diaries values(2310, "2017-11-09"); +insert into diaries values(2311, "2017-11-10"); +insert into diaries values(2312, "2017-11-11"); +insert into diaries values(2313, "2017-11-12"); +insert into diaries values(2314, "2017-11-13"); +insert into diaries values(2315, "2017-11-14"); +insert into diaries values(2316, "2017-11-15"); +insert into diaries values(2317, "2017-11-16"); +insert into diaries values(2318, "2017-11-17"); +insert into diaries values(2319, "2017-11-18"); +insert into diaries values(2320, "2017-11-19"); +insert into diaries values(2321, "2017-11-20"); +insert into diaries values(2322, "2017-11-21"); +insert into diaries values(2323, "2017-11-22"); +insert into diaries values(2324, "2017-11-23"); +insert into diaries values(2325, "2017-11-24"); +insert into diaries values(2326, "2017-11-25"); +insert into diaries values(2327, "2017-11-26"); +insert into diaries values(2328, "2017-11-27"); +insert into diaries values(2329, "2017-11-28"); +insert into diaries values(2330, "2017-11-29"); +insert into diaries values(2331, "2017-11-30"); +insert into diaries values(2332, "2017-12-01"); +insert into diaries values(2333, "2017-12-02"); +insert into diaries values(2334, "2017-12-03"); +insert into diaries values(2335, "2017-12-04"); +insert into diaries values(2336, "2017-12-05"); +insert into diaries values(2337, "2017-12-06"); +insert into diaries values(2338, "2017-12-07"); +insert into diaries values(2339, "2017-12-08"); +insert into diaries values(2340, "2017-12-09"); +insert into diaries values(2341, "2017-12-10"); +insert into diaries values(2342, "2017-12-11"); +insert into diaries values(2343, "2017-12-12"); +insert into diaries values(2344, "2017-12-13"); +insert into diaries values(2345, "2017-12-14"); +insert into diaries values(2346, "2017-12-15"); +insert into diaries values(2347, "2017-12-16"); +insert into diaries values(2348, "2017-12-17"); +insert into diaries values(2349, "2017-12-18"); +insert into diaries values(2350, "2017-12-19"); +insert into diaries values(2351, "2017-12-20"); +insert into diaries values(2352, "2017-12-21"); +insert into diaries values(2353, "2017-12-22"); +insert into diaries values(2354, "2017-12-23"); +insert into diaries values(2355, "2017-12-24"); +insert into diaries values(2356, "2017-12-25"); +insert into diaries values(2357, "2017-12-26"); +insert into diaries values(2358, "2017-12-27"); +insert into diaries values(2359, "2017-12-28"); +insert into diaries values(2360, "2017-12-29"); +insert into diaries values(2361, "2017-12-30"); +insert into diaries values(2362, "2017-12-31"); +insert into diaries values(2363, "2018-01-01"); +insert into diaries values(2364, "2018-01-02"); +insert into diaries values(2365, "2018-01-03"); +insert into diaries values(2366, "2018-01-04"); +insert into diaries values(2367, "2018-01-05"); +insert into diaries values(2368, "2018-01-06"); +insert into diaries values(2369, "2018-01-07"); +insert into diaries values(2370, "2018-01-08"); +insert into diaries values(2371, "2018-01-09"); +insert into diaries values(2372, "2018-01-10"); +insert into diaries values(2373, "2018-01-11"); +insert into diaries values(2374, "2018-01-12"); +insert into diaries values(2375, "2018-01-13"); +insert into diaries values(2376, "2018-01-14"); +insert into diaries values(2377, "2018-01-15"); +insert into diaries values(2378, "2018-01-16"); +insert into diaries values(2379, "2018-01-17"); +insert into diaries values(2380, "2018-01-18"); +insert into diaries values(2381, "2018-01-19"); +insert into diaries values(2382, "2018-01-20"); +insert into diaries values(2383, "2018-01-21"); +insert into diaries values(2384, "2018-01-22"); +insert into diaries values(2385, "2018-01-23"); +insert into diaries values(2386, "2018-01-24"); +insert into diaries values(2387, "2018-01-25"); +insert into diaries values(2388, "2018-01-26"); +insert into diaries values(2389, "2018-01-27"); +insert into diaries values(2390, "2018-01-28"); +insert into diaries values(2391, "2018-01-29"); +insert into diaries values(2392, "2018-01-30"); +insert into diaries values(2393, "2018-01-31"); +insert into diaries values(2394, "2018-02-01"); +insert into diaries values(2395, "2018-02-02"); +insert into diaries values(2396, "2018-02-03"); +insert into diaries values(2397, "2018-02-04"); +insert into diaries values(2398, "2018-02-05"); +insert into diaries values(2399, "2018-02-06"); +insert into diaries values(2400, "2018-02-07"); +insert into diaries values(2401, "2018-02-08"); +insert into diaries values(2402, "2018-02-09"); +insert into diaries values(2403, "2018-02-10"); +insert into diaries values(2404, "2018-02-11"); +insert into diaries values(2405, "2018-02-12"); +insert into diaries values(2406, "2018-02-13"); +insert into diaries values(2407, "2018-02-14"); +insert into diaries values(2408, "2018-02-15"); +insert into diaries values(2409, "2018-02-16"); +insert into diaries values(2410, "2018-02-17"); +insert into diaries values(2411, "2018-02-18"); +insert into diaries values(2412, "2018-02-19"); +insert into diaries values(2413, "2018-02-20"); +insert into diaries values(2414, "2018-02-21"); +insert into diaries values(2415, "2018-02-22"); +insert into diaries values(2416, "2018-02-23"); +insert into diaries values(2417, "2018-02-24"); +insert into diaries values(2418, "2018-02-25"); +insert into diaries values(2419, "2018-02-26"); +insert into diaries values(2420, "2018-02-27"); +insert into diaries values(2421, "2018-02-28"); +insert into diaries values(2422, "2018-03-01"); +insert into diaries values(2423, "2018-03-02"); +insert into diaries values(2424, "2018-03-03"); +insert into diaries values(2425, "2018-03-04"); +insert into diaries values(2426, "2018-03-05"); +insert into diaries values(2427, "2018-03-06"); +insert into diaries values(2428, "2018-03-07"); +insert into diaries values(2429, "2018-03-08"); +insert into diaries values(2430, "2018-03-09"); +insert into diaries values(2431, "2018-03-10"); +insert into diaries values(2432, "2018-03-11"); +insert into diaries values(2433, "2018-03-12"); +insert into diaries values(2434, "2018-03-13"); +insert into diaries values(2435, "2018-03-14"); +insert into diaries values(2436, "2018-03-15"); +insert into diaries values(2437, "2018-03-16"); +insert into diaries values(2438, "2018-03-17"); +insert into diaries values(2439, "2018-03-18"); +insert into diaries values(2440, "2018-03-19"); +insert into diaries values(2441, "2018-03-20"); +insert into diaries values(2442, "2018-03-21"); +insert into diaries values(2443, "2018-03-22"); +insert into diaries values(2444, "2018-03-23"); +insert into diaries values(2445, "2018-03-24"); +insert into diaries values(2446, "2018-03-25"); +insert into diaries values(2447, "2018-03-26"); +insert into diaries values(2448, "2018-03-27"); +insert into diaries values(2449, "2018-03-28"); +insert into diaries values(2450, "2018-03-29"); +insert into diaries values(2451, "2018-03-30"); +insert into diaries values(2452, "2018-03-31"); +insert into diaries values(2453, "2018-04-01"); +insert into diaries values(2454, "2018-04-02"); +insert into diaries values(2455, "2018-04-03"); +insert into diaries values(2456, "2018-04-04"); +insert into diaries values(2457, "2018-04-05"); +insert into diaries values(2458, "2018-04-06"); +insert into diaries values(2459, "2018-04-07"); +insert into diaries values(2460, "2018-04-08"); +insert into diaries values(2461, "2018-04-09"); +insert into diaries values(2462, "2018-04-10"); +insert into diaries values(2463, "2018-04-11"); +insert into diaries values(2464, "2018-04-12"); +insert into diaries values(2465, "2018-04-13"); +insert into diaries values(2466, "2018-04-14"); +insert into diaries values(2467, "2018-04-15"); +insert into diaries values(2468, "2018-04-16"); +insert into diaries values(2469, "2018-04-17"); +insert into diaries values(2470, "2018-04-18"); +insert into diaries values(2471, "2018-04-19"); +insert into diaries values(2472, "2018-04-20"); +insert into diaries values(2473, "2018-04-21"); +insert into diaries values(2474, "2018-04-22"); +insert into diaries values(2475, "2018-04-23"); +insert into diaries values(2476, "2018-04-24"); +insert into diaries values(2477, "2018-04-25"); +insert into diaries values(2478, "2018-04-26"); +insert into diaries values(2479, "2018-04-27"); +insert into diaries values(2480, "2018-04-28"); +insert into diaries values(2481, "2018-04-29"); +insert into diaries values(2482, "2018-04-30"); +insert into diaries values(2483, "2018-05-01"); +insert into diaries values(2484, "2018-05-02"); +insert into diaries values(2485, "2018-05-03"); +insert into diaries values(2486, "2018-05-04"); +insert into diaries values(2487, "2018-05-05"); +insert into diaries values(2488, "2018-05-06"); +insert into diaries values(2489, "2018-05-07"); +insert into diaries values(2490, "2018-05-08"); +insert into diaries values(2491, "2018-05-09"); +insert into diaries values(2492, "2018-05-10"); +insert into diaries values(2493, "2018-05-11"); +insert into diaries values(2494, "2018-05-12"); +insert into diaries values(2495, "2018-05-13"); +insert into diaries values(2496, "2018-05-14"); +insert into diaries values(2497, "2018-05-15"); +insert into diaries values(2498, "2018-05-16"); +insert into diaries values(2499, "2018-05-17"); +insert into diaries values(2500, "2018-05-18"); +insert into diaries values(2501, "2018-05-19"); +insert into diaries values(2502, "2018-05-20"); +insert into diaries values(2503, "2018-05-21"); +insert into diaries values(2504, "2018-05-22"); +insert into diaries values(2505, "2018-05-23"); +insert into diaries values(2506, "2018-05-24"); +insert into diaries values(2507, "2018-05-25"); +insert into diaries values(2508, "2018-05-26"); +insert into diaries values(2509, "2018-05-27"); +insert into diaries values(2510, "2018-05-28"); +insert into diaries values(2511, "2018-05-29"); +insert into diaries values(2512, "2018-05-30"); +insert into diaries values(2513, "2018-05-31"); +insert into diaries values(2514, "2018-06-01"); +insert into diaries values(2515, "2018-06-02"); +insert into diaries values(2516, "2018-06-03"); +insert into diaries values(2517, "2018-06-04"); +insert into diaries values(2518, "2018-06-05"); +insert into diaries values(2519, "2018-06-06"); +insert into diaries values(2520, "2018-06-07"); +insert into diaries values(2521, "2018-06-08"); +insert into diaries values(2522, "2018-06-09"); +insert into diaries values(2523, "2018-06-10"); +insert into diaries values(2524, "2018-06-11"); +insert into diaries values(2525, "2018-06-12"); +insert into diaries values(2526, "2018-06-13"); +insert into diaries values(2527, "2018-06-14"); +insert into diaries values(2528, "2018-06-15"); +insert into diaries values(2529, "2018-06-16"); +insert into diaries values(2530, "2018-06-17"); +insert into diaries values(2531, "2018-06-18"); +insert into diaries values(2532, "2018-06-19"); +insert into diaries values(2533, "2018-06-20"); +insert into diaries values(2534, "2018-06-21"); +insert into diaries values(2535, "2018-06-22"); +insert into diaries values(2536, "2018-06-23"); +insert into diaries values(2537, "2018-06-24"); +insert into diaries values(2538, "2018-06-25"); +insert into diaries values(2539, "2018-06-26"); +insert into diaries values(2540, "2018-06-27"); +insert into diaries values(2541, "2018-06-28"); +insert into diaries values(2542, "2018-06-29"); +insert into diaries values(2543, "2018-06-30"); +insert into diaries values(2544, "2018-07-01"); +insert into diaries values(2545, "2018-07-02"); +insert into diaries values(2546, "2018-07-03"); +insert into diaries values(2547, "2018-07-04"); +insert into diaries values(2548, "2018-07-05"); +insert into diaries values(2549, "2018-07-06"); +insert into diaries values(2550, "2018-07-07"); +insert into diaries values(2551, "2018-07-08"); +insert into diaries values(2552, "2018-07-09"); +insert into diaries values(2553, "2018-07-10"); +insert into diaries values(2554, "2018-07-11"); +insert into diaries values(2555, "2018-07-12"); +insert into diaries values(2556, "2018-07-13"); +insert into diaries values(2557, "2018-07-14"); +insert into diaries values(2558, "2018-07-15"); +insert into diaries values(2559, "2018-07-16"); +insert into diaries values(2560, "2018-07-17"); +insert into diaries values(2561, "2018-07-18"); +insert into diaries values(2562, "2018-07-19"); +insert into diaries values(2563, "2018-07-20"); +insert into diaries values(2564, "2018-07-21"); +insert into diaries values(2565, "2018-07-22"); +insert into diaries values(2566, "2018-07-23"); +insert into diaries values(2567, "2018-07-24"); +insert into diaries values(2568, "2018-07-25"); +insert into diaries values(2569, "2018-07-26"); +insert into diaries values(2570, "2018-07-27"); +insert into diaries values(2571, "2018-07-28"); +insert into diaries values(2572, "2018-07-29"); +insert into diaries values(2573, "2018-07-30"); +insert into diaries values(2574, "2018-07-31"); +insert into diaries values(2575, "2018-08-01"); +insert into diaries values(2576, "2018-08-02"); +insert into diaries values(2577, "2018-08-03"); +insert into diaries values(2578, "2018-08-04"); +insert into diaries values(2579, "2018-08-05"); +insert into diaries values(2580, "2018-08-06"); +insert into diaries values(2581, "2018-08-07"); +insert into diaries values(2582, "2018-08-08"); +insert into diaries values(2583, "2018-08-09"); +insert into diaries values(2584, "2018-08-10"); +insert into diaries values(2585, "2018-08-11"); +insert into diaries values(2586, "2018-08-12"); +insert into diaries values(2587, "2018-08-13"); +insert into diaries values(2588, "2018-08-14"); +insert into diaries values(2589, "2018-08-15"); +insert into diaries values(2590, "2018-08-16"); +insert into diaries values(2591, "2018-08-17"); +insert into diaries values(2592, "2018-08-18"); +insert into diaries values(2593, "2018-08-19"); +insert into diaries values(2594, "2018-08-20"); +insert into diaries values(2595, "2018-08-21"); +insert into diaries values(2596, "2018-08-22"); +insert into diaries values(2597, "2018-08-23"); +insert into diaries values(2598, "2018-08-24"); +insert into diaries values(2599, "2018-08-25"); +insert into diaries values(2600, "2018-08-26"); +insert into diaries values(2601, "2018-08-27"); +insert into diaries values(2602, "2018-08-28"); +insert into diaries values(2603, "2018-08-29"); +insert into diaries values(2604, "2018-08-30"); +insert into diaries values(2605, "2018-08-31"); +insert into diaries values(2606, "2018-09-01"); +insert into diaries values(2607, "2018-09-02"); +insert into diaries values(2608, "2018-09-03"); +insert into diaries values(2609, "2018-09-04"); +insert into diaries values(2610, "2018-09-05"); +insert into diaries values(2611, "2018-09-06"); +insert into diaries values(2612, "2018-09-07"); +insert into diaries values(2613, "2018-09-08"); +insert into diaries values(2614, "2018-09-09"); +insert into diaries values(2615, "2018-09-10"); +insert into diaries values(2616, "2018-09-11"); +insert into diaries values(2617, "2018-09-12"); +insert into diaries values(2618, "2018-09-13"); +insert into diaries values(2619, "2018-09-14"); +insert into diaries values(2620, "2018-09-15"); +insert into diaries values(2621, "2018-09-16"); +insert into diaries values(2622, "2018-09-17"); +insert into diaries values(2623, "2018-09-18"); +insert into diaries values(2624, "2018-09-19"); +insert into diaries values(2625, "2018-09-20"); +insert into diaries values(2626, "2018-09-21"); +insert into diaries values(2627, "2018-09-22"); +insert into diaries values(2628, "2018-09-23"); +insert into diaries values(2629, "2018-09-24"); +insert into diaries values(2630, "2018-09-25"); +insert into diaries values(2631, "2018-09-26"); +insert into diaries values(2632, "2018-09-27"); +insert into diaries values(2633, "2018-09-28"); +insert into diaries values(2634, "2018-09-29"); +insert into diaries values(2635, "2018-09-30"); +insert into diaries values(2636, "2018-10-01"); +insert into diaries values(2637, "2018-10-02"); +insert into diaries values(2638, "2018-10-03"); +insert into diaries values(2639, "2018-10-04"); +insert into diaries values(2640, "2018-10-05"); +insert into diaries values(2641, "2018-10-06"); +insert into diaries values(2642, "2018-10-07"); +insert into diaries values(2643, "2018-10-08"); +insert into diaries values(2644, "2018-10-09"); +insert into diaries values(2645, "2018-10-10"); +insert into diaries values(2646, "2018-10-11"); +insert into diaries values(2647, "2018-10-12"); +insert into diaries values(2648, "2018-10-13"); +insert into diaries values(2649, "2018-10-14"); +insert into diaries values(2650, "2018-10-15"); +insert into diaries values(2651, "2018-10-16"); +insert into diaries values(2652, "2018-10-17"); +insert into diaries values(2653, "2018-10-18"); +insert into diaries values(2654, "2018-10-19"); +insert into diaries values(2655, "2018-10-20"); +insert into diaries values(2656, "2018-10-21"); +insert into diaries values(2657, "2018-10-22"); +insert into diaries values(2658, "2018-10-23"); +insert into diaries values(2659, "2018-10-24"); +insert into diaries values(2660, "2018-10-25"); +insert into diaries values(2661, "2018-10-26"); +insert into diaries values(2662, "2018-10-27"); +insert into diaries values(2663, "2018-10-28"); +insert into diaries values(2664, "2018-10-29"); +insert into diaries values(2665, "2018-10-30"); +insert into diaries values(2666, "2018-10-31"); +insert into diaries values(2667, "2018-11-01"); +insert into diaries values(2668, "2018-11-02"); +insert into diaries values(2669, "2018-11-03"); +insert into diaries values(2670, "2018-11-04"); +insert into diaries values(2671, "2018-11-05"); +insert into diaries values(2672, "2018-11-06"); +insert into diaries values(2673, "2018-11-07"); +insert into diaries values(2674, "2018-11-08"); +insert into diaries values(2675, "2018-11-09"); +insert into diaries values(2676, "2018-11-10"); +insert into diaries values(2677, "2018-11-11"); +insert into diaries values(2678, "2018-11-12"); +insert into diaries values(2679, "2018-11-13"); +insert into diaries values(2680, "2018-11-14"); +insert into diaries values(2681, "2018-11-15"); +insert into diaries values(2682, "2018-11-16"); +insert into diaries values(2683, "2018-11-17"); +insert into diaries values(2684, "2018-11-18"); +insert into diaries values(2685, "2018-11-19"); +insert into diaries values(2686, "2018-11-20"); +insert into diaries values(2687, "2018-11-21"); +insert into diaries values(2688, "2018-11-22"); +insert into diaries values(2689, "2018-11-23"); +insert into diaries values(2690, "2018-11-24"); +insert into diaries values(2691, "2018-11-25"); +insert into diaries values(2692, "2018-11-26"); +insert into diaries values(2693, "2018-11-27"); +insert into diaries values(2694, "2018-11-28"); +insert into diaries values(2695, "2018-11-29"); +insert into diaries values(2696, "2018-11-30"); +insert into diaries values(2697, "2018-12-01"); +insert into diaries values(2698, "2018-12-02"); +insert into diaries values(2699, "2018-12-03"); +insert into diaries values(2700, "2018-12-04"); +insert into diaries values(2701, "2018-12-05"); +insert into diaries values(2702, "2018-12-06"); +insert into diaries values(2703, "2018-12-07"); +insert into diaries values(2704, "2018-12-08"); +insert into diaries values(2705, "2018-12-09"); +insert into diaries values(2706, "2018-12-10"); +insert into diaries values(2707, "2018-12-11"); +insert into diaries values(2708, "2018-12-12"); +insert into diaries values(2709, "2018-12-13"); +insert into diaries values(2710, "2018-12-14"); +insert into diaries values(2711, "2018-12-15"); +insert into diaries values(2712, "2018-12-16"); +insert into diaries values(2713, "2018-12-17"); +insert into diaries values(2714, "2018-12-18"); +insert into diaries values(2715, "2018-12-19"); +insert into diaries values(2716, "2018-12-20"); +insert into diaries values(2717, "2018-12-21"); +insert into diaries values(2718, "2018-12-22"); +insert into diaries values(2719, "2018-12-23"); +insert into diaries values(2720, "2018-12-24"); +insert into diaries values(2721, "2018-12-25"); +insert into diaries values(2722, "2018-12-26"); +insert into diaries values(2723, "2018-12-27"); +insert into diaries values(2724, "2018-12-28"); +insert into diaries values(2725, "2018-12-29"); +insert into diaries values(2726, "2018-12-30"); +insert into diaries values(2727, "2018-12-31"); +insert into diaries values(2728, "2019-01-01"); +insert into diaries values(2729, "2019-01-02"); +insert into diaries values(2730, "2019-01-03"); +insert into diaries values(2731, "2019-01-04"); +insert into diaries values(2732, "2019-01-05"); +insert into diaries values(2733, "2019-01-06"); +insert into diaries values(2734, "2019-01-07"); +insert into diaries values(2735, "2019-01-08"); +insert into diaries values(2736, "2019-01-09"); +insert into diaries values(2737, "2019-01-10"); +insert into diaries values(2738, "2019-01-11"); +insert into diaries values(2739, "2019-01-12"); +insert into diaries values(2740, "2019-01-13"); +insert into diaries values(2741, "2019-01-14"); +insert into diaries values(2742, "2019-01-15"); +insert into diaries values(2743, "2019-01-16"); +insert into diaries values(2744, "2019-01-17"); +insert into diaries values(2745, "2019-01-18"); +insert into diaries values(2746, "2019-01-19"); +insert into diaries values(2747, "2019-01-20"); +insert into diaries values(2748, "2019-01-21"); +insert into diaries values(2749, "2019-01-22"); +insert into diaries values(2750, "2019-01-23"); +insert into diaries values(2751, "2019-01-24"); +insert into diaries values(2752, "2019-01-25"); +insert into diaries values(2753, "2019-01-26"); +insert into diaries values(2754, "2019-01-27"); +insert into diaries values(2755, "2019-01-28"); +insert into diaries values(2756, "2019-01-29"); +insert into diaries values(2757, "2019-01-30"); +insert into diaries values(2758, "2019-01-31"); +insert into diaries values(2759, "2019-02-01"); +insert into diaries values(2760, "2019-02-02"); +insert into diaries values(2761, "2019-02-03"); +insert into diaries values(2762, "2019-02-04"); +insert into diaries values(2763, "2019-02-05"); +insert into diaries values(2764, "2019-02-06"); +insert into diaries values(2765, "2019-02-07"); +insert into diaries values(2766, "2019-02-08"); +insert into diaries values(2767, "2019-02-09"); +insert into diaries values(2768, "2019-02-10"); +insert into diaries values(2769, "2019-02-11"); +insert into diaries values(2770, "2019-02-12"); +insert into diaries values(2771, "2019-02-13"); +insert into diaries values(2772, "2019-02-14"); +insert into diaries values(2773, "2019-02-15"); +insert into diaries values(2774, "2019-02-16"); +insert into diaries values(2775, "2019-02-17"); +insert into diaries values(2776, "2019-02-18"); +insert into diaries values(2777, "2019-02-19"); +insert into diaries values(2778, "2019-02-20"); +insert into diaries values(2779, "2019-02-21"); +insert into diaries values(2780, "2019-02-22"); +insert into diaries values(2781, "2019-02-23"); +insert into diaries values(2782, "2019-02-24"); +insert into diaries values(2783, "2019-02-25"); +insert into diaries values(2784, "2019-02-26"); +insert into diaries values(2785, "2019-02-27"); +insert into diaries values(2786, "2019-02-28"); +insert into diaries values(2787, "2019-03-01"); +insert into diaries values(2788, "2019-03-02"); +insert into diaries values(2789, "2019-03-03"); +insert into diaries values(2790, "2019-03-04"); +insert into diaries values(2791, "2019-03-05"); +insert into diaries values(2792, "2019-03-06"); +insert into diaries values(2793, "2019-03-07"); +insert into diaries values(2794, "2019-03-08"); +insert into diaries values(2795, "2019-03-09"); +insert into diaries values(2796, "2019-03-10"); +insert into diaries values(2797, "2019-03-11"); +insert into diaries values(2798, "2019-03-12"); +insert into diaries values(2799, "2019-03-13"); +insert into diaries values(2800, "2019-03-14"); +insert into diaries values(2801, "2019-03-15"); +insert into diaries values(2802, "2019-03-16"); +insert into diaries values(2803, "2019-03-17"); +insert into diaries values(2804, "2019-03-18"); +insert into diaries values(2805, "2019-03-19"); +insert into diaries values(2806, "2019-03-20"); +insert into diaries values(2807, "2019-03-21"); +insert into diaries values(2808, "2019-03-22"); +insert into diaries values(2809, "2019-03-23"); +insert into diaries values(2810, "2019-03-24"); +insert into diaries values(2811, "2019-03-25"); +insert into diaries values(2812, "2019-03-26"); +insert into diaries values(2813, "2019-03-27"); +insert into diaries values(2814, "2019-03-28"); +insert into diaries values(2815, "2019-03-29"); +insert into diaries values(2816, "2019-03-30"); +insert into diaries values(2817, "2019-03-31"); +insert into diaries values(2818, "2019-04-01"); +insert into diaries values(2819, "2019-04-02"); +insert into diaries values(2820, "2019-04-03"); +insert into diaries values(2821, "2019-04-04"); +insert into diaries values(2822, "2019-04-05"); +insert into diaries values(2823, "2019-04-06"); +insert into diaries values(2824, "2019-04-07"); +insert into diaries values(2825, "2019-04-08"); +insert into diaries values(2826, "2019-04-09"); +insert into diaries values(2827, "2019-04-10"); +insert into diaries values(2828, "2019-04-11"); +insert into diaries values(2829, "2019-04-12"); +insert into diaries values(2830, "2019-04-13"); +insert into diaries values(2831, "2019-04-14"); +insert into diaries values(2832, "2019-04-15"); +insert into diaries values(2833, "2019-04-16"); +insert into diaries values(2834, "2019-04-17"); +insert into diaries values(2835, "2019-04-18"); +insert into diaries values(2836, "2019-04-19"); +insert into diaries values(2837, "2019-04-20"); +insert into diaries values(2838, "2019-04-21"); +insert into diaries values(2839, "2019-04-22"); +insert into diaries values(2840, "2019-04-23"); +insert into diaries values(2841, "2019-04-24"); +insert into diaries values(2842, "2019-04-25"); +insert into diaries values(2843, "2019-04-26"); +insert into diaries values(2844, "2019-04-27"); +insert into diaries values(2845, "2019-04-28"); +insert into diaries values(2846, "2019-04-29"); +insert into diaries values(2847, "2019-04-30"); +insert into diaries values(2848, "2019-05-01"); +insert into diaries values(2849, "2019-05-02"); +insert into diaries values(2850, "2019-05-03"); +insert into diaries values(2851, "2019-05-04"); +insert into diaries values(2852, "2019-05-05"); +insert into diaries values(2853, "2019-05-06"); +insert into diaries values(2854, "2019-05-07"); +insert into diaries values(2855, "2019-05-08"); +insert into diaries values(2856, "2019-05-09"); +insert into diaries values(2857, "2019-05-10"); +insert into diaries values(2858, "2019-05-11"); +insert into diaries values(2859, "2019-05-12"); +insert into diaries values(2860, "2019-05-13"); +insert into diaries values(2861, "2019-05-14"); +insert into diaries values(2862, "2019-05-15"); +insert into diaries values(2863, "2019-05-16"); +insert into diaries values(2864, "2019-05-17"); +insert into diaries values(2865, "2019-05-18"); +insert into diaries values(2866, "2019-05-19"); +insert into diaries values(2867, "2019-05-20"); +insert into diaries values(2868, "2019-05-21"); +insert into diaries values(2869, "2019-05-22"); +insert into diaries values(2870, "2019-05-23"); +insert into diaries values(2871, "2019-05-24"); +insert into diaries values(2872, "2019-05-25"); +insert into diaries values(2873, "2019-05-26"); +insert into diaries values(2874, "2019-05-27"); +insert into diaries values(2875, "2019-05-28"); +insert into diaries values(2876, "2019-05-29"); +insert into diaries values(2877, "2019-05-30"); +insert into diaries values(2878, "2019-05-31"); +insert into diaries values(2879, "2019-06-01"); +insert into diaries values(2880, "2019-06-02"); +insert into diaries values(2881, "2019-06-03"); +insert into diaries values(2882, "2019-06-04"); +insert into diaries values(2883, "2019-06-05"); +insert into diaries values(2884, "2019-06-06"); +insert into diaries values(2885, "2019-06-07"); +insert into diaries values(2886, "2019-06-08"); +insert into diaries values(2887, "2019-06-09"); +insert into diaries values(2888, "2019-06-10"); +insert into diaries values(2889, "2019-06-11"); +insert into diaries values(2890, "2019-06-12"); +insert into diaries values(2891, "2019-06-13"); +insert into diaries values(2892, "2019-06-14"); +insert into diaries values(2893, "2019-06-15"); +insert into diaries values(2894, "2019-06-16"); +insert into diaries values(2895, "2019-06-17"); +insert into diaries values(2896, "2019-06-18"); +insert into diaries values(2897, "2019-06-19"); +insert into diaries values(2898, "2019-06-20"); +insert into diaries values(2899, "2019-06-21"); +insert into diaries values(2900, "2019-06-22"); +insert into diaries values(2901, "2019-06-23"); +insert into diaries values(2902, "2019-06-24"); +insert into diaries values(2903, "2019-06-25"); +insert into diaries values(2904, "2019-06-26"); +insert into diaries values(2905, "2019-06-27"); +insert into diaries values(2906, "2019-06-28"); +insert into diaries values(2907, "2019-06-29"); +insert into diaries values(2908, "2019-06-30"); +insert into diaries values(2909, "2019-07-01"); +insert into diaries values(2910, "2019-07-02"); +insert into diaries values(2911, "2019-07-03"); +insert into diaries values(2912, "2019-07-04"); +insert into diaries values(2913, "2019-07-05"); +insert into diaries values(2914, "2019-07-06"); +insert into diaries values(2915, "2019-07-07"); +insert into diaries values(2916, "2019-07-08"); +insert into diaries values(2917, "2019-07-09"); +insert into diaries values(2918, "2019-07-10"); +insert into diaries values(2919, "2019-07-11"); +insert into diaries values(2920, "2019-07-12"); +insert into diaries values(2921, "2019-07-13"); +insert into diaries values(2922, "2019-07-14"); +insert into diaries values(2923, "2019-07-15"); +insert into diaries values(2924, "2019-07-16"); +insert into diaries values(2925, "2019-07-17"); +insert into diaries values(2926, "2019-07-18"); +insert into diaries values(2927, "2019-07-19"); +insert into diaries values(2928, "2019-07-20"); +insert into diaries values(2929, "2019-07-21"); +insert into diaries values(2930, "2019-07-22"); +insert into diaries values(2931, "2019-07-23"); +insert into diaries values(2932, "2019-07-24"); +insert into diaries values(2933, "2019-07-25"); +insert into diaries values(2934, "2019-07-26"); +insert into diaries values(2935, "2019-07-27"); +insert into diaries values(2936, "2019-07-28"); +insert into diaries values(2937, "2019-07-29"); +insert into diaries values(2938, "2019-07-30"); +insert into diaries values(2939, "2019-07-31"); +insert into diaries values(2940, "2019-08-01"); +insert into diaries values(2941, "2019-08-02"); +insert into diaries values(2942, "2019-08-03"); +insert into diaries values(2943, "2019-08-04"); +insert into diaries values(2944, "2019-08-05"); +insert into diaries values(2945, "2019-08-06"); +insert into diaries values(2946, "2019-08-07"); +insert into diaries values(2947, "2019-08-08"); +insert into diaries values(2948, "2019-08-09"); +insert into diaries values(2949, "2019-08-10"); +insert into diaries values(2950, "2019-08-11"); +insert into diaries values(2951, "2019-08-12"); +insert into diaries values(2952, "2019-08-13"); +insert into diaries values(2953, "2019-08-14"); +insert into diaries values(2954, "2019-08-15"); +insert into diaries values(2955, "2019-08-16"); +insert into diaries values(2956, "2019-08-17"); +insert into diaries values(2957, "2019-08-18"); +insert into diaries values(2958, "2019-08-19"); +insert into diaries values(2959, "2019-08-20"); +insert into diaries values(2960, "2019-08-21"); +insert into diaries values(2961, "2019-08-22"); +insert into diaries values(2962, "2019-08-23"); +insert into diaries values(2963, "2019-08-24"); +insert into diaries values(2964, "2019-08-25"); +insert into diaries values(2965, "2019-08-26"); +insert into diaries values(2966, "2019-08-27"); +insert into diaries values(2967, "2019-08-28"); +insert into diaries values(2968, "2019-08-29"); +insert into diaries values(2969, "2019-08-30"); +insert into diaries values(2970, "2019-08-31"); +insert into diaries values(2971, "2019-09-01"); +insert into diaries values(2972, "2019-09-02"); +insert into diaries values(2973, "2019-09-03"); +insert into diaries values(2974, "2019-09-04"); +insert into diaries values(2975, "2019-09-05"); +insert into diaries values(2976, "2019-09-06"); +insert into diaries values(2977, "2019-09-07"); +insert into diaries values(2978, "2019-09-08"); +insert into diaries values(2979, "2019-09-09"); +insert into diaries values(2980, "2019-09-10"); +insert into diaries values(2981, "2019-09-11"); +insert into diaries values(2982, "2019-09-12"); +insert into diaries values(2983, "2019-09-13"); +insert into diaries values(2984, "2019-09-14"); +insert into diaries values(2985, "2019-09-15"); +insert into diaries values(2986, "2019-09-16"); +insert into diaries values(2987, "2019-09-17"); +insert into diaries values(2988, "2019-09-18"); +insert into diaries values(2989, "2019-09-19"); +insert into diaries values(2990, "2019-09-20"); +insert into diaries values(2991, "2019-09-21"); +insert into diaries values(2992, "2019-09-22"); +insert into diaries values(2993, "2019-09-23"); +insert into diaries values(2994, "2019-09-24"); +insert into diaries values(2995, "2019-09-25"); +insert into diaries values(2996, "2019-09-26"); +insert into diaries values(2997, "2019-09-27"); +insert into diaries values(2998, "2019-09-28"); +insert into diaries values(2999, "2019-09-29"); +insert into diaries values(3000, "2019-09-30"); +insert into diaries values(3001, "2019-10-01"); +insert into diaries values(3002, "2019-10-02"); +insert into diaries values(3003, "2019-10-03"); +insert into diaries values(3004, "2019-10-04"); +insert into diaries values(3005, "2019-10-05"); +insert into diaries values(3006, "2019-10-06"); +insert into diaries values(3007, "2019-10-07"); +insert into diaries values(3008, "2019-10-08"); +insert into diaries values(3009, "2019-10-09"); +insert into diaries values(3010, "2019-10-10"); +insert into diaries values(3011, "2019-10-11"); +insert into diaries values(3012, "2019-10-12"); +insert into diaries values(3013, "2019-10-13"); +insert into diaries values(3014, "2019-10-14"); +insert into diaries values(3015, "2019-10-15"); +insert into diaries values(3016, "2019-10-16"); +insert into diaries values(3017, "2019-10-17"); +insert into diaries values(3018, "2019-10-18"); +insert into diaries values(3019, "2019-10-19"); +insert into diaries values(3020, "2019-10-20"); +insert into diaries values(3021, "2019-10-21"); +insert into diaries values(3022, "2019-10-22"); +insert into diaries values(3023, "2019-10-23"); +insert into diaries values(3024, "2019-10-24"); +insert into diaries values(3025, "2019-10-25"); +insert into diaries values(3026, "2019-10-26"); +insert into diaries values(3027, "2019-10-27"); +insert into diaries values(3028, "2019-10-28"); +insert into diaries values(3029, "2019-10-29"); +insert into diaries values(3030, "2019-10-30"); +insert into diaries values(3031, "2019-10-31"); +insert into diaries values(3032, "2019-11-01"); +insert into diaries values(3033, "2019-11-02"); +insert into diaries values(3034, "2019-11-03"); +insert into diaries values(3035, "2019-11-04"); +insert into diaries values(3036, "2019-11-05"); +insert into diaries values(3037, "2019-11-06"); +insert into diaries values(3038, "2019-11-07"); +insert into diaries values(3039, "2019-11-08"); +insert into diaries values(3040, "2019-11-09"); +insert into diaries values(3041, "2019-11-10"); +insert into diaries values(3042, "2019-11-11"); +insert into diaries values(3043, "2019-11-12"); +insert into diaries values(3044, "2019-11-13"); +insert into diaries values(3045, "2019-11-14"); +insert into diaries values(3046, "2019-11-15"); +insert into diaries values(3047, "2019-11-16"); +insert into diaries values(3048, "2019-11-17"); +insert into diaries values(3049, "2019-11-18"); +insert into diaries values(3050, "2019-11-19"); +insert into diaries values(3051, "2019-11-20"); +insert into diaries values(3052, "2019-11-21"); +insert into diaries values(3053, "2019-11-22"); +insert into diaries values(3054, "2019-11-23"); +insert into diaries values(3055, "2019-11-24"); +insert into diaries values(3056, "2019-11-25"); +insert into diaries values(3057, "2019-11-26"); +insert into diaries values(3058, "2019-11-27"); +insert into diaries values(3059, "2019-11-28"); +insert into diaries values(3060, "2019-11-29"); +insert into diaries values(3061, "2019-11-30"); +insert into diaries values(3062, "2019-12-01"); +insert into diaries values(3063, "2019-12-02"); +insert into diaries values(3064, "2019-12-03"); +insert into diaries values(3065, "2019-12-04"); +insert into diaries values(3066, "2019-12-05"); +insert into diaries values(3067, "2019-12-06"); +insert into diaries values(3068, "2019-12-07"); +insert into diaries values(3069, "2019-12-08"); +insert into diaries values(3070, "2019-12-09"); +insert into diaries values(3071, "2019-12-10"); +insert into diaries values(3072, "2019-12-11"); +insert into diaries values(3073, "2019-12-12"); +insert into diaries values(3074, "2019-12-13"); +insert into diaries values(3075, "2019-12-14"); +insert into diaries values(3076, "2019-12-15"); +insert into diaries values(3077, "2019-12-16"); +insert into diaries values(3078, "2019-12-17"); +insert into diaries values(3079, "2019-12-18"); +insert into diaries values(3080, "2019-12-19"); +insert into diaries values(3081, "2019-12-20"); +insert into diaries values(3082, "2019-12-21"); +insert into diaries values(3083, "2019-12-22"); +insert into diaries values(3084, "2019-12-23"); +insert into diaries values(3085, "2019-12-24"); +insert into diaries values(3086, "2019-12-25"); +insert into diaries values(3087, "2019-12-26"); +insert into diaries values(3088, "2019-12-27"); +insert into diaries values(3089, "2019-12-28"); +insert into diaries values(3090, "2019-12-29"); +insert into diaries values(3091, "2019-12-30"); +insert into diaries values(3092, "2019-12-31"); +insert into diaries values(3093, "2020-01-01"); +insert into diaries values(3094, "2020-01-02"); +insert into diaries values(3095, "2020-01-03"); +insert into diaries values(3096, "2020-01-04"); +insert into diaries values(3097, "2020-01-05"); +insert into diaries values(3098, "2020-01-06"); +insert into diaries values(3099, "2020-01-07"); +insert into diaries values(3100, "2020-01-08"); +insert into diaries values(3101, "2020-01-09"); +insert into diaries values(3102, "2020-01-10"); +insert into diaries values(3103, "2020-01-11"); +insert into diaries values(3104, "2020-01-12"); +insert into diaries values(3105, "2020-01-13"); +insert into diaries values(3106, "2020-01-14"); +insert into diaries values(3107, "2020-01-15"); +insert into diaries values(3108, "2020-01-16"); +insert into diaries values(3109, "2020-01-17"); +insert into diaries values(3110, "2020-01-18"); +insert into diaries values(3111, "2020-01-19"); +insert into diaries values(3112, "2020-01-20"); +insert into diaries values(3113, "2020-01-21"); +insert into diaries values(3114, "2020-01-22"); +insert into diaries values(3115, "2020-01-23"); +insert into diaries values(3116, "2020-01-24"); +insert into diaries values(3117, "2020-01-25"); +insert into diaries values(3118, "2020-01-26"); +insert into diaries values(3119, "2020-01-27"); +insert into diaries values(3120, "2020-01-28"); +insert into diaries values(3121, "2020-01-29"); +insert into diaries values(3122, "2020-01-30"); +insert into diaries values(3123, "2020-01-31"); +insert into diaries values(3124, "2020-02-01"); +insert into diaries values(3125, "2020-02-02"); +insert into diaries values(3126, "2020-02-03"); +insert into diaries values(3127, "2020-02-04"); +insert into diaries values(3128, "2020-02-05"); +insert into diaries values(3129, "2020-02-06"); +insert into diaries values(3130, "2020-02-07"); +insert into diaries values(3131, "2020-02-08"); +insert into diaries values(3132, "2020-02-09"); +insert into diaries values(3133, "2020-02-10"); +insert into diaries values(3134, "2020-02-11"); +insert into diaries values(3135, "2020-02-12"); +insert into diaries values(3136, "2020-02-13"); +insert into diaries values(3137, "2020-02-14"); +insert into diaries values(3138, "2020-02-15"); +insert into diaries values(3139, "2020-02-16"); +insert into diaries values(3140, "2020-02-17"); +insert into diaries values(3141, "2020-02-18"); +insert into diaries values(3142, "2020-02-19"); +insert into diaries values(3143, "2020-02-20"); +insert into diaries values(3144, "2020-02-21"); +insert into diaries values(3145, "2020-02-22"); +insert into diaries values(3146, "2020-02-23"); +insert into diaries values(3147, "2020-02-24"); +insert into diaries values(3148, "2020-02-25"); +insert into diaries values(3149, "2020-02-26"); +insert into diaries values(3150, "2020-02-27"); +insert into diaries values(3151, "2020-02-28"); +insert into diaries values(3152, "2020-02-29"); +insert into diaries values(3153, "2020-03-01"); +insert into diaries values(3154, "2020-03-02"); +insert into diaries values(3155, "2020-03-03"); +insert into diaries values(3156, "2020-03-04"); +insert into diaries values(3157, "2020-03-05"); +insert into diaries values(3158, "2020-03-06"); +insert into diaries values(3159, "2020-03-07"); +insert into diaries values(3160, "2020-03-08"); +insert into diaries values(3161, "2020-03-09"); +insert into diaries values(3162, "2020-03-10"); +insert into diaries values(3163, "2020-03-11"); +insert into diaries values(3164, "2020-03-12"); +insert into diaries values(3165, "2020-03-13"); +insert into diaries values(3166, "2020-03-14"); +insert into diaries values(3167, "2020-03-15"); +insert into diaries values(3168, "2020-03-16"); +insert into diaries values(3169, "2020-03-17"); +insert into diaries values(3170, "2020-03-18"); +insert into diaries values(3171, "2020-03-19"); +insert into diaries values(3172, "2020-03-20"); +insert into diaries values(3173, "2020-03-21"); +insert into diaries values(3174, "2020-03-22"); +insert into diaries values(3175, "2020-03-23"); +insert into diaries values(3176, "2020-03-24"); +insert into diaries values(3177, "2020-03-25"); +insert into diaries values(3178, "2020-03-26"); +insert into diaries values(3179, "2020-03-27"); +insert into diaries values(3180, "2020-03-28"); +insert into diaries values(3181, "2020-03-29"); +insert into diaries values(3182, "2020-03-30"); +insert into diaries values(3183, "2020-03-31"); +insert into diaries values(3184, "2020-04-01"); +insert into diaries values(3185, "2020-04-02"); +insert into diaries values(3186, "2020-04-03"); +insert into diaries values(3187, "2020-04-04"); +insert into diaries values(3188, "2020-04-05"); +insert into diaries values(3189, "2020-04-06"); +insert into diaries values(3190, "2020-04-07"); +insert into diaries values(3191, "2020-04-08"); +insert into diaries values(3192, "2020-04-09"); +insert into diaries values(3193, "2020-04-10"); +insert into diaries values(3194, "2020-04-11"); +insert into diaries values(3195, "2020-04-12"); +insert into diaries values(3196, "2020-04-13"); +insert into diaries values(3197, "2020-04-14"); +insert into diaries values(3198, "2020-04-15"); +insert into diaries values(3199, "2020-04-16"); +insert into diaries values(3200, "2020-04-17"); +insert into diaries values(3201, "2020-04-18"); +insert into diaries values(3202, "2020-04-19"); +insert into diaries values(3203, "2020-04-20"); +insert into diaries values(3204, "2020-04-21"); +insert into diaries values(3205, "2020-04-22"); +insert into diaries values(3206, "2020-04-23"); +insert into diaries values(3207, "2020-04-24"); +insert into diaries values(3208, "2020-04-25"); +insert into diaries values(3209, "2020-04-26"); +insert into diaries values(3210, "2020-04-27"); +insert into diaries values(3211, "2020-04-28"); +insert into diaries values(3212, "2020-04-29"); +insert into diaries values(3213, "2020-04-30"); +insert into diaries values(3214, "2020-05-01"); +insert into diaries values(3215, "2020-05-02"); +insert into diaries values(3216, "2020-05-03"); +insert into diaries values(3217, "2020-05-04"); +insert into diaries values(3218, "2020-05-05"); +insert into diaries values(3219, "2020-05-06"); +insert into diaries values(3220, "2020-05-07"); +insert into diaries values(3221, "2020-05-08"); +insert into diaries values(3222, "2020-05-09"); +insert into diaries values(3223, "2020-05-10"); +insert into diaries values(3224, "2020-05-11"); +insert into diaries values(3225, "2020-05-12"); +insert into diaries values(3226, "2020-05-13"); +insert into diaries values(3227, "2020-05-14"); +insert into diaries values(3228, "2020-05-15"); +insert into diaries values(3229, "2020-05-16"); +insert into diaries values(3230, "2020-05-17"); +insert into diaries values(3231, "2020-05-18"); +insert into diaries values(3232, "2020-05-19"); +insert into diaries values(3233, "2020-05-20"); +insert into diaries values(3234, "2020-05-21"); +insert into diaries values(3235, "2020-05-22"); +insert into diaries values(3236, "2020-05-23"); +insert into diaries values(3237, "2020-05-24"); +insert into diaries values(3238, "2020-05-25"); +insert into diaries values(3239, "2020-05-26"); +insert into diaries values(3240, "2020-05-27"); +insert into diaries values(3241, "2020-05-28"); +insert into diaries values(3242, "2020-05-29"); +insert into diaries values(3243, "2020-05-30"); +insert into diaries values(3244, "2020-05-31"); +insert into diaries values(3245, "2020-06-01"); +insert into diaries values(3246, "2020-06-02"); +insert into diaries values(3247, "2020-06-03"); +insert into diaries values(3248, "2020-06-04"); +insert into diaries values(3249, "2020-06-05"); +insert into diaries values(3250, "2020-06-06"); +insert into diaries values(3251, "2020-06-07"); +insert into diaries values(3252, "2020-06-08"); +insert into diaries values(3253, "2020-06-09"); +insert into diaries values(3254, "2020-06-10"); +insert into diaries values(3255, "2020-06-11"); +insert into diaries values(3256, "2020-06-12"); +insert into diaries values(3257, "2020-06-13"); +insert into diaries values(3258, "2020-06-14"); +insert into diaries values(3259, "2020-06-15"); +insert into diaries values(3260, "2020-06-16"); +insert into diaries values(3261, "2020-06-17"); +insert into diaries values(3262, "2020-06-18"); +insert into diaries values(3263, "2020-06-19"); +insert into diaries values(3264, "2020-06-20"); +insert into diaries values(3265, "2020-06-21"); +insert into diaries values(3266, "2020-06-22"); +insert into diaries values(3267, "2020-06-23"); +insert into diaries values(3268, "2020-06-24"); +insert into diaries values(3269, "2020-06-25"); +insert into diaries values(3270, "2020-06-26"); +insert into diaries values(3271, "2020-06-27"); +insert into diaries values(3272, "2020-06-28"); +insert into diaries values(3273, "2020-06-29"); +insert into diaries values(3274, "2020-06-30"); +insert into diaries values(3275, "2020-07-01"); +insert into diaries values(3276, "2020-07-02"); +insert into diaries values(3277, "2020-07-03"); +insert into diaries values(3278, "2020-07-04"); +insert into diaries values(3279, "2020-07-05"); +insert into diaries values(3280, "2020-07-06"); +insert into diaries values(3281, "2020-07-07"); +insert into diaries values(3282, "2020-07-08"); +insert into diaries values(3283, "2020-07-09"); +insert into diaries values(3284, "2020-07-10"); +insert into diaries values(3285, "2020-07-11"); +insert into diaries values(3286, "2020-07-12"); +insert into diaries values(3287, "2020-07-13"); +insert into diaries values(3288, "2020-07-14"); +insert into diaries values(3289, "2020-07-15"); +insert into diaries values(3290, "2020-07-16"); +insert into diaries values(3291, "2020-07-17"); +insert into diaries values(3292, "2020-07-18"); +insert into diaries values(3293, "2020-07-19"); +insert into diaries values(3294, "2020-07-20"); +insert into diaries values(3295, "2020-07-21"); +insert into diaries values(3296, "2020-07-22"); +insert into diaries values(3297, "2020-07-23"); +insert into diaries values(3298, "2020-07-24"); +insert into diaries values(3299, "2020-07-25"); +insert into diaries values(3300, "2020-07-26"); +insert into diaries values(3301, "2020-07-27"); +insert into diaries values(3302, "2020-07-28"); +insert into diaries values(3303, "2020-07-29"); +insert into diaries values(3304, "2020-07-30"); +insert into diaries values(3305, "2020-07-31"); +insert into diaries values(3306, "2020-08-01"); +insert into diaries values(3307, "2020-08-02"); +insert into diaries values(3308, "2020-08-03"); +insert into diaries values(3309, "2020-08-04"); +insert into diaries values(3310, "2020-08-05"); +insert into diaries values(3311, "2020-08-06"); +insert into diaries values(3312, "2020-08-07"); +insert into diaries values(3313, "2020-08-08"); +insert into diaries values(3314, "2020-08-09"); +insert into diaries values(3315, "2020-08-10"); +insert into diaries values(3316, "2020-08-11"); +insert into diaries values(3317, "2020-08-12"); +insert into diaries values(3318, "2020-08-13"); +insert into diaries values(3319, "2020-08-14"); +insert into diaries values(3320, "2020-08-15"); +insert into diaries values(3321, "2020-08-16"); +insert into diaries values(3322, "2020-08-17"); +insert into diaries values(3323, "2020-08-18"); +insert into diaries values(3324, "2020-08-19"); +insert into diaries values(3325, "2020-08-20"); +insert into diaries values(3326, "2020-08-21"); +insert into diaries values(3327, "2020-08-22"); +insert into diaries values(3328, "2020-08-23"); +insert into diaries values(3329, "2020-08-24"); +insert into diaries values(3330, "2020-08-25"); +insert into diaries values(3331, "2020-08-26"); +insert into diaries values(3332, "2020-08-27"); +insert into diaries values(3333, "2020-08-28"); +insert into diaries values(3334, "2020-08-29"); +insert into diaries values(3335, "2020-08-30"); +insert into diaries values(3336, "2020-08-31"); +insert into diaries values(3337, "2020-09-01"); +insert into diaries values(3338, "2020-09-02"); +insert into diaries values(3339, "2020-09-03"); +insert into diaries values(3340, "2020-09-04"); +insert into diaries values(3341, "2020-09-05"); +insert into diaries values(3342, "2020-09-06"); +insert into diaries values(3343, "2020-09-07"); +insert into diaries values(3344, "2020-09-08"); +insert into diaries values(3345, "2020-09-09"); +insert into diaries values(3346, "2020-09-10"); +insert into diaries values(3347, "2020-09-11"); +insert into diaries values(3348, "2020-09-12"); +insert into diaries values(3349, "2020-09-13"); +insert into diaries values(3350, "2020-09-14"); +insert into diaries values(3351, "2020-09-15"); +insert into diaries values(3352, "2020-09-16"); +insert into diaries values(3353, "2020-09-17"); +insert into diaries values(3354, "2020-09-18"); +insert into diaries values(3355, "2020-09-19"); +insert into diaries values(3356, "2020-09-20"); +insert into diaries values(3357, "2020-09-21"); +insert into diaries values(3358, "2020-09-22"); +insert into diaries values(3359, "2020-09-23"); +insert into diaries values(3360, "2020-09-24"); +insert into diaries values(3361, "2020-09-25"); +insert into diaries values(3362, "2020-09-26"); +insert into diaries values(3363, "2020-09-27"); +insert into diaries values(3364, "2020-09-28"); +insert into diaries values(3365, "2020-09-29"); +insert into diaries values(3366, "2020-09-30"); +insert into diaries values(3367, "2020-10-01"); +insert into diaries values(3368, "2020-10-02"); +insert into diaries values(3369, "2020-10-03"); +insert into diaries values(3370, "2020-10-04"); +insert into diaries values(3371, "2020-10-05"); +insert into diaries values(3372, "2020-10-06"); +insert into diaries values(3373, "2020-10-07"); +insert into diaries values(3374, "2020-10-08"); +insert into diaries values(3375, "2020-10-09"); +insert into diaries values(3376, "2020-10-10"); +insert into diaries values(3377, "2020-10-11"); +insert into diaries values(3378, "2020-10-12"); +insert into diaries values(3379, "2020-10-13"); +insert into diaries values(3380, "2020-10-14"); +insert into diaries values(3381, "2020-10-15"); +insert into diaries values(3382, "2020-10-16"); +insert into diaries values(3383, "2020-10-17"); +insert into diaries values(3384, "2020-10-18"); +insert into diaries values(3385, "2020-10-19"); +insert into diaries values(3386, "2020-10-20"); +insert into diaries values(3387, "2020-10-21"); +insert into diaries values(3388, "2020-10-22"); +insert into diaries values(3389, "2020-10-23"); +insert into diaries values(3390, "2020-10-24"); +insert into diaries values(3391, "2020-10-25"); +insert into diaries values(3392, "2020-10-26"); +insert into diaries values(3393, "2020-10-27"); +insert into diaries values(3394, "2020-10-28"); +insert into diaries values(3395, "2020-10-29"); +insert into diaries values(3396, "2020-10-30"); +insert into diaries values(3397, "2020-10-31"); +insert into diaries values(3398, "2020-11-01"); +insert into diaries values(3399, "2020-11-02"); +insert into diaries values(3400, "2020-11-03"); +insert into diaries values(3401, "2020-11-04"); +insert into diaries values(3402, "2020-11-05"); +insert into diaries values(3403, "2020-11-06"); +insert into diaries values(3404, "2020-11-07"); +insert into diaries values(3405, "2020-11-08"); +insert into diaries values(3406, "2020-11-09"); +insert into diaries values(3407, "2020-11-10"); +insert into diaries values(3408, "2020-11-11"); +insert into diaries values(3409, "2020-11-12"); +insert into diaries values(3410, "2020-11-13"); +insert into diaries values(3411, "2020-11-14"); +insert into diaries values(3412, "2020-11-15"); +insert into diaries values(3413, "2020-11-16"); +insert into diaries values(3414, "2020-11-17"); +insert into diaries values(3415, "2020-11-18"); +insert into diaries values(3416, "2020-11-19"); +insert into diaries values(3417, "2020-11-20"); +insert into diaries values(3418, "2020-11-21"); +insert into diaries values(3419, "2020-11-22"); +insert into diaries values(3420, "2020-11-23"); +insert into diaries values(3421, "2020-11-24"); +insert into diaries values(3422, "2020-11-25"); +insert into diaries values(3423, "2020-11-26"); +insert into diaries values(3424, "2020-11-27"); +insert into diaries values(3425, "2020-11-28"); +insert into diaries values(3426, "2020-11-29"); +insert into diaries values(3427, "2020-11-30"); +insert into diaries values(3428, "2020-12-01"); +insert into diaries values(3429, "2020-12-02"); +insert into diaries values(3430, "2020-12-03"); +insert into diaries values(3431, "2020-12-04"); +insert into diaries values(3432, "2020-12-05"); +insert into diaries values(3433, "2020-12-06"); +insert into diaries values(3434, "2020-12-07"); +insert into diaries values(3435, "2020-12-08"); +insert into diaries values(3436, "2020-12-09"); +insert into diaries values(3437, "2020-12-10"); +insert into diaries values(3438, "2020-12-11"); +insert into diaries values(3439, "2020-12-12"); +insert into diaries values(3440, "2020-12-13"); +insert into diaries values(3441, "2020-12-14"); +insert into diaries values(3442, "2020-12-15"); +insert into diaries values(3443, "2020-12-16"); +insert into diaries values(3444, "2020-12-17"); +insert into diaries values(3445, "2020-12-18"); +insert into diaries values(3446, "2020-12-19"); +insert into diaries values(3447, "2020-12-20"); +insert into diaries values(3448, "2020-12-21"); +insert into diaries values(3449, "2020-12-22"); +insert into diaries values(3450, "2020-12-23"); +insert into diaries values(3451, "2020-12-24"); +insert into diaries values(3452, "2020-12-25"); +insert into diaries values(3453, "2020-12-26"); +insert into diaries values(3454, "2020-12-27"); +insert into diaries values(3455, "2020-12-28"); +insert into diaries values(3456, "2020-12-29"); +insert into diaries values(3457, "2020-12-30"); +insert into diaries values(3458, "2020-12-31"); +insert into diaries values(3459, "2021-01-01"); +insert into diaries values(3460, "2021-01-02"); +insert into diaries values(3461, "2021-01-03"); +insert into diaries values(3462, "2021-01-04"); +insert into diaries values(3463, "2021-01-05"); +insert into diaries values(3464, "2021-01-06"); +insert into diaries values(3465, "2021-01-07"); +insert into diaries values(3466, "2021-01-08"); +insert into diaries values(3467, "2021-01-09"); +insert into diaries values(3468, "2021-01-10"); +insert into diaries values(3469, "2021-01-11"); +insert into diaries values(3470, "2021-01-12"); +insert into diaries values(3471, "2021-01-13"); +insert into diaries values(3472, "2021-01-14"); +insert into diaries values(3473, "2021-01-15"); +insert into diaries values(3474, "2021-01-16"); +insert into diaries values(3475, "2021-01-17"); +insert into diaries values(3476, "2021-01-18"); +insert into diaries values(3477, "2021-01-19"); +insert into diaries values(3478, "2021-01-20"); +insert into diaries values(3479, "2021-01-21"); +insert into diaries values(3480, "2021-01-22"); +insert into diaries values(3481, "2021-01-23"); +insert into diaries values(3482, "2021-01-24"); +insert into diaries values(3483, "2021-01-25"); +insert into diaries values(3484, "2021-01-26"); +insert into diaries values(3485, "2021-01-27"); +insert into diaries values(3486, "2021-01-28"); +insert into diaries values(3487, "2021-01-29"); +insert into diaries values(3488, "2021-01-30"); +insert into diaries values(3489, "2021-01-31"); +insert into diaries values(3490, "2021-02-01"); +insert into diaries values(3491, "2021-02-02"); +insert into diaries values(3492, "2021-02-03"); +insert into diaries values(3493, "2021-02-04"); +insert into diaries values(3494, "2021-02-05"); +insert into diaries values(3495, "2021-02-06"); +insert into diaries values(3496, "2021-02-07"); +insert into diaries values(3497, "2021-02-08"); +insert into diaries values(3498, "2021-02-09"); +insert into diaries values(3499, "2021-02-10"); +insert into diaries values(3500, "2021-02-11"); +insert into diaries values(3501, "2021-02-12"); +insert into diaries values(3502, "2021-02-13"); +insert into diaries values(3503, "2021-02-14"); +insert into diaries values(3504, "2021-02-15"); +insert into diaries values(3505, "2021-02-16"); +insert into diaries values(3506, "2021-02-17"); +insert into diaries values(3507, "2021-02-18"); +insert into diaries values(3508, "2021-02-19"); +insert into diaries values(3509, "2021-02-20"); +insert into diaries values(3510, "2021-02-21"); +insert into diaries values(3511, "2021-02-22"); +insert into diaries values(3512, "2021-02-23"); +insert into diaries values(3513, "2021-02-24"); +insert into diaries values(3514, "2021-02-25"); +insert into diaries values(3515, "2021-02-26"); +insert into diaries values(3516, "2021-02-27"); +insert into diaries values(3517, "2021-02-28"); +insert into diaries values(3518, "2021-03-01"); +insert into diaries values(3519, "2021-03-02"); +insert into diaries values(3520, "2021-03-03"); +insert into diaries values(3521, "2021-03-04"); +insert into diaries values(3522, "2021-03-05"); +insert into diaries values(3523, "2021-03-06"); +insert into diaries values(3524, "2021-03-07"); +insert into diaries values(3525, "2021-03-08"); +insert into diaries values(3526, "2021-03-09"); +insert into diaries values(3527, "2021-03-10"); +insert into diaries values(3528, "2021-03-11"); +insert into diaries values(3529, "2021-03-12"); +insert into diaries values(3530, "2021-03-13"); +insert into diaries values(3531, "2021-03-14"); +insert into diaries values(3532, "2021-03-15"); +insert into diaries values(3533, "2021-03-16"); +insert into diaries values(3534, "2021-03-17"); +insert into diaries values(3535, "2021-03-18"); +insert into diaries values(3536, "2021-03-19"); +insert into diaries values(3537, "2021-03-20"); +insert into diaries values(3538, "2021-03-21"); +insert into diaries values(3539, "2021-03-22"); +insert into diaries values(3540, "2021-03-23"); +insert into diaries values(3541, "2021-03-24"); +insert into diaries values(3542, "2021-03-25"); +insert into diaries values(3543, "2021-03-26"); +insert into diaries values(3544, "2021-03-27"); +insert into diaries values(3545, "2021-03-28"); +insert into diaries values(3546, "2021-03-29"); +insert into diaries values(3547, "2021-03-30"); +insert into diaries values(3548, "2021-03-31"); +insert into diaries values(3549, "2021-04-01"); +insert into diaries values(3550, "2021-04-02"); +insert into diaries values(3551, "2021-04-03"); +insert into diaries values(3552, "2021-04-04"); +insert into diaries values(3553, "2021-04-05"); +insert into diaries values(3554, "2021-04-06"); +insert into diaries values(3555, "2021-04-07"); +insert into diaries values(3556, "2021-04-08"); +insert into diaries values(3557, "2021-04-09"); +insert into diaries values(3558, "2021-04-10"); +insert into diaries values(3559, "2021-04-11"); +insert into diaries values(3560, "2021-04-12"); +insert into diaries values(3561, "2021-04-13"); +insert into diaries values(3562, "2021-04-14"); +insert into diaries values(3563, "2021-04-15"); +insert into diaries values(3564, "2021-04-16"); +insert into diaries values(3565, "2021-04-17"); +insert into diaries values(3566, "2021-04-18"); +insert into diaries values(3567, "2021-04-19"); +insert into diaries values(3568, "2021-04-20"); +insert into diaries values(3569, "2021-04-21"); +insert into diaries values(3570, "2021-04-22"); +insert into diaries values(3571, "2021-04-23"); +insert into diaries values(3572, "2021-04-24"); +insert into diaries values(3573, "2021-04-25"); +insert into diaries values(3574, "2021-04-26"); +insert into diaries values(3575, "2021-04-27"); +insert into diaries values(3576, "2021-04-28"); +insert into diaries values(3577, "2021-04-29"); +insert into diaries values(3578, "2021-04-30"); +insert into diaries values(3579, "2021-05-01"); +insert into diaries values(3580, "2021-05-02"); +insert into diaries values(3581, "2021-05-03"); +insert into diaries values(3582, "2021-05-04"); +insert into diaries values(3583, "2021-05-05"); +insert into diaries values(3584, "2021-05-06"); +insert into diaries values(3585, "2021-05-07"); +insert into diaries values(3586, "2021-05-08"); +insert into diaries values(3587, "2021-05-09"); +insert into diaries values(3588, "2021-05-10"); +insert into diaries values(3589, "2021-05-11"); +insert into diaries values(3590, "2021-05-12"); +insert into diaries values(3591, "2021-05-13"); +insert into diaries values(3592, "2021-05-14"); +insert into diaries values(3593, "2021-05-15"); +insert into diaries values(3594, "2021-05-16"); +insert into diaries values(3595, "2021-05-17"); +insert into diaries values(3596, "2021-05-18"); +insert into diaries values(3597, "2021-05-19"); +insert into diaries values(3598, "2021-05-20"); +insert into diaries values(3599, "2021-05-21"); +insert into diaries values(3600, "2021-05-22"); +insert into diaries values(3601, "2021-05-23"); +insert into diaries values(3602, "2021-05-24"); +insert into diaries values(3603, "2021-05-25"); +insert into diaries values(3604, "2021-05-26"); +insert into diaries values(3605, "2021-05-27"); +insert into diaries values(3606, "2021-05-28"); +insert into diaries values(3607, "2021-05-29"); +insert into diaries values(3608, "2021-05-30"); +insert into diaries values(3609, "2021-05-31"); +insert into diaries values(3610, "2021-06-01"); +insert into diaries values(3611, "2021-06-02"); +insert into diaries values(3612, "2021-06-03"); +insert into diaries values(3613, "2021-06-04"); +insert into diaries values(3614, "2021-06-05"); +insert into diaries values(3615, "2021-06-06"); +insert into diaries values(3616, "2021-06-07"); +insert into diaries values(3617, "2021-06-08"); +insert into diaries values(3618, "2021-06-09"); +insert into diaries values(3619, "2021-06-10"); +insert into diaries values(3620, "2021-06-11"); +insert into diaries values(3621, "2021-06-12"); +insert into diaries values(3622, "2021-06-13"); +insert into diaries values(3623, "2021-06-14"); +insert into diaries values(3624, "2021-06-15"); +insert into diaries values(3625, "2021-06-16"); +insert into diaries values(3626, "2021-06-17"); +insert into diaries values(3627, "2021-06-18"); +insert into diaries values(3628, "2021-06-19"); +insert into diaries values(3629, "2021-06-20"); +insert into diaries values(3630, "2021-06-21"); +insert into diaries values(3631, "2021-06-22"); +insert into diaries values(3632, "2021-06-23"); +insert into diaries values(3633, "2021-06-24"); +insert into diaries values(3634, "2021-06-25"); +insert into diaries values(3635, "2021-06-26"); +insert into diaries values(3636, "2021-06-27"); +insert into diaries values(3637, "2021-06-28"); +insert into diaries values(3638, "2021-06-29"); +insert into diaries values(3639, "2021-06-30"); +insert into diaries values(3640, "2021-07-01"); +insert into diaries values(3641, "2021-07-02"); +insert into diaries values(3642, "2021-07-03"); +insert into diaries values(3643, "2021-07-04"); +insert into diaries values(3644, "2021-07-05"); +insert into diaries values(3645, "2021-07-06"); +insert into diaries values(3646, "2021-07-07"); +insert into diaries values(3647, "2021-07-08"); +insert into diaries values(3648, "2021-07-09"); +insert into diaries values(3649, "2021-07-10"); +insert into diaries values(3650, "2021-07-11"); +insert into diaries values(3651, "2021-07-12"); +insert into diaries values(3652, "2021-07-13"); +insert into diaries values(3653, "2021-07-14"); +insert into diaries values(3654, "2021-07-15"); +insert into diaries values(3655, "2021-07-16"); +insert into diaries values(3656, "2021-07-17"); +insert into diaries values(3657, "2021-07-18"); +insert into diaries values(3658, "2021-07-19"); +insert into diaries values(3659, "2021-07-20"); +insert into diaries values(3660, "2021-07-21"); +insert into diaries values(3661, "2021-07-22"); +insert into diaries values(3662, "2021-07-23"); +insert into diaries values(3663, "2021-07-24"); +insert into diaries values(3664, "2021-07-25"); +insert into diaries values(3665, "2021-07-26"); +insert into diaries values(3666, "2021-07-27"); +insert into diaries values(3667, "2021-07-28"); +insert into diaries values(3668, "2021-07-29"); +insert into diaries values(3669, "2021-07-30"); +insert into diaries values(3670, "2021-07-31"); +insert into diaries values(3671, "2021-08-01"); +insert into diaries values(3672, "2021-08-02"); +insert into diaries values(3673, "2021-08-03"); +insert into diaries values(3674, "2021-08-04"); +insert into diaries values(3675, "2021-08-05"); +insert into diaries values(3676, "2021-08-06"); +insert into diaries values(3677, "2021-08-07"); +insert into diaries values(3678, "2021-08-08"); +insert into diaries values(3679, "2021-08-09"); +insert into diaries values(3680, "2021-08-10"); +insert into diaries values(3681, "2021-08-11"); +insert into diaries values(3682, "2021-08-12"); +insert into diaries values(3683, "2021-08-13"); +insert into diaries values(3684, "2021-08-14"); +insert into diaries values(3685, "2021-08-15"); +insert into diaries values(3686, "2021-08-16"); +insert into diaries values(3687, "2021-08-17"); +insert into diaries values(3688, "2021-08-18"); +insert into diaries values(3689, "2021-08-19"); +insert into diaries values(3690, "2021-08-20"); +insert into diaries values(3691, "2021-08-21"); +insert into diaries values(3692, "2021-08-22"); +insert into diaries values(3693, "2021-08-23"); +insert into diaries values(3694, "2021-08-24"); +insert into diaries values(3695, "2021-08-25"); +insert into diaries values(3696, "2021-08-26"); +insert into diaries values(3697, "2021-08-27"); +insert into diaries values(3698, "2021-08-28"); +insert into diaries values(3699, "2021-08-29"); +insert into diaries values(3700, "2021-08-30"); +insert into diaries values(3701, "2021-08-31"); +insert into diaries values(3702, "2021-09-01"); +insert into diaries values(3703, "2021-09-02"); +insert into diaries values(3704, "2021-09-03"); +insert into diaries values(3705, "2021-09-04"); +insert into diaries values(3706, "2021-09-05"); +insert into diaries values(3707, "2021-09-06"); +insert into diaries values(3708, "2021-09-07"); +insert into diaries values(3709, "2021-09-08"); +insert into diaries values(3710, "2021-09-09"); +insert into diaries values(3711, "2021-09-10"); +insert into diaries values(3712, "2021-09-11"); +insert into diaries values(3713, "2021-09-12"); +insert into diaries values(3714, "2021-09-13"); +insert into diaries values(3715, "2021-09-14"); +insert into diaries values(3716, "2021-09-15"); +insert into diaries values(3717, "2021-09-16"); +insert into diaries values(3718, "2021-09-17"); +insert into diaries values(3719, "2021-09-18"); +insert into diaries values(3720, "2021-09-19"); +insert into diaries values(3721, "2021-09-20"); +insert into diaries values(3722, "2021-09-21"); +insert into diaries values(3723, "2021-09-22"); +insert into diaries values(3724, "2021-09-23"); +insert into diaries values(3725, "2021-09-24"); +insert into diaries values(3726, "2021-09-25"); +insert into diaries values(3727, "2021-09-26"); +insert into diaries values(3728, "2021-09-27"); +insert into diaries values(3729, "2021-09-28"); +insert into diaries values(3730, "2021-09-29"); +insert into diaries values(3731, "2021-09-30"); +insert into diaries values(3732, "2021-10-01"); +insert into diaries values(3733, "2021-10-02"); +insert into diaries values(3734, "2021-10-03"); +insert into diaries values(3735, "2021-10-04"); +insert into diaries values(3736, "2021-10-05"); +insert into diaries values(3737, "2021-10-06"); +insert into diaries values(3738, "2021-10-07"); +insert into diaries values(3739, "2021-10-08"); +insert into diaries values(3740, "2021-10-09"); +insert into diaries values(3741, "2021-10-10"); +insert into diaries values(3742, "2021-10-11"); +insert into diaries values(3743, "2021-10-12"); +insert into diaries values(3744, "2021-10-13"); +insert into diaries values(3745, "2021-10-14"); +insert into diaries values(3746, "2021-10-15"); +insert into diaries values(3747, "2021-10-16"); +insert into diaries values(3748, "2021-10-17"); +insert into diaries values(3749, "2021-10-18"); +insert into diaries values(3750, "2021-10-19"); +insert into diaries values(3751, "2021-10-20"); +insert into diaries values(3752, "2021-10-21"); +insert into diaries values(3753, "2021-10-22"); +insert into diaries values(3754, "2021-10-23"); +insert into diaries values(3755, "2021-10-24"); +insert into diaries values(3756, "2021-10-25"); +insert into diaries values(3757, "2021-10-26"); +insert into diaries values(3758, "2021-10-27"); +insert into diaries values(3759, "2021-10-28"); +insert into diaries values(3760, "2021-10-29"); +insert into diaries values(3761, "2021-10-30"); +insert into diaries values(3762, "2021-10-31"); +insert into diaries values(3763, "2021-11-01"); +insert into diaries values(3764, "2021-11-02"); +insert into diaries values(3765, "2021-11-03"); +insert into diaries values(3766, "2021-11-04"); +insert into diaries values(3767, "2021-11-05"); +insert into diaries values(3768, "2021-11-06"); +insert into diaries values(3769, "2021-11-07"); +insert into diaries values(3770, "2021-11-08"); +insert into diaries values(3771, "2021-11-09"); +insert into diaries values(3772, "2021-11-10"); +insert into diaries values(3773, "2021-11-11"); +insert into diaries values(3774, "2021-11-12"); +insert into diaries values(3775, "2021-11-13"); +insert into diaries values(3776, "2021-11-14"); +insert into diaries values(3777, "2021-11-15"); +insert into diaries values(3778, "2021-11-16"); +insert into diaries values(3779, "2021-11-17"); +insert into diaries values(3780, "2021-11-18"); +insert into diaries values(3781, "2021-11-19"); +insert into diaries values(3782, "2021-11-20"); +insert into diaries values(3783, "2021-11-21"); +insert into diaries values(3784, "2021-11-22"); +insert into diaries values(3785, "2021-11-23"); +insert into diaries values(3786, "2021-11-24"); +insert into diaries values(3787, "2021-11-25"); +insert into diaries values(3788, "2021-11-26"); +insert into diaries values(3789, "2021-11-27"); +insert into diaries values(3790, "2021-11-28"); +insert into diaries values(3791, "2021-11-29"); +insert into diaries values(3792, "2021-11-30"); +insert into diaries values(3793, "2021-12-01"); +insert into diaries values(3794, "2021-12-02"); +insert into diaries values(3795, "2021-12-03"); +insert into diaries values(3796, "2021-12-04"); +insert into diaries values(3797, "2021-12-05"); +insert into diaries values(3798, "2021-12-06"); +insert into diaries values(3799, "2021-12-07"); +insert into diaries values(3800, "2021-12-08"); +insert into diaries values(3801, "2021-12-09"); +insert into diaries values(3802, "2021-12-10"); +insert into diaries values(3803, "2021-12-11"); +insert into diaries values(3804, "2021-12-12"); +insert into diaries values(3805, "2021-12-13"); +insert into diaries values(3806, "2021-12-14"); +insert into diaries values(3807, "2021-12-15"); +insert into diaries values(3808, "2021-12-16"); +insert into diaries values(3809, "2021-12-17"); +insert into diaries values(3810, "2021-12-18"); +insert into diaries values(3811, "2021-12-19"); +insert into diaries values(3812, "2021-12-20"); +insert into diaries values(3813, "2021-12-21"); +insert into diaries values(3814, "2021-12-22"); +insert into diaries values(3815, "2021-12-23"); +insert into diaries values(3816, "2021-12-24"); +insert into diaries values(3817, "2021-12-25"); +insert into diaries values(3818, "2021-12-26"); +insert into diaries values(3819, "2021-12-27"); +insert into diaries values(3820, "2021-12-28"); +insert into diaries values(3821, "2021-12-29"); +insert into diaries values(3822, "2021-12-30"); +insert into diaries values(3823, "2021-12-31"); +insert into diaries values(3824, "2022-01-01"); +insert into diaries values(3825, "2022-01-02"); +insert into diaries values(3826, "2022-01-03"); +insert into diaries values(3827, "2022-01-04"); +insert into diaries values(3828, "2022-01-05"); +insert into diaries values(3829, "2022-01-06"); +insert into diaries values(3830, "2022-01-07"); +insert into diaries values(3831, "2022-01-08"); +insert into diaries values(3832, "2022-01-09"); +insert into diaries values(3833, "2022-01-10"); +insert into diaries values(3834, "2022-01-11"); +insert into diaries values(3835, "2022-01-12"); +insert into diaries values(3836, "2022-01-13"); +insert into diaries values(3837, "2022-01-14"); +insert into diaries values(3838, "2022-01-15"); +insert into diaries values(3839, "2022-01-16"); +insert into diaries values(3840, "2022-01-17"); +insert into diaries values(3841, "2022-01-18"); +insert into diaries values(3842, "2022-01-19"); +insert into diaries values(3843, "2022-01-20"); +insert into diaries values(3844, "2022-01-21"); +insert into diaries values(3845, "2022-01-22"); +insert into diaries values(3846, "2022-01-23"); +insert into diaries values(3847, "2022-01-24"); +insert into diaries values(3848, "2022-01-25"); +insert into diaries values(3849, "2022-01-26"); +insert into diaries values(3850, "2022-01-27"); +insert into diaries values(3851, "2022-01-28"); +insert into diaries values(3852, "2022-01-29"); +insert into diaries values(3853, "2022-01-30"); +insert into diaries values(3854, "2022-01-31"); +insert into diaries values(3855, "2022-02-01"); +insert into diaries values(3856, "2022-02-02"); +insert into diaries values(3857, "2022-02-03"); +insert into diaries values(3858, "2022-02-04"); +insert into diaries values(3859, "2022-02-05"); +insert into diaries values(3860, "2022-02-06"); +insert into diaries values(3861, "2022-02-07"); +insert into diaries values(3862, "2022-02-08"); +insert into diaries values(3863, "2022-02-09"); +insert into diaries values(3864, "2022-02-10"); +insert into diaries values(3865, "2022-02-11"); +insert into diaries values(3866, "2022-02-12"); +insert into diaries values(3867, "2022-02-13"); +insert into diaries values(3868, "2022-02-14"); +insert into diaries values(3869, "2022-02-15"); +insert into diaries values(3870, "2022-02-16"); +insert into diaries values(3871, "2022-02-17"); +insert into diaries values(3872, "2022-02-18"); +insert into diaries values(3873, "2022-02-19"); +insert into diaries values(3874, "2022-02-20"); +insert into diaries values(3875, "2022-02-21"); +insert into diaries values(3876, "2022-02-22"); +insert into diaries values(3877, "2022-02-23"); +insert into diaries values(3878, "2022-02-24"); +insert into diaries values(3879, "2022-02-25"); +insert into diaries values(3880, "2022-02-26"); +insert into diaries values(3881, "2022-02-27"); +insert into diaries values(3882, "2022-02-28"); +insert into diaries values(3883, "2022-03-01"); +insert into diaries values(3884, "2022-03-02"); +insert into diaries values(3885, "2022-03-03"); +insert into diaries values(3886, "2022-03-04"); +insert into diaries values(3887, "2022-03-05"); +insert into diaries values(3888, "2022-03-06"); +insert into diaries values(3889, "2022-03-07"); +insert into diaries values(3890, "2022-03-08"); +insert into diaries values(3891, "2022-03-09"); +insert into diaries values(3892, "2022-03-10"); +insert into diaries values(3893, "2022-03-11"); +insert into diaries values(3894, "2022-03-12"); +insert into diaries values(3895, "2022-03-13"); +insert into diaries values(3896, "2022-03-14"); +insert into diaries values(3897, "2022-03-15"); +insert into diaries values(3898, "2022-03-16"); +insert into diaries values(3899, "2022-03-17"); +insert into diaries values(3900, "2022-03-18"); +insert into diaries values(3901, "2022-03-19"); +insert into diaries values(3902, "2022-03-20"); +insert into diaries values(3903, "2022-03-21"); +insert into diaries values(3904, "2022-03-22"); +insert into diaries values(3905, "2022-03-23"); +insert into diaries values(3906, "2022-03-24"); +insert into diaries values(3907, "2022-03-25"); +insert into diaries values(3908, "2022-03-26"); +insert into diaries values(3909, "2022-03-27"); +insert into diaries values(3910, "2022-03-28"); +insert into diaries values(3911, "2022-03-29"); +insert into diaries values(3912, "2022-03-30"); +insert into diaries values(3913, "2022-03-31"); +insert into diaries values(3914, "2022-04-01"); +insert into diaries values(3915, "2022-04-02"); +insert into diaries values(3916, "2022-04-03"); +insert into diaries values(3917, "2022-04-04"); +insert into diaries values(3918, "2022-04-05"); +insert into diaries values(3919, "2022-04-06"); +insert into diaries values(3920, "2022-04-07"); +insert into diaries values(3921, "2022-04-08"); +insert into diaries values(3922, "2022-04-09"); +insert into diaries values(3923, "2022-04-10"); +insert into diaries values(3924, "2022-04-11"); +insert into diaries values(3925, "2022-04-12"); +insert into diaries values(3926, "2022-04-13"); +insert into diaries values(3927, "2022-04-14"); +insert into diaries values(3928, "2022-04-15"); +insert into diaries values(3929, "2022-04-16"); +insert into diaries values(3930, "2022-04-17"); +insert into diaries values(3931, "2022-04-18"); +insert into diaries values(3932, "2022-04-19"); +insert into diaries values(3933, "2022-04-20"); +insert into diaries values(3934, "2022-04-21"); +insert into diaries values(3935, "2022-04-22"); +insert into diaries values(3936, "2022-04-23"); +insert into diaries values(3937, "2022-04-24"); +insert into diaries values(3938, "2022-04-25"); +insert into diaries values(3939, "2022-04-26"); +insert into diaries values(3940, "2022-04-27"); +insert into diaries values(3941, "2022-04-28"); +insert into diaries values(3942, "2022-04-29"); +insert into diaries values(3943, "2022-04-30"); +insert into diaries values(3944, "2022-05-01"); +insert into diaries values(3945, "2022-05-02"); +insert into diaries values(3946, "2022-05-03"); +insert into diaries values(3947, "2022-05-04"); +insert into diaries values(3948, "2022-05-05"); +insert into diaries values(3949, "2022-05-06"); +insert into diaries values(3950, "2022-05-07"); +insert into diaries values(3951, "2022-05-08"); +insert into diaries values(3952, "2022-05-09"); +insert into diaries values(3953, "2022-05-10"); +insert into diaries values(3954, "2022-05-11"); +insert into diaries values(3955, "2022-05-12"); +insert into diaries values(3956, "2022-05-13"); +insert into diaries values(3957, "2022-05-14"); +insert into diaries values(3958, "2022-05-15"); +insert into diaries values(3959, "2022-05-16"); +insert into diaries values(3960, "2022-05-17"); +insert into diaries values(3961, "2022-05-18"); +insert into diaries values(3962, "2022-05-19"); +insert into diaries values(3963, "2022-05-20"); +insert into diaries values(3964, "2022-05-21"); +insert into diaries values(3965, "2022-05-22"); +insert into diaries values(3966, "2022-05-23"); +insert into diaries values(3967, "2022-05-24"); +insert into diaries values(3968, "2022-05-25"); +insert into diaries values(3969, "2022-05-26"); +insert into diaries values(3970, "2022-05-27"); +insert into diaries values(3971, "2022-05-28"); +insert into diaries values(3972, "2022-05-29"); +insert into diaries values(3973, "2022-05-30"); +insert into diaries values(3974, "2022-05-31"); +insert into diaries values(3975, "2022-06-01"); +insert into diaries values(3976, "2022-06-02"); +insert into diaries values(3977, "2022-06-03"); +insert into diaries values(3978, "2022-06-04"); +insert into diaries values(3979, "2022-06-05"); +insert into diaries values(3980, "2022-06-06"); +insert into diaries values(3981, "2022-06-07"); +insert into diaries values(3982, "2022-06-08"); +insert into diaries values(3983, "2022-06-09"); +insert into diaries values(3984, "2022-06-10"); +insert into diaries values(3985, "2022-06-11"); +insert into diaries values(3986, "2022-06-12"); +insert into diaries values(3987, "2022-06-13"); +insert into diaries values(3988, "2022-06-14"); +insert into diaries values(3989, "2022-06-15"); +insert into diaries values(3990, "2022-06-16"); +insert into diaries values(3991, "2022-06-17"); +insert into diaries values(3992, "2022-06-18"); +insert into diaries values(3993, "2022-06-19"); +insert into diaries values(3994, "2022-06-20"); +insert into diaries values(3995, "2022-06-21"); +insert into diaries values(3996, "2022-06-22"); +insert into diaries values(3997, "2022-06-23"); +insert into diaries values(3998, "2022-06-24"); +insert into diaries values(3999, "2022-06-25"); +insert into diaries values(4000, "2022-06-26"); +insert into diaries values(4001, "2022-06-27"); +insert into diaries values(4002, "2022-06-28"); +insert into diaries values(4003, "2022-06-29"); +insert into diaries values(4004, "2022-06-30"); +insert into diaries values(4005, "2022-07-01"); +insert into diaries values(4006, "2022-07-02"); +insert into diaries values(4007, "2022-07-03"); +insert into diaries values(4008, "2022-07-04"); +insert into diaries values(4009, "2022-07-05"); +insert into diaries values(4010, "2022-07-06"); +insert into diaries values(4011, "2022-07-07"); +insert into diaries values(4012, "2022-07-08"); +insert into diaries values(4013, "2022-07-09"); +insert into diaries values(4014, "2022-07-10"); +insert into diaries values(4015, "2022-07-11"); +insert into diaries values(4016, "2022-07-12"); +insert into diaries values(4017, "2022-07-13"); +insert into diaries values(4018, "2022-07-14"); +insert into diaries values(4019, "2022-07-15"); +insert into diaries values(4020, "2022-07-16"); +insert into diaries values(4021, "2022-07-17"); +insert into diaries values(4022, "2022-07-18"); +insert into diaries values(4023, "2022-07-19"); +insert into diaries values(4024, "2022-07-20"); +insert into diaries values(4025, "2022-07-21"); +insert into diaries values(4026, "2022-07-22"); +insert into diaries values(4027, "2022-07-23"); +insert into diaries values(4028, "2022-07-24"); +insert into diaries values(4029, "2022-07-25"); +insert into diaries values(4030, "2022-07-26"); +insert into diaries values(4031, "2022-07-27"); +insert into diaries values(4032, "2022-07-28"); +insert into diaries values(4033, "2022-07-29"); +insert into diaries values(4034, "2022-07-30"); +insert into diaries values(4035, "2022-07-31"); +insert into diaries values(4036, "2022-08-01"); +insert into diaries values(4037, "2022-08-02"); +insert into diaries values(4038, "2022-08-03"); +insert into diaries values(4039, "2022-08-04"); +insert into diaries values(4040, "2022-08-05"); +insert into diaries values(4041, "2022-08-06"); +insert into diaries values(4042, "2022-08-07"); +insert into diaries values(4043, "2022-08-08"); +insert into diaries values(4044, "2022-08-09"); +insert into diaries values(4045, "2022-08-10"); +insert into diaries values(4046, "2022-08-11"); +insert into diaries values(4047, "2022-08-12"); +insert into diaries values(4048, "2022-08-13"); +insert into diaries values(4049, "2022-08-14"); +insert into diaries values(4050, "2022-08-15"); +insert into diaries values(4051, "2022-08-16"); +insert into diaries values(4052, "2022-08-17"); +insert into diaries values(4053, "2022-08-18"); +insert into diaries values(4054, "2022-08-19"); +insert into diaries values(4055, "2022-08-20"); +insert into diaries values(4056, "2022-08-21"); +insert into diaries values(4057, "2022-08-22"); +insert into diaries values(4058, "2022-08-23"); +insert into diaries values(4059, "2022-08-24"); +insert into diaries values(4060, "2022-08-25"); +insert into diaries values(4061, "2022-08-26"); +insert into diaries values(4062, "2022-08-27"); +insert into diaries values(4063, "2022-08-28"); +insert into diaries values(4064, "2022-08-29"); +insert into diaries values(4065, "2022-08-30"); +insert into diaries values(4066, "2022-08-31"); +insert into diaries values(4067, "2022-09-01"); +insert into diaries values(4068, "2022-09-02"); +insert into diaries values(4069, "2022-09-03"); +insert into diaries values(4070, "2022-09-04"); +insert into diaries values(4071, "2022-09-05"); +insert into diaries values(4072, "2022-09-06"); +insert into diaries values(4073, "2022-09-07"); +insert into diaries values(4074, "2022-09-08"); +insert into diaries values(4075, "2022-09-09"); +insert into diaries values(4076, "2022-09-10"); +insert into diaries values(4077, "2022-09-11"); +insert into diaries values(4078, "2022-09-12"); +insert into diaries values(4079, "2022-09-13"); +insert into diaries values(4080, "2022-09-14"); +insert into diaries values(4081, "2022-09-15"); +insert into diaries values(4082, "2022-09-16"); +insert into diaries values(4083, "2022-09-17"); +insert into diaries values(4084, "2022-09-18"); +insert into diaries values(4085, "2022-09-19"); +insert into diaries values(4086, "2022-09-20"); +insert into diaries values(4087, "2022-09-21"); +insert into diaries values(4088, "2022-09-22"); +insert into diaries values(4089, "2022-09-23"); +insert into diaries values(4090, "2022-09-24"); +insert into diaries values(4091, "2022-09-25"); +insert into diaries values(4092, "2022-09-26"); +insert into diaries values(4093, "2022-09-27"); +insert into diaries values(4094, "2022-09-28"); +insert into diaries values(4095, "2022-09-29"); +commit; +set autocommit=1; + +select * from diaries where match(title) against("2022-09-0") order by id; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test new file mode 100644 index 00000000..306a12bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_matched_order.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kentoku SHIBA +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS texts; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE texts ( + id INT PRIMARY KEY, + matched TEXT, + not_matched TEXT, + FULLTEXT KEY (matched), + FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; + +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); + +SELECT id, + matched, + not_matched, + MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), + MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) + FROM texts + WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE) + ORDER BY MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE), + id; + +DROP TABLE texts; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test new file mode 100644 index 00000000..488af677 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_have_where_no_order.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kentoku SHIBA +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS texts; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE texts ( + id INT PRIMARY KEY, + matched TEXT, + not_matched TEXT, + FULLTEXT KEY (matched), + FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; + +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); + +SELECT * + FROM (SELECT id, + matched, + not_matched, + MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), + MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) + FROM texts + WHERE MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)) + AS searched_texts + ORDER BY id; + +DROP TABLE texts; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test new file mode 100644 index 00000000..89a0804e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_matched_and_not_matched_no_where_both_order.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kentoku SHIBA +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS texts; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE texts ( + id INT PRIMARY KEY, + matched TEXT, + not_matched TEXT, + FULLTEXT KEY (matched), + FULLTEXT KEY (not_matched) +) DEFAULT CHARSET=UTF8 COMMENT='engine "InnoDB"'; + +INSERT INTO texts VALUES (1, 'Hello1', 'World1'); +INSERT INTO texts VALUES (2, 'Hello2', 'World2'); +INSERT INTO texts VALUES (3, 'Hello3', 'World3'); + +SELECT id, + matched, + not_matched, + MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), + MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE) + FROM texts + ORDER BY MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE), + MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE), + id; + +DROP TABLE texts; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test new file mode 100644 index 00000000..0d2e0056 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test new file mode 100644 index 00000000..2886edaf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test new file mode 100644 index 00000000..249abeed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; + +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +select * from diaries where match(title, content) against("富士山"); + +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title, content) against("富士山"); + +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); + +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test new file mode 100644 index 00000000..63b5943f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +insert into diaries values(1, "Hello", "はじめました。"); +insert into diaries values(2, "天気", "明日の富士山の天気について"); +insert into diaries values(3, "富士山", "今日もきれい。"); +update diaries set title = "チョモランマ" where id = 3; +update diaries set content = "チョモランマと富士山" where id = 1; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test new file mode 100644 index 00000000..749b08ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + title text, + body text, + fulltext index title_index (title), + fulltext index body_index (body) +) comment = 'engine "innodb"' default charset utf8; + +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); + +select * from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +select *, match(title) against("survey"), match(body) against("groonga") + from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test new file mode 100644 index 00000000..dc92fafd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test @@ -0,0 +1,101 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su") order by c1; +select * from t1 where match(c3) against("ii") order by c1; +select * from t1 where match(c3) against("+su" in boolean mode) order by c1; +select * from t1 where match(c3) against("+ii" in boolean mode) order by c1; +drop table t1; + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values(1, "明日の富士山の天気について","あああああああ"); +insert into t1 values(2, "いいいいい","明日の富士山の天気は分かりません"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山") order by c1; +select * from t1 where match(c3) against("富士山") order by c1; +drop table t1; + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +drop table t1,t2; + +# for "not match against" +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1; +select * from t1 where not match(c3) against("uu"); +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +select * from t1 where not match(c3) against("dummy"); +select * from t1 where c1 = 4 and not match(c3) against("uu"); +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +select * from t1 where c1 > 4 and not match(c3) against("uu"); +select * from t1 where c2 = 10 and not match(c3) against("uu"); +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +select * from t1 where c2 < 15 and not match(c3) against("uu"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test new file mode 100644 index 00000000..473fd2d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test @@ -0,0 +1,47 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select *,match(c3) against("uu") from t1 where match(c3) against("uu") order by c1; +select * from t1 where not match(c3) against("uu") order by c1; +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy") order by c1; +select * from t1 where not match(c3) against("dummy") order by c1; +select * from t1 where c1 = 4 and not match(c3) against("uu") order by c1; +select * from t1 where c1 <= 4 and not match(c3) against("uu") order by c1; +select * from t1 where c1 > 4 and not match(c3) against("uu") order by c1; +select * from t1 where c2 = 10 and not match(c3) against("uu") order by c1; +select * from t1 where c2 >= 15 and not match(c3) against("uu") order by c1; +select * from t1 where c2 < 15 and not match(c3) against("uu") order by c1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test new file mode 100644 index 00000000..6949ecd6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE ft( + a INT DEFAULT 0, + b TEXT, + c TEXT, + PRIMARY KEY(a), + FULLTEXT KEY ftx1(b), + FULLTEXT KEY ftx2(c) +)ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; + +INSERT INTO ft VALUES(1,'aaaaa','abcde'); +INSERT INTO ft VALUES(2,'bbbbb','bcdef'); +INSERT INTO ft VALUES(3,'ccccc','cdefg'); +INSERT INTO ft VALUES(4,'ddddd','defgh'); +INSERT INTO ft VALUES(5,'eeeee','efghi'); + +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); + +DROP TABLE ft; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test new file mode 100644 index 00000000..aa510012 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test @@ -0,0 +1,73 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; + +START TRANSACTION; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +disable_query_log; +CONNECT(search_connection, localhost, root); +enable_query_log; +USE test; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +disable_query_log; +CONNECTION default; +enable_query_log; +COMMIT; + +disable_query_log; +CONNECTION search_connection; +enable_query_log; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; +disable_query_log; +DISCONNECT search_connection; +enable_query_log; + +disable_query_log; +CONNECTION default; +enable_query_log; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test new file mode 100644 index 00000000..0423e948 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test @@ -0,0 +1,36 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test new file mode 100644 index 00000000..046e9d74 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +SELECT last_insert_id(); +SELECT last_insert_id(10); +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test new file mode 100644 index 00000000..80dc209a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test @@ -0,0 +1,145 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; +insert into shops (name, location) + values ('nezu-no-taiyaki', + ST_GeomFromText('POINT(139.762573 35.720253)')); +insert into shops (name, location) + values ('taiyaki-kataoka', + ST_GeomFromText('POINT(139.715591 35.712521)')); +insert into shops (name, location) + values ('soba-taiyaki-ku', + ST_GeomFromText('POINT(139.659088 35.683712)')); +insert into shops (name, location) + values ('kuruma', + ST_GeomFromText('POINT(139.706207 35.721516)')); +insert into shops (name, location) + values ('hirose-ya', + ST_GeomFromText('POINT(139.685608 35.714844)')); +insert into shops (name, location) + values ('sazare', + ST_GeomFromText('POINT(139.685043 35.714653)')); +insert into shops (name, location) + values ('omede-taiyaki', + ST_GeomFromText('POINT(139.817154 35.700516)')); +insert into shops (name, location) + values ('onaga-ya', + ST_GeomFromText('POINT(139.81105 35.698254)')); +insert into shops (name, location) + values ('shiro-ya', + ST_GeomFromText('POINT(139.638611 35.705517)')); +insert into shops (name, location) + values ('fuji-ya', + ST_GeomFromText('POINT(139.637115 35.703938)')); +insert into shops (name, location) + values ('miyoshi', + ST_GeomFromText('POINT(139.537323 35.644539)')); +insert into shops (name, location) + values ('juju-ya', + ST_GeomFromText('POINT(139.695755 35.628922)')); +insert into shops (name, location) + values ('tatsumi-ya', + ST_GeomFromText('POINT(139.638657 35.665501)')); +insert into shops (name, location) + values ('tetsuji', + ST_GeomFromText('POINT(139.76857 35.680912)')); +insert into shops (name, location) + values ('gazuma-ya', + ST_GeomFromText('POINT(139.647598 35.700817)')); +insert into shops (name, location) + values ('honma-mon', + ST_GeomFromText('POINT(139.652573 35.722736)')); +insert into shops (name, location) + values ('naniwa-ya', + ST_GeomFromText('POINT(139.796234 35.730061)')); +insert into shops (name, location) + values ('kuro-dai', + ST_GeomFromText('POINT(139.704834 35.650345)')); +insert into shops (name, location) + values ('daruma', + ST_GeomFromText('POINT(139.770599 35.681461)')); +insert into shops (name, location) + values ('yanagi-ya', + ST_GeomFromText('POINT(139.783981 35.685341)')); +insert into shops (name, location) + values ('sharaku', + ST_GeomFromText('POINT(139.794846 35.716969)')); +insert into shops (name, location) + values ('takane', + ST_GeomFromText('POINT(139.560913 35.698601)')); +insert into shops (name, location) + values ('chiyoda', + ST_GeomFromText('POINT(139.652817 35.642601)')); +insert into shops (name, location) + values ('da-ka-po', + ST_GeomFromText('POINT(139.727356 35.627346)')); +insert into shops (name, location) + values ('matsushima-ya', + ST_GeomFromText('POINT(139.737381 35.640556)')); +insert into shops (name, location) + values ('kazuya', + ST_GeomFromText('POINT(139.760895 35.673508)')); +insert into shops (name, location) + values ('furuya-kogane-an', + ST_GeomFromText('POINT(139.676071 35.680603)')); +insert into shops (name, location) + values ('hachi-no-ie', + ST_GeomFromText('POINT(139.668106 35.608021)')); +insert into shops (name, location) + values ('azuki-chan', + ST_GeomFromText('POINT(139.673203 35.64151)')); +insert into shops (name, location) + values ('kuriko-an', + ST_GeomFromText('POINT(139.796829 35.712013)')); +insert into shops (name, location) + values ('yume-no-aru-machi-no-taiyaki-ya-san', + ST_GeomFromText('POINT(139.712524 35.616199)')); +insert into shops (name, location) + values ('naze-ya', + ST_GeomFromText('POINT(139.665833 35.609039)')); +insert into shops (name, location) + values ('sanoki-ya', + ST_GeomFromText('POINT(139.770721 35.66592)')); +insert into shops (name, location) + values ('shigeta', + ST_GeomFromText('POINT(139.780273 35.672626)')); +insert into shops (name, location) + values ('nishimi-ya', + ST_GeomFromText('POINT(139.774628 35.671825)')); +insert into shops (name, location) + values ('hiiragi', + 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 new file mode 100644 index 00000000..cc4d50b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test @@ -0,0 +1,48 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; + +insert into shops (name, location) + values ('sazare', + 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(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, ST_AsText(location) as location_text from shops; + +drop table shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test new file mode 100644 index 00000000..b340cf71 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; + +insert into shops (name, location) + values ('sazare', + 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 = ST_GeomFromText('POINT(139.66116 35.57566)') + where name = 'sazare'; +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; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test new file mode 100644 index 00000000..89e87360 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test @@ -0,0 +1,32 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET UTF8 COMMENT = 'engine "InnoDB"'; +SELECT COUNT(*) FROM ids FORCE INDEX(PRIMARY); + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test new file mode 100644 index 00000000..03aa71cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test @@ -0,0 +1,91 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# data types +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26"); +select * from t1; +drop table t1; + +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("11:22:33"); +select * from t1; +drop table t1; + +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010"); +select * from t1; +drop table t1; + +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +drop table t1; + + +# duplicated key error +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +select * from t1; +--error ER_DUP_ENTRY +insert into t1 values(1,200); +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test new file mode 100644 index 00000000..e315ac5d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content text, + fulltext index (content) +) default charset utf8 comment = 'engine "innodb"'; + +LOCK TABLE diaries WRITE; +insert into diaries values(1, "今日からはじめました。"); +insert into diaries values(2, "明日の富士山の天気について"); +insert into diaries values(3, "今日も天気がよくてきれいに見える。"); +UNLOCK TABLES; + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test new file mode 100644 index 00000000..e7fba640 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + date TIMESTAMP NOT NULL, + title VARCHAR(100) NOT NULL, + content TEXT NOT NULL, + PRIMARY KEY (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); + +SELECT * FROM diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy new shoes.") + ON DUPLICATE KEY UPDATE date = "2012-03-03", + content = "I buy a new hat."; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test new file mode 100644 index 00000000..dc5d8b5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + date TIMESTAMP NOT NULL, + title VARCHAR(100) NOT NULL, + content TEXT NOT NULL, + UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +# For MariaDB 10.2.3 +-- replace_result current_timestamp() CURRENT_TIMESTAMP +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); + +SELECT * FROM diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy new shoes.") + ON DUPLICATE KEY UPDATE date = "2012-03-03", + content = "I buy a new hat."; +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test new file mode 100644 index 00000000..436904e2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kenji Maruyama +# Copyright(C) 2013-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql.inc +--source ../../include/mroonga/have_version_5_6_or_later.inc +--source ../../include/mroonga/skip_mysql_5_7_or_later.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS integers; +--enable_warnings + +SET optimizer_switch='mrr_cost_based=off'; + +CREATE TABLE integers ( + id INT PRIMARY KEY AUTO_INCREMENT, + value INT, + KEY (value) +) COMMENT='engine "InnoDB"'; + +INSERT INTO integers (value) VALUES (0), (1), (2), (3); + +EXPLAIN SELECT * FROM integers + WHERE value IN (0, 2); + +SELECT * FROM integers + WHERE value IN (0, 2); + +DROP TABLE integers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test new file mode 100644 index 00000000..c883e493 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_mysql_5_7_or_later_disk_sweep.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kenji Maruyama +# Copyright(C) 2013-2016 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 USA + +--source ../../include/mroonga/have_mysql_5_7_or_later.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS integers; +--enable_warnings + +SET optimizer_switch='mrr_cost_based=off'; + +CREATE TABLE integers ( + id INT PRIMARY KEY AUTO_INCREMENT, + value INT, + KEY (value) +) COMMENT='engine "InnoDB"'; + +INSERT INTO integers (value) VALUES (0), (1), (2), (3); + +EXPLAIN SELECT * FROM integers + WHERE value IN (0, 2); + +SELECT * FROM integers + WHERE value IN (0, 2); + +DROP TABLE integers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test new file mode 100644 index 00000000..a47e73f5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test @@ -0,0 +1,60 @@ +# Copyright(C) 2010 Kentoku SHIBA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 ( + c1 int primary key, + c2 int, + c3 text, + key idx1(c2), + fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") desc; +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") desc limit 1, 1; +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii"); +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") limit 1; +show status like 'mroonga_fast_order_limit'; + +select count(*) from t1 where match(c3) against("ii") limit 1; +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test new file mode 100644 index 00000000..21180eb9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_direction.test @@ -0,0 +1,50 @@ +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 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, "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'; + +SELECT id, content + FROM memos + WHERE MATCH(content) AGAINST("+Mroonga" IN BOOLEAN MODE) + ORDER BY id + 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/optimization_order_limit_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test new file mode 100644 index 00000000..d4032829 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 ( + c1 int primary key, + c2 int, + c3 text, + key idx1(c2), + fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); + +show status like 'mroonga_fast_order_limit'; + +select *, match(c3) against("ii") from t1 order by c1 desc limit 1; + +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/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 00000000..2513df8e --- /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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should 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-1335 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 00000000..d2ed32dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema-master.opt @@ -0,0 +1 @@ +--loose-performance-schema diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test new file mode 100644 index 00000000..6270ea66 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/performance_schema.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SHOW VARIABLES LIKE 'performance_schema'; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + content VARCHAR(255), + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!"); + +SHOW TABLES FROM performance_schema LIKE 'threads'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test new file mode 100644 index 00000000..5d9c5bd2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test @@ -0,0 +1,58 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.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) +) COMMENT = 'engine "innodb"' 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"); + +--remove_files_wildcard $MYSQLD_DATADIR repair_test.mrn* + +FLUSH TABLES; + +# Error ER_CANT_OPEN_FILE mroonga: failed to open table: +--error ER_CANT_OPEN_FILE +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +REPAIR TABLE diaries; + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +DROP TABLE diaries; + +DROP DATABASE repair_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test new file mode 100644 index 00000000..2fefadc2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test @@ -0,0 +1,58 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/skip_solaris.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) +) COMMENT = 'engine "innodb"' 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"); + +--remove_file $MYSQLD_DATADIR/repair_test.mrn.000010A + +FLUSH TABLES; + +# Error ER_CANT_OPEN_FILE system call error: No such file or directory: failed to open path: +--error ER_CANT_OPEN_FILE +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +REPAIR TABLE diaries; + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +DROP TABLE diaries; + +DROP DATABASE repair_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test new file mode 100644 index 00000000..e93f7f79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TEMPORARY TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); + +SELECT * FROM diaries; + +DROP TEMPORARY TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test new file mode 100644 index 00000000..4284f60a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test @@ -0,0 +1,63 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +SET @tmp_query_cache_size = @@query_cache_size; +SET GLOBAL query_cache_size = 1048576; + +--disable_warnings +DROP TABLE IF EXISTS simple_table; +--enable_warnings + +CREATE TABLE simple_table ( + id INT PRIMARY KEY +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE simple_table; + +INSERT INTO simple_table (id) VALUES (1),(2); + +disable_query_log; +CONNECT(second_connection, localhost, root); +enable_query_log; +USE test; +START TRANSACTION; +INSERT INTO simple_table (id) VALUES (3); + +disable_query_log; +CONNECTION default; +enable_query_log; +SELECT * FROM simple_table; + +disable_query_log; +CONNECTION second_connection; +enable_query_log; +COMMIT; + +disable_query_log; +CONNECTION default; +enable_query_log; +SELECT * FROM simple_table; + +DROP TABLE simple_table; +disable_query_log; +DISCONNECT second_connection; +enable_query_log; + +SET GLOBAL query_cache_size = @tmp_query_cache_size; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test new file mode 100644 index 00000000..8d3a569d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test @@ -0,0 +1,58 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +DELETE FROM diaries WHERE id = 1; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test new file mode 100644 index 00000000..df568a79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test @@ -0,0 +1,55 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +UPDATE diaries SET title = "survey day!" WHERE id = 1; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test new file mode 100644 index 00000000..f538c3d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test @@ -0,0 +1,62 @@ +# Copyright(C) 2011-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日からはじめました。"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日の富士山の天気について"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気がよくてきれいに見える。"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) + ORDER BY id; +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+今日" IN BOOLEAN MODE) + ORDER BY id; + +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰り道", "つかれたー"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "久しぶり", "天気が悪いからずっと留守番。"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "初雪", "今年はじめての雪!"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("+悪い" IN BOOLEAN MODE) + ORDER BY id; + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test new file mode 100644 index 00000000..fae21d7b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test @@ -0,0 +1,43 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +update t1 set c1=40 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test new file mode 100644 index 00000000..a42c06e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; + +update t1 set c2=c2+100 where c1=1; +select * from t1; +update t1 set c2=c2+100 where c1=2; +select * from t1; +update t1 set c2=c2+100 where c1=3; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test new file mode 100644 index 00000000..2669423f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test @@ -0,0 +1,54 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; + +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; + +set mroonga_dry_write=true; +delete from diaries where id = 2; +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +set mroonga_dry_write=false; +delete from diaries where id = 3; +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +insert into diaries (id, body) values (2, "sleeping..."); +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test new file mode 100644 index 00000000..5e369b24 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test new file mode 100644 index 00000000..f27e9c7d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; + +insert into diaries (body) values ("will start groonga!"); + +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +select * from diaries where match (body) against ("will"); +select * from diaries where match (body) against ("starting"); + +set mroonga_dry_write=false; +update diaries set body = "started groonga." where id = 1; +select * from diaries; +select * from diaries where match (body) against ("will"); +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test new file mode 100644 index 00000000..a81468ea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test @@ -0,0 +1,60 @@ +# Copyright(C) 2012-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) 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 ("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 + +disable_query_log; +CONNECT(search_connection, localhost, root); +enable_query_log; +USE test; + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +disable_query_log; +DISCONNECT search_connection; +CONNECTION default; +enable_query_log; + +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 new file mode 100644 index 00000000..94f1a3ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'tokenizer "TokenDelimit"' +) 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); + +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 mroonga_match_escalation_threshold = -1; +--enable_warnings +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/packages/Makefile.am b/storage/mroonga/packages/Makefile.am new file mode 100644 index 00000000..fed925c3 --- /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 00000000..0ebc7f67 --- /dev/null +++ b/storage/mroonga/packages/apt/Makefile.am @@ -0,0 +1,91 @@ +REPOSITORIES_PATH = repositories +DISTRIBUTIONS = debian +ARCHITECTURES = i386 amd64 +CODE_NAMES = jessie stretch +MYSQL_VARIANTS = 5.5 mariadb-10.0 + +all: + +release: download 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: source env.sh + vagrant destroy --force + for variant in $(MYSQL_VARIANTS); do \ + cp env.sh tmp/; \ + echo "MYSQL_VARIANT=$${variant}" >> tmp/env.sh; \ + for architecture in $(ARCHITECTURES); do \ + for code_name in $(CODE_NAMES); do \ + rm -rf tmp/debian; \ + if [ $${variant} = "5.5" -a $${code_name} = "stretch" ]; then \ + continue; \ + fi; \ + if [ $${code_name} = "stretch" ]; then \ + cp -rp $(srcdir)/../debian-mariadb-10.0 tmp/debian; \ + for f in `find tmp/debian -maxdepth 2 -type f`; do \ + RENAMED=`echo $$f | sed 's/10.0/10.1/'`; \ + sed -i'' 's/10.0/10.1/g' $${f}; \ + if [ $${f} = $$RENAMED ]; then \ + continue; \ + fi; \ + mv $${f} $$RENAMED; \ + done; \ + if [ $${architecture} = "amd64" ]; then \ + sed -i'' 's,lib/mysql/,lib/x86_64-linux-gnu/mariadb18/,' \ + tmp/debian/mariadb-server-10.1-mroonga.install; \ + elif [ $${architecture} = "i386" ]; then \ + sed -i'' 's,lib/mysql/,lib/i386-linux-gnu/mariadb18/,' \ + tmp/debian/mariadb-server-10.1-mroonga.install; \ + fi; \ + else \ + cp -rp $(srcdir)/../debian-$${variant} tmp/debian; \ + fi; \ + id=debian-$$code_name-$$architecture; \ + vagrant up $$id || exit 1; \ + vagrant destroy --force $$id; \ + done; \ + done; \ + done + +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 00000000..ee4a6aeb --- /dev/null +++ b/storage/mroonga/packages/apt/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 => "debian-jessie-i386", + :box => "bento/debian-8.9-i386", + }, + { + :id => "debian-jessie-amd64", + :box => "bento/debian-8.9", + }, + { + :id => "debian-stretch-i386", + :box => "bento/debian-9.1-i386", + }, + { + :id => "debian-stretch-amd64", + :box => "bento/debian-9.1", + }, + ] + + vms.each do |vm| + config.vm.define(vm[:id]) do |node| + # Use official box + node.vm.box = vm[:box] if vm[:box] + # Use box and box_url until official box is released + node.vm.box = vm[:id] if vm[:box_url] + node.vm.box_url = vm[:box_url] if vm[:box_url] + node.vm.provision(:shell, :path => "build-deb.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 = (ENV["VM_CPUS"] || vm_n_cpus).to_i + virtual_box.memory = (ENV["VM_MEMORY"] || 768).to_i + 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 00000000..e0e03d8e --- /dev/null +++ b/storage/mroonga/packages/apt/build-deb.sh @@ -0,0 +1,106 @@ +#!/bin/sh + +LANG=C + +run() +{ + "$@" + if test $? -ne 0; then + echo "Failed $@" + exit 1 + fi +} + +. /vagrant/tmp/env.sh + +code_name=$(lsb_release --codename --short) +case "${MYSQL_VARIANT}" in + mariadb-*) + case "${code_name}" in + stretch) + mysql_server_package=mariadb-server-10.1 + MYSQL_VARIANT=mariadb-10.1 + ;; + *) + mysql_server_package=mariadb-server-${MYSQL_VARIANT##mariadb-} + ;; + esac + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadb-client-lgpl-dev" + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmariadbd-dev" + ;; + *) + mysql_server_package=mysql-server-${MYSQL_VARIANT} + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqlclient-dev" + DEPENDED_PACKAGES="${DEPENDED_PACKAGES} libmysqld-dev" + ;; +esac + +grep '^deb ' /etc/apt/sources.list | \ + sed -e 's/^deb /deb-src /' > /etc/apt/sources.list.d/base-source.list + +run sudo sed -i'' -e 's/httpredir/ftp.jp/g' /etc/apt/sources.list + +run apt-get update +run apt-get install -y lsb-release + +distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z') +case "${distribution}" in + debian) + component=main + run cat < /etc/apt/sources.list.d/groonga.list +deb http://packages.groonga.org/debian/ ${code_name} main +deb-src http://packages.groonga.org/debian/ ${code_name} main +EOF + if ! grep --quiet security /etc/apt/sources.list; then + run cat < /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 < /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 cd build +run tar xfz /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz +run mv ${PACKAGE}-${VERSION} ${PACKAGE}-${MYSQL_VARIANT}-${VERSION} +run tar cfz ${PACKAGE}-${MYSQL_VARIANT}_${VERSION}.orig.tar.gz \ + ${PACKAGE}-${MYSQL_VARIANT}-${VERSION} +run cd ${PACKAGE}-${MYSQL_VARIANT}-${VERSION}/ +run cp -rp /vagrant/tmp/debian debian +# export DEB_BUILD_OPTIONS=noopt +MYSQL_PACKAGE_INFO=$(apt-cache show ${mysql_server_package} | + grep Version | + sort | + tail -1) +MYSQL_PACKAGE_VERSION=${MYSQL_PACKAGE_INFO##Version: } +sed -i'' \ + -e "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/g" \ + -e "s/MARIADB_VERSION/$MYSQL_PACKAGE_VERSION/g" \ + 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.* *.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 00000000..51109aee --- /dev/null +++ b/storage/mroonga/packages/apt/env.sh.in @@ -0,0 +1,16 @@ +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +DEPENDED_PACKAGES=" +debhelper +autotools-dev +libgroonga-dev +pkg-config +libmecab-dev +mecab-utils +gdb +libxml2-dev +unixodbc-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 00000000..57c985f3 --- /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 + jessie|stretch|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 00000000..e0d963ff --- /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 + jessie|stretch|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 00000000..a95ad117 --- /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 < dists/.htaccess +Options +Indexes +EOF + + cat < 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 < 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 < 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 < 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 < 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 + jessie|stretch|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/rpm/Makefile.am b/storage/mroonga/packages/rpm/Makefile.am new file mode 100644 index 00000000..aa1ba3ad --- /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 00000000..72d860a9 --- /dev/null +++ b/storage/mroonga/packages/rpm/centos/Makefile.am @@ -0,0 +1,19 @@ +EXTRA_DIST = \ + mysql55-mroonga.spec.in \ + mysql56-community-mroonga.spec.in \ + mysql57-community-mroonga.spec.in \ + mariadb-mroonga.spec.in \ + mariadb-10.1-mroonga.spec.in \ + mariadb-10.2-mroonga.spec.in \ + percona-server-56-mroonga.spec.in \ + percona-server-57-mroonga.spec.in + +noinst_DATA = \ + mysql55-mroonga.spec \ + mysql56-community-mroonga.spec \ + mysql57-community-mroonga.spec \ + mariadb-mroonga.spec \ + mariadb-10.1-mroonga.spec \ + mariadb-10.2-mroonga.spec \ + percona-server-56-mroonga.spec \ + percona-server-57-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 00000000..d23c499f --- /dev/null +++ b/storage/mroonga/packages/rpm/centos/mariadb-mroonga.spec.in @@ -0,0 +1,486 @@ +%define mariadb_epoch_default 1 +%define mariadb_version_default 5.5.56 +%define mariadb_release_default 2 +%define mariadb_dist_default .el7 +%define mariadb_download_base_url_default http://vault.centos.org/7.4.1708/os/Source/SPackages/ +%define mariadb_spec_file_default mariadb.spec + +%define _mariadb_epoch %{?mariadb_epoch:%{mariadb_epoch}}%{!?mariadb_epoch:%{mariadb_epoch_default}} +%define _mariadb_version %{?mariadb_version:%{mariadb_version}}%{!?mariadb_version:%{mariadb_version_default}} +%define _mariadb_release %{?mariadb_release:%{mariadb_release}}%{!?mariadb_release:%{mariadb_release_default}} +%define _mariadb_dist %{?mariadb_dist:%{mariadb_dist}}%{!?mariadb_dist:%{mariadb_dist_default}} +%define _mariadb_download_base_url %{?mariadb_download_base_url:%{mariadb_download_base_url}}%{!?mariadb_download_base_url:%{mariadb_download_base_url_default}} +%define _mariadb_spec_file %{?mariadb_spec_file:%{mariadb_spec_file}}%{!?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" > /dev/null 2>&1; 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" > /dev/null 2>&1; 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 +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Fri Sep 15 2017 Kouhei Sutou - 7.06-2 +- rebuild against the latest MariaDB. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Wed Dec 16 2015 Kouhei Sutou - 5.10-2 +- rebuild against MariaDB on CentOS 7.2. Reported by Larry Kim. Thanks!!! + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + +* Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 +- new upstream release. + +* Fri May 29 2015 HAYASHI Kentaro - 5.03-1 +- new upstream release. + +* Wed Apr 29 2015 HAYASHI Kentaro - 5.02-1 +- new upstream release. + +* Sun Mar 29 2015 HAYASHI Kentaro - 5.01-1 +- new upstream release. + +* Mon Feb 09 2015 - 5.00-1 +- new upstream release. + +* Thu Jan 29 2015 HAYASHI Kentaro - 4.10-1 +- new upstream release. + +* Wed Jan 14 2015 HAYASHI Kentaro - 4.09-2 +- build against mariadb-5.5.40-2.el7_0. + +* Mon Dec 29 2014 Kouhei Sutou - 4.09-1 +- new upstream release. + +* Sat Nov 29 2014 HAYASHI Kentaro - 4.08-1 +- new upstream release. + +* Wed Oct 29 2014 Kouhei Sutou - 4.07-1 +- new upstream release. + +* Mon Sep 29 2014 Kouhei Sutou - 4.06-1 +- new upstream release. + +* Fri Aug 29 2014 Kouhei Sutou - 4.05-1 +- new upstream release. + +* Thu Aug 14 2014 Kouhei Sutou - 4.04-4 +- build MariaDB for libmysqlservices.a. + +* Thu Aug 14 2014 Kouhei Sutou - 4.04-3 +- support epoch in MariaDB. + +* Wed Aug 13 2014 Kouhei Sutou - 4.04-2 +- build against mariadb-5.5.37-1.el7_0. + +* Sun Aug 10 2014 Kouhei Sutou - 4.04-1 +- initial packaging for CentOS 7 based on mysql-mroogna package. + +* Tue Jul 29 2014 HAYASHI Kentaro - 4.04-1 +- new upstream release. + +* Thu May 29 2014 Kouhei Sutou - 4.03-1 +- new upstream release. + +* Tue Apr 29 2014 Kouhei Sutou - 4.02-1 +- new upstream release. + +* Sat Mar 29 2014 HAYASHI Kentaro - 4.01-1 +- new upstream release. + +* Thu Feb 13 2014 HAYASHI Kentaro - 4.00-2 +- use MySQL 5.1.73-3 on CentOS 6. + +* Sun Feb 09 2014 HAYASHI Kentaro - 4.00-1 +- new upstream release. + +* Wed Jan 29 2014 HAYASHI Kentaro - 3.12-1 +- new upstream release. + +* Sun Dec 29 2013 HAYASHI Kentaro - 3.11-1 +- new upstream release. + +* Sat Dec 7 2013 HAYASHI Kentaro - 3.10-2 +- use MySQL 5.1.71-1 on CentOS 6. + +* Fri Nov 29 2013 HAYASHI Kentaro - 3.10-1 +- new upstream release. + +* Tue Oct 29 2013 HAYASHI Kentaro - 3.09-1 +- new upstream release. + +* Sun Sep 29 2013 HAYASHI Kentaro - 3.08-1 +- new upstream release. +- use MySQL 5.6.14-1 on CentOS 5. + +* Wed Sep 4 2013 HAYASHI Kentaro - 3.07-2 +- fix a bug that mroonga is removed accidentally on upgrade #1918. + Reported by @ceekz. Thanks!!! + +* Thu Aug 29 2013 HAYASHI Kentaro - 3.07-1 +- new upstream release. +- use MySQL 5.6.13-1 on CentOS 5. + +* Mon Jul 29 2013 HAYASHI Kentaro - 3.06-1 +- new upstream release. +- use MySQL 5.6.12-2 on CentOS 5. + +* Sat Jun 29 2013 HAYASHI Kentaro - 3.05-1 +- new upstream release. +- use MySQL 5.6.12 on CentOS 5. + +* Wed May 29 2013 HAYASHI Kentaro - 3.04-1 +- new upstream release. + +* Fri May 10 2013 HAYASHI Kentaro - 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 - 3.03-1 +- new upstream release. + +* Fri Mar 29 2013 HAYASHI Kentaro - 3.02-0 +- new upstream release. + +* Thu Feb 28 2013 HAYASHI Kentaro - 3.01-0 +- new upstream release. + +* Sat Feb 09 2013 HAYASHI Kentaro - 3.00-0 +- new upstream release. +- require groonga 3.0.0 or later + +* Tue Feb 05 2013 HAYASHI Kentaro - 2.10-2 +- use MySQL 5.1.67-1 on CentOS 6. + Reported by wakisuke.ua. Thanks!!! + +* Sat Dec 29 2012 HAYASHI Kentaro - 2.10-0 +- new upstream release. + +* Mon Dec 10 2012 HAYASHI Kentaro - 2.09-1 +- use MySQL 5.1.66-2 on CentOS 6. + Reported by wakisuke.ua. Thanks!!! + +* Thu Nov 29 2012 HAYASHI Kentaro - 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 - 2.08-0 +- new upstream release. +- add missing "DROP FUNCTION mroonga_snippet". + Reported by @tokuhy. Thanks!!! + +* Sat Sep 29 2012 HAYASHI Kentaro - 2.07-0 +- new upstream release. + +* Wed Aug 29 2012 Kouhei Sutou - 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 - 2.05-0 +- new upstream release. +- use MySQL 5.5.25a. + +* Fri Jun 29 2012 Kouhei Sutou - 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 - 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 - 2.02-0 +- new upstream release. +- use MySQL 5.5.23. +- require groonga 2.0.2 or later. + +* Thu Mar 29 2012 Kouhei Sutou - 2.01-0 +- new upstream release. +- ensure plugin is uninstalled by closing all tables use mroonga. + +* Wed Feb 29 2012 Kouhei Sutou - 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 - 1.20-0 +- new upstream release. +- require groonga 1.3.0. +- groonga -> mroonga. +- use MySQL 5.5.20. + +* Thu Dec 29 2011 Kouhei Sutou - 1.11-0 +- new upstream release. + +* Sat Oct 29 2011 Kouhei Sutou - 1.10-0 +- new upstream release. +- groonga storage engine -> mroonga. + +* Thu Sep 29 2011 Kouhei Sutou - 1.0.0-0 +- new upstream release. + +* Mon Aug 29 2011 Kouhei Sutou - 0.9-0 +- new upstream release. + +* Fri Jul 29 2011 Kouhei Sutou - 0.8-0 +- new upstream release. + +* Wed Jun 29 2011 Kouhei Sutou - 0.7-0 +- new upstream release. + +* Sun May 29 2011 Kouhei Sutou - 0.6-0 +- new upstream release. + +* Tue May 17 2011 Kouhei Sutou - 0.5-2 +- use MySQL 5.5.12. + +* Tue Mar 29 2011 Kouhei Sutou - 0.5-1 +- new upstream release. + +* Sat Jan 29 2011 Kouhei Sutou - 0.4-4 +- do not remove plugin on upgrade. + +* Wed Jan 12 2011 Kouhei Sutou - 0.4-3 +- rebuild without debug symbol. + +* Thu Dec 30 2010 Kouhei Sutou - 0.4-2 +- use MySQL 5.5.8-1. +- fix SQL literal notation. + +* Mon Nov 29 2010 Kouhei Sutou - 0.4-1 +- use the latest MySQL. +- new upstream release. + +* Sun Nov 21 2010 Kouhei Sutou - 0.3-2 +- install user define function. + +* Fri Oct 29 2010 Kouhei Sutou - 0.3-1 +- new upstream release. + +* Fri Oct 08 2010 Kouhei Sutou - 0.2-2 +- specify target MySQL version. +- use %{version}. + +* Wed Sep 29 2010 Kouhei Sutou - 0.2-1 +- new upstream release. + +* Sun Sep 12 2010 Kouhei Sutou - 0.1-3 +- require MySQL-client-community. + +* Fri Sep 10 2010 Kouhei Sutou - 0.1-2 +- use MySQL-devel-community. + +* Fri Sep 03 2010 Kouhei Sutou - 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 00000000..8bd2ba54 --- /dev/null +++ b/storage/mroonga/packages/rpm/centos/mysql55-mroonga.spec.in @@ -0,0 +1,311 @@ +%{?scl:%scl_package mroonga} +%{!?scl:%global pkg_name %{name}} +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} + +%if %{_centos_ver} == 6 +%define mysql_version_default 5.5.52 +%define mysql_release_default 1 +%define mysql_dist_default el6 +%define mysql_download_base_url_default http://vault.centos.org/6.8/sclo/Source/rh/mysql55/ +%define mysql_spec_file_default mysql.spec +%else +%define mysql_version_default 5.5.45 +%define mysql_release_default 1 +%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 + +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?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'` +if $mysql_command -u root -e "quit" > /dev/null 2>&1; 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=`$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" > /dev/null 2>&1; 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 +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + +* Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 +- new upstream release. + +* Fri May 29 2015 HAYASHI Kentaro - 5.03-1 +- new upstream release. + +* Wed Apr 29 2015 HAYASHI Kentaro - 5.02-1 +- new upstream release. + +* Sun Mar 29 2015 HAYASHI Kentaro - 5.01-1 +- new upstream release. + +* Mon Feb 09 2015 - 5.00-1 +- new upstream release. + +* Thu Jan 29 2015 HAYASHI Kentaro - 4.10-1 +- new upstream release. + +* Mon Dec 29 2014 Kouhei Sutou - 4.09-1 +- new upstream release. + +* Sat Nov 29 2014 HAYASHI Kentaro - 4.08-1 +- new upstream release. + +* Wed Oct 29 2014 Kouhei Sutou - 4.07-1 +- new upstream release. + +* Mon Sep 29 2014 Kouhei Sutou - 4.06-1 +- new upstream release. + +* Fri Aug 29 2014 Kouhei Sutou - 4.05-1 +- new upstream release. + +* Tue Jul 29 2014 HAYASHI Kentaro - 4.04-1 +- new upstream release. + +* Thu May 29 2014 Kouhei Sutou - 4.03-2 +- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!! + +* Thu May 29 2014 Kouhei Sutou - 4.03-1 +- new upstream release. + +* Tue Apr 29 2014 Kouhei Sutou - 4.02-1 +- new upstream release. + +* Sat Mar 29 2014 HAYASHI Kentaro - 4.01-1 +- new upstream release. + +* Thu Mar 06 2014 HAYASHI Kentaro - 4.00-2 +- use MySQL 5.5.36 on CentOS 5. + +* Sun Feb 09 2014 HAYASHI Kentaro - 4.00-1 +- new upstream release. + +* Wed Jan 29 2014 HAYASHI Kentaro - 3.12-1 +- new upstream release. + +* Sun Dec 29 2013 HAYASHI Kentaro - 3.11-1 +- new upstream release. + +* Fri Nov 29 2013 HAYASHI Kentaro - 3.10-1 +- new upstream release. + +* Tue Oct 29 2013 HAYASHI Kentaro - 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 00000000..dea7cebc --- /dev/null +++ b/storage/mroonga/packages/rpm/centos/mysql56-community-mroonga.spec.in @@ -0,0 +1,374 @@ +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} + +%if %{_centos_ver} == 7 +%define mysql_version_default 5.6.37 +%define mysql_release_default 2 +%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.37 +%define mysql_release_default 2 +%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 + +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?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: numactl-devel +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} \ + --enable-fast-mutexes \ + %{?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 ! /sbin/service mysqld status > /dev/null; then + /sbin/service mysqld start + stop_after_installation=1 +else + stop_after_installation=0 +fi + +mysql_command=`which mysql` +if $mysql_command -u root -e "quit" > /dev/null 2>&1; 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=`$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") + +if [ "$stop_after_installation" = "1" ]; then + /sbin/service mysqld stop +fi + +%preun +if ! /sbin/service mysqld status > /dev/null; then + /sbin/service mysqld start + stop_after_uninstallation=1 +else + stop_after_uninstallation=0 +fi + +uninstall_sql=%{_datadir}/mroonga/uninstall.sql +mysql_command=`which mysql` +if $mysql_command -u root -e "quit" > /dev/null 2>&1; 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 + +if [ "$stop_after_uninstallation" = "1" ]; then + /sbin/service mysqld stop +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 +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Wed Aug 23 2017 Kentaro Hayashi - 7.05-2 +- build against MySQL 5.6.37 on CentOS 7. Reported by Hiroshi Kagami. Thanks!!! + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Fri Jul 21 2017 Kentaro Hayashi - 7.04-2 +- build against MySQL 5.6.37 on CentOS 6. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Apr 12 2017 Kentaro Hayashi - 7.01-2 +- build against MySQL 5.6.36 Reported by @tigersun2000. Thanks!!! + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Mon Oct 24 2016 Kouhei Sutou - 6.09-2 +- build against MySQL 5.6.34. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Wed Sep 14 2016 Kentaro Hayashi - 6.08-2 +- build against MySQL 5.6.33. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Mon Jun 06 2016 Kouhei Sutou - 6.03-2 +- build against MySQL 5.6.30. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Wed Dec 09 2015 Kouhei Sutou - 5.10-2 +- build against MySQL 5.6.28. Reported by @stealthinu. Thanks!!! + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Sat Oct 03 2015 Kouhei Sutou - 5.08-2 +- build against MySQL 5.6.27. Reported by @star_orihime. Thanks!!! + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Wed Jul 29 2015 Masafumi Yokoyama - 5.05-1 +- new upstream release. + +* Mon Jun 29 2015 Masafumi Yokoyama - 5.04-1 +- new upstream release. + +* Tue Jun 02 2015 Masafumi Yokoyama - 5.03-2 +- build against MySQL 5.6.25. + +* Fri May 29 2015 HAYASHI Kentaro - 5.03-1 +- new upstream release. + +* Wed Apr 29 2015 HAYASHI Kentaro - 5.02-1 +- new upstream release. + +* Fri Apr 10 2015 Kouhei Sutou - 5.01-2 +- build against MySQL 5.6.24. + +* Sun Mar 29 2015 HAYASHI Kentaro - 5.01-1 +- new upstream release. + +* Mon Feb 09 2015 HAYASHI Kentaro - 5.00-1 +- new upstream release. + +* Wed Feb 04 2015 HAYASHI Kentaro - 4.10-2 +- build against MySQL 5.6.23-2 on MySQL yum repository. + +* Thu Jan 29 2015 HAYASHI Kentaro - 4.10-1 +- new upstream release. + +* Mon Dec 29 2014 Kouhei Sutou - 4.09-1 +- new upstream release. + +* Sat Nov 29 2014 HAYASHI Kentaro - 4.08-1 +- new upstream release. + +* Wed Oct 29 2014 Kouhei Sutou - 4.07-1 +- new upstream release. + +* Mon Sep 29 2014 Kouhei Sutou - 4.06-1 +- new upstream release. + +* Sat Sep 27 2014 Eiichi Sato - 4.05-2 +- build against MySQL 5.6.21-2 on MySQL yum repository. + +* Fri Aug 29 2014 Kouhei Sutou - 4.05-1 +- new upstream release. + +* Sat Aug 09 2014 Eiichi Sato - 4.04-2 +- build against MySQL 5.6.20-4 on MySQL yum repository. + +* Tue Jul 29 2014 HAYASHI Kentaro - 4.04-1 +- new upstream release. + +* Thu May 29 2014 Kouhei Sutou - 4.03-2 +- build against MySQL 5.6.37. Reported by YOSHIDA Mitsuo. Thanks!!! + +* Thu May 29 2014 Kouhei Sutou - 4.03-1 +- new upstream release. + +* Tue Apr 29 2014 Kouhei Sutou - 4.02-1 +- new upstream release. + +* Sat Mar 29 2014 HAYASHI Kentaro - 4.01-1 +- new upstream release. + +* Thu Mar 06 2014 HAYASHI Kentaro - 4.00-2 +- use MySQL 5.5.36 on CentOS 5. + +* Sun Feb 09 2014 HAYASHI Kentaro - 4.00-1 +- new upstream release. + +* Wed Jan 29 2014 HAYASHI Kentaro - 3.12-1 +- new upstream release. + +* Sun Dec 29 2013 HAYASHI Kentaro - 3.11-1 +- new upstream release. + +* Fri Nov 29 2013 HAYASHI Kentaro - 3.10-1 +- new upstream release. + +* Tue Oct 29 2013 HAYASHI Kentaro - 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 00000000..abf3bfde --- /dev/null +++ b/storage/mroonga/packages/rpm/centos/percona-server-56-mroonga.spec.in @@ -0,0 +1,273 @@ +%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:5} + +%define mysql_version_default 5.6.37 +%define mysql_release_default rel82.2 +%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 + +%define _mysql_version %{?mysql_version:%{mysql_version}}%{!?mysql_version:%{mysql_version_default}} +%define _mysql_release %{?mysql_release:%{mysql_release}}%{!?mysql_release:%{mysql_release_default}} +%define _mysql_dist %{?mysql_dist:%{mysql_dist}}%{!?mysql_dist:%{mysql_dist_default}} +%define _mysql_download_base_url %{?mysql_download_base_url:%{mysql_download_base_url}}%{!?mysql_download_base_url:%{mysql_download_base_url_default}} +%define _mysql_spec_file %{?mysql_spec_file:%{mysql_spec_file}}%{!?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} \ + --enable-fast-mutexes \ + %{?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 ! /sbin/service mysql status > /dev/null; then + /sbin/service mysql start + stop_after_installation=1 +else + stop_after_installation=0 +fi + +mysql_command=`which mysql` +password_option="" + +if $mysql_command -u root -e "quit" > /dev/null 2>&1; 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=`$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") + +if [ "$stop_after_installation" = "1" ]; then + /sbin/service mysql stop +fi + +%preun +if ! /sbin/service mysql status > /dev/null; then + /sbin/service mysql start + stop_after_uninstallation=1 +else + stop_after_uninstallation=0 +fi + +uninstall_sql=%{_datadir}/mroonga/uninstall.sql +mysql_command=`which mysql` +if $mysql_command -u root -e "quit" > /dev/null 2>&1; 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 + +if [ "$stop_after_uninstallation" = "1" ]; then + /sbin/service mysql stop +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 +* Thu Oct 12 2017 Kentaro Hayashi - 7.07-1 +- new upstream release. + +* Tue Aug 29 2017 Kentaro Hayashi - 7.06-1 +- new upstream release. + +* Mon Aug 14 2017 Kentaro Hayashi - 7.05-2 +- build against Percona Server 5.6.36rel82.1 Reported by @tigersun2000_twitter. Thanks!!! + +* Sat Jul 29 2017 Kentaro Hayashi - 7.05-1 +- new upstream release. + +* Thu Jun 29 2017 Kentaro Hayashi - 7.04-1 +- new upstream release. + +* Mon May 29 2017 Kentaro Hayashi - 7.03-1 +- new upstream release. + +* Thu May 17 2017 Kentaro Hayashi - 7.02-2 +- build against Percona Server 5.6.36. Reported by @pinpikokun. Thanks!!! + +* Sat Apr 29 2017 Kentaro Hayashi - 7.02-1 +- new upstream release. + +* Wed Mar 29 2017 Kentaro Hayashi - 7.01-1 +- new upstream release. + +* Thu Feb 09 2017 Kentaro Hayashi - 7.00-1 +- new upstream release. + +* Fri Jan 13 2017 Kouhei Sutou - 6.13-1 +- new upstream release. + +* Thu Dec 29 2016 Kentaro Hayashi - 6.12-1 +- new upstream release. + +* Tue Nov 29 2016 Kentaro Hayashi - 6.11-1 +- new upstream release. + +* Sat Oct 29 2016 Kentaro Hayashi - 6.10-1 +- new upstream release. + +* Mon Oct 24 2016 Kouhei Sutou - 6.09-2 +- build against Percona Server 5.6.33. Reported by Hiroshi Kagami. Thanks!!! + +* Thu Sep 29 2016 Kentaro Hayashi - 6.09-1 +- new upstream release. + +* Mon Aug 29 2016 Kentaro Hayashi - 6.08-1 +- new upstream release. + +* Fri Jul 29 2016 Kentaro Hayashi - 6.07-1 +- new upstream release. + +* Thu Jun 30 2016 Masafumi Yokoyama - 6.06-1 +- new upstream release. + +* Wed Jun 29 2016 Kentaro Hayashi - 6.05-1 +- new upstream release. + +* Sun May 29 2016 Kentaro Hayashi - 6.03-1 +- new upstream release. + +* Fri Apr 29 2016 HAYASHI Kentaro - 6.02-1 +- new upstream release. + +* Tue Mar 29 2016 Masafumi Yokoyama - 6.01-1 +- new upstream release. + +* Mon Feb 29 2016 Kouhei Sutou - 6.00-1 +- new upstream release. + +* Fri Jan 29 2016 Kouhei Sutou - 5.12-1 +- new upstream release. + +* Tue Dec 29 2015 Kouhei Sutou - 5.11-1 +- new upstream release. + +* Sun Nov 29 2015 Kouhei Sutou - 5.10-1 +- new upstream release. + +* Thu Oct 29 2015 Kouhei Sutou - 5.09-1 +- new upstream release. + +* Tue Sep 29 2015 Kouhei Sutou - 5.08-1 +- new upstream release. + +* Mon Aug 31 2015 Kouhei Sutou - 5.06-1 +- new upstream release. + +* Tue Mar 17 2015 Kouhei Sutou - 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 00000000..efd09777 --- /dev/null +++ b/storage/mroonga/packages/source/Makefile.am @@ -0,0 +1,125 @@ +MROONGA_BASE = $(PACKAGE)-$(VERSION) +MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz + +GROONGA_VERSION = 7.0.7 +GROONGA_BASE = groonga-$(GROONGA_VERSION) +GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz + +GROONGA_NORMALIZER_MYSQL_VERSION = 1.1.1 +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.1.28 +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: download 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 + cd $(GROONGA_BASE)/vendor && ruby download_mecab.rb + cd $(GROONGA_BASE)/vendor && ruby download_lz4.rb + 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 00000000..c135088b --- /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 00000000..7241391b --- /dev/null +++ b/storage/mroonga/packages/ubuntu/Makefile.am @@ -0,0 +1,57 @@ +CODE_NAMES = trusty,xenial,zesty +SOURCE = ../$(PACKAGE)-$(VERSION).tar.gz +SOURCE_55_BASE = $(PACKAGE)-5.5 +SOURCE_55 = $(SOURCE_55_BASE)_$(VERSION).orig.tar.gz +SOURCE_56_BASE = $(PACKAGE)-5.6 +SOURCE_56 = $(SOURCE_56_BASE)_$(VERSION).orig.tar.gz +SOURCE_57_BASE = $(PACKAGE)-5.7 +SOURCE_57 = $(SOURCE_57_BASE)_$(VERSION).orig.tar.gz +SOURCE_MARIADB_10_0_BASE = $(PACKAGE)-mariadb-10.0 +SOURCE_MARIADB_10_0 = $(SOURCE_MARIADB_10_0_BASE)_$(VERSION).orig.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-directory '$(builddir)/' \ + --code-names '$(CODE_NAMES)' \ + --debian-base-directory '$(srcdir)/../' \ + --ppa '$(LAUNCHPAD_PPA)' \ + --pgp-sign-key '$(LAUNCHPAD_UPLOADER_PGP_KEY)' + +source: $(SOURCE_55) $(SOURCE_56) $(SOURCE_57) $(SOURCE_MARIADB_10_0) + +$(SOURCE): + ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $(SOURCE) + +$(SOURCE_55): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_55_BASE)-$(VERSION) + tar cfz $(SOURCE_55) $(SOURCE_55_BASE)-$(VERSION) + rm -r $(SOURCE_55_BASE)-$(VERSION) + +$(SOURCE_56): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_56_BASE)-$(VERSION) + tar cfz $(SOURCE_56) $(SOURCE_56_BASE)-$(VERSION) + rm -r $(SOURCE_56_BASE)-$(VERSION) + +$(SOURCE_57): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_57_BASE)-$(VERSION) + tar cfz $(SOURCE_57) $(SOURCE_57_BASE)-$(VERSION) + rm -r $(SOURCE_57_BASE)-$(VERSION) + +$(SOURCE_MARIADB_10_0): $(SOURCE) + tar xf $(SOURCE) + mv $(PACKAGE)-$(VERSION) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) + tar cfz $(SOURCE_MARIADB_10_0) $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) + rm -r $(SOURCE_MARIADB_10_0_BASE)-$(VERSION) diff --git a/storage/mroonga/packages/ubuntu/upload.rb b/storage/mroonga/packages/ubuntu/upload.rb new file mode 100755 index 00000000..c8ca8aa5 --- /dev/null +++ b/storage/mroonga/packages/ubuntu/upload.rb @@ -0,0 +1,247 @@ +#!/usr/bin/env ruby +# +# Copyright(C) 2014-2016 Kouhei Sutou +# Copyright(C) 2014 HAYASHI Kentaro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License 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-1335 USA + +require "optparse" +require "fileutils" +require "pathname" +require "open-uri" + +class Uploader + def initialize + @dput_configuration_name = "groonga-ppa" + @use_pbuilder = false + end + + def run + ensure_dput_configuration + + parse_command_line! + + ensure_mysql_version + + @required_groonga_version = required_groonga_version + + @code_names.each do |code_name| + mysql55_version = @mysql55_versions[code_name] + mysql56_version = @mysql56_versions[code_name] + mysql57_version = @mysql57_versions[code_name] + mariadb10_0_version = @mariadb10_0_versions[code_name] + if mysql55_version + upload(code_name, "5.5", mysql55_version) + end + if mysql56_version + upload(code_name, "5.6", mysql56_version) + end + if mysql57_version + upload(code_name, "5.7", mysql57_version) + end + if mariadb10_0_version + upload(code_name, "mariadb-10.0", mariadb10_0_version) + end + 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_versions = {} + @mysql55_versions = {} + @mysql56_versions = {} + @mysql57_versions = {} + @mariadb10_0_versions = {} + @code_names.each do |code_name| + source_names = [code_name, "#{code_name}-updates"] + source_names.each do |source_name| + allpackages_url = + "http://packages.ubuntu.com/#{source_name}/allpackages?format=txt.gz" + open(allpackages_url) do |file| + file.each_line do |line| + case line + when /\Amysql-server \((.+?)[\s)]/ + @mysql_versions[code_name] = $1 + when /\Amysql-server-5\.5 \((.+?)[\s)]/ + @mysql55_versions[code_name] = $1 + when /\Amysql-server-5\.6 \((.+?)[\s)]/ + @mysql56_versions[code_name] = $1 + when /\Amysql-server-5\.7 \((.+?)[\s)]/ + @mysql57_versions[code_name] = $1 + when /\Amariadb-server-10\.0 \((.+?)[\s)]/ + @mariadb10_0_versions[code_name] = $1 + end + end + 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-directory=DIRECTORY", + "The directory that has source archives") do |directory| + @source_archive_directory = Pathname.new(directory).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-base-directory=DIRECTORY", + "The directory that has debianXX/ directory") do |directory| + @debian_base_directory = Pathname.new(directory).expand_path + end + parser.on("--ppa=PPA", + "The personal package archive name (groonga-ppa or groonga-nightly") do |ppa| + @dput_configuration_name = ppa + 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("--[no-]pbuilder", + "Use pbuilder for build check") do |use_pbuilder| + @use_pbuilder = use_pbuilder + end + + parser.parse! + end + + def upload(code_name, mysql_short_version, mysql_version) + default_mysql_version = (@mysql_versions[code_name] == mysql_version) + deb_package_name = "#{@package}-#{mysql_short_version}" + in_temporary_directory do + source_archive = + @source_archive_directory + "#{deb_package_name}_#{@version}.orig.tar.gz" + run_command("tar", "xf", source_archive.to_s) + directory_name = "#{deb_package_name}-#{@version}" + Dir.chdir(directory_name) do + debian_directory = + @debian_base_directory + "debian-#{mysql_short_version}" + 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}.") + remove_versionless_mroonga = true + if default_mysql_version or mysql_short_version.start_with?("mariadb-") + remove_versionless_mroonga = false + end + if remove_versionless_mroonga + control_content = File.read("debian/control") + File.open("debian/control", "w") do |control| + in_mysql_server_mroonga = false + control_content.each_line do |line| + case line.chomp + when "" + if in_mysql_server_mroonga + in_mysql_server_mroonga = false + else + control.print(line) + end + when "Package: mysql-server-mroonga" + in_mysql_server_mroonga = true + else + next if in_mysql_server_mroonga + control.print(line) + end + end + end + end + run_command("sed", + "-i", "-e", + "s,MYSQL_VERSION\\|MARIADB_VERSION,#{mysql_version},", + "debian/control") + run_command("debuild", + "--no-lintian", + # Workaround for Launchpad. Launchpad doesn't accept + # .buildinfo yet. + # See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853795 + "--buildinfo-option=-O", + "-d", + "-S", + "-sa", + "-pgpg2", + "-k#{@pgp_sign_key}") + if @use_pbuilder + run_command("pbuilder-dist", code_name, "build", + "../#{deb_package_name}_#{deb_version}.dsc") + else + run_command("dput", @dput_configuration_name, + "../#{deb_package_name}_#{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 00000000..240c3873 --- /dev/null +++ b/storage/mroonga/packages/windows/Makefile.am @@ -0,0 +1,12 @@ +EXTRA_DIST = \ + README.md \ + build-vc2015.bat \ + build-vc2015-zip-32.bat \ + build-vc2015-zip-64.bat \ + build-vc2015-msi-32.bat \ + build-vc2015-msi-64.bat \ + build-vc2017.bat \ + build-vc2017-zip-32.bat \ + build-vc2017-zip-64.bat \ + build-vc2017-msi-32.bat \ + build-vc2017-msi-64.bat diff --git a/storage/mroonga/packages/windows/README.md b/storage/mroonga/packages/windows/README.md new file mode 100644 index 00000000..8737f262 --- /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 Studio 2015 for Windows Desktop or later to build Mroonga with express +edition. `build-vc2015.bat` is a build batch script to build with +Visual Studio 2015 for Windows Desktop. + +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 Studio Community + +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-vc2015.bat`. +And then, you can build MSI package with Visual Studio 2015 Community. 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 00000000..69d803e8 --- /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 2015" > 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 00000000..a3d6681b --- /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 2015 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 00000000..8247fd54 --- /dev/null +++ b/storage/mroonga/packages/windows/build-vc2015-zip-32.bat @@ -0,0 +1,13 @@ +rmdir /S /Q build-vc2015-zip-32 +mkdir build-vc2015-zip-32 +cd build-vc2015-zip-32 +cmake ..\source -G "Visual Studio 14 2015" ^ + -DMRN_GROONGA_EMBED=OFF ^ + -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^ + -DGRN_WITH_BUNDLED_LZ4=ON ^ + -DGRN_WITH_BUNDLED_MECAB=ON ^ + > 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 00000000..b56d80eb --- /dev/null +++ b/storage/mroonga/packages/windows/build-vc2015-zip-64.bat @@ -0,0 +1,13 @@ +rmdir /S /Q build-vc2015-zip-64 +mkdir build-vc2015-zip-64 +cd build-vc2015-zip-64 +cmake ..\source -G "Visual Studio 14 2015 Win64" ^ + -DMRN_GROONGA_EMBED=OFF ^ + -DMRN_GROONGA_NORMALIZER_MYSQL_EMBED=OFF ^ + -DGRN_WITH_BUNDLED_LZ4=ON ^ + -DGRN_WITH_BUNDLED_MECAB=ON ^ + > 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 00000000..729f181d --- /dev/null +++ b/storage/mroonga/packages/windows/build-vc2015.bat @@ -0,0 +1,4 @@ +call build-vc2015-zip-32.bat +call 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 00000000..9d1bd606 --- /dev/null +++ b/storage/mroonga/packages/yum/Makefile.am @@ -0,0 +1,77 @@ +REPOSITORIES_PATH = repositories +DISTRIBUTIONS = centos +ARCHITECTURES = i386 x86_64 +MYSQL_VARIANTS = \ + mysql55 \ + mysql56-community \ + mysql57-community \ + mariadb \ + mariadb-10.1 \ + mariadb-10.2 \ + percona-server-56 \ + percona-server-57 +CENTOS_VERSIONS = 6 7 +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)" \ + "$(CENTOS_VERSIONS)" + +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)/mariadb-10.1-$(PACKAGE).spec +specs: $(SPEC_DIR)/mariadb-10.2-$(PACKAGE).spec +specs: $(SPEC_DIR)/percona-server-56-$(PACKAGE).spec +specs: $(SPEC_DIR)/percona-server-57-$(PACKAGE).spec diff --git a/storage/mroonga/packages/yum/Vagrantfile b/storage/mroonga/packages/yum/Vagrantfile new file mode 100644 index 00000000..af14bc9a --- /dev/null +++ b/storage/mroonga/packages/yum/Vagrantfile @@ -0,0 +1,42 @@ +# -*- 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-6-i386", + :box => "bento/centos-6.9-i386", + }, + { + :id => "centos-6-x86_64", + :box => "bento/centos-6.9", + }, + { + :id => "centos-7-x86_64", + :box => "bento/centos-7.4", + }, + ] + + vms.each do |vm| + config.vm.define(vm[:id]) do |node| + node.vm.box = vm[:box] + 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 + virtual_box.memory = (ENV["VM_MEMORY"] || 1024).to_i + 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 00000000..fc84e450 --- /dev/null +++ b/storage/mroonga/packages/yum/build-in-vm.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +if [ $# != 5 ]; then + echo "Usage: $0 PACKAGE SPEC_DIR MYSQL_VARIANTS ARCHITECTURES" + echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64' '6 7'" + exit 1 +fi + +PACKAGE="$1" +SPEC_DIR="$2" +MYSQL_VARIANTS="$3" +ARCHITECTURES="$4" +CENTOS_VERSIONS="$5" + +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="6" + ;; + mysql56-community) + centos_versions="6 7" + ;; + mysql57-community) + centos_versions="6 7" + ;; + mariadb) + centos_versions="7" + ;; + mariadb-10.1) + centos_versions="6 7" + ;; + mariadb-10.2) + centos_versions="6 7" + ;; + percona-server-56) + centos_versions="6 7" + ;; + percona-server-57) + centos_versions="6 7" + ;; + esac + + for architecture in ${architectures}; do + for centos_version in ${centos_versions}; do + skip=1 + for given_version in ${CENTOS_VERSIONS}; do + if [ ${given_version} = ${centos_version} ]; then + skip=0 + fi + done + if [ $skip -eq 1 ]; then + continue + fi + 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 00000000..6ba943ae --- /dev/null +++ b/storage/mroonga/packages/yum/build-rpm.sh @@ -0,0 +1,182 @@ +#!/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 < ~/.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) + release_rpm=groonga-release-1.3.0-1.noarch.rpm + if [ ${distribution_version} = 5 ]; then + wget http://packages.groonga.org/${distribution}/${release_rpm} + run yum install -y --nogpgcheck ${release_rpm} + rm -f ${release_rpm} + else + run yum install -y \ + http://packages.groonga.org/${distribution}/${release_rpm} + fi + run yum makecache + + 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 + ;; + mysql5?-community-${PACKAGE}) + release_rpm=mysql-community-release-el${distribution_version}-7.noarch.rpm + run yum -y install http://repo.mysql.com/${release_rpm} + if [ "${package_name}" = "mysql57-community-${PACKAGE}" ]; then + run yum install -y yum-utils + run yum-config-manager --disable mysql56-community + run yum-config-manager --enable mysql57-community + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + fi + run yum install -y mysql-community-devel + ;; + mariadb-${PACKAGE}) + run yum install -y mariadb-devel + ;; + mariadb-10.1-${PACKAGE}) + if [ "${architecture}" = "x86_64" ]; then + mariadb_architecture="amd64" + else + mariadb_architecture="x86" + fi + cat < /etc/yum.repos.d/MariaDB.repo +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/${distribution}${distribution_version}-${mariadb_architecture} +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +REPO + run yum install -y MariaDB-devel + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + ;; + mariadb-10.2-${PACKAGE}) + if [ "${architecture}" = "x86_64" ]; then + mariadb_architecture="amd64" + else + mariadb_architecture="x86" + fi + cat < /etc/yum.repos.d/MariaDB.repo +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.2/${distribution}${distribution_version}-${mariadb_architecture} +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +REPO + run yum install -y MariaDB-devel + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + ;; + percona-server-56-${PACKAGE}) + release_rpm_version=0.1-4 + release_rpm=percona-release-${release_rpm_version}.noarch.rpm + run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm} + run yum install -y Percona-Server-devel-56 + ;; + percona-server-57-${PACKAGE}) + release_rpm_version=0.1-4 + release_rpm=percona-release-${release_rpm_version}.noarch.rpm + run yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm} + run yum install -y Percona-Server-devel-57 + if [ ${distribution_version} = 6 ]; then + run yum install -y cmake28 + fi + ;; + esac + ;; +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 [ "${package_name}" = "percona-server-57-${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 00000000..3d327a17 --- /dev/null +++ b/storage/mroonga/packages/yum/env.sh.in @@ -0,0 +1,32 @@ +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +DEPENDED_PACKAGES=" +intltool +libtool +gcc +gcc-c++ +make +gperf +readline-devel +openssl-devel +zlib-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 +numactl-devel +groonga-devel +groonga-normalizer-mysql-devel +cyrus-sasl-devel +openldap-devel +" diff --git a/storage/mroonga/packages/yum/sign-rpm.sh b/storage/mroonga/packages/yum/sign-rpm.sh new file mode 100755 index 00000000..27ec5711 --- /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' | grep -v 'MISSING KEYS' | 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 00000000..59eeafa5 --- /dev/null +++ b/storage/mroonga/packages/yum/update-repository.sh @@ -0,0 +1,27 @@ +#!/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 + test -d $dir && run createrepo $dir + done; +done diff --git a/storage/mroonga/plugin_version b/storage/mroonga/plugin_version new file mode 100644 index 00000000..120096f1 --- /dev/null +++ b/storage/mroonga/plugin_version @@ -0,0 +1 @@ +7.7 \ No newline at end of file diff --git a/storage/mroonga/required_groonga_normalizer_mysql_version b/storage/mroonga/required_groonga_normalizer_mysql_version new file mode 100644 index 00000000..66c4c226 --- /dev/null +++ b/storage/mroonga/required_groonga_normalizer_mysql_version @@ -0,0 +1 @@ +1.0.9 diff --git a/storage/mroonga/required_groonga_version b/storage/mroonga/required_groonga_version new file mode 100644 index 00000000..024b4b9b --- /dev/null +++ b/storage/mroonga/required_groonga_version @@ -0,0 +1 @@ +7.0.6 diff --git a/storage/mroonga/sources.am b/storage/mroonga/sources.am new file mode 100644 index 00000000..c7ddcfa5 --- /dev/null +++ b/storage/mroonga/sources.am @@ -0,0 +1,12 @@ +sources = \ + mrn_macro.hpp \ + mrn_constants.hpp \ + ha_mroonga.cpp \ + ha_mroonga.hpp \ + mrn_table.cpp \ + mrn_table.hpp \ + mrn_err.h \ + mrn_mysql.h \ + mrn_mysql_compat.h \ + mrn_variables.hpp \ + ha_mroonga.def diff --git a/storage/mroonga/test/Makefile.am b/storage/mroonga/test/Makefile.am new file mode 100644 index 00000000..ce75011b --- /dev/null +++ b/storage/mroonga/test/Makefile.am @@ -0,0 +1,14 @@ +SUBDIRS = unit + +TESTS = run-sql-test.sh +TESTS_ENVIRONMENT = \ + NO_MAKE="yes" + +if WITH_CUTTER +TESTS += run-unit-test.sh +TESTS_ENVIRONMENT += CUTTER="$(CUTTER)" +endif + +EXTRA_DIST = \ + run-unit-test.sh \ + run-sql-test.sh diff --git a/storage/mroonga/test/run-sql-test.sh b/storage/mroonga/test/run-sql-test.sh new file mode 100755 index 00000000..589de478 --- /dev/null +++ b/storage/mroonga/test/run-sql-test.sh @@ -0,0 +1,244 @@ +#!/bin/sh +# +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2010-2017 Kouhei Sutou +# Copyright(C) 2011 Kazuhiko +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +export BASE_DIR="$(cd $(dirname $0); pwd)" +top_dir="$BASE_DIR/.." +mroonga_test_dir="${top_dir}/mysql-test/mroonga" + +n_processors=1 +case `uname` in + Linux) + n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)" + ;; + Darwin) + n_processors="$(/usr/sbin/sysctl -n hw.ncpu)" + ;; + *) + : + ;; +esac + +if [ "$NO_MAKE" != "yes" ]; then + MAKE_ARGS= + if [ -n "$n_processors" ]; then + MAKE_ARGS="-j${n_processors}" + fi + make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 +fi + +. "${top_dir}/config.sh" + +bundled_groonga_normalizer_mysql_dir="${top_dir}/vendor/groonga/vendor/plugins/groonga-normalizer-mysql" +if [ -d "${bundled_groonga_normalizer_mysql_dir}" ]; then + GRN_PLUGINS_DIR="${bundled_groonga_normalizer_mysql_dir}" + export GRN_PLUGINS_DIR +fi + +maria_storage_dir="${MYSQL_SOURCE_DIR}/storage/maria" +if [ -d "${maria_storage_dir}" ]; then + mariadb="yes" +else + mariadb="no" +fi +percona_udf_dir="${MYSQL_SOURCE_DIR}/plugin/percona-udf" +if [ -d "${percona_udf_dir}" ]; then + percona="yes" +else + percona="no" +fi + +source_mysql_test_dir="${MYSQL_SOURCE_DIR}/mysql-test" +build_mysql_test_dir="${MYSQL_BUILD_DIR}/mysql-test" +source_test_suites_dir="${source_mysql_test_dir}/suite" +source_test_include_dir="${source_mysql_test_dir}/include" +build_test_suites_dir="${build_mysql_test_dir}/suite" +build_test_include_dir="${build_mysql_test_dir}/include" +case "${MYSQL_VERSION}" in + 5.1.*) + plugins_dir="${MYSQL_BUILD_DIR}/lib/mysql/plugin" + if [ ! -d "${build_test_suites_dir}" ]; then + mkdir -p "${build_test_suites_dir}" + fi + ;; + *) + if [ ! -d "${build_test_suites_dir}" ]; then + ln -s "${source_test_suites_dir}" "${build_test_suites_dir}" + fi + if [ "${mariadb}" = "yes" ]; then + if [ "${MRN_BUNDLED}" != "TRUE" ]; then + mariadb_mroonga_plugin_dir="${MYSQL_BUILD_DIR}/plugin/mroonga" + if [ ! -e "${mariadb_mroonga_plugin_dir}" ]; then + ln -s "${top_dir}" "${mariadb_mroonga_plugin_dir}" + fi + fi + plugins_dir= + elif [ "${percona}" = "yes" ]; then + plugins_dir="${MYSQL_SOURCE_DIR}/lib/mysql/plugin" + else + plugins_dir="${MYSQL_SOURCE_DIR}/lib/plugin" + fi + ;; +esac + +same_link_p() +{ + src=$1 + dest=$2 + if [ -L "$dest" -a "$(readlink "$dest")" = "$src" ]; then + return 0 + else + return 1 + fi +} + +mroonga_mysql_test_suite_dir="${build_test_suites_dir}/mroonga" +if ! same_link_p "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}"; then + rm -rf "${mroonga_mysql_test_suite_dir}" + ln -s "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}" +fi + +innodb_test_suite_dir="${build_test_suites_dir}/innodb" +mroonga_wrapper_innodb_test_suite_name="mroonga_wrapper_innodb" +mroonga_wrapper_innodb_test_suite_dir="${build_test_suites_dir}/${mroonga_wrapper_innodb_test_suite_name}" +mroonga_wrapper_innodb_include_dir="${mroonga_wrapper_innodb_test_suite_dir}/include/" +if [ "$0" -nt "$(dirname "${mroonga_wrapper_innodb_test_suite_dir}")" ]; then + rm -rf "${mroonga_wrapper_innodb_test_suite_dir}" +fi +if [ ! -d "${mroonga_wrapper_innodb_test_suite_dir}" ]; then + cp -rp "${innodb_test_suite_dir}" "${mroonga_wrapper_innodb_test_suite_dir}" + mkdir -p "${mroonga_wrapper_innodb_include_dir}" + cp -rp "${source_test_include_dir}"/innodb[-_]*.inc \ + "${mroonga_wrapper_innodb_include_dir}" + ruby -i'' \ + -pe "\$_.gsub!(/\\bengine\\s*=\\s*innodb\\b([^;\\n]*)/i, + \"ENGINE=mroonga\\\1 COMMENT='ENGINE \\\"InnoDB\\\"'\") + \$_.gsub!(/\\b(storage_engine\\s*=\\s*)innodb\\b([^;\\n]*)/i, + \"\\\1mroonga\") + \$_.gsub!(/^(--\\s*source\\s+)(include\\/innodb)/i, + \"\\\1suite/mroonga_wrapper_innodb/\\\2\") + " \ + ${mroonga_wrapper_innodb_test_suite_dir}/r/*.result \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test \ + ${mroonga_wrapper_innodb_test_suite_dir}/include/*.inc + sed -i'' \ + -e '1 i --source ../mroonga/include/mroonga/have_mroonga.inc' \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test +fi + +all_test_suite_names="" +suite_dir="${mroonga_test_dir}/.." +cd "${suite_dir}" +suite_dir="$(pwd)" +for test_suite_name in \ + $(find mroonga -type d -name 'include' '!' -prune -o \ + -type d '!' -name 'mroonga' \ + '!' -name 'include' \ + '!' -name '[tr]'); do + if [ -n "${all_test_suite_names}" ]; then + all_test_suite_names="${all_test_suite_names}," + fi + all_test_suite_names="${all_test_suite_names}${test_suite_name}" +done +cd - + +if [ -n "${plugins_dir}" ]; then + if [ -d "${top_dir}/.libs" ]; then + make -C ${top_dir} \ + install-pluginLTLIBRARIES \ + plugindir=${plugins_dir} > /dev/null || \ + exit 1 + else + mkdir -p "${plugins_dir}" + cp "${top_dir}/ha_mroonga.so" "${plugins_dir}" || exit 1 + fi +fi + +mysql_test_run_options="" +test_suite_names="" +test_names="" +while [ $# -gt 0 ]; do + arg="$1" + shift + case "$arg" in + --manual-gdb|--gdb|--client-gdb|--boot-gdb|--debug|--valgrind) + n_processors=1 + mysql_test_run_options="${mysql_test_run_options} ${arg}" + ;; + --*) + mysql_test_run_options="${mysql_test_run_options} ${arg}" + ;; + *) + case "$arg" in + */t/*.test) + test_suite_name=$(echo "$arg" | sed -e 's,/t/.*\.test,,g') + test_suite_name=$(cd "$test_suite_name" && pwd) + test_name=$(echo "$arg" | sed -e 's,.*/t/\(.*\)\.test,\1,g') + ;; + *) + if [ -d "$arg" ]; then + test_suite_name=$(cd "$arg" && pwd) + else + test_suite_name="$arg" + fi + test_name="" + ;; + esac + + if [ -n "${test_name}" ]; then + if [ -n "${test_names}" ]; then + test_names="${test_names}|" + fi + test_names="${test_names}${test_name}" + fi + + test_suite_name=$(echo "$test_suite_name" | sed -e "s,^${suite_dir}/,,") + if echo "${test_suite_names}" | grep --quiet "${test_suite_name}"; then + continue + fi + if [ -n "${test_suite_names}" ]; then + test_suite_names="${test_suite_names}," + fi + test_suite_names="${test_suite_names}${test_suite_name}" + ;; + esac +done + +if [ -z "$test_suite_names" ]; then + test_suite_names="${all_test_suite_names}" +fi + +mysql_test_run_args="" +if [ "${percona}" != "yes" ]; then + mysql_test_run_args="${mysql_test_run_args} --mem" +fi +mysql_test_run_args="${mysql_test_run_args} --parallel=${n_processors}" +mysql_test_run_args="${mysql_test_run_args} --retry=1" +mysql_test_run_args="${mysql_test_run_args} --suite=${test_suite_names}" +mysql_test_run_args="${mysql_test_run_args} --force" +mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-load-add=ha_mroonga.so" +mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-mroonga=ON" +if [ -n "$test_names" ]; then + mysql_test_run_args="${mysql_test_run_args} --do-test=${test_names}" +fi + +(cd "$build_mysql_test_dir" && \ + perl -I . ./mysql-test-run.pl \ + ${mysql_test_run_args} \ + ${mysql_test_run_options}) diff --git a/storage/mroonga/test/run-unit-test.sh b/storage/mroonga/test/run-unit-test.sh new file mode 100755 index 00000000..6d995131 --- /dev/null +++ b/storage/mroonga/test/run-unit-test.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +export BASE_DIR="`dirname $0`" +top_dir="$BASE_DIR/.." + +if test -z "$NO_MAKE"; then + MAKE_ARGS= + case `uname` in + Linux) + MAKE_ARGS="-j$(grep '^processor' /proc/cpuinfo | wc -l)" + ;; + Darwin) + MAKE_ARGS="-j$(/usr/sbin/sysctl -n hw.ncpu)" + ;; + *) + : + ;; + esac + make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 +fi + +if test -z "$CUTTER"; then + CUTTER="`make -s -C $top_dir echo-cutter`" +fi +export CUTTER + +CUTTER_ARGS= +CUTTER_WRAPPER= +if test x"$STOP" = x"yes"; then + CUTTER_ARGS="-v v --fatal-failures" +else + CUTTER_ARGS="-v v" +fi + +if test x"$CUTTER_DEBUG" = x"yes"; then + if test x"$TUI_DEBUG" = x"yes"; then + CUTTER_WRAPPER="$top_dir/libtool --mode=execute gdb --tui --args" + else + CUTTER_WRAPPER="$top_dir/libtool --mode=execute gdb --args" + fi + CUTTER_ARGS="--keep-opening-modules" +elif test x"$CUTTER_CHECK_LEAK" = x"yes"; then + CUTTER_WRAPPER="$top_dir/libtool --mode=execute valgrind " + CUTTER_WRAPPER="$CUTTER_WRAPPER --leak-check=full --show-reachable=yes -v" + CUTTER_ARGS="--keep-opening-modules" +fi + +CUTTER_ARGS="$CUTTER_ARGS -s $BASE_DIR" +$CUTTER_WRAPPER $CUTTER $CUTTER_ARGS "$@" $BASE_DIR diff --git a/storage/mroonga/test/unit/Makefile.am b/storage/mroonga/test/unit/Makefile.am new file mode 100644 index 00000000..3950ce0d --- /dev/null +++ b/storage/mroonga/test/unit/Makefile.am @@ -0,0 +1,27 @@ +if WITH_CUTTER +noinst_LTLIBRARIES = \ + test_mrn_path_mapper.la +endif + +AM_CPPFLAGS = \ + $(GROONGA_CFLAGS) \ + $(CPPCUTTER_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/lib + +AM_LDFLAGS = \ + -module \ + -rpath $(libdir) \ + -avoid-version \ + -no-undefined + +LIBS = \ + $(CPPCUTTER_LIBS) \ + $(GROONGA_LIBS) \ + $(MECAB_LIBS) + +test_mrn_path_mapper_la_SOURCES = \ + test_mrn_path_mapper.cpp + +test_mrn_path_mapper_la_LIBADD = \ + $(top_builddir)/lib/libmrn_no_mysql.la diff --git a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp new file mode 100644 index 00000000..3ede8726 --- /dev/null +++ b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp @@ -0,0 +1,134 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*/ + +#include +#include + +#include + +namespace test_mrn_path_mapper { + namespace db_path { + namespace without_prefix { + void test_normal_db() { + mrn::PathMapper mapper("./db/", NULL); + cppcut_assert_equal("db.mrn", mapper.db_path()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("db.mrn", mapper.db_path()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0.mrn", + mapper.db_path()); + } + } + + namespace with_prefix { + void test_normal_db() { + mrn::PathMapper mapper("./db/", "mroonga.data/"); + cppcut_assert_equal("mroonga.data/db.mrn", mapper.db_path()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", "mroonga.data/"); + cppcut_assert_equal("mroonga.data/db.mrn", mapper.db_path()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", "mroonga.data/"); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0.mrn", + mapper.db_path()); + } + } + } + + namespace db_name { + void test_normal_db() { + mrn::PathMapper mapper("./db/", NULL); + cppcut_assert_equal("db", mapper.db_name()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("db", mapper.db_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0", + mapper.db_name()); + } + } + + namespace table_name { + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("table", mapper.table_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("#sql27c5_1_0", mapper.table_name()); + } + + void test_underscore_start_table() { + mrn::PathMapper mapper("./db/_table", NULL); + cppcut_assert_equal("@005ftable", mapper.table_name()); + } + } + + namespace mysql_table_name { + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("table", mapper.mysql_table_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("#sql27c5_1_0", mapper.mysql_table_name()); + } + + void test_underscore_start_table() { + mrn::PathMapper mapper("./db/_table", NULL); + cppcut_assert_equal("_table", mapper.mysql_table_name()); + } + } + + 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/Makefile.am b/storage/mroonga/tools/Makefile.am new file mode 100644 index 00000000..b65b9300 --- /dev/null +++ b/storage/mroonga/tools/Makefile.am @@ -0,0 +1,6 @@ +noinstall_ruby_scripts = \ + prepare-sphinx-html.rb \ + upload-to-github.rb + +EXTRA_DIST = \ + $(noinstall_ruby_scripts) diff --git a/storage/mroonga/tools/prepare-sphinx-html.rb b/storage/mroonga/tools/prepare-sphinx-html.rb new file mode 100755 index 00000000..71e12f0e --- /dev/null +++ b/storage/mroonga/tools/prepare-sphinx-html.rb @@ -0,0 +1,175 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +if ARGV.size != 2 + puts "Usage: #{$0} SOURCE_DIR DEST_DIR" + exit(false) +end + +require 'pathname' +require "fileutils" + +def fix_link(text, extension, language) + send("fix_#{extension}_link", text, language) +end + +def fix_link_path(text) + text.gsub(/\b_(sources|static|images)\b/, '\1') +end + +def fix_language_link(url, language) + url.gsub(/\A((?:\.\.\/){2,})([a-z]{2})\/html\//) do + relative_base_path = $1 + link_language = $2 + close_quote = $3 + if language == "en" + relative_base_path = relative_base_path.gsub(/\A\.\.\//, '') + end + if link_language != "en" + relative_base_path += "#{link_language}/" + end + "#{relative_base_path}docs/" + end +end + +def fix_html_link(html, language) + html = html.gsub(/(href|src)="(.+?)"/) do + attribute = $1 + link = $2 + link = fix_link_path(link) + link = fix_language_link(link, language) + "#{attribute}=\"#{link}\"" + end + html.gsub(/(id="top-link" href=)"(.+?)"/) do + prefix = $1 + top_path = $2.gsub(/\/index\.html\z/, '/') + top_path = "./" if ["index.html", "#"].include?(top_path) + "#{prefix}\"#{top_path}../\"" + end +end + +def fix_js_link(js, language) + fix_link_path(js) +end + +LANGUAGE_TO_LOCALE = { + "ja" => "ja_JP", + "en" => "en_US", +} + +def insert_facebook_html_header(html) + html.gsub(/<\/head>/) do + <<-HTML + + + + + + + + + HTML + end +end + +def insert_facebook_html_fb_root(html) + html.gsub(//) do + <<-HTML + +
+ HTML + end +end + +def insert_facebook_html_buttons(html) + html.gsub(/(