sequel 5.28.0 → 5.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +64 -1922
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/doc/advanced_associations.rdoc +4 -4
- data/doc/association_basics.rdoc +3 -3
- data/doc/code_order.rdoc +12 -2
- data/doc/model_dataset_method_design.rdoc +1 -1
- data/doc/postgresql.rdoc +71 -0
- data/doc/release_notes/5.29.0.txt +22 -0
- data/doc/release_notes/5.30.0.txt +20 -0
- data/doc/release_notes/5.31.0.txt +148 -0
- data/doc/release_notes/5.32.0.txt +46 -0
- data/doc/release_notes/5.33.0.txt +24 -0
- data/doc/testing.rdoc +1 -1
- data/lib/sequel/adapters/postgres.rb +5 -1
- data/lib/sequel/adapters/shared/access.rb +6 -6
- data/lib/sequel/adapters/shared/mssql.rb +5 -5
- data/lib/sequel/adapters/shared/mysql.rb +10 -10
- data/lib/sequel/adapters/shared/oracle.rb +16 -16
- data/lib/sequel/adapters/shared/postgres.rb +169 -14
- data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
- data/lib/sequel/adapters/shared/sqlite.rb +32 -5
- data/lib/sequel/adapters/tinytds.rb +1 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +2 -2
- data/lib/sequel/connection_pool/threaded.rb +1 -1
- data/lib/sequel/core.rb +318 -314
- data/lib/sequel/database/query.rb +1 -1
- data/lib/sequel/database/schema_generator.rb +1 -1
- data/lib/sequel/database/transactions.rb +8 -12
- data/lib/sequel/dataset/misc.rb +2 -2
- data/lib/sequel/extensions/connection_expiration.rb +2 -2
- data/lib/sequel/extensions/connection_validator.rb +2 -2
- data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
- data/lib/sequel/extensions/index_caching.rb +9 -7
- data/lib/sequel/extensions/integer64.rb +2 -0
- data/lib/sequel/extensions/migration.rb +1 -1
- data/lib/sequel/extensions/pg_enum.rb +5 -2
- data/lib/sequel/extensions/pg_hstore.rb +6 -0
- data/lib/sequel/extensions/pg_inet.rb +13 -5
- data/lib/sequel/extensions/pg_interval.rb +2 -0
- data/lib/sequel/extensions/pg_range.rb +2 -0
- data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
- data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
- data/lib/sequel/extensions/schema_dumper.rb +10 -4
- data/lib/sequel/extensions/server_block.rb +3 -3
- data/lib/sequel/model/associations.rb +18 -5
- data/lib/sequel/model/base.rb +60 -53
- data/lib/sequel/model/plugins.rb +1 -0
- data/lib/sequel/plugins/association_lazy_eager_option.rb +66 -0
- data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
- data/lib/sequel/plugins/association_proxies.rb +2 -0
- data/lib/sequel/plugins/boolean_subsets.rb +4 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +26 -26
- data/lib/sequel/plugins/dirty.rb +13 -13
- data/lib/sequel/plugins/empty_failure_backtraces.rb +38 -0
- data/lib/sequel/plugins/forbid_lazy_load.rb +214 -0
- data/lib/sequel/plugins/json_serializer.rb +18 -11
- data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
- data/lib/sequel/plugins/skip_saving_columns.rb +108 -0
- data/lib/sequel/plugins/subclasses.rb +2 -0
- data/lib/sequel/plugins/throw_failures.rb +1 -1
- data/lib/sequel/timezones.rb +6 -4
- data/lib/sequel/version.rb +1 -1
- metadata +18 -367
- data/Rakefile +0 -151
- data/doc/release_notes/4.0.0.txt +0 -262
- data/doc/release_notes/4.1.0.txt +0 -85
- data/doc/release_notes/4.10.0.txt +0 -226
- data/doc/release_notes/4.11.0.txt +0 -147
- data/doc/release_notes/4.12.0.txt +0 -105
- data/doc/release_notes/4.13.0.txt +0 -169
- data/doc/release_notes/4.14.0.txt +0 -68
- data/doc/release_notes/4.15.0.txt +0 -56
- data/doc/release_notes/4.16.0.txt +0 -36
- data/doc/release_notes/4.17.0.txt +0 -38
- data/doc/release_notes/4.18.0.txt +0 -36
- data/doc/release_notes/4.19.0.txt +0 -45
- data/doc/release_notes/4.2.0.txt +0 -129
- data/doc/release_notes/4.20.0.txt +0 -79
- data/doc/release_notes/4.21.0.txt +0 -94
- data/doc/release_notes/4.22.0.txt +0 -72
- data/doc/release_notes/4.23.0.txt +0 -65
- data/doc/release_notes/4.24.0.txt +0 -99
- data/doc/release_notes/4.25.0.txt +0 -181
- data/doc/release_notes/4.26.0.txt +0 -44
- data/doc/release_notes/4.27.0.txt +0 -78
- data/doc/release_notes/4.28.0.txt +0 -57
- data/doc/release_notes/4.29.0.txt +0 -41
- data/doc/release_notes/4.3.0.txt +0 -40
- data/doc/release_notes/4.30.0.txt +0 -37
- data/doc/release_notes/4.31.0.txt +0 -57
- data/doc/release_notes/4.32.0.txt +0 -132
- data/doc/release_notes/4.33.0.txt +0 -88
- data/doc/release_notes/4.34.0.txt +0 -86
- data/doc/release_notes/4.35.0.txt +0 -130
- data/doc/release_notes/4.36.0.txt +0 -116
- data/doc/release_notes/4.37.0.txt +0 -50
- data/doc/release_notes/4.38.0.txt +0 -67
- data/doc/release_notes/4.39.0.txt +0 -127
- data/doc/release_notes/4.4.0.txt +0 -92
- data/doc/release_notes/4.40.0.txt +0 -179
- data/doc/release_notes/4.41.0.txt +0 -77
- data/doc/release_notes/4.42.0.txt +0 -221
- data/doc/release_notes/4.43.0.txt +0 -87
- data/doc/release_notes/4.44.0.txt +0 -125
- data/doc/release_notes/4.45.0.txt +0 -370
- data/doc/release_notes/4.46.0.txt +0 -404
- data/doc/release_notes/4.47.0.txt +0 -56
- data/doc/release_notes/4.48.0.txt +0 -293
- data/doc/release_notes/4.49.0.txt +0 -222
- data/doc/release_notes/4.5.0.txt +0 -34
- data/doc/release_notes/4.6.0.txt +0 -30
- data/doc/release_notes/4.7.0.txt +0 -103
- data/doc/release_notes/4.8.0.txt +0 -175
- data/doc/release_notes/4.9.0.txt +0 -190
- data/spec/adapter_spec.rb +0 -4
- data/spec/adapters/db2_spec.rb +0 -170
- data/spec/adapters/mssql_spec.rb +0 -828
- data/spec/adapters/mysql_spec.rb +0 -1060
- data/spec/adapters/oracle_spec.rb +0 -371
- data/spec/adapters/postgres_spec.rb +0 -4476
- data/spec/adapters/spec_helper.rb +0 -44
- data/spec/adapters/sqlanywhere_spec.rb +0 -97
- data/spec/adapters/sqlite_spec.rb +0 -652
- data/spec/bin_spec.rb +0 -278
- data/spec/core/connection_pool_spec.rb +0 -1250
- data/spec/core/database_spec.rb +0 -2915
- data/spec/core/dataset_spec.rb +0 -5547
- data/spec/core/deprecated_spec.rb +0 -70
- data/spec/core/expression_filters_spec.rb +0 -1498
- data/spec/core/mock_adapter_spec.rb +0 -722
- data/spec/core/object_graph_spec.rb +0 -336
- data/spec/core/placeholder_literalizer_spec.rb +0 -166
- data/spec/core/schema_generator_spec.rb +0 -214
- data/spec/core/schema_spec.rb +0 -1844
- data/spec/core/spec_helper.rb +0 -24
- data/spec/core/version_spec.rb +0 -14
- data/spec/core_extensions_spec.rb +0 -763
- data/spec/core_model_spec.rb +0 -2
- data/spec/core_spec.rb +0 -1
- data/spec/deprecation_helper.rb +0 -30
- data/spec/extensions/accessed_columns_spec.rb +0 -51
- data/spec/extensions/active_model_spec.rb +0 -99
- data/spec/extensions/after_initialize_spec.rb +0 -28
- data/spec/extensions/any_not_empty_spec.rb +0 -23
- data/spec/extensions/arbitrary_servers_spec.rb +0 -109
- data/spec/extensions/association_dependencies_spec.rb +0 -125
- data/spec/extensions/association_multi_add_remove_spec.rb +0 -1041
- data/spec/extensions/association_pks_spec.rb +0 -423
- data/spec/extensions/association_proxies_spec.rb +0 -100
- data/spec/extensions/auto_literal_strings_spec.rb +0 -205
- data/spec/extensions/auto_validations_spec.rb +0 -229
- data/spec/extensions/blacklist_security_spec.rb +0 -95
- data/spec/extensions/blank_spec.rb +0 -69
- data/spec/extensions/boolean_readers_spec.rb +0 -93
- data/spec/extensions/boolean_subsets_spec.rb +0 -47
- data/spec/extensions/caching_spec.rb +0 -273
- data/spec/extensions/caller_logging_spec.rb +0 -52
- data/spec/extensions/class_table_inheritance_spec.rb +0 -750
- data/spec/extensions/column_conflicts_spec.rb +0 -75
- data/spec/extensions/column_select_spec.rb +0 -129
- data/spec/extensions/columns_introspection_spec.rb +0 -90
- data/spec/extensions/columns_updated_spec.rb +0 -35
- data/spec/extensions/composition_spec.rb +0 -248
- data/spec/extensions/connection_expiration_spec.rb +0 -151
- data/spec/extensions/connection_validator_spec.rb +0 -144
- data/spec/extensions/constant_sql_override_spec.rb +0 -24
- data/spec/extensions/constraint_validations_plugin_spec.rb +0 -300
- data/spec/extensions/constraint_validations_spec.rb +0 -439
- data/spec/extensions/core_refinements_spec.rb +0 -528
- data/spec/extensions/csv_serializer_spec.rb +0 -183
- data/spec/extensions/current_datetime_timestamp_spec.rb +0 -27
- data/spec/extensions/dataset_associations_spec.rb +0 -365
- data/spec/extensions/dataset_source_alias_spec.rb +0 -51
- data/spec/extensions/date_arithmetic_spec.rb +0 -181
- data/spec/extensions/datetime_parse_to_time_spec.rb +0 -169
- data/spec/extensions/def_dataset_method_spec.rb +0 -100
- data/spec/extensions/defaults_setter_spec.rb +0 -150
- data/spec/extensions/delay_add_association_spec.rb +0 -73
- data/spec/extensions/dirty_spec.rb +0 -222
- data/spec/extensions/duplicate_columns_handler_spec.rb +0 -104
- data/spec/extensions/eager_each_spec.rb +0 -62
- data/spec/extensions/eager_graph_eager_spec.rb +0 -100
- data/spec/extensions/empty_array_consider_nulls_spec.rb +0 -24
- data/spec/extensions/error_splitter_spec.rb +0 -18
- data/spec/extensions/error_sql_spec.rb +0 -20
- data/spec/extensions/escaped_like_spec.rb +0 -40
- data/spec/extensions/eval_inspect_spec.rb +0 -81
- data/spec/extensions/exclude_or_null_spec.rb +0 -15
- data/spec/extensions/finder_spec.rb +0 -260
- data/spec/extensions/force_encoding_spec.rb +0 -126
- data/spec/extensions/freeze_datasets_spec.rb +0 -31
- data/spec/extensions/graph_each_spec.rb +0 -113
- data/spec/extensions/hook_class_methods_spec.rb +0 -402
- data/spec/extensions/identifier_mangling_spec.rb +0 -201
- data/spec/extensions/implicit_subquery_spec.rb +0 -58
- data/spec/extensions/index_caching_spec.rb +0 -66
- data/spec/extensions/inflector_spec.rb +0 -183
- data/spec/extensions/input_transformer_spec.rb +0 -69
- data/spec/extensions/insert_conflict_spec.rb +0 -103
- data/spec/extensions/insert_returning_select_spec.rb +0 -72
- data/spec/extensions/instance_filters_spec.rb +0 -79
- data/spec/extensions/instance_hooks_spec.rb +0 -246
- data/spec/extensions/integer64_spec.rb +0 -22
- data/spec/extensions/inverted_subsets_spec.rb +0 -33
- data/spec/extensions/json_serializer_spec.rb +0 -336
- data/spec/extensions/lazy_attributes_spec.rb +0 -183
- data/spec/extensions/list_spec.rb +0 -291
- data/spec/extensions/looser_typecasting_spec.rb +0 -43
- data/spec/extensions/many_through_many_spec.rb +0 -2177
- data/spec/extensions/migration_spec.rb +0 -864
- data/spec/extensions/modification_detection_spec.rb +0 -93
- data/spec/extensions/mssql_optimistic_locking_spec.rb +0 -92
- data/spec/extensions/named_timezones_spec.rb +0 -218
- data/spec/extensions/nested_attributes_spec.rb +0 -815
- data/spec/extensions/null_dataset_spec.rb +0 -85
- data/spec/extensions/optimistic_locking_spec.rb +0 -127
- data/spec/extensions/pagination_spec.rb +0 -116
- data/spec/extensions/pg_array_associations_spec.rb +0 -802
- data/spec/extensions/pg_array_ops_spec.rb +0 -144
- data/spec/extensions/pg_array_spec.rb +0 -398
- data/spec/extensions/pg_auto_constraint_validations_spec.rb +0 -209
- data/spec/extensions/pg_enum_spec.rb +0 -118
- data/spec/extensions/pg_extended_date_support_spec.rb +0 -126
- data/spec/extensions/pg_hstore_ops_spec.rb +0 -238
- data/spec/extensions/pg_hstore_spec.rb +0 -219
- data/spec/extensions/pg_inet_ops_spec.rb +0 -102
- data/spec/extensions/pg_inet_spec.rb +0 -72
- data/spec/extensions/pg_interval_spec.rb +0 -103
- data/spec/extensions/pg_json_ops_spec.rb +0 -356
- data/spec/extensions/pg_json_spec.rb +0 -451
- data/spec/extensions/pg_loose_count_spec.rb +0 -23
- data/spec/extensions/pg_range_ops_spec.rb +0 -60
- data/spec/extensions/pg_range_spec.rb +0 -600
- data/spec/extensions/pg_row_ops_spec.rb +0 -61
- data/spec/extensions/pg_row_plugin_spec.rb +0 -60
- data/spec/extensions/pg_row_spec.rb +0 -363
- data/spec/extensions/pg_static_cache_updater_spec.rb +0 -93
- data/spec/extensions/pg_timestamptz_spec.rb +0 -17
- data/spec/extensions/prepared_statements_safe_spec.rb +0 -66
- data/spec/extensions/prepared_statements_spec.rb +0 -177
- data/spec/extensions/pretty_table_spec.rb +0 -123
- data/spec/extensions/query_spec.rb +0 -94
- data/spec/extensions/rcte_tree_spec.rb +0 -387
- data/spec/extensions/round_timestamps_spec.rb +0 -39
- data/spec/extensions/s_spec.rb +0 -60
- data/spec/extensions/schema_caching_spec.rb +0 -64
- data/spec/extensions/schema_dumper_spec.rb +0 -870
- data/spec/extensions/select_remove_spec.rb +0 -38
- data/spec/extensions/sequel_4_dataset_methods_spec.rb +0 -121
- data/spec/extensions/serialization_modification_detection_spec.rb +0 -98
- data/spec/extensions/serialization_spec.rb +0 -365
- data/spec/extensions/server_block_spec.rb +0 -135
- data/spec/extensions/server_logging_spec.rb +0 -45
- data/spec/extensions/sharding_spec.rb +0 -197
- data/spec/extensions/shared_caching_spec.rb +0 -151
- data/spec/extensions/single_table_inheritance_spec.rb +0 -347
- data/spec/extensions/singular_table_names_spec.rb +0 -22
- data/spec/extensions/skip_create_refresh_spec.rb +0 -18
- data/spec/extensions/spec_helper.rb +0 -70
- data/spec/extensions/split_array_nil_spec.rb +0 -24
- data/spec/extensions/split_values_spec.rb +0 -57
- data/spec/extensions/sql_comments_spec.rb +0 -33
- data/spec/extensions/sql_expr_spec.rb +0 -59
- data/spec/extensions/static_cache_cache_spec.rb +0 -35
- data/spec/extensions/static_cache_spec.rb +0 -471
- data/spec/extensions/string_agg_spec.rb +0 -90
- data/spec/extensions/string_date_time_spec.rb +0 -95
- data/spec/extensions/string_stripper_spec.rb +0 -68
- data/spec/extensions/subclasses_spec.rb +0 -79
- data/spec/extensions/subset_conditions_spec.rb +0 -38
- data/spec/extensions/symbol_aref_refinement_spec.rb +0 -28
- data/spec/extensions/symbol_as_refinement_spec.rb +0 -21
- data/spec/extensions/synchronize_sql_spec.rb +0 -124
- data/spec/extensions/table_select_spec.rb +0 -83
- data/spec/extensions/tactical_eager_loading_spec.rb +0 -402
- data/spec/extensions/thread_local_timezones_spec.rb +0 -67
- data/spec/extensions/throw_failures_spec.rb +0 -74
- data/spec/extensions/timestamps_spec.rb +0 -209
- data/spec/extensions/to_dot_spec.rb +0 -153
- data/spec/extensions/touch_spec.rb +0 -226
- data/spec/extensions/tree_spec.rb +0 -334
- data/spec/extensions/typecast_on_load_spec.rb +0 -86
- data/spec/extensions/unlimited_update_spec.rb +0 -21
- data/spec/extensions/update_or_create_spec.rb +0 -83
- data/spec/extensions/update_primary_key_spec.rb +0 -105
- data/spec/extensions/update_refresh_spec.rb +0 -59
- data/spec/extensions/uuid_spec.rb +0 -101
- data/spec/extensions/validate_associated_spec.rb +0 -52
- data/spec/extensions/validation_class_methods_spec.rb +0 -1040
- data/spec/extensions/validation_contexts_spec.rb +0 -31
- data/spec/extensions/validation_helpers_spec.rb +0 -525
- data/spec/extensions/whitelist_security_spec.rb +0 -157
- data/spec/extensions/xml_serializer_spec.rb +0 -213
- data/spec/files/bad_down_migration/001_create_alt_basic.rb +0 -4
- data/spec/files/bad_down_migration/002_create_alt_advanced.rb +0 -4
- data/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +0 -3
- data/spec/files/bad_up_migration/001_create_alt_basic.rb +0 -4
- data/spec/files/bad_up_migration/002_create_alt_advanced.rb +0 -3
- data/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +0 -4
- data/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +0 -9
- data/spec/files/double_migration/001_create_sessions.rb +0 -9
- data/spec/files/double_migration/002_create_nodes.rb +0 -19
- data/spec/files/double_migration/003_3_create_users.rb +0 -4
- data/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +0 -4
- data/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +0 -9
- data/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +0 -4
- data/spec/files/empty_migration/001_create_sessions.rb +0 -9
- data/spec/files/empty_migration/002_create_nodes.rb +0 -0
- data/spec/files/empty_migration/003_3_create_users.rb +0 -4
- data/spec/files/integer_migrations/001_create_sessions.rb +0 -9
- data/spec/files/integer_migrations/002_create_nodes.rb +0 -9
- data/spec/files/integer_migrations/003_3_create_users.rb +0 -4
- data/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/missing_integer_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +0 -4
- data/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/reversible_migrations/001_reversible.rb +0 -5
- data/spec/files/reversible_migrations/002_reversible.rb +0 -5
- data/spec/files/reversible_migrations/003_reversible.rb +0 -5
- data/spec/files/reversible_migrations/004_reversible.rb +0 -5
- data/spec/files/reversible_migrations/005_reversible.rb +0 -10
- data/spec/files/reversible_migrations/006_reversible.rb +0 -10
- data/spec/files/reversible_migrations/007_reversible.rb +0 -10
- data/spec/files/timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/transaction_specified_migrations/002_create_basic.rb +0 -4
- data/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +0 -3
- data/spec/files/transaction_unspecified_migrations/002_create_basic.rb +0 -3
- data/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +0 -9
- data/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +0 -9
- data/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +0 -4
- data/spec/guards_helper.rb +0 -59
- data/spec/integration/associations_test.rb +0 -2597
- data/spec/integration/database_test.rb +0 -113
- data/spec/integration/dataset_test.rb +0 -2037
- data/spec/integration/eager_loader_test.rb +0 -687
- data/spec/integration/migrator_test.rb +0 -262
- data/spec/integration/model_test.rb +0 -203
- data/spec/integration/plugin_test.rb +0 -2423
- data/spec/integration/prepared_statement_test.rb +0 -405
- data/spec/integration/schema_test.rb +0 -903
- data/spec/integration/spec_helper.rb +0 -71
- data/spec/integration/timezone_test.rb +0 -86
- data/spec/integration/transaction_test.rb +0 -603
- data/spec/integration/type_test.rb +0 -127
- data/spec/model/association_reflection_spec.rb +0 -803
- data/spec/model/associations_spec.rb +0 -4738
- data/spec/model/base_spec.rb +0 -875
- data/spec/model/class_dataset_methods_spec.rb +0 -146
- data/spec/model/dataset_methods_spec.rb +0 -198
- data/spec/model/eager_loading_spec.rb +0 -2377
- data/spec/model/hooks_spec.rb +0 -370
- data/spec/model/inflector_spec.rb +0 -26
- data/spec/model/model_spec.rb +0 -956
- data/spec/model/plugins_spec.rb +0 -429
- data/spec/model/record_spec.rb +0 -2118
- data/spec/model/spec_helper.rb +0 -46
- data/spec/model/validations_spec.rb +0 -220
- data/spec/model_no_assoc_spec.rb +0 -1
- data/spec/model_spec.rb +0 -1
- data/spec/plugin_spec.rb +0 -1
- data/spec/sequel_coverage.rb +0 -15
- data/spec/sequel_warning.rb +0 -4
- data/spec/spec_config.rb +0 -12
data/doc/testing.rdoc
CHANGED
@@ -162,13 +162,13 @@ SEQUEL_CONNECTION_VALIDATOR :: Use the connection validator extension when runni
|
|
162
162
|
SEQUEL_DUPLICATE_COLUMNS_HANDLER :: Use the duplicate columns handler extension with value given when running the specs
|
163
163
|
SEQUEL_ERROR_SQL :: Use the error_sql extension when running the specs
|
164
164
|
SEQUEL_INDEX_CACHING :: Use the index_caching extension when running the specs
|
165
|
+
SEQUEL_FIBER_CONCURRENCY :: Use the fiber_concurrency extension when running the adapter and integration specs
|
165
166
|
SEQUEL_FREEZE_DATABASE :: Freeze the database before running the integration specs
|
166
167
|
SEQUEL_IDENTIFIER_MANGLING :: Use the identifier_mangling extension when running the specs
|
167
168
|
SEQUEL_INTEGER64 :: Use the integer64 extension when running the adapter or integration specs
|
168
169
|
SEQUEL_MODEL_PREPARED_STATEMENTS :: Use the prepared_statements plugin when running the specs
|
169
170
|
SEQUEL_MODEL_THROW_FAILURES :: Use the throw_failures plugin when running the specs
|
170
171
|
SEQUEL_NO_CACHE_ASSOCIATIONS :: Don't cache association metadata when running the specs
|
171
|
-
SEQUEL_NO_CHECK_SQLS :: Don't check for specific SQL syntax when running the specs
|
172
172
|
SEQUEL_CHECK_PENDING :: Try running all specs (note, can cause lockups for some adapters), and raise errors for skipped specs that don't fail
|
173
173
|
SEQUEL_NO_PENDING :: Don't skip any specs, try running all specs (note, can cause lockups for some adapters)
|
174
174
|
SEQUEL_PG_TIMESTAMPTZ :: Use the pg_timestamptz extension when running the postgres specs
|
@@ -70,6 +70,10 @@ module Sequel
|
|
70
70
|
# string names of the server side prepared statement, and values
|
71
71
|
# are SQL strings.
|
72
72
|
attr_reader :prepared_statements
|
73
|
+
|
74
|
+
unless public_method_defined?(:async_exec_params)
|
75
|
+
alias async_exec_params async_exec
|
76
|
+
end
|
73
77
|
else
|
74
78
|
# Make postgres-pr look like pg
|
75
79
|
CONNECTION_OK = -1
|
@@ -149,7 +153,7 @@ module Sequel
|
|
149
153
|
|
150
154
|
# Return the PGResult containing the query results.
|
151
155
|
def execute_query(sql, args)
|
152
|
-
@db.log_connection_yield(sql, self, args){args ?
|
156
|
+
@db.log_connection_yield(sql, self, args){args ? async_exec_params(sql, args) : async_exec(sql)}
|
153
157
|
end
|
154
158
|
end
|
155
159
|
|
@@ -171,6 +171,12 @@ module Sequel
|
|
171
171
|
clone(:into => table)
|
172
172
|
end
|
173
173
|
|
174
|
+
# Access uses [] for quoting identifiers, and can't handle
|
175
|
+
# ] inside identifiers.
|
176
|
+
def quoted_identifier_append(sql, v)
|
177
|
+
sql << '[' << v.to_s << ']'
|
178
|
+
end
|
179
|
+
|
174
180
|
# Access does not support derived column lists.
|
175
181
|
def supports_derived_column_lists?
|
176
182
|
false
|
@@ -279,12 +285,6 @@ module Sequel
|
|
279
285
|
literal_append(sql, l)
|
280
286
|
end
|
281
287
|
end
|
282
|
-
|
283
|
-
# Access uses [] for quoting identifiers, and can't handle
|
284
|
-
# ] inside identifiers.
|
285
|
-
def quoted_identifier_append(sql, v)
|
286
|
-
sql << '[' << v.to_s << ']'
|
287
|
-
end
|
288
288
|
end
|
289
289
|
end
|
290
290
|
end
|
@@ -775,11 +775,6 @@ module Sequel
|
|
775
775
|
end
|
776
776
|
end
|
777
777
|
|
778
|
-
# MSSQL does not allow ordering in sub-clauses unless TOP (limit) is specified
|
779
|
-
def aggregate_dataset
|
780
|
-
(options_overlap(Sequel::Dataset::COUNT_FROM_SELF_OPTS) && !options_overlap([:limit])) ? unordered.from_self : super
|
781
|
-
end
|
782
|
-
|
783
778
|
# If the dataset using a order without a limit or offset or custom SQL,
|
784
779
|
# remove the order. Compounds on Microsoft SQL Server have undefined
|
785
780
|
# order unless the result is specifically ordered. Applying the current
|
@@ -799,6 +794,11 @@ module Sequel
|
|
799
794
|
|
800
795
|
private
|
801
796
|
|
797
|
+
# MSSQL does not allow ordering in sub-clauses unless TOP (limit) is specified
|
798
|
+
def aggregate_dataset
|
799
|
+
(options_overlap(Sequel::Dataset::COUNT_FROM_SELF_OPTS) && !options_overlap([:limit])) ? unordered.from_self : super
|
800
|
+
end
|
801
|
+
|
802
802
|
# Allow update and delete for unordered, limited datasets only.
|
803
803
|
def check_not_limited!(type)
|
804
804
|
return if @opts[:skip_limit_check] && type != :truncate
|
@@ -691,7 +691,7 @@ module Sequel
|
|
691
691
|
end
|
692
692
|
|
693
693
|
# Return the results of an EXPLAIN query as a string. Options:
|
694
|
-
# :extended :: Use EXPLAIN
|
694
|
+
# :extended :: Use EXPLAIN EXTENDED instead of EXPLAIN if true.
|
695
695
|
def explain(opts=OPTS)
|
696
696
|
# Load the PrettyTable class, needed for explain output
|
697
697
|
Sequel.extension(:_pretty_table) unless defined?(Sequel::PrettyTable)
|
@@ -717,15 +717,6 @@ module Sequel
|
|
717
717
|
SQL::PlaceholderLiteralString.new((opts[:boolean] ? MATCH_AGAINST_BOOLEAN : MATCH_AGAINST), [Array(cols), terms])
|
718
718
|
end
|
719
719
|
|
720
|
-
# Transforms :straight to STRAIGHT_JOIN.
|
721
|
-
def join_type_sql(join_type)
|
722
|
-
if join_type == :straight
|
723
|
-
'STRAIGHT_JOIN'
|
724
|
-
else
|
725
|
-
super
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
720
|
# Sets up the insert methods to use INSERT IGNORE.
|
730
721
|
# Useful if you have a unique key and want to just skip
|
731
722
|
# inserting rows that violate the unique key restriction.
|
@@ -956,6 +947,15 @@ module Sequel
|
|
956
947
|
end
|
957
948
|
end
|
958
949
|
|
950
|
+
# Transforms :straight to STRAIGHT_JOIN.
|
951
|
+
def join_type_sql(join_type)
|
952
|
+
if join_type == :straight
|
953
|
+
'STRAIGHT_JOIN'
|
954
|
+
else
|
955
|
+
super
|
956
|
+
end
|
957
|
+
end
|
958
|
+
|
959
959
|
# MySQL allows a LIMIT in DELETE and UPDATE statements.
|
960
960
|
def limit_sql(sql)
|
961
961
|
if l = @opts[:limit]
|
@@ -422,22 +422,6 @@ module Sequel
|
|
422
422
|
end
|
423
423
|
end
|
424
424
|
|
425
|
-
def select_limit_sql(sql)
|
426
|
-
return unless supports_fetch_next_rows?
|
427
|
-
|
428
|
-
if offset = @opts[:offset]
|
429
|
-
sql << " OFFSET "
|
430
|
-
literal_append(sql, offset)
|
431
|
-
sql << " ROWS"
|
432
|
-
end
|
433
|
-
|
434
|
-
if limit = @opts[:limit]
|
435
|
-
sql << " FETCH NEXT "
|
436
|
-
literal_append(sql, limit)
|
437
|
-
sql << " ROWS ONLY"
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|
441
425
|
# Oracle requires recursive CTEs to have column aliases.
|
442
426
|
def recursive_cte_requires_column_aliases?
|
443
427
|
true
|
@@ -624,6 +608,22 @@ module Sequel
|
|
624
608
|
:union
|
625
609
|
end
|
626
610
|
|
611
|
+
def select_limit_sql(sql)
|
612
|
+
return unless supports_fetch_next_rows?
|
613
|
+
|
614
|
+
if offset = @opts[:offset]
|
615
|
+
sql << " OFFSET "
|
616
|
+
literal_append(sql, offset)
|
617
|
+
sql << " ROWS"
|
618
|
+
end
|
619
|
+
|
620
|
+
if limit = @opts[:limit]
|
621
|
+
sql << " FETCH NEXT "
|
622
|
+
literal_append(sql, limit)
|
623
|
+
sql << " ROWS ONLY"
|
624
|
+
end
|
625
|
+
end
|
626
|
+
|
627
627
|
# Use SKIP LOCKED if skipping locked rows.
|
628
628
|
def select_lock_sql(sql)
|
629
629
|
super
|
@@ -134,6 +134,96 @@ module Sequel
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
+
# Generator used for creating tables that are partitions of other tables.
|
138
|
+
class CreatePartitionOfTableGenerator
|
139
|
+
MINVALUE = Sequel.lit('MINVALUE').freeze
|
140
|
+
MAXVALUE = Sequel.lit('MAXVALUE').freeze
|
141
|
+
|
142
|
+
def initialize(&block)
|
143
|
+
instance_exec(&block)
|
144
|
+
end
|
145
|
+
|
146
|
+
# The minimum value of the data type used in range partitions, useful
|
147
|
+
# as an argument to #from.
|
148
|
+
def minvalue
|
149
|
+
MINVALUE
|
150
|
+
end
|
151
|
+
|
152
|
+
# The minimum value of the data type used in range partitions, useful
|
153
|
+
# as an argument to #to.
|
154
|
+
def maxvalue
|
155
|
+
MAXVALUE
|
156
|
+
end
|
157
|
+
|
158
|
+
# Assumes range partitioning, sets the inclusive minimum value of the range for
|
159
|
+
# this partition.
|
160
|
+
def from(*v)
|
161
|
+
@from = v
|
162
|
+
end
|
163
|
+
|
164
|
+
# Assumes range partitioning, sets the exclusive maximum value of the range for
|
165
|
+
# this partition.
|
166
|
+
def to(*v)
|
167
|
+
@to = v
|
168
|
+
end
|
169
|
+
|
170
|
+
# Assumes list partitioning, sets the values to be included in this partition.
|
171
|
+
def values_in(*v)
|
172
|
+
@in = v
|
173
|
+
end
|
174
|
+
|
175
|
+
# Assumes hash partitioning, sets the modulus for this parition.
|
176
|
+
def modulus(v)
|
177
|
+
@modulus = v
|
178
|
+
end
|
179
|
+
|
180
|
+
# Assumes hash partitioning, sets the remainder for this parition.
|
181
|
+
def remainder(v)
|
182
|
+
@remainder = v
|
183
|
+
end
|
184
|
+
|
185
|
+
# Sets that this is a default partition, where values not in other partitions
|
186
|
+
# are stored.
|
187
|
+
def default
|
188
|
+
@default = true
|
189
|
+
end
|
190
|
+
|
191
|
+
# The from and to values of this partition for a range partition.
|
192
|
+
def range
|
193
|
+
[@from, @to]
|
194
|
+
end
|
195
|
+
|
196
|
+
# The values to include in this partition for a list partition.
|
197
|
+
def list
|
198
|
+
@in
|
199
|
+
end
|
200
|
+
|
201
|
+
# The modulus and remainder to use for this partition for a hash partition.
|
202
|
+
def hash_values
|
203
|
+
[@modulus, @remainder]
|
204
|
+
end
|
205
|
+
|
206
|
+
# Determine the appropriate partition type for this partition by which methods
|
207
|
+
# were called on it.
|
208
|
+
def partition_type
|
209
|
+
raise Error, "Unable to determine partition type, multiple different partitioning methods called" if [@from || @to, @list, @modulus || @remainder, @default].compact.length > 1
|
210
|
+
|
211
|
+
if @from || @to
|
212
|
+
raise Error, "must call both from and to when creating a partition of a table if calling either" unless @from && @to
|
213
|
+
:range
|
214
|
+
elsif @in
|
215
|
+
:list
|
216
|
+
elsif @modulus || @remainder
|
217
|
+
raise Error, "must call both modulus and remainder when creating a partition of a table if calling either" unless @modulus && @remainder
|
218
|
+
:hash
|
219
|
+
elsif @default
|
220
|
+
:default
|
221
|
+
else
|
222
|
+
raise Error, "unable to determine partition type, no partitioning methods called"
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
137
227
|
# Error raised when Sequel determines a PostgreSQL exclusion constraint has been violated.
|
138
228
|
class ExclusionConstraintViolation < Sequel::ConstraintViolation; end
|
139
229
|
|
@@ -359,6 +449,26 @@ module Sequel
|
|
359
449
|
self << create_schema_sql(name, opts)
|
360
450
|
end
|
361
451
|
|
452
|
+
# Support partitions of tables using the :partition_of option.
|
453
|
+
def create_table(name, options=OPTS, &block)
|
454
|
+
if options[:partition_of]
|
455
|
+
create_partition_of_table_from_generator(name, CreatePartitionOfTableGenerator.new(&block), options)
|
456
|
+
return
|
457
|
+
end
|
458
|
+
|
459
|
+
super
|
460
|
+
end
|
461
|
+
|
462
|
+
# Support partitions of tables using the :partition_of option.
|
463
|
+
def create_table?(name, options=OPTS, &block)
|
464
|
+
if options[:partition_of]
|
465
|
+
create_table(name, options.merge!(:if_not_exists=>true), &block)
|
466
|
+
return
|
467
|
+
end
|
468
|
+
|
469
|
+
super
|
470
|
+
end
|
471
|
+
|
362
472
|
# Create a trigger in the database. Arguments:
|
363
473
|
# table :: the table on which this trigger operates
|
364
474
|
# name :: the name of this trigger
|
@@ -840,7 +950,7 @@ module Sequel
|
|
840
950
|
# default value is given.
|
841
951
|
def column_definition_default_sql(sql, column)
|
842
952
|
super
|
843
|
-
if !column[:serial] && !['serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]
|
953
|
+
if !column[:serial] && !['smallserial', 'serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]
|
844
954
|
if (identity = column[:identity])
|
845
955
|
sql << " GENERATED "
|
846
956
|
sql << (identity == :always ? "ALWAYS" : "BY DEFAULT")
|
@@ -1018,6 +1128,36 @@ module Sequel
|
|
1018
1128
|
"CREATE#{' OR REPLACE' if opts[:replace] && server_version >= 90000}#{' TRUSTED' if opts[:trusted]} LANGUAGE #{name}#{" HANDLER #{opts[:handler]}" if opts[:handler]}#{" VALIDATOR #{opts[:validator]}" if opts[:validator]}"
|
1019
1129
|
end
|
1020
1130
|
|
1131
|
+
# Create a partition of another table, used when the create_table with
|
1132
|
+
# the :partition_of option is given.
|
1133
|
+
def create_partition_of_table_from_generator(name, generator, options)
|
1134
|
+
execute_ddl(create_partition_of_table_sql(name, generator, options))
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
# SQL for creating a partition of another table.
|
1138
|
+
def create_partition_of_table_sql(name, generator, options)
|
1139
|
+
sql = create_table_prefix_sql(name, options).dup
|
1140
|
+
|
1141
|
+
sql << " PARTITION OF #{quote_schema_table(options[:partition_of])}"
|
1142
|
+
|
1143
|
+
case generator.partition_type
|
1144
|
+
when :range
|
1145
|
+
from, to = generator.range
|
1146
|
+
sql << " FOR VALUES FROM #{literal(from)} TO #{literal(to)}"
|
1147
|
+
when :list
|
1148
|
+
sql << " FOR VALUES IN #{literal(generator.list)}"
|
1149
|
+
when :hash
|
1150
|
+
mod, remainder = generator.hash_values
|
1151
|
+
sql << " FOR VALUES WITH (MODULUS #{literal(mod)}, REMAINDER #{literal(remainder)})"
|
1152
|
+
when :default
|
1153
|
+
sql << " DEFAULT"
|
1154
|
+
end
|
1155
|
+
|
1156
|
+
sql << create_table_suffix_sql(name, options)
|
1157
|
+
|
1158
|
+
sql
|
1159
|
+
end
|
1160
|
+
|
1021
1161
|
# SQL for creating a schema.
|
1022
1162
|
def create_schema_sql(name, opts=OPTS)
|
1023
1163
|
"CREATE SCHEMA #{'IF NOT EXISTS ' if opts[:if_not_exists]}#{quote_identifier(name)}#{" AUTHORIZATION #{literal(opts[:owner])}" if opts[:owner]}"
|
@@ -1039,25 +1179,36 @@ module Sequel
|
|
1039
1179
|
"CREATE #{prefix_sql}TABLE#{' IF NOT EXISTS' if options[:if_not_exists]} #{options[:temp] ? quote_identifier(name) : quote_schema_table(name)}"
|
1040
1180
|
end
|
1041
1181
|
|
1182
|
+
# SQL for creating a table with PostgreSQL specific options
|
1042
1183
|
def create_table_sql(name, generator, options)
|
1043
|
-
|
1184
|
+
"#{super}#{create_table_suffix_sql(name, options)}"
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
# Handle various PostgreSQl specific table extensions such as inheritance,
|
1188
|
+
# partitioning, tablespaces, and foreign tables.
|
1189
|
+
def create_table_suffix_sql(name, options)
|
1190
|
+
sql = String.new
|
1044
1191
|
|
1045
1192
|
if inherits = options[:inherits]
|
1046
|
-
sql
|
1193
|
+
sql << " INHERITS (#{Array(inherits).map{|t| quote_schema_table(t)}.join(', ')})"
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
if partition_by = options[:partition_by]
|
1197
|
+
sql << " PARTITION BY #{options[:partition_type]||'RANGE'} #{literal(Array(partition_by))}"
|
1047
1198
|
end
|
1048
1199
|
|
1049
1200
|
if on_commit = options[:on_commit]
|
1050
1201
|
raise(Error, "can't provide :on_commit without :temp to create_table") unless options[:temp]
|
1051
1202
|
raise(Error, "unsupported on_commit option: #{on_commit.inspect}") unless ON_COMMIT.has_key?(on_commit)
|
1052
|
-
sql
|
1203
|
+
sql << " ON COMMIT #{ON_COMMIT[on_commit]}"
|
1053
1204
|
end
|
1054
1205
|
|
1055
1206
|
if tablespace = options[:tablespace]
|
1056
|
-
sql
|
1207
|
+
sql << " TABLESPACE #{quote_identifier(tablespace)}"
|
1057
1208
|
end
|
1058
1209
|
|
1059
1210
|
if server = options[:foreign]
|
1060
|
-
sql
|
1211
|
+
sql << " SERVER #{quote_identifier(server)}"
|
1061
1212
|
if foreign_opts = options[:options]
|
1062
1213
|
sql << " OPTIONS (#{foreign_opts.map{|k, v| "#{k} #{literal(v.to_s)}"}.join(', ')})"
|
1063
1214
|
end
|
@@ -1273,6 +1424,10 @@ module Sequel
|
|
1273
1424
|
|
1274
1425
|
if server_version > 100000
|
1275
1426
|
ds = ds.select_append{pg_attribute[:attidentity]}
|
1427
|
+
|
1428
|
+
if server_version > 120000
|
1429
|
+
ds = ds.select_append{Sequel.~(pg_attribute[:attgenerated]=>'').as(:generated)}
|
1430
|
+
end
|
1276
1431
|
end
|
1277
1432
|
|
1278
1433
|
ds.map do |row|
|
@@ -1751,6 +1906,14 @@ module Sequel
|
|
1751
1906
|
end
|
1752
1907
|
end
|
1753
1908
|
|
1909
|
+
def to_prepared_statement(type, *a)
|
1910
|
+
if type == :insert && !@opts.has_key?(:returning)
|
1911
|
+
returning(insert_pk).send(:to_prepared_statement, :insert_pk, *a)
|
1912
|
+
else
|
1913
|
+
super
|
1914
|
+
end
|
1915
|
+
end
|
1916
|
+
|
1754
1917
|
private
|
1755
1918
|
|
1756
1919
|
# Format TRUNCATE statement with PostgreSQL specific options.
|
@@ -1965,14 +2128,6 @@ module Sequel
|
|
1965
2128
|
true
|
1966
2129
|
end
|
1967
2130
|
|
1968
|
-
def to_prepared_statement(type, *a)
|
1969
|
-
if type == :insert && !@opts.has_key?(:returning)
|
1970
|
-
returning(insert_pk).send(:to_prepared_statement, :insert_pk, *a)
|
1971
|
-
else
|
1972
|
-
super
|
1973
|
-
end
|
1974
|
-
end
|
1975
|
-
|
1976
2131
|
# Concatenate the expressions with a space in between
|
1977
2132
|
def full_text_string_join(cols)
|
1978
2133
|
cols = Array(cols).map{|x| SQL::Function.new(:COALESCE, x, '')}
|
@@ -23,15 +23,6 @@ module Sequel
|
|
23
23
|
to_application_timestamp(v.to_s) if v
|
24
24
|
end
|
25
25
|
|
26
|
-
# Convert smallint type to boolean if convert_smallint_to_bool is true
|
27
|
-
def schema_column_type(db_type)
|
28
|
-
if convert_smallint_to_bool && db_type =~ /smallint/i
|
29
|
-
:boolean
|
30
|
-
else
|
31
|
-
super
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
26
|
def schema_parse_table(table, opts)
|
36
27
|
m = output_identifier_meth(opts[:dataset])
|
37
28
|
im = input_identifier_meth(opts[:dataset])
|
@@ -216,6 +207,15 @@ module Sequel
|
|
216
207
|
"ALTER TABLE #{quote_schema_table(name)} RENAME #{quote_schema_table(new_name)}"
|
217
208
|
end
|
218
209
|
|
210
|
+
# Convert smallint type to boolean if convert_smallint_to_bool is true
|
211
|
+
def schema_column_type(db_type)
|
212
|
+
if convert_smallint_to_bool && db_type =~ /smallint/i
|
213
|
+
:boolean
|
214
|
+
else
|
215
|
+
super
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
219
|
def tables_and_views(type, opts=OPTS)
|
220
220
|
m = output_identifier_meth
|
221
221
|
metadata_dataset.
|