sequel 2.7.1 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/CHANGELOG +56 -0
  2. data/README +1 -0
  3. data/Rakefile +1 -1
  4. data/lib/sequel_core.rb +9 -16
  5. data/lib/sequel_core/adapters/ado.rb +6 -15
  6. data/lib/sequel_core/adapters/db2.rb +8 -10
  7. data/lib/sequel_core/adapters/dbi.rb +6 -4
  8. data/lib/sequel_core/adapters/informix.rb +21 -22
  9. data/lib/sequel_core/adapters/jdbc.rb +69 -10
  10. data/lib/sequel_core/adapters/jdbc/postgresql.rb +1 -0
  11. data/lib/sequel_core/adapters/mysql.rb +81 -13
  12. data/lib/sequel_core/adapters/odbc.rb +32 -4
  13. data/lib/sequel_core/adapters/openbase.rb +6 -5
  14. data/lib/sequel_core/adapters/oracle.rb +23 -7
  15. data/lib/sequel_core/adapters/postgres.rb +42 -32
  16. data/lib/sequel_core/adapters/shared/mssql.rb +37 -62
  17. data/lib/sequel_core/adapters/shared/mysql.rb +22 -7
  18. data/lib/sequel_core/adapters/shared/oracle.rb +27 -48
  19. data/lib/sequel_core/adapters/shared/postgres.rb +64 -43
  20. data/lib/sequel_core/adapters/shared/progress.rb +31 -0
  21. data/lib/sequel_core/adapters/shared/sqlite.rb +15 -4
  22. data/lib/sequel_core/adapters/sqlite.rb +6 -14
  23. data/lib/sequel_core/connection_pool.rb +47 -13
  24. data/lib/sequel_core/database.rb +60 -35
  25. data/lib/sequel_core/database/schema.rb +4 -4
  26. data/lib/sequel_core/dataset.rb +12 -3
  27. data/lib/sequel_core/dataset/convenience.rb +4 -13
  28. data/lib/sequel_core/dataset/prepared_statements.rb +30 -28
  29. data/lib/sequel_core/dataset/sql.rb +144 -85
  30. data/lib/sequel_core/dataset/stored_procedures.rb +75 -0
  31. data/lib/sequel_core/dataset/unsupported.rb +31 -0
  32. data/lib/sequel_core/exceptions.rb +6 -0
  33. data/lib/sequel_core/schema/generator.rb +4 -3
  34. data/lib/sequel_core/schema/sql.rb +41 -23
  35. data/lib/sequel_core/sql.rb +29 -1
  36. data/lib/sequel_model/associations.rb +1 -1
  37. data/lib/sequel_model/record.rb +31 -28
  38. data/spec/adapters/mysql_spec.rb +37 -4
  39. data/spec/adapters/oracle_spec.rb +26 -4
  40. data/spec/adapters/sqlite_spec.rb +7 -0
  41. data/spec/integration/prepared_statement_test.rb +24 -0
  42. data/spec/integration/schema_test.rb +1 -1
  43. data/spec/sequel_core/connection_pool_spec.rb +49 -2
  44. data/spec/sequel_core/core_sql_spec.rb +9 -2
  45. data/spec/sequel_core/database_spec.rb +64 -14
  46. data/spec/sequel_core/dataset_spec.rb +105 -7
  47. data/spec/sequel_core/schema_spec.rb +40 -12
  48. data/spec/sequel_core/spec_helper.rb +1 -0
  49. data/spec/sequel_model/spec_helper.rb +1 -0
  50. metadata +6 -3
@@ -628,6 +628,17 @@ context "DB#alter_table" do
628
628
  end
629
629
  @db.sqls.should == ["ALTER TABLE cats ALTER COLUMN score TYPE real"]
630
630
  end
631
+
632
+ specify "should support set_column_type with options" do
633
+ @db.alter_table(:cats) do
634
+ set_column_type :score, :integer, :unsigned=>true
635
+ set_column_type :score, :varchar, :size=>30
636
+ set_column_type :score, :enum, :elements=>['a', 'b']
637
+ end
638
+ @db.sqls.should == ["ALTER TABLE cats ALTER COLUMN score TYPE integer UNSIGNED",
639
+ "ALTER TABLE cats ALTER COLUMN score TYPE varchar(30)",
640
+ "ALTER TABLE cats ALTER COLUMN score TYPE enum('a', 'b')"]
641
+ end
631
642
  end
632
643
 
633
644
  context "Schema Parser" do
@@ -647,11 +658,11 @@ context "Schema Parser" do
647
658
  [[:a, {:db_type=>t.to_s}]]
648
659
  end
649
660
  @db.schema(:x).should == [[:a, {:db_type=>"x"}]]
650
- @sqls.should == [:x]
661
+ @sqls.should == ['x']
651
662
  @db.schema(:x).should == [[:a, {:db_type=>"x"}]]
652
- @sqls.should == [:x]
663
+ @sqls.should == ['x']
653
664
  @db.schema(:x, :reload=>true).should == [[:a, {:db_type=>"x"}]]
654
- @sqls.should == [:x, :x]
665
+ @sqls.should == ['x', 'x']
655
666
  end
656
667
 
657
668
  specify "should parse the schema correctly for all tables" do
