sequel 5.3.0 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +30 -0
  3. data/bin/sequel +13 -0
  4. data/doc/cheat_sheet.rdoc +1 -0
  5. data/doc/dataset_filtering.rdoc +1 -1
  6. data/doc/querying.rdoc +8 -11
  7. data/doc/release_notes/5.4.0.txt +80 -0
  8. data/doc/testing.rdoc +2 -0
  9. data/lib/sequel/adapters/shared/db2.rb +6 -5
  10. data/lib/sequel/adapters/shared/mssql.rb +5 -8
  11. data/lib/sequel/adapters/shared/mysql.rb +4 -8
  12. data/lib/sequel/adapters/shared/oracle.rb +1 -1
  13. data/lib/sequel/adapters/shared/postgres.rb +5 -3
  14. data/lib/sequel/adapters/shared/sqlanywhere.rb +1 -6
  15. data/lib/sequel/adapters/shared/sqlite.rb +2 -0
  16. data/lib/sequel/database/connecting.rb +1 -1
  17. data/lib/sequel/database/schema_methods.rb +10 -1
  18. data/lib/sequel/dataset/query.rb +1 -2
  19. data/lib/sequel/extensions/date_arithmetic.rb +27 -10
  20. data/lib/sequel/extensions/datetime_parse_to_time.rb +37 -0
  21. data/lib/sequel/extensions/index_caching.rb +107 -0
  22. data/lib/sequel/extensions/null_dataset.rb +3 -1
  23. data/lib/sequel/extensions/pg_timestamptz.rb +26 -0
  24. data/lib/sequel/model/base.rb +2 -2
  25. data/lib/sequel/plugins/class_table_inheritance.rb +11 -3
  26. data/lib/sequel/plugins/json_serializer.rb +2 -2
  27. data/lib/sequel/plugins/xml_serializer.rb +1 -1
  28. data/lib/sequel/version.rb +1 -1
  29. data/spec/adapters/postgres_spec.rb +1 -1
  30. data/spec/adapters/spec_helper.rb +3 -0
  31. data/spec/adapters/sqlite_spec.rb +1 -1
  32. data/spec/bin_spec.rb +9 -0
  33. data/spec/core/connection_pool_spec.rb +2 -2
  34. data/spec/core/dataset_spec.rb +1 -6
  35. data/spec/extensions/class_table_inheritance_spec.rb +52 -2
  36. data/spec/extensions/date_arithmetic_spec.rb +15 -1
  37. data/spec/extensions/datetime_parse_to_time_spec.rb +169 -0
  38. data/spec/extensions/index_caching_spec.rb +66 -0
  39. data/spec/extensions/json_serializer_spec.rb +5 -0
  40. data/spec/extensions/null_dataset_spec.rb +5 -0
  41. data/spec/extensions/pg_extended_date_support_spec.rb +4 -0
  42. data/spec/extensions/pg_timestamptz_spec.rb +17 -0
  43. data/spec/extensions/xml_serializer_spec.rb +7 -0
  44. data/spec/integration/dataset_test.rb +6 -0
  45. data/spec/integration/prepared_statement_test.rb +1 -1
  46. data/spec/integration/schema_test.rb +19 -17
  47. data/spec/integration/spec_helper.rb +4 -0
  48. data/spec/model/record_spec.rb +28 -0
  49. metadata +11 -3
