sequel 3.8.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +48 -0
- data/Rakefile +6 -28
- data/bin/sequel +7 -2
- data/doc/release_notes/3.9.0.txt +233 -0
- data/lib/sequel/adapters/ado.rb +4 -8
- data/lib/sequel/adapters/amalgalite.rb +1 -1
- data/lib/sequel/adapters/dbi.rb +3 -3
- data/lib/sequel/adapters/do.rb +7 -13
- data/lib/sequel/adapters/jdbc.rb +10 -16
- data/lib/sequel/adapters/jdbc/h2.rb +5 -0
- data/lib/sequel/adapters/mysql.rb +10 -23
- data/lib/sequel/adapters/odbc.rb +6 -10
- data/lib/sequel/adapters/postgres.rb +0 -5
- data/lib/sequel/adapters/shared/mssql.rb +17 -9
- data/lib/sequel/adapters/shared/mysql.rb +16 -7
- data/lib/sequel/adapters/shared/sqlite.rb +5 -0
- data/lib/sequel/adapters/sqlite.rb +2 -1
- data/lib/sequel/connection_pool.rb +67 -349
- data/lib/sequel/connection_pool/sharded_single.rb +84 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +211 -0
- data/lib/sequel/connection_pool/single.rb +29 -0
- data/lib/sequel/connection_pool/threaded.rb +150 -0
- data/lib/sequel/core.rb +46 -15
- data/lib/sequel/database.rb +11 -9
- data/lib/sequel/dataset/convenience.rb +23 -0
- data/lib/sequel/dataset/graph.rb +2 -2
- data/lib/sequel/dataset/query.rb +9 -5
- data/lib/sequel/dataset/sql.rb +87 -12
- data/lib/sequel/extensions/inflector.rb +8 -1
- data/lib/sequel/extensions/schema_dumper.rb +3 -4
- data/lib/sequel/model/associations.rb +5 -43
- data/lib/sequel/model/base.rb +9 -2
- data/lib/sequel/model/default_inflections.rb +1 -1
- data/lib/sequel/model/exceptions.rb +11 -1
- data/lib/sequel/model/inflections.rb +8 -1
- data/lib/sequel/model/plugins.rb +2 -12
- data/lib/sequel/plugins/active_model.rb +5 -0
- data/lib/sequel/plugins/association_dependencies.rb +1 -1
- data/lib/sequel/plugins/many_through_many.rb +1 -1
- data/lib/sequel/plugins/optimistic_locking.rb +65 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +14 -3
- data/lib/sequel/plugins/validation_helpers.rb +2 -2
- data/lib/sequel/sql.rb +2 -2
- data/lib/sequel/timezones.rb +2 -2
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +19 -0
- data/spec/adapters/mysql_spec.rb +4 -0
- data/spec/adapters/postgres_spec.rb +180 -0
- data/spec/adapters/spec_helper.rb +15 -1
- data/spec/core/connection_pool_spec.rb +119 -78
- data/spec/core/database_spec.rb +41 -50
- data/spec/core/dataset_spec.rb +115 -4
- data/spec/extensions/active_model_spec.rb +40 -34
- data/spec/extensions/boolean_readers_spec.rb +1 -1
- data/spec/extensions/migration_spec.rb +43 -38
- data/spec/extensions/optimistic_locking_spec.rb +100 -0
- data/spec/extensions/schema_dumper_spec.rb +4 -4
- data/spec/extensions/single_table_inheritance_spec.rb +19 -11
- data/spec/integration/dataset_test.rb +44 -1
- data/spec/integration/plugin_test.rb +39 -0
- data/spec/integration/prepared_statement_test.rb +58 -7
- data/spec/integration/spec_helper.rb +4 -0
- data/spec/model/eager_loading_spec.rb +24 -0
- data/spec/model/validations_spec.rb +5 -1
- metadata +114 -106
data/CHANGELOG
CHANGED
@@ -1,3 +1,51 @@
|
|
1
|
+
=== 3.9.0 (2010-03-04)
|
2
|
+
|
3
|
+
* Allow loading adapters and extensions from outside of the Sequel lib directory (jeremyevans)
|
4
|
+
|
5
|
+
* Make limit and offset work as bound variables in prepared statements (jeremyevans)
|
6
|
+
|
7
|
+
* In the single_table_inheritance plugin, handle case where the sti_key is nil or '' specially (jeremyevans) (#287)
|
8
|
+
|
9
|
+
* Handle IN/NOT IN with an empty array (jeremyevans)
|
10
|
+
|
11
|
+
* Emulate IN/NOT IN with multiple columns where the database doesn't support it and a dataset is given (jeremyevans)
|
12
|
+
|
13
|
+
* Add Dataset#unused_table_alias, for generating a table alias that has not yet been used in the query (jeremyevans)
|
14
|
+
|
15
|
+
* Support an empty database argument in bin/sequel, useful for testing things without a real database (jeremyevans)
|
16
|
+
|
17
|
+
* Support for schemas and aliases when eager graphing (jeremyevans)
|
18
|
+
|
19
|
+
* Handle using an SQL::Identifier as an 4th option to Dataset#join_table (jeremyevans)
|
20
|
+
|
21
|
+
* Move gem spec from Rakefile to a .gemspec file, for compatibility with gem build and builder (jeremyevans) (#285)
|
22
|
+
|
23
|
+
* Fix MSSQL 2005+ offset emulation on ruby 1.9 (jeremyevans)
|
24
|
+
|
25
|
+
* Make active_model plugin work with ActiveModel 3.0 beta Lint specs, now requires active_model (jeremyevans)
|
26
|
+
|
27
|
+
* Correctly create foreign key constraints on MySQL with the InnoDB engine, but you must specify the :key option (jeremyevans)
|
28
|
+
|
29
|
+
* Add an optimistic_locking plugin for models, similar to ActiveRecord's optimistic locking support (jeremyevans)
|
30
|
+
|
31
|
+
* Handle implicitly qualified symbols in UPDATE statements, useful for updating joined datasets (jeremyevans)
|
32
|
+
|
33
|
+
* Have schema_dumper extension pass options hash to Database#tables (jeremyevans) (#283)
|
34
|
+
|
35
|
+
* Make all internal uses of require thread-safe (jeremyevans)
|
36
|
+
|
37
|
+
* Refactor connection pool into 4 separate pools, increase performance for unsharded setups (jeremyevans)
|
38
|
+
|
39
|
+
* Change a couple instance_evaled lambdas into procs, for 1.9.2 compatibility (jeremyevans)
|
40
|
+
|
41
|
+
* Raise error message earlier if DISTINCT ON is used on SQLite (jeremyevans)
|
42
|
+
|
43
|
+
* Speed up prepared statements on SQLite (jeremyevans)
|
44
|
+
|
45
|
+
* Correctly handle ODBC timestamps when database_timezone is nil (jeremyevans)
|
46
|
+
|
47
|
+
* Add Sequel::ValidationFailed#errors (tmm1)
|
48
|
+
|
1
49
|
=== 3.8.0 (2010-01-04)
|
2
50
|
|
3
51
|
* Catch cases in the postgres adapter where exceptions weren't converted or raised appropriately (jeremyevans)
|
data/Rakefile
CHANGED
@@ -9,45 +9,23 @@ end
|
|
9
9
|
|
10
10
|
NAME = 'sequel'
|
11
11
|
VERS = lambda do
|
12
|
-
require "lib/sequel/version"
|
12
|
+
require File.expand_path("../lib/sequel/version", __FILE__)
|
13
13
|
Sequel.version
|
14
14
|
end
|
15
|
-
CLEAN.include ["**/.*.sw?", "
|
15
|
+
CLEAN.include ["**/.*.sw?", "sequel-*.gem", ".config", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc*"]
|
16
16
|
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Sequel: The Database Toolkit for Ruby']
|
17
17
|
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
|
18
18
|
|
19
19
|
# Gem Packaging and Release
|
20
20
|
|
21
|
-
spec = Gem::Specification.new do |s|
|
22
|
-
s.name = NAME
|
23
|
-
s.rubyforge_project = 'sequel'
|
24
|
-
s.version = VERS.call
|
25
|
-
s.platform = Gem::Platform::RUBY
|
26
|
-
s.has_rdoc = true
|
27
|
-
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG", "COPYING"] + Dir["doc/*.rdoc"] + Dir['doc/release_notes/*.txt']
|
28
|
-
s.rdoc_options += RDOC_OPTS
|
29
|
-
s.summary = "The Database Toolkit for Ruby"
|
30
|
-
s.description = s.summary
|
31
|
-
s.author = "Jeremy Evans"
|
32
|
-
s.email = "code@jeremyevans.net"
|
33
|
-
s.homepage = "http://sequel.rubyforge.org"
|
34
|
-
s.required_ruby_version = ">= 1.8.4"
|
35
|
-
s.files = %w(COPYING CHANGELOG README.rdoc Rakefile) + Dir["{bin,doc,spec,lib}/**/*"]
|
36
|
-
s.require_path = "lib"
|
37
|
-
s.bindir = 'bin'
|
38
|
-
s.executables << 'sequel'
|
39
|
-
end
|
40
|
-
|
41
21
|
desc "Packages sequel"
|
42
|
-
task :package=>[:clean]
|
43
|
-
|
44
|
-
p.need_tar = true
|
45
|
-
p.gem_spec = spec
|
22
|
+
task :package=>[:clean] do |p|
|
23
|
+
sh %{gem build sequel.gemspec}
|
46
24
|
end
|
47
25
|
|
48
26
|
desc "Install sequel gem"
|
49
27
|
task :install=>[:package] do
|
50
|
-
sh %{sudo gem install
|
28
|
+
sh %{sudo gem install ./#{NAME}-#{VERS.call} --local}
|
51
29
|
end
|
52
30
|
|
53
31
|
desc "Uninstall sequel gem"
|
@@ -57,7 +35,7 @@ end
|
|
57
35
|
|
58
36
|
desc "Upload sequel gem to gemcutter"
|
59
37
|
task :release=>[:package] do
|
60
|
-
sh %{gem push
|
38
|
+
sh %{gem push ./#{NAME}-#{VERS.call}.gem}
|
61
39
|
end
|
62
40
|
|
63
41
|
### RDoc
|
data/bin/sequel
CHANGED
@@ -95,7 +95,6 @@ end
|
|
95
95
|
error_proc["Error: Must specify -m if using -M"] if migrate_ver && !migrate_dir
|
96
96
|
error_proc["Error: Cannot specify -D or -d with -m"] if dump_migration && migrate_dir
|
97
97
|
error_proc["Error: Cannot specify -C with -d, -D, or -m"] if copy_databases && (dump_migration || migrate_dir)
|
98
|
-
error_proc["Error: Must specify database connection string or path to yaml file as argument"] if db.nil? || db.empty?
|
99
98
|
|
100
99
|
if logfile || echo
|
101
100
|
require 'logger'
|
@@ -105,7 +104,13 @@ if logfile || echo
|
|
105
104
|
end
|
106
105
|
|
107
106
|
connect_proc = lambda do |database|
|
108
|
-
db = if
|
107
|
+
db = if database.nil? || database.empty?
|
108
|
+
db = Sequel::Database.new(:quote_identifiers=>false)
|
109
|
+
def db.connect(*args); Object.new; end
|
110
|
+
db.identifier_input_method = nil
|
111
|
+
db.identifier_output_method = nil
|
112
|
+
db
|
113
|
+
elsif File.exist?(database)
|
109
114
|
require 'yaml'
|
110
115
|
env ||= "development"
|
111
116
|
db_config = YAML.load_file(database)
|
@@ -0,0 +1,233 @@
|
|
1
|
+
New Features
|
2
|
+
------------
|
3
|
+
|
4
|
+
* The ConnectionPool classes were refactored from 2 separate
|
5
|
+
classes to a 5 class hierarchy, with one main class and 4
|
6
|
+
subclasses, one for each combination of sharding and threading.
|
7
|
+
|
8
|
+
The primary reason for this refactoring is to make it so that
|
9
|
+
the user doesn't have to pay a performance penalty for sharding
|
10
|
+
if they aren't using it. A connection pool that supports sharding
|
11
|
+
is automatically used if the :servers option is used when setting
|
12
|
+
up the database connection.
|
13
|
+
|
14
|
+
In addition, the default connection pool no longer contains
|
15
|
+
the code to schedule future disconnections of currently allocated
|
16
|
+
connections. The sharded connection pool must be used if that
|
17
|
+
feature is desired.
|
18
|
+
|
19
|
+
The unsharded connection pools are about 25-30% faster than the
|
20
|
+
sharded versions.
|
21
|
+
|
22
|
+
* An optimistic_locking plugin was added to Sequel::Model. This
|
23
|
+
plugin implements a simple database-independent locking mechanism
|
24
|
+
to ensure that concurrent updates do not override changes:
|
25
|
+
|
26
|
+
class Person < Sequel::Model
|
27
|
+
plugin :optimistic_locking
|
28
|
+
end
|
29
|
+
p1 = Person[1]
|
30
|
+
p2 = Person[1]
|
31
|
+
# works
|
32
|
+
p1.update(:name=>'Jim')
|
33
|
+
# raises Sequel::Plugins::OptimisticLocking::Error
|
34
|
+
p2.update(:name=>'Bob')
|
35
|
+
|
36
|
+
In order for this plugin to work, you need to make sure that the
|
37
|
+
database table has a lock_version column (or other column you name
|
38
|
+
via the lock_column class level accessor) that defaults to 0.
|
39
|
+
|
40
|
+
The optimistic_locking plugin does not work with the
|
41
|
+
class_table_inheritance plugin.
|
42
|
+
|
43
|
+
* Dataset#unused_table_alias was added, which takes a symbol and
|
44
|
+
returns either that symbol or a new symbol which can be used as
|
45
|
+
a table alias when joining a table to the dataset. The symbol
|
46
|
+
returned is guaranteed to not already be used by the dataset:
|
47
|
+
|
48
|
+
DB[:test].unused_table_alias(:blah) # => :blah
|
49
|
+
DB[:test].unused_table_alias(:test) # => :test_0
|
50
|
+
|
51
|
+
The use case is when you need to join a table to a dataset, where
|
52
|
+
the table may already be used inside the dataset, and you want
|
53
|
+
to generate a unique alias:
|
54
|
+
|
55
|
+
ds.join(:table.as(ds.unused_table_alias(:table)), ...)
|
56
|
+
|
57
|
+
* The Sequel::ValidationFailed exception now has an errors accessor
|
58
|
+
which returns the Sequel::Model::Errors instance with the
|
59
|
+
validation errors. This can be helpful in situations where a
|
60
|
+
generalized rescue is done where the model object reference is
|
61
|
+
not available.
|
62
|
+
|
63
|
+
* bin/sequel now works without an argument, which is useful for
|
64
|
+
testing SQL generation (and not much else).
|
65
|
+
|
66
|
+
* Support SELECT ... INTO in the MSSQL adapter, using Dataset#into,
|
67
|
+
which takes a table argument.
|
68
|
+
|
69
|
+
* You can now provide your own connection pool class via the
|
70
|
+
:pool_class option when instantiating the database.
|
71
|
+
|
72
|
+
Other Improvements
|
73
|
+
------------------
|
74
|
+
|
75
|
+
* IN/NOT IN constructs with an empty array are now handled properly.
|
76
|
+
|
77
|
+
DB[:table].filter(:id=>[]) # IN
|
78
|
+
DB[:table].exclude(:id=>[]) # NOT IN
|
79
|
+
|
80
|
+
Before, the IN construct would mostly work, other than some minor
|
81
|
+
differences in NULL semantics. However, the NOT IN construct
|
82
|
+
would not work. Sequel now handles the NOT IN case using an
|
83
|
+
expression that evaluates to true.
|
84
|
+
|
85
|
+
* If using an IN/NOT IN construct with multiple columns and a dataset
|
86
|
+
argument, where multiple column IN/NOT IN support is emulated, a
|
87
|
+
separate query is done to get the records, which is then handled
|
88
|
+
like an array of values. This means that the following type of
|
89
|
+
query now works on all tested databases:
|
90
|
+
|
91
|
+
DB[:table1].filter([:id1, :id2]=>DB[:table2].select(:id1, :id2))
|
92
|
+
|
93
|
+
* Schemas and aliases are now handled correctly when eager graphing.
|
94
|
+
|
95
|
+
* Implicitly qualified symbols are now handled correctly in update
|
96
|
+
statements, useful if you are updating a joined dataset and need
|
97
|
+
to reference a column that appears in multiple tables.
|
98
|
+
|
99
|
+
* The active_model plugin has been brought up to date with
|
100
|
+
activemodel 3.0 beta (though it doesn't work on edge).
|
101
|
+
Additionally, the active_model plugin now requires active_model
|
102
|
+
in order to use ActiveModel::Naming.
|
103
|
+
|
104
|
+
* In the schema_dumper extension, always include the varchar limit,
|
105
|
+
even if it is 255 columns (the default). This makes it so that
|
106
|
+
PostgreSQL will use a varchar(255) column instead of a text column
|
107
|
+
when restoring a schema dump of a varchar(255) column from another
|
108
|
+
database.
|
109
|
+
|
110
|
+
* You can now load adapters from outside the Sequel lib directory,
|
111
|
+
now they just need to be in a sequel/adapters directory somewhere
|
112
|
+
in the LOAD_PATH.
|
113
|
+
|
114
|
+
* You can now load extensions from outside the Sequel lib directory
|
115
|
+
using Sequel.extension. External extensions need to be in a
|
116
|
+
sequel/extensions directory somewhere in the LOAD_PATH.
|
117
|
+
|
118
|
+
* Using bound variables for limit and offset in prepared statements
|
119
|
+
now works correctly.
|
120
|
+
|
121
|
+
* Performance of prepared statements was improved in the native
|
122
|
+
SQLite adapter.
|
123
|
+
|
124
|
+
* The schema_dumper extension now passes the options hash from
|
125
|
+
dump_*_migration to Database#tables.
|
126
|
+
|
127
|
+
* In the single_table_inheritance plugin, qualify the sti_key column
|
128
|
+
with the table name, so that subclass datasets can safely be joined
|
129
|
+
to other tables having the same column name.
|
130
|
+
|
131
|
+
* In the single_table_inheritance plugin, handle case where the
|
132
|
+
sti_key value is nil or '' specially, so that those cases
|
133
|
+
always return an instance of the main model class. This fixes
|
134
|
+
issues if constantize(nil) returns Object instead of raising
|
135
|
+
an exception.
|
136
|
+
|
137
|
+
* No longer use Date#to_s for literalization, always use ISO8601
|
138
|
+
format for dates.
|
139
|
+
|
140
|
+
* A couple lambdas which were instance_evaled were changed to procs
|
141
|
+
for ruby 1.9.2 compatibility.
|
142
|
+
|
143
|
+
* MSSQL emulated offset support was simplified to only use one
|
144
|
+
subquery, and made to work correctly on ruby 1.9.
|
145
|
+
|
146
|
+
* Emulate multiple column IN/NOT IN on H2, since it doesn't handle
|
147
|
+
all cases correctly.
|
148
|
+
|
149
|
+
* ODBC timestamps are now handled correctly if the database_timezone
|
150
|
+
is nil.
|
151
|
+
|
152
|
+
* ArgumentErrors raised when running queries in the ODBC adapter are
|
153
|
+
now raised as DatabaseErrors.
|
154
|
+
|
155
|
+
* Attempting to use DISTINCT ON on SQLite now raises an error before
|
156
|
+
sending the query to the database.
|
157
|
+
|
158
|
+
* The options hash passed to the database connection method is no
|
159
|
+
longer modified. However, there may be additional options
|
160
|
+
present in Database#opts that weren't specified by the options
|
161
|
+
hash passed to the database connection method.
|
162
|
+
|
163
|
+
* Make Dataset#add_graph_aliases handle the case where the dataset
|
164
|
+
has not yet been graphed.
|
165
|
+
|
166
|
+
* You can now provide an SQL::Identifier as a 4th argument to
|
167
|
+
Dataset#join_table, and unsupported arguments are caught and an
|
168
|
+
exception is raised.
|
169
|
+
|
170
|
+
* The gem specification has been moved out of the Rakefile, so
|
171
|
+
that the gem can now be built without rake, and works well with
|
172
|
+
gem build and bundler.
|
173
|
+
|
174
|
+
* The Rakefile no longer assumes the current directory is in the
|
175
|
+
$LOAD_PATH, so it should work correctly on ruby 1.9.2.
|
176
|
+
|
177
|
+
* All internal uses of require are now thread safe.
|
178
|
+
|
179
|
+
* Empty query parameter keys in connection strings are now ignored
|
180
|
+
instead of raising an exception.
|
181
|
+
|
182
|
+
* The specs were changed so that you can run them in parallel.
|
183
|
+
Previously there was a race condition in the migration extension
|
184
|
+
specs.
|
185
|
+
|
186
|
+
Backwards Compatibility
|
187
|
+
-----------------------
|
188
|
+
|
189
|
+
* If you plan on using sharding at any point, you now must pass
|
190
|
+
a :servers option when connecting to the database, even if it is
|
191
|
+
an empty hash. You can no longer just call Database#add_servers
|
192
|
+
later.
|
193
|
+
|
194
|
+
* The connection_proc and disconnection_proc accessors were removed
|
195
|
+
from the connection pools, so you can no longer modify the procs
|
196
|
+
after the connection pool has been instantiated. You must now
|
197
|
+
provide the connection_proc as the block argument when
|
198
|
+
instantiating the pool, and the disconnection_proc via the
|
199
|
+
:disconnection_proc option.
|
200
|
+
|
201
|
+
* In the hash passed to Dataset#update, symbol keys with a double
|
202
|
+
embedded underscore are now considerated as implicit qualifiers,
|
203
|
+
instead of being used verbatim. If you have a column that includes
|
204
|
+
a double underscore, you now need to wrap it in an SQL::Identifier
|
205
|
+
or use a String instead.
|
206
|
+
|
207
|
+
* The connection pools no longer convert non-StandardError based
|
208
|
+
exceptions to RuntimeErrors. Previously, all of the common adapters
|
209
|
+
turned this feature off, so there is no change for most users.
|
210
|
+
|
211
|
+
* Sequel::ConnectionPool is now considered an abstract class and
|
212
|
+
should not be instantiated directly. Use ConnectionPool.get_pool
|
213
|
+
to return an instance of the appropriate subclass.
|
214
|
+
|
215
|
+
* The Sequel::SingleThreadedPool constant is no longer defined.
|
216
|
+
|
217
|
+
* The private Dataset#eager_unique_table_alias method was removed,
|
218
|
+
use the new public Dataset#unused_table_alias method instead, which
|
219
|
+
has a slightly different API.
|
220
|
+
|
221
|
+
* The private Dataset#eager_graph_qualify_order method was removed,
|
222
|
+
used Dataset#qualified_expression instead.
|
223
|
+
|
224
|
+
* The private Sequel::Model class methods plugin_gem_location and
|
225
|
+
plugin_gem_location_old have been removed.
|
226
|
+
|
227
|
+
* Gems built with the rake tasks now show up in the root directory
|
228
|
+
instead of the pkg subdirectory, and no tarball package is created.
|
229
|
+
|
230
|
+
Other News
|
231
|
+
----------
|
232
|
+
|
233
|
+
* Sequel now has an official blog at http://sequel.heroku.com.
|
data/lib/sequel/adapters/ado.rb
CHANGED
@@ -7,11 +7,11 @@ module Sequel
|
|
7
7
|
set_adapter_scheme :ado
|
8
8
|
|
9
9
|
def initialize(opts)
|
10
|
-
super
|
11
|
-
opts[:driver] ||= 'SQL Server'
|
12
|
-
case opts[:driver]
|
10
|
+
super
|
11
|
+
@opts[:driver] ||= 'SQL Server'
|
12
|
+
case @opts[:driver]
|
13
13
|
when 'SQL Server'
|
14
|
-
Sequel.
|
14
|
+
Sequel.ts_require 'adapters/ado/mssql'
|
15
15
|
extend Sequel::ADO::MSSQL::DatabaseMethods
|
16
16
|
end
|
17
17
|
end
|
@@ -69,10 +69,6 @@ module Sequel
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
def connection_pool_default_options
|
73
|
-
super.merge(:pool_convert_exceptions=>false)
|
74
|
-
end
|
75
|
-
|
76
72
|
def disconnect_connection(conn)
|
77
73
|
conn.Close
|
78
74
|
end
|
@@ -125,7 +125,7 @@ module Sequel
|
|
125
125
|
# Also, force the max connections to 1 if a memory database is being
|
126
126
|
# used, as otherwise each connection gets a separate database.
|
127
127
|
def connection_pool_default_options
|
128
|
-
o = super.
|
128
|
+
o = super.dup
|
129
129
|
# Default to only a single connection if a memory database is used,
|
130
130
|
# because otherwise each connection will get a separate database
|
131
131
|
o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database])
|
data/lib/sequel/adapters/dbi.rb
CHANGED
@@ -21,10 +21,10 @@ module Sequel
|
|
21
21
|
}
|
22
22
|
|
23
23
|
def initialize(opts)
|
24
|
-
super
|
25
|
-
case opts[:db_type]
|
24
|
+
super
|
25
|
+
case @opts[:db_type]
|
26
26
|
when 'mssql'
|
27
|
-
Sequel.
|
27
|
+
Sequel.ts_require 'adapters/shared/mssql'
|
28
28
|
extend Sequel::MSSQL::DatabaseMethods
|
29
29
|
end
|
30
30
|
end
|
data/lib/sequel/adapters/do.rb
CHANGED
@@ -14,18 +14,18 @@ module Sequel
|
|
14
14
|
# Contains procs keyed on sub adapter type that extend the
|
15
15
|
# given database object so it supports the correct database type.
|
16
16
|
DATABASE_SETUP = {:postgres=>proc do |db|
|
17
|
-
|
18
|
-
Sequel.
|
17
|
+
Sequel.tsk_require 'do_postgres'
|
18
|
+
Sequel.ts_require 'adapters/do/postgres'
|
19
19
|
db.extend(Sequel::DataObjects::Postgres::DatabaseMethods)
|
20
20
|
end,
|
21
21
|
:mysql=>proc do |db|
|
22
|
-
|
23
|
-
Sequel.
|
22
|
+
Sequel.tsk_require 'do_mysql'
|
23
|
+
Sequel.ts_require 'adapters/do/mysql'
|
24
24
|
db.extend(Sequel::DataObjects::MySQL::DatabaseMethods)
|
25
25
|
end,
|
26
26
|
:sqlite3=>proc do |db|
|
27
|
-
|
28
|
-
Sequel.
|
27
|
+
Sequel.tsk_require 'do_sqlite3'
|
28
|
+
Sequel.ts_require 'adapters/do/sqlite'
|
29
29
|
db.extend(Sequel::DataObjects::SQLite::DatabaseMethods)
|
30
30
|
end
|
31
31
|
}
|
@@ -43,12 +43,11 @@ module Sequel
|
|
43
43
|
# raise an error immediately if the connection doesn't have a
|
44
44
|
# uri, since DataObjects requires one.
|
45
45
|
def initialize(opts)
|
46
|
-
|
46
|
+
super
|
47
47
|
raise(Error, "No connection string specified") unless uri
|
48
48
|
if prok = DATABASE_SETUP[subadapter.to_sym]
|
49
49
|
prok.call(self)
|
50
50
|
end
|
51
|
-
super(opts)
|
52
51
|
end
|
53
52
|
|
54
53
|
# Setup a DataObjects::Connection to the database.
|
@@ -145,11 +144,6 @@ module Sequel
|
|
145
144
|
:execute_non_query
|
146
145
|
end
|
147
146
|
|
148
|
-
# The DataObjects adapter should convert exceptions by default.
|
149
|
-
def connection_pool_default_options
|
150
|
-
super.merge(:pool_convert_exceptions=>false)
|
151
|
-
end
|
152
|
-
|
153
147
|
# Close the given database connection.
|
154
148
|
def disconnect_connection(c)
|
155
149
|
c.close
|