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
@@ -33,7 +33,7 @@ POSTGRES_DB.create_table! :test4 do
|
|
33
33
|
bytea :value
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
describe "A PostgreSQL database" do
|
37
37
|
before do
|
38
38
|
@db = POSTGRES_DB
|
39
39
|
end
|
@@ -54,7 +54,7 @@ context "A PostgreSQL database" do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
describe "A PostgreSQL dataset" do
|
58
58
|
before do
|
59
59
|
@d = POSTGRES_DB[:test]
|
60
60
|
@d.delete # remove all records
|
@@ -234,7 +234,7 @@ if POSTGRES_DB.pool.respond_to?(:max_size) and POSTGRES_DB.pool.max_size > 1
|
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
237
|
-
|
237
|
+
describe "A PostgreSQL dataset with a timestamp field" do
|
238
238
|
before do
|
239
239
|
@d = POSTGRES_DB[:test3]
|
240
240
|
@d.delete
|
@@ -259,7 +259,7 @@ context "A PostgreSQL dataset with a timestamp field" do
|
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
|
-
|
262
|
+
describe "PostgreSQL's EXPLAIN and ANALYZE" do
|
263
263
|
specify "should not raise errors" do
|
264
264
|
@d = POSTGRES_DB[:test3]
|
265
265
|
proc{@d.explain}.should_not raise_error
|
@@ -267,7 +267,7 @@ context "PostgreSQL's EXPLAIN and ANALYZE" do
|
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
270
|
-
|
270
|
+
describe "A PostgreSQL database" do
|
271
271
|
before do
|
272
272
|
@db = POSTGRES_DB
|
273
273
|
end
|
@@ -310,7 +310,7 @@ context "A PostgreSQL database" do
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
-
|
313
|
+
describe "A PostgreSQL database" do
|
314
314
|
before do
|
315
315
|
@db = POSTGRES_DB
|
316
316
|
@db.drop_table(:posts) rescue nil
|
@@ -424,7 +424,7 @@ context "A PostgreSQL database" do
|
|
424
424
|
end
|
425
425
|
end
|
426
426
|
|
427
|
-
|
427
|
+
describe "Postgres::Dataset#import" do
|
428
428
|
before do
|
429
429
|
@db = POSTGRES_DB
|
430
430
|
@db.create_table!(:test){Integer :x; Integer :y}
|
@@ -463,7 +463,7 @@ context "Postgres::Dataset#import" do
|
|
463
463
|
end
|
464
464
|
end
|
465
465
|
|
466
|
-
|
466
|
+
describe "Postgres::Dataset#insert" do
|
467
467
|
before do
|
468
468
|
@db = POSTGRES_DB
|
469
469
|
@db.create_table!(:test5){primary_key :xid; Integer :value}
|
@@ -551,7 +551,7 @@ context "Postgres::Dataset#insert" do
|
|
551
551
|
end
|
552
552
|
end
|
553
553
|
|
554
|
-
|
554
|
+
describe "Postgres::Database schema qualified tables" do
|
555
555
|
before do
|
556
556
|
POSTGRES_DB << "CREATE SCHEMA schema_test"
|
557
557
|
POSTGRES_DB.instance_variable_set(:@primary_keys, {})
|
@@ -656,7 +656,7 @@ context "Postgres::Database schema qualified tables" do
|
|
656
656
|
end
|
657
657
|
end
|
658
658
|
|
659
|
-
|
659
|
+
describe "Postgres::Database schema qualified tables and eager graphing" do
|
660
660
|
before(:all) do
|
661
661
|
@db = POSTGRES_DB
|
662
662
|
@db.run "DROP SCHEMA s CASCADE" rescue nil
|
@@ -844,7 +844,7 @@ if POSTGRES_DB.server_version >= 80300
|
|
844
844
|
full_text_index [:title, :body]
|
845
845
|
end
|
846
846
|
|
847
|
-
|
847
|
+
describe "PostgreSQL tsearch2" do
|
848
848
|
before do
|
849
849
|
@ds = POSTGRES_DB[:test6]
|
850
850
|
end
|
@@ -873,7 +873,7 @@ if POSTGRES_DB.server_version >= 80300
|
|
873
873
|
end
|
874
874
|
|
875
875
|
if POSTGRES_DB.dataset.supports_window_functions?
|
876
|
-
|
876
|
+
describe "Postgres::Dataset named windows" do
|
877
877
|
before do
|
878
878
|
@db = POSTGRES_DB
|
879
879
|
@db.create_table!(:i1){Integer :id; Integer :group_id; Integer :amount}
|
@@ -902,7 +902,7 @@ if POSTGRES_DB.dataset.supports_window_functions?
|
|
902
902
|
end
|
903
903
|
end
|
904
904
|
|
905
|
-
|
905
|
+
describe "Postgres::Database functions, languages, and triggers" do
|
906
906
|
before do
|
907
907
|
@d = POSTGRES_DB
|
908
908
|
end
|
@@ -973,7 +973,7 @@ context "Postgres::Database functions, languages, and triggers" do
|
|
973
973
|
end
|
974
974
|
|
975
975
|
if POSTGRES_DB.adapter_scheme == :postgres
|
976
|
-
|
976
|
+
describe "Postgres::Dataset #use_cursor" do
|
977
977
|
before(:all) do
|
978
978
|
@db = POSTGRES_DB
|
979
979
|
@db.create_table!(:test_cursor){Integer :x}
|
@@ -6,7 +6,7 @@ unless defined?(SQLITE_DB)
|
|
6
6
|
end
|
7
7
|
INTEGRATION_DB = SQLITE_DB unless defined?(INTEGRATION_DB)
|
8
8
|
|
9
|
-
|
9
|
+
describe "An SQLite database" do
|
10
10
|
before do
|
11
11
|
@db = SQLITE_DB
|
12
12
|
@fk = @db.foreign_keys
|
@@ -128,7 +128,7 @@ context "An SQLite database" do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
|
131
|
+
describe "An SQLite dataset" do
|
132
132
|
before do
|
133
133
|
@d = SQLITE_DB[:items]
|
134
134
|
end
|
@@ -148,7 +148,7 @@ context "An SQLite dataset" do
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
|
151
|
+
describe "An SQLite numeric column" do
|
152
152
|
specify "should handle and return BigDecimal values" do
|
153
153
|
SQLITE_DB.create_table!(:d){numeric :d}
|
154
154
|
d = SQLITE_DB[:d]
|
@@ -162,7 +162,7 @@ context "An SQLite numeric column" do
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
|
165
|
+
describe "An SQLite dataset AS clause" do
|
166
166
|
specify "should use a string literal for :col___alias" do
|
167
167
|
SQLITE_DB.literal(:c___a).should == "c AS 'a'"
|
168
168
|
end
|
@@ -188,7 +188,7 @@ context "An SQLite dataset AS clause" do
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
-
|
191
|
+
describe "SQLite::Dataset#delete" do
|
192
192
|
before do
|
193
193
|
SQLITE_DB.create_table! :items do
|
194
194
|
primary_key :id
|
@@ -220,7 +220,7 @@ context "SQLite::Dataset#delete" do
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
|
223
|
+
describe "SQLite::Dataset#update" do
|
224
224
|
before do
|
225
225
|
SQLITE_DB.create_table! :items do
|
226
226
|
primary_key :id
|
@@ -243,7 +243,7 @@ context "SQLite::Dataset#update" do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
-
|
246
|
+
describe "SQLite dataset" do
|
247
247
|
before do
|
248
248
|
SQLITE_DB.create_table! :test do
|
249
249
|
primary_key :id
|
@@ -282,7 +282,7 @@ context "SQLite dataset" do
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
|
285
|
-
|
285
|
+
describe "A SQLite database" do
|
286
286
|
before do
|
287
287
|
@db = SQLITE_DB
|
288
288
|
@db.create_table! :test2 do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper')
|
2
2
|
CONNECTION_POOL_DEFAULTS = {:pool_timeout=>5, :pool_sleep_time=>0.001, :max_connections=>4}
|
3
3
|
|
4
|
-
|
4
|
+
describe "An empty ConnectionPool" do
|
5
5
|
before do
|
6
6
|
@cpool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS){}
|
7
7
|
end
|
@@ -19,7 +19,7 @@ context "An empty ConnectionPool" do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
describe "ConnectionPool options" do
|
23
23
|
specify "should support string option values" do
|
24
24
|
cpool = Sequel::ConnectionPool.get_pool({:max_connections=>'5', :pool_timeout=>'3', :pool_sleep_time=>'0.01'}){}
|
25
25
|
cpool.max_size.should == 5
|
@@ -35,7 +35,7 @@ context "ConnectionPool options" do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
describe "A connection pool handling connections" do
|
39
39
|
before do
|
40
40
|
@max_size = 2
|
41
41
|
@cpool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:disconnection_proc=>proc{|c| @max_size=3}, :max_connections=>@max_size)) {:got_connection}
|
@@ -107,7 +107,7 @@ context "A connection pool handling connections" do
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
|
110
|
+
describe "A connection pool handling connection errors" do
|
111
111
|
specify "#hold should raise a Sequel::DatabaseConnectionError if an exception is raised by the connection_proc" do
|
112
112
|
cpool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS){raise Interrupt}
|
113
113
|
proc{cpool.hold{:block_return}}.should raise_error(Sequel::DatabaseConnectionError)
|
@@ -132,7 +132,7 @@ class DummyConnection
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
describe "ConnectionPool#hold" do
|
136
136
|
before do
|
137
137
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS) {DummyConnection.new}
|
138
138
|
end
|
@@ -158,7 +158,7 @@ context "ConnectionPool#hold" do
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
|
161
|
+
describe "A connection pool with a max size of 1" do
|
162
162
|
before do
|
163
163
|
@invoked_count = 0
|
164
164
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:max_connections=>1)) {@invoked_count += 1; 'herro'}
|
@@ -166,14 +166,15 @@ context "A connection pool with a max size of 1" do
|
|
166
166
|
|
167
167
|
specify "should let only one thread access the connection at any time" do
|
168
168
|
cc,c1, c2 = nil
|
169
|
+
m = (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx') ? 30 : 1
|
169
170
|
|
170
171
|
t1 = Thread.new {@pool.hold {|c| cc = c; c1 = c.dup; while c == 'herro';sleep 0.01;end}}
|
171
|
-
sleep 0.
|
172
|
+
sleep 0.02 * m
|
172
173
|
cc.should == 'herro'
|
173
174
|
c1.should == 'herro'
|
174
175
|
|
175
176
|
t2 = Thread.new {@pool.hold {|c| c2 = c.dup; while c == 'hello';sleep 0.01;end}}
|
176
|
-
sleep 0.02
|
177
|
+
sleep 0.02 * m
|
177
178
|
|
178
179
|
# connection held by t1
|
179
180
|
t1.should be_alive
|
@@ -187,7 +188,7 @@ context "A connection pool with a max size of 1" do
|
|
187
188
|
@pool.allocated.should == {t1=>cc}
|
188
189
|
|
189
190
|
cc.gsub!('rr', 'll')
|
190
|
-
sleep 0.05
|
191
|
+
sleep 0.05 * m
|
191
192
|
|
192
193
|
# connection held by t2
|
193
194
|
t1.should_not be_alive
|
@@ -199,7 +200,7 @@ context "A connection pool with a max size of 1" do
|
|
199
200
|
@pool.allocated.should == {t2=>cc}
|
200
201
|
|
201
202
|
cc.gsub!('ll', 'rr')
|
202
|
-
sleep 0.05
|
203
|
+
sleep 0.05 * m
|
203
204
|
|
204
205
|
#connection released
|
205
206
|
t2.should_not be_alive
|
@@ -290,7 +291,7 @@ shared_examples_for "A threaded connection pool" do
|
|
290
291
|
cc[7].should be_nil
|
291
292
|
|
292
293
|
stop = true
|
293
|
-
sleep 0.
|
294
|
+
sleep 0.1
|
294
295
|
|
295
296
|
threads.each {|t| t.should_not be_alive}
|
296
297
|
|
@@ -301,7 +302,7 @@ shared_examples_for "A threaded connection pool" do
|
|
301
302
|
end
|
302
303
|
end
|
303
304
|
|
304
|
-
|
305
|
+
describe "Threaded Unsharded Connection Pool" do
|
305
306
|
before do
|
306
307
|
@invoked_count = 0
|
307
308
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:max_connections=>5)) {@invoked_count += 1}
|
@@ -310,7 +311,7 @@ context "Threaded Unsharded Connection Pool" do
|
|
310
311
|
it_should_behave_like "A threaded connection pool"
|
311
312
|
end
|
312
313
|
|
313
|
-
|
314
|
+
describe "Threaded Sharded Connection Pool" do
|
314
315
|
before do
|
315
316
|
@invoked_count = 0
|
316
317
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:max_connections=>5, :servers=>{})) {@invoked_count += 1}
|
@@ -319,7 +320,7 @@ context "Threaded Sharded Connection Pool" do
|
|
319
320
|
it_should_behave_like "A threaded connection pool"
|
320
321
|
end
|
321
322
|
|
322
|
-
|
323
|
+
describe "ConnectionPool#disconnect" do
|
323
324
|
before do
|
324
325
|
@count = 0
|
325
326
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:max_connections=>5, :servers=>{})) {{:id => @count += 1}}
|
@@ -385,7 +386,7 @@ context "ConnectionPool#disconnect" do
|
|
385
386
|
end
|
386
387
|
end
|
387
388
|
|
388
|
-
|
389
|
+
describe "A connection pool with multiple servers" do
|
389
390
|
before do
|
390
391
|
@invoked_counts = Hash.new(0)
|
391
392
|
@pool = Sequel::ConnectionPool.get_pool(CONNECTION_POOL_DEFAULTS.merge(:servers=>{:read_only=>{}})){|server| "#{server}#{@invoked_counts[server] += 1}"}
|
@@ -616,7 +617,7 @@ end
|
|
616
617
|
|
617
618
|
ST_CONNECTION_POOL_DEFAULTS = CONNECTION_POOL_DEFAULTS.merge(:single_threaded=>true)
|
618
619
|
|
619
|
-
|
620
|
+
describe "SingleConnectionPool" do
|
620
621
|
before do
|
621
622
|
@pool = Sequel::ConnectionPool.get_pool(ST_CONNECTION_POOL_DEFAULTS){1234}
|
622
623
|
end
|
@@ -638,7 +639,7 @@ context "SingleConnectionPool" do
|
|
638
639
|
end
|
639
640
|
end
|
640
641
|
|
641
|
-
|
642
|
+
describe "A single threaded pool with multiple servers" do
|
642
643
|
before do
|
643
644
|
@max_size=2
|
644
645
|
@pool = Sequel::ConnectionPool.get_pool(ST_CONNECTION_POOL_DEFAULTS.merge(:disconnection_proc=>proc{|c| @max_size=3}, :servers=>{:read_only=>{}})){|server| server}
|
data/spec/core/core_sql_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(File.expand_path(__FILE__)), 'spec_helper')
|
2
2
|
|
3
|
-
|
3
|
+
describe "Array#all_two_pairs?" do
|
4
4
|
specify "should return false if empty" do
|
5
5
|
[].all_two_pairs?.should == false
|
6
6
|
end
|
@@ -23,7 +23,7 @@ context "Array#all_two_pairs?" do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
describe "Array#case and Hash#case" do
|
27
27
|
before do
|
28
28
|
@d = Sequel::Dataset.new(nil)
|
29
29
|
end
|
@@ -55,7 +55,7 @@ context "Array#case and Hash#case" do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
describe "Array#sql_value_list and #sql_array" do
|
59
59
|
before do
|
60
60
|
@d = Sequel::Dataset.new(nil)
|
61
61
|
end
|
@@ -73,7 +73,7 @@ context "Array#sql_value_list and #sql_array" do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
describe "String#lit" do
|
77
77
|
before do
|
78
78
|
@ds = ds = MockDatabase.new.dataset
|
79
79
|
end
|
@@ -111,7 +111,7 @@ context "String#lit" do
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
|
114
|
+
describe "String#to_sequel_blob" do
|
115
115
|
specify "should return a Blob object" do
|
116
116
|
'xyz'.to_sequel_blob.should be_a_kind_of(::Sequel::SQL::Blob)
|
117
117
|
'xyz'.to_sequel_blob.should == 'xyz'
|
@@ -122,7 +122,7 @@ context "String#to_sequel_blob" do
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
|
125
|
+
describe "#desc" do
|
126
126
|
before do
|
127
127
|
@ds = Sequel::Dataset.new(nil)
|
128
128
|
end
|
@@ -138,7 +138,7 @@ context "#desc" do
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
|
141
|
+
describe "#asc" do
|
142
142
|
before do
|
143
143
|
@ds = Sequel::Dataset.new(nil)
|
144
144
|
end
|
@@ -154,7 +154,7 @@ context "#asc" do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
describe "#as" do
|
158
158
|
before do
|
159
159
|
@ds = Sequel::Dataset.new(nil)
|
160
160
|
end
|
@@ -174,7 +174,7 @@ context "#as" do
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
-
|
177
|
+
describe "Column references" do
|
178
178
|
before do
|
179
179
|
@c = Class.new(Sequel::Dataset) do
|
180
180
|
def quoted_identifier(c); "`#{c}`"; end
|
@@ -211,7 +211,7 @@ context "Column references" do
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
|
214
|
+
describe "Blob" do
|
215
215
|
specify "#to_sequel_blob should return self" do
|
216
216
|
blob = "x".to_sequel_blob
|
217
217
|
blob.to_sequel_blob.object_id.should == blob.object_id
|
@@ -219,7 +219,7 @@ context "Blob" do
|
|
219
219
|
end
|
220
220
|
|
221
221
|
if RUBY_VERSION < '1.9.0'
|
222
|
-
|
222
|
+
describe "Symbol#[]" do
|
223
223
|
specify "should format an SQL Function" do
|
224
224
|
ds = Sequel::Dataset.new(nil)
|
225
225
|
ds.literal(:xyz[]).should == 'xyz()'
|
@@ -229,7 +229,7 @@ if RUBY_VERSION < '1.9.0'
|
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
-
|
232
|
+
describe "Symbol#*" do
|
233
233
|
before do
|
234
234
|
@ds = Sequel::Dataset.new(nil)
|
235
235
|
end
|
@@ -249,7 +249,7 @@ context "Symbol#*" do
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
-
|
252
|
+
describe "Symbol" do
|
253
253
|
before do
|
254
254
|
@ds = Sequel::Dataset.new(nil)
|
255
255
|
@ds.quote_identifiers = true
|
@@ -287,7 +287,7 @@ context "Symbol" do
|
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
|
-
|
290
|
+
describe "Dataset#literal" do
|
291
291
|
before do
|
292
292
|
@ds = MockDataset.new(nil)
|
293
293
|
end
|
@@ -323,7 +323,7 @@ context "Dataset#literal" do
|
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
326
|
-
|
326
|
+
describe "Symbol" do
|
327
327
|
before do
|
328
328
|
@ds = Sequel::Dataset.new(MockDatabase.new)
|
329
329
|
end
|
@@ -390,7 +390,7 @@ context "Symbol" do
|
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
393
|
-
|
393
|
+
describe "Sequel::SQL::Function#==" do
|
394
394
|
specify "should be true for functions with the same name and arguments, false otherwise" do
|
395
395
|
a = :date.sql_function(:t)
|
396
396
|
b = :date.sql_function(:t)
|
@@ -407,7 +407,7 @@ context "Sequel::SQL::Function#==" do
|
|
407
407
|
end
|
408
408
|
end
|
409
409
|
|
410
|
-
|
410
|
+
describe "Sequel::SQL::OrderedExpression" do
|
411
411
|
specify "should #desc" do
|
412
412
|
@oe = :column.asc
|
413
413
|
@oe.descending.should == false
|
@@ -427,7 +427,7 @@ context "Sequel::SQL::OrderedExpression" do
|
|
427
427
|
end
|
428
428
|
end
|
429
429
|
|
430
|
-
|
430
|
+
describe "Expression" do
|
431
431
|
specify "should consider objects == only if they have the same attributes" do
|
432
432
|
:column.qualify(:table).cast(:type).*(:numeric_column).asc.should == :column.qualify(:table).cast(:type).*(:numeric_column).asc
|
433
433
|
:other_column.qualify(:table).cast(:type).*(:numeric_column).asc.should_not == :column.qualify(:table).cast(:type).*(:numeric_column).asc
|