@@ -38,6 +38,10 @@ if DB.adapter_scheme == :ibmdb || (DB.adapter_scheme == :ado && DB.database_type
38
38
  end
39
39
  end
40
40
 
41
+ if ENV['SEQUEL_INDEX_CACHING']
42
+ DB.extension :index_caching
43
+ end
44
+
41
45
  if ENV['SEQUEL_ERROR_SQL']
42
46
  DB.extension :error_sql
43
47
  end
@@ -100,6 +100,34 @@ describe "Model#save" do
100
100
  DB.sqls.must_equal ["INSERT INTO items (y) VALUES (2) RETURNING *"]
101
101
  end
102
102
 
103
+ it "should issue regular insert query if insert_select returns nil" do
104
+ @c.dataset = @c.dataset.with_fetch(:id=>4, :x=>2).with_autoid(4).with_extend do
105
+ def supports_insert_select?; true end
106
+ def insert_select(hash)
107
+ end
108
+ end
109
+ o = @c.new(:x => 1)
110
+ o.save
111
+
112
+ DB.sqls.must_equal ["INSERT INTO items (x) VALUES (1)", "SELECT * FROM items WHERE id = 4"]
113
+ o.values.must_equal(:id=>4, :x=>2)
114
+ end
115
+
116
+ it "should assume insert statement already ran if insert_select returns false" do
117
+ @c.dataset = @c.dataset.with_fetch(:y=>2).with_extend do
118
+ def supports_insert_select?; true end
119
+ def insert_select(hash)
120
+ with_sql_first("INSERT INTO items (y) VALUES (2) RETURNING *")
121
+ false
122
+ end
123
+ end
124
+ o = @c.new(:x => 1)
125
+ o.save
126
+
127
+ o.values.must_equal(:x=>1)
128
+ DB.sqls.must_equal ["INSERT INTO items (y) VALUES (2) RETURNING *"]
129
+ end
130
+
103
131
  it "should not use dataset's insert_select method if specific columns are selected" do
104
132
  @c.dataset = @c.dataset.select(:y).with_extend{def insert_select(*) raise; end}
105
133
  @c.new(:x => 1).save
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-01 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -254,6 +254,7 @@ extra_rdoc_files:
254
254
  - doc/release_notes/5.1.0.txt
255
255
  - doc/release_notes/5.2.0.txt
256
256
  - doc/release_notes/5.3.0.txt
257
+ - doc/release_notes/5.4.0.txt
257
258
  files:
258
259
  - CHANGELOG
259
260
  - MIT-LICENSE
@@ -402,6 +403,7 @@ files:
402
403
  - doc/release_notes/5.1.0.txt
403
404
  - doc/release_notes/5.2.0.txt
404
405
  - doc/release_notes/5.3.0.txt
406
+ - doc/release_notes/5.4.0.txt
405
407
  - doc/schema_modification.rdoc
406
408
  - doc/security.rdoc
407
409
  - doc/sharding.rdoc
@@ -505,6 +507,7 @@ files:
505
507
  - lib/sequel/extensions/current_datetime_timestamp.rb
506
508
  - lib/sequel/extensions/dataset_source_alias.rb
507
509
  - lib/sequel/extensions/date_arithmetic.rb
510
+ - lib/sequel/extensions/datetime_parse_to_time.rb
508
511
  - lib/sequel/extensions/duplicate_columns_handler.rb
509
512
  - lib/sequel/extensions/empty_array_consider_nulls.rb
510
513
  - lib/sequel/extensions/error_sql.rb
@@ -514,6 +517,7 @@ files:
514
517
  - lib/sequel/extensions/graph_each.rb
515
518
  - lib/sequel/extensions/identifier_mangling.rb
516
519
  - lib/sequel/extensions/implicit_subquery.rb
520
+ - lib/sequel/extensions/index_caching.rb
517
521
  - lib/sequel/extensions/inflector.rb
518
522
  - lib/sequel/extensions/looser_typecasting.rb
519
523
  - lib/sequel/extensions/migration.rb
@@ -539,6 +543,7 @@ files:
539
543
  - lib/sequel/extensions/pg_row.rb
540
544
  - lib/sequel/extensions/pg_row_ops.rb
541
545
  - lib/sequel/extensions/pg_static_cache_updater.rb
546
+ - lib/sequel/extensions/pg_timestamptz.rb
542
547
  - lib/sequel/extensions/pretty_table.rb
543
548
  - lib/sequel/extensions/query.rb
544
549
  - lib/sequel/extensions/round_timestamps.rb
@@ -705,6 +710,7 @@ files:
705
710
  - spec/extensions/dataset_associations_spec.rb
706
711
  - spec/extensions/dataset_source_alias_spec.rb
707
712
  - spec/extensions/date_arithmetic_spec.rb
713
+ - spec/extensions/datetime_parse_to_time_spec.rb
708
714
  - spec/extensions/def_dataset_method_spec.rb
709
715
  - spec/extensions/defaults_setter_spec.rb
710
716
  - spec/extensions/delay_add_association_spec.rb
@@ -722,6 +728,7 @@ files:
722
728
  - spec/extensions/hook_class_methods_spec.rb
723
729
  - spec/extensions/identifier_mangling_spec.rb
724
730
  - spec/extensions/implicit_subquery_spec.rb
731
+ - spec/extensions/index_caching_spec.rb
725
732
  - spec/extensions/inflector_spec.rb
726
733
  - spec/extensions/input_transformer_spec.rb
727
734
  - spec/extensions/insert_returning_select_spec.rb
@@ -760,6 +767,7 @@ files:
760
767
  - spec/extensions/pg_row_plugin_spec.rb
761
768
  - spec/extensions/pg_row_spec.rb
762
769
  - spec/extensions/pg_static_cache_updater_spec.rb
770
+ - spec/extensions/pg_timestamptz_spec.rb
763
771
  - spec/extensions/prepared_statements_safe_spec.rb
764
772
  - spec/extensions/prepared_statements_spec.rb
765
773
  - spec/extensions/pretty_table_spec.rb
@@ -925,7 +933,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
925
933
  version: '0'
926
934
  requirements: []
927
935
  rubyforge_project:
928
- rubygems_version: 2.6.13
936
+ rubygems_version: 2.7.3
929
937
  signing_key:
930
938
  specification_version: 4
931
939
  summary: The Database Toolkit for Ruby