sequel 3.20.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +32 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/Rakefile +13 -3
- data/bin/sequel +18 -5
- data/doc/active_record.rdoc +4 -4
- data/doc/opening_databases.rdoc +38 -1
- data/doc/release_notes/3.21.0.txt +87 -0
- data/doc/validations.rdoc +2 -2
- data/lib/sequel/adapters/informix.rb +1 -1
- data/lib/sequel/adapters/jdbc/h2.rb +2 -5
- data/lib/sequel/adapters/jdbc/mssql.rb +1 -4
- data/lib/sequel/adapters/jdbc/mysql.rb +1 -4
- data/lib/sequel/adapters/jdbc/postgresql.rb +1 -6
- data/lib/sequel/adapters/jdbc/sqlite.rb +2 -8
- data/lib/sequel/adapters/shared/mssql.rb +8 -0
- data/lib/sequel/adapters/shared/mysql.rb +23 -3
- data/lib/sequel/adapters/shared/oracle.rb +2 -2
- data/lib/sequel/adapters/tinytds.rb +125 -0
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/schema_methods.rb +37 -5
- data/lib/sequel/dataset/sql.rb +6 -6
- data/lib/sequel/extensions/schema_dumper.rb +1 -1
- data/lib/sequel/model/base.rb +50 -0
- data/lib/sequel/model/plugins.rb +0 -55
- data/lib/sequel/plugins/association_autoreloading.rb +48 -0
- data/lib/sequel/plugins/validation_class_methods.rb +6 -5
- data/lib/sequel/plugins/validation_helpers.rb +2 -2
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/firebird_spec.rb +6 -6
- data/spec/adapters/informix_spec.rb +2 -2
- data/spec/adapters/mssql_spec.rb +18 -13
- data/spec/adapters/mysql_spec.rb +47 -20
- data/spec/adapters/oracle_spec.rb +40 -4
- data/spec/adapters/postgres_spec.rb +14 -14
- data/spec/adapters/spec_helper.rb +1 -1
- data/spec/adapters/sqlite_spec.rb +8 -8
- data/spec/core/connection_pool_spec.rb +18 -17
- data/spec/core/core_sql_spec.rb +18 -18
- data/spec/core/database_spec.rb +62 -62
- data/spec/core/dataset_spec.rb +105 -92
- data/spec/core/expression_filters_spec.rb +2 -2
- data/spec/core/schema_spec.rb +6 -6
- data/spec/core/version_spec.rb +1 -1
- data/spec/extensions/association_autoreloading_spec.rb +94 -0
- data/spec/extensions/blank_spec.rb +6 -6
- data/spec/extensions/looser_typecasting_spec.rb +1 -1
- data/spec/extensions/migration_spec.rb +6 -6
- data/spec/extensions/pagination_spec.rb +2 -2
- data/spec/extensions/pretty_table_spec.rb +2 -2
- data/spec/extensions/query_spec.rb +2 -2
- data/spec/extensions/schema_dumper_spec.rb +2 -1
- data/spec/extensions/single_table_inheritance_spec.rb +1 -1
- data/spec/extensions/sql_expr_spec.rb +1 -1
- data/spec/extensions/string_date_time_spec.rb +4 -4
- data/spec/extensions/validation_class_methods_spec.rb +2 -2
- data/spec/integration/dataset_test.rb +8 -3
- data/spec/integration/plugin_test.rb +5 -5
- data/spec/integration/prepared_statement_test.rb +1 -1
- data/spec/integration/schema_test.rb +7 -0
- data/spec/integration/spec_helper.rb +14 -1
- data/spec/integration/timezone_test.rb +4 -4
- data/spec/integration/type_test.rb +1 -1
- data/spec/model/model_spec.rb +3 -3
- metadata +9 -4
| @@ -414,7 +414,7 @@ describe "Touch plugin" do | |
| 414 414 | 
             
              specify "should update the timestamp column when touching the record" do
         | 
| 415 415 | 
             
                @album.updated_at.should == nil
         | 
| 416 416 | 
             
                @album.touch
         | 
| 417 | 
            -
                @album.updated_at.to_i.should  | 
| 417 | 
            +
                @album.updated_at.to_i.should be_within(2).of(Time.now.to_i)
         | 
| 418 418 | 
             
              end
         | 
| 419 419 |  | 
| 420 420 | 
             
              cspecify "should update the timestamp column for associated records when the record is updated or destroyed", [:do, :sqlite], [:jdbc, :sqlite] do
         | 
| @@ -422,16 +422,16 @@ describe "Touch plugin" do | |
| 422 422 | 
             
                @album.update(:name=>'B')
         | 