@@ -662,18 +673,34 @@ context "Schema Parser" do
662
673
  sqls << t
663
674
  [[:x, {:db_type=>t.to_s}]]
664
675
  end
665
- @db.schema.should == {:x=>[[:x, {:db_type=>"x"}]]}
666
- @sqls.should == [:x]
667
- @db.schema.should == {:x=>[[:x, {:db_type=>"x"}]]}
668
- @sqls.should == [:x]
669
- @db.schema(nil, :reload=>true).should == {:x=>[[:x, {:db_type=>"x"}]]}
670
- @sqls.should == [:x, :x]
676
+ @db.schema.should == {'x'=>[[:x, {:db_type=>"x"}]]}
677
+ @sqls.should == ['x']
678
+ @db.schema.should == {'x'=>[[:x, {:db_type=>"x"}]]}
679
+ @sqls.should == ['x']
680
+ @db.schema(nil, :reload=>true).should == {'x'=>[[:x, {:db_type=>"x"}]]}
681
+ @sqls.should == ['x', 'x']
671
682
  @db.meta_def(:schema_parse_tables) do |opts|
672
683
  sqls << 1
673
- {:x=>[[:a, {:db_type=>"1"}]]}
684
+ {'x'=>[[:a, {:db_type=>"1"}]]}
685
+ end
686
+ @db.schema(nil, :reload=>true).should == {'x'=>[[:a, {:db_type=>"1"}]]}
687
+ @sqls.should == ['x', 'x', 1]
688
+ end
689
+
690
+ specify "should convert various types of table name arguments" do
691
+ @db.meta_def(:schema_parse_table) do |t, opts|
692
+ [[t, {:db_type=>t}]]
674
693
  end
675
- @db.schema(nil, :reload=>true).should == {:x=>[[:a, {:db_type=>"1"}]]}
676
- @sqls.should == [:x, :x, 1]
694
+ s1 = @db.schema(:x)
695
+ s1.should == [['x', {:db_type=>'x'}]]
696
+ @db.schema[:x].object_id.should == s1.object_id
697
+ @db.schema(:x.identifier).object_id.should == s1.object_id
698
+ @db.schema[:x.identifier].object_id.should == s1.object_id
699
+ s2 = @db.schema(:x__y)
700
+ s2.should == [['y', {:db_type=>'y'}]]
701
+ @db.schema[:x__y].object_id.should == s2.object_id
702
+ @db.schema(:y.qualify(:x)).object_id.should == s2.object_id
703
+ @db.schema[:y.qualify(:x)].object_id.should == s2.object_id
677
704
  end
678
705
 
679
706
  specify "should correctly parse all supported data types" do
@@ -683,6 +710,7 @@ context "Schema Parser" do
683
710
  @db.schema(:tinyint).first.last[:type].should == :boolean
684
711
  Sequel.convert_tinyint_to_bool = false
685
712
  @db.schema(:tinyint, :reload=>true).first.last[:type].should == :integer
713
+ @db.schema(:interval).first.last[:type].should == :interval
686
714
  @db.schema(:int).first.last[:type].should == :integer
687
715
  @db.schema(:integer).first.last[:type].should == :integer
688
716
  @db.schema(:bigint).first.last[:type].should == :integer
@@ -25,6 +25,7 @@ end
25
25
 
26
26
  class MockDatabase < Sequel::Database
27
27
  @@quote_identifiers = false
28
+ @@upcase_identifiers = false
28
29
  attr_reader :sqls
29
30
 
30
31
  def execute(sql, opts={})
@@ -34,6 +34,7 @@ end
34
34
 
35
35
  class MockDatabase < Sequel::Database
36
36
  @@quote_identifiers = false
37
+ @@upcase_identifiers = false
37
38
  attr_reader :sqls
38
39
 
39
40
  def execute(sql, opts={})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-04 00:00:00 -08:00
12
+ date: 2008-12-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -113,6 +113,7 @@ files:
113
113
  - lib/sequel_core/adapters/shared/oracle.rb
114
114
  - lib/sequel_core/adapters/shared/postgres.rb
115
115
  - lib/sequel_core/adapters/shared/sqlite.rb
116
+ - lib/sequel_core/adapters/shared/progress.rb
116
117
  - lib/sequel_core/adapters/sqlite.rb
117
118
  - lib/sequel_core/connection_pool.rb
118
119
  - lib/sequel_core/core_ext.rb
@@ -129,6 +130,8 @@ files:
129
130
  - lib/sequel_core/dataset/query.rb
130
131
  - lib/sequel_core/dataset/schema.rb
131
132
  - lib/sequel_core/dataset/sql.rb
133
+ - lib/sequel_core/dataset/unsupported.rb
134
+ - lib/sequel_core/dataset/stored_procedures.rb
132
135
  - lib/sequel_core/deprecated.rb
133
136
  - lib/sequel_core/exceptions.rb
134
137
  - lib/sequel_core/migration.rb
@@ -181,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
184
  requirements: []
182
185
 
183
186
  rubyforge_project: sequel
184
- rubygems_version: 1.3.0
187
+ rubygems_version: 1.3.1
185
188
  signing_key:
186
189
  specification_version: 2
187
190
  summary: The Database Toolkit for Ruby