sequel 4.30.0 → 4.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +18 -0
- data/MIT-LICENSE +1 -1
- data/bin/sequel +1 -0
- data/doc/opening_databases.rdoc +6 -0
- data/doc/release_notes/4.31.0.txt +57 -0
- data/lib/sequel.rb +2 -0
- data/lib/sequel/adapters/ado.rb +2 -0
- data/lib/sequel/adapters/ado/access.rb +2 -0
- data/lib/sequel/adapters/ado/mssql.rb +2 -0
- data/lib/sequel/adapters/amalgalite.rb +2 -0
- data/lib/sequel/adapters/cubrid.rb +2 -0
- data/lib/sequel/adapters/do.rb +2 -0
- data/lib/sequel/adapters/do/mysql.rb +2 -0
- data/lib/sequel/adapters/do/postgres.rb +2 -0
- data/lib/sequel/adapters/do/sqlite3.rb +2 -0
- data/lib/sequel/adapters/ibmdb.rb +3 -1
- data/lib/sequel/adapters/jdbc.rb +2 -0
- data/lib/sequel/adapters/jdbc/as400.rb +2 -0
- data/lib/sequel/adapters/jdbc/cubrid.rb +2 -0
- data/lib/sequel/adapters/jdbc/db2.rb +2 -0
- data/lib/sequel/adapters/jdbc/derby.rb +2 -0
- data/lib/sequel/adapters/jdbc/firebirdsql.rb +2 -0
- data/lib/sequel/adapters/jdbc/h2.rb +2 -0
- data/lib/sequel/adapters/jdbc/hsqldb.rb +2 -0
- data/lib/sequel/adapters/jdbc/informix-sqli.rb +2 -0
- data/lib/sequel/adapters/jdbc/jdbcprogress.rb +2 -0
- data/lib/sequel/adapters/jdbc/jtds.rb +2 -0
- data/lib/sequel/adapters/jdbc/mssql.rb +2 -0
- data/lib/sequel/adapters/jdbc/mysql.rb +2 -0
- data/lib/sequel/adapters/jdbc/oracle.rb +2 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +24 -1
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +2 -0
- data/lib/sequel/adapters/jdbc/sqlite.rb +2 -0
- data/lib/sequel/adapters/jdbc/sqlserver.rb +2 -0
- data/lib/sequel/adapters/jdbc/transactions.rb +2 -0
- data/lib/sequel/adapters/mock.rb +2 -0
- data/lib/sequel/adapters/mysql.rb +2 -0
- data/lib/sequel/adapters/mysql2.rb +2 -0
- data/lib/sequel/adapters/odbc.rb +2 -0
- data/lib/sequel/adapters/odbc/db2.rb +2 -0
- data/lib/sequel/adapters/odbc/mssql.rb +2 -0
- data/lib/sequel/adapters/odbc/progress.rb +2 -0
- data/lib/sequel/adapters/oracle.rb +4 -2
- data/lib/sequel/adapters/postgres.rb +5 -3
- data/lib/sequel/adapters/postgresql.rb +2 -0
- data/lib/sequel/adapters/shared/access.rb +2 -0
- data/lib/sequel/adapters/shared/cubrid.rb +2 -0
- data/lib/sequel/adapters/shared/db2.rb +2 -0
- data/lib/sequel/adapters/shared/firebird.rb +2 -0
- data/lib/sequel/adapters/shared/informix.rb +2 -0
- data/lib/sequel/adapters/shared/mssql.rb +2 -0
- data/lib/sequel/adapters/shared/mysql.rb +5 -1
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +2 -0
- data/lib/sequel/adapters/shared/oracle.rb +5 -3
- data/lib/sequel/adapters/shared/postgres.rb +19 -12
- data/lib/sequel/adapters/shared/progress.rb +2 -0
- data/lib/sequel/adapters/shared/sqlanywhere.rb +3 -1
- data/lib/sequel/adapters/shared/sqlite.rb +2 -0
- data/lib/sequel/adapters/sqlanywhere.rb +2 -0
- data/lib/sequel/adapters/sqlite.rb +4 -1
- data/lib/sequel/adapters/swift.rb +2 -0
- data/lib/sequel/adapters/swift/mysql.rb +2 -0
- data/lib/sequel/adapters/swift/postgres.rb +2 -0
- data/lib/sequel/adapters/swift/sqlite.rb +2 -0
- data/lib/sequel/adapters/tinytds.rb +2 -0
- data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +5 -3
- data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +5 -3
- data/lib/sequel/adapters/utils/pg_types.rb +2 -0
- data/lib/sequel/adapters/utils/replace.rb +2 -0
- data/lib/sequel/adapters/utils/split_alter_table.rb +2 -0
- data/lib/sequel/adapters/utils/stored_procedures.rb +2 -0
- data/lib/sequel/ast_transformer.rb +2 -0
- data/lib/sequel/connection_pool.rb +2 -0
- data/lib/sequel/connection_pool/sharded_single.rb +2 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +2 -0
- data/lib/sequel/connection_pool/single.rb +2 -0
- data/lib/sequel/connection_pool/threaded.rb +2 -0
- data/lib/sequel/core.rb +2 -0
- data/lib/sequel/database.rb +2 -0
- data/lib/sequel/database/connecting.rb +2 -0
- data/lib/sequel/database/dataset.rb +2 -0
- data/lib/sequel/database/dataset_defaults.rb +2 -0
- data/lib/sequel/database/features.rb +2 -0
- data/lib/sequel/database/logging.rb +2 -0
- data/lib/sequel/database/misc.rb +2 -0
- data/lib/sequel/database/query.rb +2 -0
- data/lib/sequel/database/schema_generator.rb +2 -0
- data/lib/sequel/database/schema_methods.rb +11 -4
- data/lib/sequel/database/transactions.rb +2 -0
- data/lib/sequel/dataset.rb +2 -0
- data/lib/sequel/dataset/actions.rb +2 -0
- data/lib/sequel/dataset/features.rb +2 -0
- data/lib/sequel/dataset/graph.rb +2 -0
- data/lib/sequel/dataset/misc.rb +2 -0
- data/lib/sequel/dataset/mutation.rb +2 -0
- data/lib/sequel/dataset/placeholder_literalizer.rb +3 -1
- data/lib/sequel/dataset/prepared_statements.rb +2 -0
- data/lib/sequel/dataset/query.rb +2 -0
- data/lib/sequel/dataset/sql.rb +7 -5
- data/lib/sequel/deprecated.rb +2 -0
- data/lib/sequel/exceptions.rb +2 -0
- data/lib/sequel/extensions/_pretty_table.rb +5 -3
- data/lib/sequel/extensions/arbitrary_servers.rb +2 -0
- data/lib/sequel/extensions/blank.rb +2 -0
- data/lib/sequel/extensions/columns_introspection.rb +2 -0
- data/lib/sequel/extensions/connection_validator.rb +2 -0
- data/lib/sequel/extensions/constraint_validations.rb +2 -0
- data/lib/sequel/extensions/core_extensions.rb +2 -0
- data/lib/sequel/extensions/core_refinements.rb +2 -0
- data/lib/sequel/extensions/current_datetime_timestamp.rb +2 -0
- data/lib/sequel/extensions/dataset_source_alias.rb +2 -0
- data/lib/sequel/extensions/date_arithmetic.rb +3 -1
- data/lib/sequel/extensions/empty_array_consider_nulls.rb +2 -0
- data/lib/sequel/extensions/empty_array_ignore_nulls.rb +2 -0
- data/lib/sequel/extensions/error_sql.rb +2 -0
- data/lib/sequel/extensions/eval_inspect.rb +2 -0
- data/lib/sequel/extensions/filter_having.rb +2 -0
- data/lib/sequel/extensions/from_block.rb +2 -0
- data/lib/sequel/extensions/graph_each.rb +2 -0
- data/lib/sequel/extensions/hash_aliases.rb +2 -0
- data/lib/sequel/extensions/inflector.rb +2 -0
- data/lib/sequel/extensions/looser_typecasting.rb +2 -0
- data/lib/sequel/extensions/meta_def.rb +2 -0
- data/lib/sequel/extensions/migration.rb +14 -4
- data/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +2 -0
- data/lib/sequel/extensions/named_timezones.rb +2 -0
- data/lib/sequel/extensions/null_dataset.rb +2 -0
- data/lib/sequel/extensions/pagination.rb +2 -0
- data/lib/sequel/extensions/pg_array.rb +16 -36
- data/lib/sequel/extensions/pg_array_ops.rb +2 -0
- data/lib/sequel/extensions/pg_enum.rb +4 -1
- data/lib/sequel/extensions/pg_hstore.rb +3 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +2 -0
- data/lib/sequel/extensions/pg_inet.rb +2 -0
- data/lib/sequel/extensions/pg_inet_ops.rb +2 -0
- data/lib/sequel/extensions/pg_interval.rb +3 -1
- data/lib/sequel/extensions/pg_json.rb +2 -0
- data/lib/sequel/extensions/pg_json_ops.rb +2 -0
- data/lib/sequel/extensions/pg_loose_count.rb +2 -0
- data/lib/sequel/extensions/pg_range.rb +2 -0
- data/lib/sequel/extensions/pg_range_ops.rb +2 -0
- data/lib/sequel/extensions/pg_row.rb +2 -0
- data/lib/sequel/extensions/pg_row_ops.rb +2 -0
- data/lib/sequel/extensions/pg_static_cache_updater.rb +2 -0
- data/lib/sequel/extensions/pretty_table.rb +2 -0
- data/lib/sequel/extensions/query.rb +2 -0
- data/lib/sequel/extensions/query_literals.rb +2 -0
- data/lib/sequel/extensions/round_timestamps.rb +2 -0
- data/lib/sequel/extensions/ruby18_symbol_extensions.rb +2 -0
- data/lib/sequel/extensions/schema_caching.rb +2 -0
- data/lib/sequel/extensions/schema_dumper.rb +4 -1
- data/lib/sequel/extensions/select_remove.rb +2 -0
- data/lib/sequel/extensions/sequel_3_dataset_methods.rb +3 -1
- data/lib/sequel/extensions/server_block.rb +2 -0
- data/lib/sequel/extensions/set_overrides.rb +2 -0
- data/lib/sequel/extensions/split_array_nil.rb +2 -0
- data/lib/sequel/extensions/sql_expr.rb +2 -0
- data/lib/sequel/extensions/string_date_time.rb +2 -0
- data/lib/sequel/extensions/thread_local_timezones.rb +2 -0
- data/lib/sequel/extensions/to_dot.rb +3 -1
- data/lib/sequel/model.rb +2 -0
- data/lib/sequel/model/associations.rb +3 -1
- data/lib/sequel/model/base.rb +5 -1
- data/lib/sequel/model/dataset_module.rb +2 -0
- data/lib/sequel/model/default_inflections.rb +2 -0
- data/lib/sequel/model/errors.rb +2 -0
- data/lib/sequel/model/exceptions.rb +2 -0
- data/lib/sequel/model/inflections.rb +2 -0
- data/lib/sequel/model/plugins.rb +2 -0
- data/lib/sequel/no_core_ext.rb +2 -0
- data/lib/sequel/plugins/accessed_columns.rb +2 -0
- data/lib/sequel/plugins/active_model.rb +2 -0
- data/lib/sequel/plugins/after_initialize.rb +2 -0
- data/lib/sequel/plugins/association_autoreloading.rb +2 -0
- data/lib/sequel/plugins/association_dependencies.rb +2 -0
- data/lib/sequel/plugins/association_pks.rb +20 -24
- data/lib/sequel/plugins/association_proxies.rb +2 -0
- data/lib/sequel/plugins/auto_validations.rb +2 -0
- data/lib/sequel/plugins/before_after_save.rb +2 -0
- data/lib/sequel/plugins/blacklist_security.rb +2 -0
- data/lib/sequel/plugins/boolean_readers.rb +2 -0
- data/lib/sequel/plugins/boolean_subsets.rb +2 -0
- data/lib/sequel/plugins/caching.rb +2 -0
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -0
- data/lib/sequel/plugins/column_conflicts.rb +2 -0
- data/lib/sequel/plugins/column_select.rb +2 -0
- data/lib/sequel/plugins/composition.rb +2 -0
- data/lib/sequel/plugins/constraint_validations.rb +2 -0
- data/lib/sequel/plugins/csv_serializer.rb +2 -0
- data/lib/sequel/plugins/dataset_associations.rb +2 -0
- data/lib/sequel/plugins/defaults_setter.rb +2 -0
- data/lib/sequel/plugins/delay_add_association.rb +2 -0
- data/lib/sequel/plugins/dirty.rb +2 -0
- data/lib/sequel/plugins/eager_each.rb +2 -0
- data/lib/sequel/plugins/error_splitter.rb +2 -0
- data/lib/sequel/plugins/force_encoding.rb +2 -0
- data/lib/sequel/plugins/hook_class_methods.rb +2 -0
- data/lib/sequel/plugins/identifier_columns.rb +2 -0
- data/lib/sequel/plugins/input_transformer.rb +2 -0
- data/lib/sequel/plugins/insert_returning_select.rb +2 -0
- data/lib/sequel/plugins/instance_filters.rb +2 -0
- data/lib/sequel/plugins/instance_hooks.rb +2 -0
- data/lib/sequel/plugins/inverted_subsets.rb +2 -0
- data/lib/sequel/plugins/json_serializer.rb +2 -0
- data/lib/sequel/plugins/lazy_attributes.rb +2 -0
- data/lib/sequel/plugins/list.rb +2 -0
- data/lib/sequel/plugins/many_through_many.rb +2 -0
- data/lib/sequel/plugins/many_to_one_pk_lookup.rb +2 -0
- data/lib/sequel/plugins/modification_detection.rb +2 -0
- data/lib/sequel/plugins/mssql_optimistic_locking.rb +2 -0
- data/lib/sequel/plugins/nested_attributes.rb +2 -0
- data/lib/sequel/plugins/optimistic_locking.rb +2 -0
- data/lib/sequel/plugins/pg_array_associations.rb +2 -0
- data/lib/sequel/plugins/pg_row.rb +2 -0
- data/lib/sequel/plugins/pg_typecast_on_load.rb +2 -0
- data/lib/sequel/plugins/prepared_statements.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_associations.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_safe.rb +2 -0
- data/lib/sequel/plugins/prepared_statements_with_pk.rb +2 -0
- data/lib/sequel/plugins/rcte_tree.rb +2 -0
- data/lib/sequel/plugins/schema.rb +2 -0
- data/lib/sequel/plugins/scissors.rb +2 -0
- data/lib/sequel/plugins/serialization.rb +2 -0
- data/lib/sequel/plugins/serialization_modification_detection.rb +2 -0
- data/lib/sequel/plugins/sharding.rb +2 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +2 -0
- data/lib/sequel/plugins/singular_table_names.rb +2 -0
- data/lib/sequel/plugins/skip_create_refresh.rb +2 -0
- data/lib/sequel/plugins/split_values.rb +2 -0
- data/lib/sequel/plugins/static_cache.rb +2 -0
- data/lib/sequel/plugins/string_stripper.rb +2 -0
- data/lib/sequel/plugins/subclasses.rb +2 -0
- data/lib/sequel/plugins/subset_conditions.rb +2 -0
- data/lib/sequel/plugins/table_select.rb +2 -0
- data/lib/sequel/plugins/tactical_eager_loading.rb +2 -0
- data/lib/sequel/plugins/timestamps.rb +2 -0
- data/lib/sequel/plugins/touch.rb +2 -0
- data/lib/sequel/plugins/tree.rb +2 -0
- data/lib/sequel/plugins/typecast_on_load.rb +2 -0
- data/lib/sequel/plugins/unlimited_update.rb +2 -0
- data/lib/sequel/plugins/update_or_create.rb +2 -0
- data/lib/sequel/plugins/update_primary_key.rb +2 -0
- data/lib/sequel/plugins/update_refresh.rb +2 -0
- data/lib/sequel/plugins/uuid.rb +2 -0
- data/lib/sequel/plugins/validate_associated.rb +2 -0
- data/lib/sequel/plugins/validation_class_methods.rb +2 -0
- data/lib/sequel/plugins/validation_helpers.rb +3 -1
- data/lib/sequel/plugins/xml_serializer.rb +2 -0
- data/lib/sequel/sql.rb +3 -1
- data/lib/sequel/timezones.rb +2 -0
- data/lib/sequel/version.rb +3 -1
- data/spec/adapters/mysql_spec.rb +4 -0
- data/spec/adapters/postgres_spec.rb +35 -11
- data/spec/core/connection_pool_spec.rb +1 -1
- data/spec/extensions/association_pks_spec.rb +4 -2
- data/spec/extensions/caching_spec.rb +1 -1
- data/spec/extensions/csv_serializer_spec.rb +7 -0
- data/spec/extensions/date_arithmetic_spec.rb +1 -1
- data/spec/extensions/dirty_spec.rb +6 -6
- data/spec/extensions/force_encoding_spec.rb +12 -12
- data/spec/extensions/input_transformer_spec.rb +1 -1
- data/spec/extensions/migration_spec.rb +16 -0
- data/spec/extensions/modification_detection_spec.rb +2 -2
- data/spec/extensions/nested_attributes_spec.rb +1 -1
- data/spec/extensions/optimistic_locking_spec.rb +1 -1
- data/spec/extensions/pg_array_spec.rb +3 -8
- data/spec/files/double_migration/001_create_sessions.rb +9 -0
- data/spec/files/double_migration/002_create_nodes.rb +19 -0
- data/spec/files/double_migration/003_3_create_users.rb +4 -0
- data/spec/files/empty_migration/001_create_sessions.rb +9 -0
- data/spec/files/empty_migration/002_create_nodes.rb +0 -0
- data/spec/files/empty_migration/003_3_create_users.rb +4 -0
- metadata +11 -3
data/lib/sequel/plugins/touch.rb
CHANGED
data/lib/sequel/plugins/tree.rb
CHANGED
data/lib/sequel/plugins/uuid.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
module Sequel
|
2
4
|
module Plugins
|
3
5
|
# The validation_helpers plugin contains instance method equivalents for most of the legacy
|
@@ -214,7 +216,7 @@ module Sequel
|
|
214
216
|
# a modified dataset that is filtered to include only rows with
|
215
217
|
# the same values as the current object for each column in the array.
|
216
218
|
#
|
217
|
-
# If you want to
|
219
|
+
# If you want to do a case insensitive uniqueness validation on a database that
|
218
220
|
# is case sensitive by default, you can use:
|
219
221
|
#
|
220
222
|
# validates_unique :column, :where=>(proc do |ds, obj, cols|
|
data/lib/sequel/sql.rb
CHANGED
data/lib/sequel/timezones.rb
CHANGED
data/lib/sequel/version.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
module Sequel
|
2
4
|
# The major version of Sequel. Only bumped for major changes.
|
3
5
|
MAJOR = 4
|
4
6
|
# The minor version of Sequel. Bumped for every non-patch level
|
5
7
|
# release, generally around once a month.
|
6
|
-
MINOR =
|
8
|
+
MINOR = 31
|
7
9
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
8
10
|
# releases that fix regressions from previous versions.
|
9
11
|
TINY = 0
|
data/spec/adapters/mysql_spec.rb
CHANGED
@@ -640,6 +640,10 @@ describe "MySQL foreign key support" do
|
|
640
640
|
DB.create_table!(:testfk){primary_key :id; foreign_key :fk, :testfk}
|
641
641
|
end
|
642
642
|
|
643
|
+
it "should create table with self referential with non-autoincrementing key without :key" do
|
644
|
+
DB.create_table!(:testfk){Integer :id, :primary_key=>true; foreign_key :fk, :testfk}
|
645
|
+
end
|
646
|
+
|
643
647
|
it "should create table with self referential with composite keys without :key" do
|
644
648
|
DB.create_table!(:testfk){Integer :id; Integer :id2; Integer :fk; Integer :fk2; primary_key([:id, :id2]); foreign_key([:fk, :fk2], :testfk)}
|
645
649
|
end
|
@@ -2289,6 +2289,30 @@ describe 'PostgreSQL array handling' do
|
|
2289
2289
|
end
|
2290
2290
|
end
|
2291
2291
|
|
2292
|
+
it 'retrieve arrays with explicit bounds' do
|
2293
|
+
@db.create_table!(:items) do
|
2294
|
+
column :n, 'integer[]'
|
2295
|
+
end
|
2296
|
+
@ds.insert(:n=>"[0:1]={2,3}")
|
2297
|
+
rs = @ds.all
|
2298
|
+
rs.must_equal [{:n=>[2,3]}]
|
2299
|
+
rs.first.values.each{|v| v.class.must_equal(Sequel::Postgres::PGArray)}
|
2300
|
+
rs.first.values.each{|v| v.to_a.must_be_kind_of(Array)}
|
2301
|
+
@ds.delete
|
2302
|
+
@ds.insert(rs.first)
|
2303
|
+
@ds.all.must_equal rs
|
2304
|
+
|
2305
|
+
@ds.delete
|
2306
|
+
@ds.insert(:n=>"[0:1][0:0]={{2},{3}}")
|
2307
|
+
rs = @ds.all
|
2308
|
+
rs.must_equal [{:n=>[[2], [3]]}]
|
2309
|
+
rs.first.values.each{|v| v.class.must_equal(Sequel::Postgres::PGArray)}
|
2310
|
+
rs.first.values.each{|v| v.to_a.must_be_kind_of(Array)}
|
2311
|
+
@ds.delete
|
2312
|
+
@ds.insert(rs.first)
|
2313
|
+
@ds.all.must_equal rs
|
2314
|
+
end if DB.adapter_scheme == :postgres || DB.adapter_scheme == :jdbc
|
2315
|
+
|
2292
2316
|
it 'use arrays in bound variables' do
|
2293
2317
|
@db.create_table!(:items) do
|
2294
2318
|
column :i, 'int4[]'
|
@@ -2347,7 +2371,7 @@ describe 'PostgreSQL array handling' do
|
|
2347
2371
|
@ds.get(:i).must_equal a
|
2348
2372
|
@ds.filter(:i=>:$i).call(:first, :i=>a).must_equal(:i=>a)
|
2349
2373
|
@ds.filter(:i=>:$i).call(:first, :i=>Sequel.pg_array([Sequel.blob("b\0")], 'bytea')).must_equal nil
|
2350
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
2374
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
2351
2375
|
|
2352
2376
|
it 'with models' do
|
2353
2377
|
@db.create_table!(:items) do
|
@@ -2535,7 +2559,7 @@ describe 'PostgreSQL hstore handling' do
|
|
2535
2559
|
@ds.get(:i).must_equal @h
|
2536
2560
|
@ds.filter(:i=>:$i).call(:first, :i=>@h).must_equal(:i=>@h)
|
2537
2561
|
@ds.filter(:i=>:$i).call(:first, :i=>{}).must_equal nil
|
2538
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
2562
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
2539
2563
|
|
2540
2564
|
it 'with models and associations' do
|
2541
2565
|
@db.create_table!(:items) do
|
@@ -2808,7 +2832,7 @@ describe 'PostgreSQL json type' do
|
|
2808
2832
|
j = Sequel.pg_array([pg_json.call('a'=>1), pg_json.call(['b', 2])], json_type)
|
2809
2833
|
@ds.call(:insert, {:i=>j}, {:i=>:$i})
|
2810
2834
|
@ds.get(:i).must_equal j
|
2811
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
2835
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
2812
2836
|
|
2813
2837
|
it 'operations/functions with pg_json_ops' do
|
2814
2838
|
Sequel.extension :pg_json_ops
|
@@ -2996,7 +3020,7 @@ describe 'PostgreSQL inet/cidr types' do
|
|
2996
3020
|
@ds.filter(:i=>:$i, :c=>:$c, :m=>:$m).call(:first, :i=>[@ipv4], :c=>[@ipv4nm], :m=>['12:34:56:78:90:ab']).must_equal(:i=>[@ipv4], :c=>[@ipv4nm], :m=>['12:34:56:78:90:ab'])
|
2997
3021
|
@ds.filter(:i=>:$i, :c=>:$c, :m=>:$m).call(:first, :i=>[], :c=>[], :m=>[]).must_equal nil
|
2998
3022
|
@ds.filter(:i=>:$i, :c=>:$c, :m=>:$m).call(:delete, :i=>[@ipv4], :c=>[@ipv4nm], :m=>['12:34:56:78:90:ab']).must_equal 1
|
2999
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3023
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3000
3024
|
|
3001
3025
|
it 'with models' do
|
3002
3026
|
@db.create_table!(:items) do
|
@@ -3145,7 +3169,7 @@ describe 'PostgreSQL range types' do
|
|
3145
3169
|
@ds.filter(h).call(:first, @pgra).each{|k, v| v.must_be :==, @ra[k].to_a}
|
3146
3170
|
@ds.filter(h).call(:first, r2).must_equal nil
|
3147
3171
|
@ds.filter(h).call(:delete, @ra).must_equal 1
|
3148
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3172
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3149
3173
|
|
3150
3174
|
it 'with models' do
|
3151
3175
|
@db.create_table!(:items){primary_key :id; int4range :i4; int8range :i8; numrange :n; daterange :d; tsrange :t; tstzrange :tz}
|
@@ -3318,7 +3342,7 @@ describe 'PostgreSQL interval types' do
|
|
3318
3342
|
@ds.call(:insert, {:i=>d}, {:i=>:$i})
|
3319
3343
|
@ds.get(:i).must_equal d
|
3320
3344
|
@ds.filter(:i=>:$i).call(:first, :i=>d).must_equal(:i=>d)
|
3321
|
-
@ds.filter(:i
|
3345
|
+
@ds.filter(:i=>Sequel.cast(:$i, :interval)).call(:first, :i=>'0').must_equal nil
|
3322
3346
|
@ds.filter(:i=>:$i).call(:delete, :i=>d).must_equal 1
|
3323
3347
|
|
3324
3348
|
@db.create_table!(:items){column :i, 'interval[]'}
|
@@ -3326,7 +3350,7 @@ describe 'PostgreSQL interval types' do
|
|
3326
3350
|
@ds.filter(:i=>:$i).call(:first, :i=>[d]).must_equal(:i=>[d])
|
3327
3351
|
@ds.filter(:i=>:$i).call(:first, :i=>[]).must_equal nil
|
3328
3352
|
@ds.filter(:i=>:$i).call(:delete, :i=>[d]).must_equal 1
|
3329
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3353
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3330
3354
|
|
3331
3355
|
it 'with models' do
|
3332
3356
|
@db.create_table!(:items) do
|
@@ -3443,7 +3467,7 @@ describe 'PostgreSQL row-valued/composite types' do
|
|
3443
3467
|
@ds.delete
|
3444
3468
|
@ds.call(:insert, {:address=>Sequel.pg_row([nil, nil, nil])}, {:address=>:$address, :id=>1})
|
3445
3469
|
@ds.get(:address).must_equal(:street=>nil, :city=>nil, :zip=>nil)
|
3446
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3470
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3447
3471
|
|
3448
3472
|
it 'use arrays of row types in bound variables' do
|
3449
3473
|
@ds = @db[:company]
|
@@ -3455,7 +3479,7 @@ describe 'PostgreSQL row-valued/composite types' do
|
|
3455
3479
|
@ds.delete
|
3456
3480
|
@ds.call(:insert, {:employees=>Sequel.pg_array([@db.row_type(:person, [1, Sequel.pg_row([nil, nil, nil])])])}, {:employees=>:$employees, :id=>1})
|
3457
3481
|
@ds.get(:employees).must_equal [{:address=>{:city=>nil, :zip=>nil, :street=>nil}, :id=>1}]
|
3458
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3482
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3459
3483
|
|
3460
3484
|
it 'operations/functions with pg_row_ops' do
|
3461
3485
|
@ds.insert(:id=>1, :address=>Sequel.pg_row(['123 Sesame St', 'Somewhere', '12345']))
|
@@ -3581,7 +3605,7 @@ describe 'PostgreSQL row-valued/composite types' do
|
|
3581
3605
|
@ds.get(:address).must_equal @a
|
3582
3606
|
@ds.filter(:address=>Sequel.cast(:$address, :address)).call(:first, :address=>@a)[:id].must_equal 1
|
3583
3607
|
@ds.filter(:address=>Sequel.cast(:$address, :address)).call(:first, :address=>Address.new(:street=>'123 Sesame St', :city=>'Somewhere', :zip=>'12356')).must_equal nil
|
3584
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3608
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3585
3609
|
|
3586
3610
|
it 'use arrays of model objects in bound variables' do
|
3587
3611
|
@ds = @db[:company]
|
@@ -3589,7 +3613,7 @@ describe 'PostgreSQL row-valued/composite types' do
|
|
3589
3613
|
@ds.get(:company).must_equal Company.new(:id=>1, :employees=>@es)
|
3590
3614
|
@ds.filter(:employees=>Sequel.cast(:$employees, 'person[]')).call(:first, :employees=>@es)[:id].must_equal 1
|
3591
3615
|
@ds.filter(:employees=>Sequel.cast(:$employees, 'person[]')).call(:first, :employees=>Sequel.pg_array([@db.row_type(:person, [1, Sequel.pg_row(['123 Sesame St', 'Somewhere', '12356'])])])).must_equal nil
|
3592
|
-
end if DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG
|
3616
|
+
end if (DB.adapter_scheme == :postgres && SEQUEL_POSTGRES_USES_PG) || DB.adapter_scheme == :jdbc
|
3593
3617
|
|
3594
3618
|
it 'model typecasting' do
|
3595
3619
|
Person.plugin :pg_typecast_on_load, :address unless @native
|
@@ -169,7 +169,7 @@ describe "A connection pool with a max size of 1" do
|
|
169
169
|
before do
|
170
170
|
@invoked_count = 0
|
171
171
|
icp = proc{@invoked_count += 1}
|
172
|
-
@pool = Sequel::ConnectionPool.get_pool(mock_db.call{icp.call; 'herro'}, CONNECTION_POOL_DEFAULTS.merge(:max_connections=>1))
|
172
|
+
@pool = Sequel::ConnectionPool.get_pool(mock_db.call{icp.call; 'herro'.dup}, CONNECTION_POOL_DEFAULTS.merge(:max_connections=>1))
|
173
173
|
end
|
174
174
|
|
175
175
|
it "should let only one thread access the connection at any time" do
|
@@ -284,10 +284,11 @@ describe "Sequel::Plugins::AssociationPks" do
|
|
284
284
|
it "should handle delaying setting of association pks until after saving for new objects, if :delay plugin option is used" do
|
285
285
|
@Artist.one_to_many :albums, :clone=>:albums, :delay_pks=>true
|
286
286
|
@Album.many_to_many :tags, :clone=>:tags, :delay_pks=>true
|
287
|
+
@Album.db_schema[:id][:type] = :integer
|
287
288
|
|
288
289
|
ar = @Artist.new
|
289
290
|
ar.album_pks.must_equal []
|
290
|
-
ar.album_pks = [1,2,3]
|
291
|
+
ar.album_pks = ["1","2","3"]
|
291
292
|
ar.album_pks.must_equal [1,2,3]
|
292
293
|
@db.sqls.must_equal []
|
293
294
|
|
@@ -320,11 +321,12 @@ describe "Sequel::Plugins::AssociationPks" do
|
|
320
321
|
it "should handle delaying setting of association pks until after saving for existing objects, if :delay=>:all plugin option is used" do
|
321
322
|
@Artist.one_to_many :albums, :clone=>:albums, :delay_pks=>:always
|
322
323
|
@Album.many_to_many :tags, :clone=>:tags, :delay_pks=>:always
|
324
|
+
@Album.db_schema[:id][:type] = :integer
|
323
325
|
|
324
326
|
ar = @Artist.load(:id=>1)
|
325
327
|
ar.album_pks.must_equal [1,2,3]
|
326
328
|
@db.sqls
|
327
|
-
ar.album_pks = [2,4]
|
329
|
+
ar.album_pks = ["2","4"]
|
328
330
|
ar.album_pks.must_equal [2,4]
|
329
331
|
@db.sqls.must_equal []
|
330
332
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
|
2
2
|
|
3
|
+
begin
|
4
|
+
csv_lib = RUBY_VERSION < '1.9' ? 'fastercsv' : 'csv'
|
5
|
+
require csv_lib
|
6
|
+
rescue LoadError => e
|
7
|
+
skip_warn "csv_serializer plugin: can't load #{csv_lib} (#{e.class}: #{e})"
|
8
|
+
else
|
3
9
|
describe "Sequel::Plugins::CsvSerializer" do
|
4
10
|
before do
|
5
11
|
artist = @Artist = Class.new(Sequel::Model(:artists))
|
@@ -171,3 +177,4 @@ describe "Sequel::Plugins::CsvSerializer" do
|
|
171
177
|
@album.to_csv(:except=>[:id, :artist_id]).must_equal "RF\n"
|
172
178
|
end
|
173
179
|
end
|
180
|
+
end
|