| 423 423 | 
             
                ua = @artist.reload.updated_at
         | 
| 424 424 | 
             
                if ua.is_a?(Time)
         | 
| 425 | 
            -
                  ua.to_i.should  | 
| 425 | 
            +
                  ua.to_i.should be_within(2).of(Time.now.to_i)
         | 
| 426 426 | 
             
                else
         | 
| 427 | 
            -
                  (DateTime.now - ua).should  | 
| 427 | 
            +
                  (DateTime.now - ua).should be_within(2.0/86400).of(0)
         | 
| 428 428 | 
             
                end
         | 
| 429 429 | 
             
                @artist.update(:updated_at=>nil)
         | 
| 430 430 | 
             
                @album.destroy
         | 
| 431 431 | 
             
                if ua.is_a?(Time)
         | 
| 432 | 
            -
                  ua.to_i.should  | 
| 432 | 
            +
                  ua.to_i.should be_within(2).of(Time.now.to_i)
         | 
| 433 433 | 
             
                else
         | 
| 434 | 
            -
                  (DateTime.now - ua).should  | 
| 434 | 
            +
                  (DateTime.now - ua).should be_within(2.0/86400).of(0)
         | 
| 435 435 | 
             
                end
         | 
| 436 436 | 
             
              end
         | 
| 437 437 | 
             
            end
         | 
| @@ -242,7 +242,7 @@ describe "Bound Argument Types" do | |
| 242 242 | 
             
                @ds.filter(:d=>@ds.ba(:$x, :date)).prepare(:first, :ps_date).call(:x=>@vs[:d])[:d].should == @vs[:d]
         | 
| 243 243 | 
             
              end
         | 
| 244 244 |  | 
| 245 | 
            -
              cspecify "should handle datetime type", [:do], [:mysql2], [:swift], [:jdbc, :sqlite] do
         | 
| 245 | 
            +
              cspecify "should handle datetime type", [:do], [:mysql2], [:swift], [:jdbc, :sqlite], [:tinytds] do
         | 
| 246 246 | 
             
                Sequel.datetime_class = DateTime
         | 
| 247 247 | 
             
                @ds.filter(:dt=>@ds.ba(:$x, :timestamp)).prepare(:first, :ps_datetime).call(:x=>@vs[:dt])[:dt].should == @vs[:dt]
         | 
| 248 248 | 
             
              end
         | 
| @@ -193,6 +193,13 @@ describe "Database schema modifiers" do | |
| 193 193 | 
             
                @ds.columns!.should == [:number]
         | 
| 194 194 | 
             
              end
         | 
| 195 195 |  | 
| 196 | 
            +
              specify "should handle combination of default, unique, and not null" do
         | 
| 197 | 
            +
                @db.create_table!(:items){Integer :number, :default=>0, :null=>false, :unique=>true}
         | 
| 198 | 
            +
                @db.table_exists?(:items).should == true
         | 
| 199 | 
            +
                @db.schema(:items, :reload=>true).map{|x| x.last}.first.values_at(:ruby_default, :allow_null).should == [0, false]
         | 
| 200 | 
            +
                @ds.insert([10])
         | 
| 201 | 
            +
              end
         | 
| 202 | 
            +
             | 
| 196 203 | 
             
              specify "should handle foreign keys correctly when creating tables" do
         | 
| 197 204 | 
             
                @db.create_table!(:items) do 
         | 
| 198 205 | 
             
                  primary_key :id
         | 
| @@ -16,7 +16,20 @@ def clear_sqls | |
| 16 16 | 
             
              $sqls.clear
         | 
| 17 17 | 
             
            end 
         | 
| 18 18 |  | 
| 19 | 
            -
             | 
| 19 | 
            +
            unless defined?(RSpec)
         | 
| 20 | 
            +
              module Spec::Matchers
         | 
| 21 | 
            +
                class BeWithin
         | 
| 22 | 
            +
                  include Spec::Matchers
         | 
| 23 | 
            +
                  def initialize(delta); @delta = delta; end
         | 
| 24 | 
            +
                  def of(expected); be_close(expected, @delta); end 
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
                def be_within(delta)
         | 
| 27 | 
            +
                  BeWithin.new(delta)
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            (defined?(RSpec) ? RSpec::Core::ExampleGroup : Spec::Example::ExampleGroup).class_eval do
         | 
| 20 33 | 
             
              def log
         | 
| 21 34 | 
             
                begin
         | 
| 22 35 | 
             
                  INTEGRATION_DB.loggers << Logger.new(STDOUT)
         | 
