sequel_core 2.2.0 → 3.8.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.
- metadata +30 -101
- data/CHANGELOG +0 -1519
- data/COPYING +0 -19
- data/README +0 -313
- data/Rakefile +0 -158
- data/bin/sequel +0 -117
- data/doc/cheat_sheet.rdoc +0 -225
- data/doc/dataset_filtering.rdoc +0 -182
- data/lib/sequel_core.rb +0 -136
- data/lib/sequel_core/adapters/adapter_skeleton.rb +0 -68
- data/lib/sequel_core/adapters/ado.rb +0 -90
- data/lib/sequel_core/adapters/db2.rb +0 -160
- data/lib/sequel_core/adapters/dbi.rb +0 -127
- data/lib/sequel_core/adapters/informix.rb +0 -89
- data/lib/sequel_core/adapters/jdbc.rb +0 -110
- data/lib/sequel_core/adapters/mysql.rb +0 -486
- data/lib/sequel_core/adapters/odbc.rb +0 -167
- data/lib/sequel_core/adapters/odbc_mssql.rb +0 -106
- data/lib/sequel_core/adapters/openbase.rb +0 -76
- data/lib/sequel_core/adapters/oracle.rb +0 -182
- data/lib/sequel_core/adapters/postgres.rb +0 -560
- data/lib/sequel_core/adapters/sqlite.rb +0 -270
- data/lib/sequel_core/connection_pool.rb +0 -194
- data/lib/sequel_core/core_ext.rb +0 -197
- data/lib/sequel_core/core_sql.rb +0 -184
- data/lib/sequel_core/database.rb +0 -462
- data/lib/sequel_core/database/schema.rb +0 -156
- data/lib/sequel_core/dataset.rb +0 -457
- data/lib/sequel_core/dataset/callback.rb +0 -13
- data/lib/sequel_core/dataset/convenience.rb +0 -245
- data/lib/sequel_core/dataset/pagination.rb +0 -96
- data/lib/sequel_core/dataset/query.rb +0 -41
- data/lib/sequel_core/dataset/schema.rb +0 -15
- data/lib/sequel_core/dataset/sql.rb +0 -889
- data/lib/sequel_core/deprecated.rb +0 -26
- data/lib/sequel_core/exceptions.rb +0 -42
- data/lib/sequel_core/migration.rb +0 -187
- data/lib/sequel_core/object_graph.rb +0 -216
- data/lib/sequel_core/pretty_table.rb +0 -71
- data/lib/sequel_core/schema.rb +0 -2
- data/lib/sequel_core/schema/generator.rb +0 -239
- data/lib/sequel_core/schema/sql.rb +0 -326
- data/lib/sequel_core/sql.rb +0 -812
- data/lib/sequel_core/worker.rb +0 -68
- data/spec/adapters/informix_spec.rb +0 -96
- data/spec/adapters/mysql_spec.rb +0 -765
- data/spec/adapters/oracle_spec.rb +0 -222
- data/spec/adapters/postgres_spec.rb +0 -441
- data/spec/adapters/sqlite_spec.rb +0 -413
- data/spec/connection_pool_spec.rb +0 -363
- data/spec/core_ext_spec.rb +0 -156
- data/spec/core_sql_spec.rb +0 -427
- data/spec/database_spec.rb +0 -963
- data/spec/dataset_spec.rb +0 -2933
- data/spec/expression_filters_spec.rb +0 -316
- data/spec/migration_spec.rb +0 -261
- data/spec/object_graph_spec.rb +0 -230
- data/spec/pretty_table_spec.rb +0 -58
- data/spec/rcov.opts +0 -6
- data/spec/schema_generator_spec.rb +0 -122
- data/spec/schema_spec.rb +0 -422
- data/spec/spec.opts +0 -0
- data/spec/spec_config.rb +0 -7
- data/spec/spec_config.rb.example +0 -8
- data/spec/spec_helper.rb +0 -55
- data/spec/worker_spec.rb +0 -96
data/spec/spec.opts
DELETED
File without changes
|
data/spec/spec_config.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# database objects for running adapter specs
|
2
|
-
# INFORMIX_DB = Sequel.connect('informix://localhost/mydb')
|
3
|
-
MYSQL_URL = 'mysql://agp:sequel++@sql.mit.edu/agp+sequel'
|
4
|
-
# MYSQL_SOCKET_FILE = '/tmp/mysql.sock'
|
5
|
-
# ORACLE_DB = Sequel.connect('oracle://hr:hr@localhost/XE')
|
6
|
-
POSTGRES_URL = 'postgres://_postgresql@postgresql/sequel_test'
|
7
|
-
# SQLITE_DB = Sequel.connect('sqlite:/')
|
data/spec/spec_config.rb.example
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# database objects for running adapter specs
|
2
|
-
# INFORMIX_DB = Sequel.connect('informix://localhost/mydb')
|
3
|
-
# MYSQL_USER = 'root'
|
4
|
-
# MYSQL_DB = Sequel.connect("mysql://#{MYSQL_USER}@localhost/sandbox")
|
5
|
-
# MYSQL_SOCKET_FILE = '/tmp/mysql.sock'
|
6
|
-
# ORACLE_DB = Sequel.connect('oracle://hr:hr@localhost/XE')
|
7
|
-
# POSTGRES_DB = Sequel.connect('postgres://postgres:postgres@localhost:5432/reality_spec')
|
8
|
-
# SQLITE_DB = Sequel.connect('sqlite:/')
|
data/spec/spec_helper.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
unless Object.const_defined?('Sequel')
|
3
|
-
$:.unshift(File.join(File.dirname(__FILE__), "../lib/"))
|
4
|
-
require 'sequel_core'
|
5
|
-
end
|
6
|
-
|
7
|
-
class MockDataset < Sequel::Dataset
|
8
|
-
def insert(*args)
|
9
|
-
@db.execute insert_sql(*args)
|
10
|
-
end
|
11
|
-
|
12
|
-
def update(*args)
|
13
|
-
@db.execute update_sql(*args)
|
14
|
-
end
|
15
|
-
|
16
|
-
def fetch_rows(sql)
|
17
|
-
@db.execute(sql)
|
18
|
-
yield({:id => 1, :x => 1})
|
19
|
-
end
|
20
|
-
|
21
|
-
def quoted_identifier(c)
|
22
|
-
"\"#{c}\""
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class MockDatabase < Sequel::Database
|
27
|
-
@@quote_identifiers = false
|
28
|
-
attr_reader :sqls
|
29
|
-
|
30
|
-
def execute(sql)
|
31
|
-
@sqls ||= []
|
32
|
-
@sqls << sql
|
33
|
-
end
|
34
|
-
|
35
|
-
def reset
|
36
|
-
@sqls = []
|
37
|
-
end
|
38
|
-
|
39
|
-
def transaction; yield; end
|
40
|
-
|
41
|
-
def dataset; MockDataset.new(self); end
|
42
|
-
end
|
43
|
-
|
44
|
-
class SchemaDummyDatabase < Sequel::Database
|
45
|
-
attr_reader :sqls
|
46
|
-
|
47
|
-
def execute(sql)
|
48
|
-
@sqls ||= []
|
49
|
-
@sqls << sql
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
if File.exists?(File.join(File.dirname(__FILE__), 'spec_config.rb'))
|
54
|
-
require File.join(File.dirname(__FILE__), 'spec_config.rb')
|
55
|
-
end
|
data/spec/worker_spec.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
context "A worker" do
|
4
|
-
setup do
|
5
|
-
@w = Sequel::Worker.new
|
6
|
-
end
|
7
|
-
|
8
|
-
teardown do
|
9
|
-
sleep 0.1
|
10
|
-
@w.join if @w
|
11
|
-
end
|
12
|
-
|
13
|
-
specify "should be a thread" do
|
14
|
-
@w.should be_a_kind_of(Thread)
|
15
|
-
end
|
16
|
-
|
17
|
-
specify "should be alive until it is joined" do
|
18
|
-
@w.should be_alive
|
19
|
-
end
|
20
|
-
|
21
|
-
specify "should be busy if any jobs are pending" do
|
22
|
-
@w.should_not be_busy
|
23
|
-
@w.add {sleep 0.5}
|
24
|
-
@w.should be_busy
|
25
|
-
end
|
26
|
-
|
27
|
-
specify "should accept jobs and perform them in the correct order" do
|
28
|
-
values = []
|
29
|
-
@w.add {values << 1}
|
30
|
-
@w.async {values << 2}
|
31
|
-
@w << proc {values << 3}
|
32
|
-
|
33
|
-
@w.join
|
34
|
-
values.should == [1, 2, 3]
|
35
|
-
end
|
36
|
-
|
37
|
-
specify "should isolate errors and hold them in #errors" do
|
38
|
-
values = []
|
39
|
-
@w.add {values << 1}
|
40
|
-
@w.async {values << 2}
|
41
|
-
@w.async {raise "bad bad bad"}
|
42
|
-
@w << proc {values << 3}
|
43
|
-
|
44
|
-
@w.join
|
45
|
-
values.should == [1, 2, 3]
|
46
|
-
@w.errors.size.should == 1
|
47
|
-
@w.errors.first.message.should == 'bad bad bad'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "A worker with a given db" do
|
52
|
-
setup do
|
53
|
-
@db = MockDatabase.new
|
54
|
-
@m = Module.new do
|
55
|
-
def transaction
|
56
|
-
execute('BEGIN')
|
57
|
-
yield
|
58
|
-
execute('COMMIT')
|
59
|
-
rescue
|
60
|
-
execute('ROLLBACK')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
@db.extend(@m)
|
64
|
-
@w = Sequel::Worker.new(@db)
|
65
|
-
end
|
66
|
-
|
67
|
-
teardown do
|
68
|
-
@w.join if @w
|
69
|
-
end
|
70
|
-
|
71
|
-
specify "should wrap everything in a transaction" do
|
72
|
-
@w.async {@db[:items] << {:x => 1}}
|
73
|
-
@w.join
|
74
|
-
@w = nil
|
75
|
-
@db.sqls.should == [
|
76
|
-
'BEGIN',
|
77
|
-
'INSERT INTO items (x) VALUES (1)',
|
78
|
-
'COMMIT'
|
79
|
-
]
|
80
|
-
end
|
81
|
-
|
82
|
-
specify "should rollback the transaction if any error is raised" do
|
83
|
-
@w.async {@db[:items] << {:x => 1}}
|
84
|
-
@w.async {sleep 0.2; raise "that's bad"}
|
85
|
-
@w.async {@db[:items] << {:x => 2}}
|
86
|
-
@w.join
|
87
|
-
@db.sqls.should == [
|
88
|
-
'BEGIN',
|
89
|
-
'INSERT INTO items (x) VALUES (1)',
|
90
|
-
'INSERT INTO items (x) VALUES (2)',
|
91
|
-
'ROLLBACK'
|
92
|
-
]
|
93
|
-
@w.errors.size.should == 1
|
94
|
-
@w.errors.first.message.should == "that's bad"
|
95
|
-
end
|
96
|
-
end
|