| @@ -7,7 +7,7 @@ describe "Sequel timezone support" do | |
| 7 7 | 
             
                  @db[:t].insert(t)
         | 
| 8 8 | 
             
                  t2 = @db[:t].single_value
         | 
| 9 9 | 
             
                  t2 = Sequel.database_to_application_timestamp(t2.to_s) unless t2.is_a?(Time)
         | 
| 10 | 
            -
                  (t2 - t).should  | 
| 10 | 
            +
                  (t2 - t).should be_within(2).of(0)
         | 
| 11 11 | 
             
                  t2.utc_offset.should == 0 if Sequel.application_timezone == :utc
         | 
| 12 12 | 
             
                  t2.utc_offset.should == t.getlocal.utc_offset if Sequel.application_timezone == :local
         | 
| 13 13 | 
             
                  @db[:t].delete
         | 
| @@ -20,7 +20,7 @@ describe "Sequel timezone support" do | |
| 20 20 | 
             
                  @db[:t].insert(dt)
         | 
| 21 21 | 
             
                  dt2 = @db[:t].single_value
         | 
| 22 22 | 
             
                  dt2 = Sequel.database_to_application_timestamp(dt2.to_s) unless dt2.is_a?(DateTime)
         | 
| 23 | 
            -
                  (dt2 - dt).should  | 
| 23 | 
            +
                  (dt2 - dt).should be_within(0.00002).of(0)
         | 
| 24 24 | 
             
                  dt2.offset.should == 0 if Sequel.application_timezone == :utc
         | 
| 25 25 | 
             
                  dt2.offset.should == dt.offset if Sequel.application_timezone == :local
         | 
| 26 26 | 
             
                  @db[:t].delete
         | 
| @@ -37,13 +37,13 @@ describe "Sequel timezone support" do | |
| 37 37 | 
             
                Sequel.datetime_class = Time
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 | 
            -
              cspecify "should support using UTC for database storage and local time for the application", [:swift], [:do, proc{|db| db.database_type != :sqlite}] do
         | 
| 40 | 
            +
              cspecify "should support using UTC for database storage and local time for the application", [:swift], [:tinytds], [:do, proc{|db| db.database_type != :sqlite}] do
         | 
| 41 41 | 
             
                Sequel.database_timezone = :utc
         | 
| 42 42 | 
             
                Sequel.application_timezone = :local
         | 
| 43 43 | 
             
                test_timezone
         | 
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 | 
            -
              cspecify "should support using local time for database storage and UTC for the application", [:swift], [:do, proc{|db| db.database_type != :sqlite}] do
         | 
| 46 | 
            +
              cspecify "should support using local time for database storage and UTC for the application", [:swift], [:tinytds], [:do, proc{|db| db.database_type != :sqlite}] do
         | 
| 47 47 | 
             
                Sequel.database_timezone = :local
         | 
| 48 48 | 
             
                Sequel.application_timezone = :utc
         | 
| 49 49 | 
             
                test_timezone
         | 
| @@ -79,7 +79,7 @@ describe "Supported types" do | |
| 79 79 | 
             
                ds.first[:tim].strftime('%Y%m%d%H%M%S').should == t.strftime('%Y%m%d%H%M%S')
         | 
| 80 80 | 
             
              end
         | 
| 81 81 |  | 
| 82 | 
            -
              cspecify "should support generic file type", [:do], [:odbc, :mssql], [:mysql2], [:swift] do
         | 
| 82 | 
            +
              cspecify "should support generic file type", [:do], [:odbc, :mssql], [:mysql2], [:swift], [:tinytds] do
         | 
| 83 83 | 
             
                ds = create_items_table_with_column(:name, File)
         | 
| 84 84 | 
             
                ds.insert(:name => ("a\0"*300).to_sequel_blob)
         | 
| 85 85 | 
             
                ds.all.should == [{:name=>("a\0"*300).to_sequel_blob}]
         | 
    
        data/spec/model/model_spec.rb
    CHANGED
    
    | @@ -511,7 +511,7 @@ describe Sequel::Model, ".[]" do | |
| 511 511 | 
             
              end
         | 
| 512 512 | 
             
            end
         | 
| 513 513 |  | 
| 514 | 
            -
             | 
| 514 | 
            +
            describe "Model#inspect" do
         | 
| 515 515 | 
             
              before do
         | 
| 516 516 | 
             
                @o = Sequel::Model.load(:x => 333)
         | 
| 517 517 | 
             
              end
         | 
| @@ -521,7 +521,7 @@ context "Model#inspect" do | |
| 521 521 | 
             
              end
         | 
| 522 522 | 
             
            end
         | 
| 523 523 |  | 
| 524 | 
            -
             | 
| 524 | 
            +
            describe "Model.db_schema" do
         | 
| 525 525 | 
             
              before do
         | 
| 526 526 | 
             
                @c = Class.new(Sequel::Model(:items)) do
         | 
| 527 527 | 
             
                  def self.columns; orig_columns; end
         | 
| @@ -618,7 +618,7 @@ context "Model.db_schema" do | |
| 618 618 | 
             
              end
         | 
| 619 619 | 
             
            end
         | 
| 620 620 |  | 
| 621 | 
            -
             | 
| 621 | 
            +
            describe "Model#use_transactions" do
         | 
| 622 622 | 
             
              before do
         | 
| 623 623 | 
             
                @c = Class.new(Sequel::Model(:items))
         | 
| 624 624 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sequel
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 83
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 3
         | 
| 8 | 
            -
              -  | 
| 8 | 
            +
              - 21
         | 
| 9 9 | 
             
              - 0
         | 
| 10 | 
            -
              version: 3. | 
| 10 | 
            +
              version: 3.21.0
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Jeremy Evans
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011- | 
| 18 | 
            +
            date: 2011-03-01 00:00:00 -08:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: []
         | 
| 21 21 |  | 
| @@ -84,6 +84,7 @@ extra_rdoc_files: | |
| 84 84 | 
             
            - doc/release_notes/3.18.0.txt
         | 
| 85 85 | 
             
            - doc/release_notes/3.19.0.txt
         | 
| 86 86 | 
             
            - doc/release_notes/3.20.0.txt
         | 
| 87 | 
            +
            - doc/release_notes/3.21.0.txt
         | 
| 87 88 | 
             
            files: 
         | 
| 88 89 | 
             
            - MIT-LICENSE
         | 
| 89 90 | 
             
            - CHANGELOG
         | 
| @@ -135,6 +136,7 @@ files: | |
| 135 136 | 
             
            - doc/release_notes/3.18.0.txt
         | 
| 136 137 | 
             
            - doc/release_notes/3.19.0.txt
         | 
| 137 138 | 
             
            - doc/release_notes/3.20.0.txt
         | 
| 139 | 
            +
            - doc/release_notes/3.21.0.txt
         | 
| 138 140 | 
             
            - doc/sharding.rdoc
         | 
| 139 141 | 
             
            - doc/sql.rdoc
         | 
| 140 142 | 
             
            - doc/virtual_rows.rdoc
         | 
| @@ -213,6 +215,7 @@ files: | |
| 213 215 | 
             
            - spec/extensions/tree_spec.rb
         | 
| 214 216 | 
             
            - spec/extensions/xml_serializer_spec.rb
         | 
| 215 217 | 
             
            - spec/extensions/to_dot_spec.rb
         | 
| 218 | 
            +
            - spec/extensions/association_autoreloading_spec.rb
         | 
| 216 219 | 
             
            - spec/integration/associations_test.rb
         | 
| 217 220 | 
             
            - spec/integration/database_test.rb
         | 
| 218 221 | 
             
            - spec/integration/dataset_test.rb
         | 
| @@ -321,6 +324,7 @@ files: | |
| 321 324 | 
             
            - lib/sequel/adapters/swift/mysql.rb
         | 
| 322 325 | 
             
            - lib/sequel/adapters/swift/postgres.rb
         | 
| 323 326 | 
             
            - lib/sequel/adapters/swift/sqlite.rb
         | 
| 327 | 
            +
            - lib/sequel/adapters/tinytds.rb
         | 
| 324 328 | 
             
            - lib/sequel/connection_pool.rb
         | 
| 325 329 | 
             
            - lib/sequel/connection_pool/sharded_single.rb
         | 
| 326 330 | 
             
            - lib/sequel/connection_pool/sharded_threaded.rb
         | 
| @@ -405,6 +409,7 @@ files: | |
| 405 409 | 
             
            - lib/sequel/plugins/list.rb
         | 
| 406 410 | 
             
            - lib/sequel/plugins/tree.rb
         | 
| 407 411 | 
             
            - lib/sequel/plugins/xml_serializer.rb
         | 
| 412 | 
            +
            - lib/sequel/plugins/association_autoreloading.rb
         | 
| 408 413 | 
             
            - lib/sequel/sql.rb
         | 
| 409 414 | 
             
            - lib/sequel/timezones.rb
         | 
| 410 415 | 
             
            - lib/sequel/version.rb
         |