sequel 4.21.0 → 4.22.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.
- checksums.yaml +4 -4
- data/CHANGELOG +32 -0
- data/README.rdoc +3 -4
- data/doc/opening_databases.rdoc +10 -75
- data/doc/release_notes/4.22.0.txt +72 -0
- data/lib/sequel/adapters/ado/access.rb +1 -1
- data/lib/sequel/adapters/cubrid.rb +3 -3
- data/lib/sequel/adapters/db2.rb +1 -0
- data/lib/sequel/adapters/dbi.rb +1 -0
- data/lib/sequel/adapters/fdbsql.rb +3 -2
- data/lib/sequel/adapters/firebird.rb +1 -0
- data/lib/sequel/adapters/ibmdb.rb +1 -21
- data/lib/sequel/adapters/informix.rb +1 -0
- data/lib/sequel/adapters/jdbc.rb +37 -49
- data/lib/sequel/adapters/jdbc/fdbsql.rb +1 -0
- data/lib/sequel/adapters/mysql.rb +5 -3
- data/lib/sequel/adapters/mysql2.rb +5 -2
- data/lib/sequel/adapters/odbc.rb +8 -4
- data/lib/sequel/adapters/openbase.rb +1 -0
- data/lib/sequel/adapters/oracle.rb +3 -46
- data/lib/sequel/adapters/postgres.rb +3 -36
- data/lib/sequel/adapters/shared/access.rb +1 -1
- data/lib/sequel/adapters/shared/fdbsql.rb +3 -3
- data/lib/sequel/adapters/shared/mssql.rb +1 -1
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +12 -44
- data/lib/sequel/adapters/shared/oracle.rb +6 -2
- data/lib/sequel/adapters/shared/postgres.rb +6 -6
- data/lib/sequel/adapters/shared/sqlite.rb +1 -1
- data/lib/sequel/adapters/sqlite.rb +3 -46
- data/lib/sequel/adapters/tinytds.rb +12 -28
- data/lib/sequel/adapters/utils/pg_types.rb +1 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +63 -16
- data/lib/sequel/connection_pool/threaded.rb +72 -18
- data/lib/sequel/core.rb +1 -1
- data/lib/sequel/database/connecting.rb +2 -2
- data/lib/sequel/database/misc.rb +5 -5
- data/lib/sequel/database/query.rb +3 -2
- data/lib/sequel/database/schema_generator.rb +19 -19
- data/lib/sequel/database/schema_methods.rb +2 -2
- data/lib/sequel/database/transactions.rb +3 -3
- data/lib/sequel/dataset/actions.rb +18 -8
- data/lib/sequel/dataset/graph.rb +2 -2
- data/lib/sequel/dataset/prepared_statements.rb +28 -1
- data/lib/sequel/dataset/query.rb +7 -7
- data/lib/sequel/exceptions.rb +27 -24
- data/lib/sequel/extensions/_pretty_table.rb +1 -1
- data/lib/sequel/extensions/constraint_validations.rb +2 -2
- data/lib/sequel/extensions/date_arithmetic.rb +2 -2
- data/lib/sequel/extensions/pg_array.rb +10 -1
- data/lib/sequel/extensions/pg_row.rb +1 -1
- data/lib/sequel/extensions/pg_static_cache_updater.rb +1 -1
- data/lib/sequel/extensions/schema_dumper.rb +8 -8
- data/lib/sequel/extensions/split_array_nil.rb +1 -1
- data/lib/sequel/model.rb +1 -1
- data/lib/sequel/model/associations.rb +18 -11
- data/lib/sequel/model/base.rb +15 -15
- data/lib/sequel/model/exceptions.rb +11 -2
- data/lib/sequel/plugins/accessed_columns.rb +1 -1
- data/lib/sequel/plugins/auto_validations.rb +1 -1
- data/lib/sequel/plugins/boolean_readers.rb +1 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +4 -7
- data/lib/sequel/plugins/composition.rb +1 -1
- data/lib/sequel/plugins/constraint_validations.rb +2 -2
- data/lib/sequel/plugins/csv_serializer.rb +171 -0
- data/lib/sequel/plugins/dirty.rb +2 -2
- data/lib/sequel/plugins/hook_class_methods.rb +1 -1
- data/lib/sequel/plugins/instance_hooks.rb +1 -1
- data/lib/sequel/plugins/many_through_many.rb +1 -1
- data/lib/sequel/plugins/nested_attributes.rb +5 -5
- data/lib/sequel/plugins/pg_array_associations.rb +4 -4
- data/lib/sequel/plugins/prepared_statements.rb +2 -2
- data/lib/sequel/plugins/prepared_statements_safe.rb +1 -1
- data/lib/sequel/plugins/serialization.rb +6 -6
- data/lib/sequel/plugins/serialization_modification_detection.rb +1 -1
- data/lib/sequel/plugins/sharding.rb +3 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +5 -13
- data/lib/sequel/plugins/static_cache.rb +2 -2
- data/lib/sequel/plugins/tactical_eager_loading.rb +1 -1
- data/lib/sequel/plugins/tree.rb +1 -1
- data/lib/sequel/plugins/validation_class_methods.rb +2 -2
- data/lib/sequel/plugins/validation_helpers.rb +4 -4
- data/lib/sequel/plugins/xml_serializer.rb +3 -3
- data/lib/sequel/sql.rb +1 -1
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/postgres_spec.rb +17 -0
- data/spec/core/connection_pool_spec.rb +1 -1
- data/spec/core/dataset_spec.rb +22 -0
- data/spec/extensions/auto_validations_spec.rb +1 -1
- data/spec/extensions/blacklist_security_spec.rb +2 -2
- data/spec/extensions/csv_serializer_spec.rb +173 -0
- data/spec/extensions/json_serializer_spec.rb +2 -2
- data/spec/extensions/nested_attributes_spec.rb +9 -9
- data/spec/extensions/pg_array_spec.rb +5 -0
- data/spec/extensions/single_table_inheritance_spec.rb +21 -0
- data/spec/extensions/touch_spec.rb +1 -1
- data/spec/extensions/tree_spec.rb +4 -0
- data/spec/extensions/xml_serializer_spec.rb +3 -3
- data/spec/integration/prepared_statement_test.rb +1 -1
- data/spec/integration/schema_test.rb +7 -0
- data/spec/integration/type_test.rb +2 -2
- data/spec/model/associations_spec.rb +108 -14
- data/spec/model/base_spec.rb +8 -8
- data/spec/model/record_spec.rb +7 -7
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7bcc145a56d7aca254c6a4298678e07ea3cbd4f0
|
|
4
|
+
data.tar.gz: 8c90dbb6ef553ddb4995b70f9ac3d0cf03d4dd76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b0214c84c88c09f8c3130a75a1e0f3cacf55584f3f3fc310907cd4e08cfdc39147ea4fca90475917db55ac054bcfc8778ea8df2648b2edff8ca9282f4348c72
|
|
7
|
+
data.tar.gz: b6efbc0bdd00bd6e5d668960b085e5fd26b6da7fa6592c4621c5f3505d221b1988243af9fbd27ba8075541de6d3a2c24a13c73f36240761416f2c7c7ba10db47
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
=== 4.22.0 (2015-05-01)
|
|
2
|
+
|
|
3
|
+
* Deprecate the db2, dbi, fdbsql, firebird, jdbc/fdbsql, informix, and openbase adapters (jeremyevans)
|
|
4
|
+
|
|
5
|
+
* Avoid hash allocations and rehashes (jeremyevans)
|
|
6
|
+
|
|
7
|
+
* Don't silently ignore :jdbc_properties Database option in jdbc adapter (jeremyevans)
|
|
8
|
+
|
|
9
|
+
* Make tree plugin set reciprocal association for children association correctly (lpil, jeremyevans) (#995)
|
|
10
|
+
|
|
11
|
+
* Add Sequel::MassAssignmentRestriction exception, raised for mass assignment errors in strict mode (jeremyevans) (#994)
|
|
12
|
+
|
|
13
|
+
* Handle ODBC::SQL_BIT type as boolean in the odbc adapter, fixing boolean handling on odbc/mssql (jrgns) (#993)
|
|
14
|
+
|
|
15
|
+
* Make :auto_validations plugin check :default entry instead of :ruby_default entry for checking existence of default value (jeremyevans) (#990)
|
|
16
|
+
|
|
17
|
+
* Adapters should now set :default schema option to nil when adapter can determine that the value is nil (jeremyevans)
|
|
18
|
+
|
|
19
|
+
* Do not add a schema :max_length entry for a varchar(max) column on MSSQL (jeremyevans)
|
|
20
|
+
|
|
21
|
+
* Allow :default value for PostgreSQL array columns to be a ruby array when using the pg_array extension (jeremyevans) (#989)
|
|
22
|
+
|
|
23
|
+
* Add csv_serializer plugin for serializing model objects to and from csv (bjmllr, jeremyevans) (#988)
|
|
24
|
+
|
|
25
|
+
* Make Dataset#to_hash and #to_hash_groups handle single array argument for model datasets (jeremyevans)
|
|
26
|
+
|
|
27
|
+
* Handle Model#cancel_action in association before hooks (jeremyevans)
|
|
28
|
+
|
|
29
|
+
* Use a condition variable instead of busy waiting in the threaded connection pools on ruby 1.9+ (jeremyevans)
|
|
30
|
+
|
|
31
|
+
* Use Symbol#to_proc instead of explicit blocks (jeremyevans)
|
|
32
|
+
|
|
1
33
|
=== 4.21.0 (2015-04-01)
|
|
2
34
|
|
|
3
35
|
* Support :tsquery and :tsvector options in Dataset#full_text_search on PostgreSQL, for using existing tsquery/tsvector expressions (jeremyevans)
|
data/README.rdoc
CHANGED
|
@@ -12,8 +12,7 @@ toolkit for Ruby.
|
|
|
12
12
|
two-phase commit, transaction isolation, master/slave
|
|
13
13
|
configurations, and database sharding.
|
|
14
14
|
* Sequel currently has adapters for ADO, Amalgalite, CUBRID,
|
|
15
|
-
DataObjects,
|
|
16
|
-
IBM_DB, Informix, JDBC, MySQL, Mysql2, ODBC, OpenBase, Oracle,
|
|
15
|
+
DataObjects, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle,
|
|
17
16
|
PostgreSQL, SQLAnywhere, SQLite3, Swift, and TinyTDS.
|
|
18
17
|
|
|
19
18
|
== Resources
|
|
@@ -466,7 +465,7 @@ to select from a qualified table:
|
|
|
466
465
|
|
|
467
466
|
=== Identifier aliases
|
|
468
467
|
|
|
469
|
-
You can also alias identifiers by using the triple
|
|
468
|
+
You can also alias identifiers by using the triple underscore special notation <tt>:column___alias</tt> or <tt>:table__column___alias</tt>:
|
|
470
469
|
|
|
471
470
|
items.literal(:price___p)
|
|
472
471
|
# price AS p
|
|
@@ -807,7 +806,7 @@ Sequel models also provide a +subset+ class method that creates a dataset method
|
|
|
807
806
|
|
|
808
807
|
You can define a +validate+ method for your model, which +save+
|
|
809
808
|
will check before attempting to save the model in the database.
|
|
810
|
-
If an attribute of the model isn't valid, you should add
|
|
809
|
+
If an attribute of the model isn't valid, you should add an error
|
|
811
810
|
message for that attribute to the model object's +errors+. If an
|
|
812
811
|
object has any errors added by the validate method, +save+ will
|
|
813
812
|
raise an error or return false depending on how it is configured
|
data/doc/opening_databases.rdoc
CHANGED
|
@@ -154,39 +154,6 @@ cubrid is a ruby extension for accessing a CUBRID database. Currently,
|
|
|
154
154
|
the ruby cubrid gem is in fairly rough state, with broken transaction
|
|
155
155
|
support and some other issues, but most things work.
|
|
156
156
|
|
|
157
|
-
=== db2
|
|
158
|
-
|
|
159
|
-
Requires: db2/db2cli
|
|
160
|
-
|
|
161
|
-
This is the older DB2 adapter. It's recommended you try the ibmdb adapter
|
|
162
|
-
instead for new DB2 work, as it is better supported.
|
|
163
|
-
|
|
164
|
-
=== dbi
|
|
165
|
-
|
|
166
|
-
Allows access to a multitude of databases via ruby-dbi. Additional options:
|
|
167
|
-
|
|
168
|
-
:db_type :: Specifying 'mssql' allows Microsoft SQL Server specific syntax to
|
|
169
|
-
be used. Otherwise has no effect.
|
|
170
|
-
|
|
171
|
-
DBI connection strings are a preprocessed a bit, and are specified with a dbi-
|
|
172
|
-
in front of the protocol. Examples:
|
|
173
|
-
|
|
174
|
-
dbi-ado://...
|
|
175
|
-
dbi-db2://...
|
|
176
|
-
dbi-frontbase://...
|
|
177
|
-
dbi-interbase://...
|
|
178
|
-
dbi-msql://...
|
|
179
|
-
dbi-mysql://...
|
|
180
|
-
dbi-odbc://...
|
|
181
|
-
dbi-oracle://...
|
|
182
|
-
dbi-pg://...
|
|
183
|
-
dbi-proxy://...
|
|
184
|
-
dbi-sqlite://...
|
|
185
|
-
dbi-sqlrelay://...
|
|
186
|
-
|
|
187
|
-
While the DBI adapter does work, it is recommended that you use another adapter
|
|
188
|
-
if your database supports it.
|
|
189
|
-
|
|
190
157
|
=== do
|
|
191
158
|
|
|
192
159
|
Requires: data_objects
|
|
@@ -206,24 +173,6 @@ Connection string examples:
|
|
|
206
173
|
do:postgres://user:password@host/database
|
|
207
174
|
do:mysql://user:password@host/database
|
|
208
175
|
|
|
209
|
-
=== fdbsql
|
|
210
|
-
|
|
211
|
-
Requires: pg
|
|
212
|
-
|
|
213
|
-
The following additional options are supported:
|
|
214
|
-
|
|
215
|
-
:connect_timeout :: Set the number of seconds to wait for a connection (default 20).
|
|
216
|
-
:notice_receiver :: A proc that be called with the PGresult objects that have notice or warning messages.
|
|
217
|
-
The default notice receiver just prints the messages to stderr, but this can be used
|
|
218
|
-
to handle notice/warning messages differently.
|
|
219
|
-
:sslmode :: Set to 'disable', 'allow', 'prefer', 'require' to choose how to treat SSL.
|
|
220
|
-
|
|
221
|
-
=== firebird
|
|
222
|
-
|
|
223
|
-
Requires: fb (using code at http://github.com/wishdev/fb)
|
|
224
|
-
|
|
225
|
-
Does not support the :port option.
|
|
226
|
-
|
|
227
176
|
=== ibmdb
|
|
228
177
|
|
|
229
178
|
requires 'ibm_db'
|
|
@@ -231,31 +180,14 @@ requires 'ibm_db'
|
|
|
231
180
|
This connects to DB2 using IBM_DB. This is the recommended adapter if you are
|
|
232
181
|
using a C-based ruby to connect to DB2.
|
|
233
182
|
|
|
234
|
-
=== informix
|
|
235
|
-
|
|
236
|
-
Does not support the :host or :port options. Depending on the configuration of your server
|
|
237
|
-
it may be necessary to either set
|
|
238
|
-
|
|
239
|
-
DB.quote_identifier = false
|
|
240
|
-
|
|
241
|
-
or set
|
|
242
|
-
|
|
243
|
-
export DELIMIDENT=y
|
|
244
|
-
|
|
245
|
-
in the scripts environment.
|
|
246
|
-
|
|
247
|
-
The following additional options are supported:
|
|
248
|
-
|
|
249
|
-
:nolog :: Disable transactions for the database.
|
|
250
|
-
|
|
251
183
|
=== jdbc
|
|
252
184
|
|
|
253
185
|
Requires: java
|
|
254
186
|
|
|
255
187
|
Houses Sequel's JDBC support when running on JRuby.
|
|
256
|
-
Support for individual database types is done using
|
|
188
|
+
Support for individual database types is done using subadapters.
|
|
257
189
|
There are currently subadapters for PostgreSQL, MySQL, SQLite, H2, HSQLDB, Derby,
|
|
258
|
-
Oracle, MSSQL, JTDS, AS400, Progress,
|
|
190
|
+
Oracle, MSSQL, JTDS, AS400, Progress, Firebird, Informix, and DB2.
|
|
259
191
|
For PostgreSQL, MySQL, SQLite, H2, HSQLDB, Derby, and JTDS,
|
|
260
192
|
this can use the jdbc-* gem, for the others you need to have the .jar in your CLASSPATH
|
|
261
193
|
or load the Java class manually before calling Sequel.connect.
|
|
@@ -291,7 +223,6 @@ Example connection strings:
|
|
|
291
223
|
jdbc:jdbcprogress:T:hostname:port:database
|
|
292
224
|
jdbc:cubrid:hostname:port:database:::
|
|
293
225
|
jdbc:sqlanywhere://localhost?DBN=Test;UID=user;PWD=password
|
|
294
|
-
jdbc:fdbsql://localhost:15432/user?user=user&password=password
|
|
295
226
|
|
|
296
227
|
You can also use JNDI connection strings:
|
|
297
228
|
|
|
@@ -358,10 +289,6 @@ The :host and :port options are not respected. The following additional options
|
|
|
358
289
|
:drvconnect :: Can be given an ODBC connection string, and will use ODBC::Database#drvconnect to
|
|
359
290
|
do the connection. Typical usage would be: <tt>Sequel.odbc(:drvconnect=>'driver={...};...')</tt>
|
|
360
291
|
|
|
361
|
-
=== openbase
|
|
362
|
-
|
|
363
|
-
The :port option is ignored.
|
|
364
|
-
|
|
365
292
|
=== oracle
|
|
366
293
|
|
|
367
294
|
Requires: oci8
|
|
@@ -445,6 +372,14 @@ The following additional options are supported:
|
|
|
445
372
|
:readonly :: open database in read-only mode
|
|
446
373
|
:timeout :: the busy timeout to use in milliseconds (default: 5000).
|
|
447
374
|
|
|
375
|
+
Note that SQLite memory databases are restricted to a single connection by
|
|
376
|
+
default. This is because SQLite does not allow multiple connections to
|
|
377
|
+
a single memory database. For this reason, Sequel sets the maximum number
|
|
378
|
+
of connections in the connection pool to 1 by default when an SQLite memory
|
|
379
|
+
database is used. Attempts to force the use of more than 1 connection
|
|
380
|
+
can result in weird behavior, since the connections will be to separate
|
|
381
|
+
memory databases.
|
|
382
|
+
|
|
448
383
|
=== swift
|
|
449
384
|
|
|
450
385
|
swift is a ruby 1.9+ library, so you'll need to be running ruby 1.9+. It
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
= New Features
|
|
2
|
+
|
|
3
|
+
* A csv_serializer plugin has been added, for serializing model
|
|
4
|
+
objects and datasets to CSV, or parsing CSV into a model
|
|
5
|
+
object or array of model objects. Behavior and API is similar to
|
|
6
|
+
the existing xml_serializer and json_serializer plugins.
|
|
7
|
+
|
|
8
|
+
* Sequel::MassAssignmentRestriction is now raised for mass assignment
|
|
9
|
+
errors in strict mode (the default). Previously the generic
|
|
10
|
+
Sequel::Error was used.
|
|
11
|
+
|
|
12
|
+
= Other Improvements
|
|
13
|
+
|
|
14
|
+
* On Ruby 1.9+, Sequel now uses condition variables instead of busy
|
|
15
|
+
waiting for connections in the threaded conection pools. This
|
|
16
|
+
can significantly decrease overhead when waiting for connections,
|
|
17
|
+
which can improve performance on machines that are compute
|
|
18
|
+
bottlenecked. This also makes the connection pool checkouts more
|
|
19
|
+
fair, reducing the chance that a request for a connection will
|
|
20
|
+
fail with a PoolTimeout when under heavy resource contention.
|
|
21
|
+
|
|
22
|
+
* Sequel now attempts to avoid hash allocations and rehashing in
|
|
23
|
+
performance sensitive code. This can speed up Dataset#clone,
|
|
24
|
+
Model#clone, and #Model#dup by about 60%, and speed up method
|
|
25
|
+
chains such as:
|
|
26
|
+
|
|
27
|
+
ds.select(:a).where(:a=>1).order(1)
|
|
28
|
+
|
|
29
|
+
by almost 20%.
|
|
30
|
+
|
|
31
|
+
* Symbol#to_proc is used instead of explicit blocks across the
|
|
32
|
+
the library, which should improve performance slightly on Ruby 1.9+.
|
|
33
|
+
|
|
34
|
+
* When Model#cancel_action is used in association before hooks,
|
|
35
|
+
Sequel will now return false if raise_on_save_failure = false,
|
|
36
|
+
instead of raising an exception. This mirrors the behavior
|
|
37
|
+
when Model#cancel_action is used inside model save hooks when
|
|
38
|
+
raise_on_save_failure = false.
|
|
39
|
+
|
|
40
|
+
* Dataset#to_hash and #to_hash_groups now work correctly on model
|
|
41
|
+
datasets when given a single array argument.
|
|
42
|
+
|
|
43
|
+
* The auto_validations plugin now works correctly on columns that
|
|
44
|
+
have a default value, but where the default value is not parseable
|
|
45
|
+
into a ruby object by the adapter.
|
|
46
|
+
|
|
47
|
+
* The tree plugin now correctly sets the reciprocal association
|
|
48
|
+
in the children association it creates.
|
|
49
|
+
|
|
50
|
+
* In the pg_array extension, if the :default value when creating a
|
|
51
|
+
column is set to a ruby array, Sequel will now convert it to a
|
|
52
|
+
PostgreSQL array.
|
|
53
|
+
|
|
54
|
+
* Sequel no longer adds a :max_length entry to the schema for
|
|
55
|
+
varchar(max) columns on Microsoft SQL Server.
|
|
56
|
+
|
|
57
|
+
* Adapters now are specified to set the :default schema entry for
|
|
58
|
+
columns to nil if the adapter can determine the :default is nil.
|
|
59
|
+
Adapters that ship with Sequel already did this, but previously
|
|
60
|
+
it was unspecified behavior.
|
|
61
|
+
|
|
62
|
+
* Sequel no longer silently ignores the :jdbc_properties Database
|
|
63
|
+
option in the jdbc adapter. Previously, it only used the
|
|
64
|
+
:jdbc_properties option if it was not able to connect without it.
|
|
65
|
+
|
|
66
|
+
* Bit types are now converted to boolean values in the ODBC adapter.
|
|
67
|
+
|
|
68
|
+
= Backwards Compatibility
|
|
69
|
+
|
|
70
|
+
* The db2, dbi, fdbsql, firebird, jdbc/fdbsql, informix, and openbase
|
|
71
|
+
adapters are now deprecated and will be removed in a future version
|
|
72
|
+
of Sequel.
|
|
@@ -294,7 +294,7 @@ module Sequel
|
|
|
294
294
|
|
|
295
295
|
def fetch_ado_schema(type, criteria=[])
|
|
296
296
|
execute_open_ado_schema(type, criteria) do |s|
|
|
297
|
-
cols = s.Fields.extend(Enumerable).map
|
|
297
|
+
cols = s.Fields.extend(Enumerable).map(&:Name)
|
|
298
298
|
s.getRows.transpose.each do |r|
|
|
299
299
|
row = {}
|
|
300
300
|
cols.each{|c| row[c] = r.shift}
|
|
@@ -6,7 +6,7 @@ module Sequel
|
|
|
6
6
|
CUBRID_TYPE_PROCS = {
|
|
7
7
|
::Cubrid::DATE => lambda{|t| Date.new(t.year, t.month, t.day)},
|
|
8
8
|
::Cubrid::TIME => lambda{|t| SQLTime.create(t.hour, t.min, t.sec)},
|
|
9
|
-
21 => lambda
|
|
9
|
+
21 => lambda(&:to_i)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
class Database < Sequel::Database
|
|
@@ -31,7 +31,7 @@ module Sequel
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def server_version
|
|
34
|
-
@server_version ||= synchronize
|
|
34
|
+
@server_version ||= synchronize(&:server_version)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def execute(sql, opts=OPTS)
|
|
@@ -125,7 +125,7 @@ module Sequel
|
|
|
125
125
|
execute(sql) do |stmt|
|
|
126
126
|
begin
|
|
127
127
|
cols = stmt.column_info.map{|c| [output_identifier(c[COLUMN_INFO_NAME]), CUBRID_TYPE_PROCS[c[COLUMN_INFO_TYPE]]]}
|
|
128
|
-
@columns = cols.map
|
|
128
|
+
@columns = cols.map(&:first)
|
|
129
129
|
stmt.each do |r|
|
|
130
130
|
row = {}
|
|
131
131
|
cols.zip(r).each{|(k, p), v| row[k] = (v && p) ? p.call(v) : v}
|
data/lib/sequel/adapters/db2.rb
CHANGED
data/lib/sequel/adapters/dbi.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'pg'
|
|
|
2
2
|
|
|
3
3
|
Sequel.require 'adapters/utils/pg_types'
|
|
4
4
|
Sequel.require 'adapters/shared/fdbsql'
|
|
5
|
+
Sequel::Deprecation.deprecate 'The fdbsql adapter is deprecated and will be removed in a future version of Sequel.'
|
|
5
6
|
|
|
6
7
|
module Sequel
|
|
7
8
|
module Fdbsql
|
|
@@ -109,12 +110,12 @@ module Sequel
|
|
|
109
110
|
|
|
110
111
|
# Execute the given SQL with the stored bind arguments.
|
|
111
112
|
def execute(sql, opts=OPTS, &block)
|
|
112
|
-
super(sql, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
113
|
+
super(sql, {:arguments=>bind_arguments}.merge!(opts), &block)
|
|
113
114
|
end
|
|
114
115
|
|
|
115
116
|
# Same as execute, explicit due to intricacies of alias and super.
|
|
116
117
|
def execute_dui(sql, opts=OPTS, &block)
|
|
117
|
-
super(sql, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
118
|
+
super(sql, {:arguments=>bind_arguments}.merge!(opts), &block)
|
|
118
119
|
end
|
|
119
120
|
end
|
|
120
121
|
|
|
@@ -393,28 +393,8 @@ module Sequel
|
|
|
393
393
|
end
|
|
394
394
|
end
|
|
395
395
|
|
|
396
|
-
|
|
397
|
-
module PreparedStatementMethods
|
|
398
|
-
include Sequel::Dataset::UnnumberedArgumentMapper
|
|
399
|
-
|
|
400
|
-
private
|
|
401
|
-
# Execute the prepared statement with arguments instead of the given SQL.
|
|
402
|
-
def execute(sql, opts=OPTS, &block)
|
|
403
|
-
super(prepared_statement_name, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
404
|
-
end
|
|
405
|
-
|
|
406
|
-
# Execute the prepared statment with arguments instead of the given SQL.
|
|
407
|
-
def execute_dui(sql, opts=OPTS, &block)
|
|
408
|
-
super(prepared_statement_name, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
409
|
-
end
|
|
410
|
-
|
|
411
|
-
# Execute the prepared statement with arguments instead of the given SQL.
|
|
412
|
-
def execute_insert(sql, opts=OPTS, &block)
|
|
413
|
-
super(prepared_statement_name, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
414
|
-
end
|
|
396
|
+
PreparedStatementMethods = prepared_statements_module(:prepare_bind, Sequel::Dataset::UnnumberedArgumentMapper)
|
|
415
397
|
|
|
416
|
-
end
|
|
417
|
-
|
|
418
398
|
# Emulate support of bind arguments in called statements.
|
|
419
399
|
def call(type, bind_arguments={}, *values, &block)
|
|
420
400
|
ps = to_prepared_statement(type, values)
|
data/lib/sequel/adapters/jdbc.rb
CHANGED
|
@@ -204,6 +204,7 @@ module Sequel
|
|
|
204
204
|
args.concat([opts[:user], opts[:password]]) if opts[:user] && opts[:password]
|
|
205
205
|
begin
|
|
206
206
|
JavaSQL::DriverManager.setLoginTimeout(opts[:login_timeout]) if opts[:login_timeout]
|
|
207
|
+
raise StandardError, "skipping regular connection" if opts[:jdbc_properties]
|
|
207
208
|
JavaSQL::DriverManager.getConnection(*args)
|
|
208
209
|
rescue JavaSQL::SQLException, NativeException, StandardError => e
|
|
209
210
|
raise e unless driver
|
|
@@ -254,7 +255,7 @@ module Sequel
|
|
|
254
255
|
log_yield(sql){stmt.execute(sql)}
|
|
255
256
|
when :insert
|
|
256
257
|
log_yield(sql){execute_statement_insert(stmt, sql)}
|
|
257
|
-
last_insert_id(conn, opts.merge(:stmt=>stmt))
|
|
258
|
+
last_insert_id(conn, Hash[opts].merge!(:stmt=>stmt))
|
|
258
259
|
else
|
|
259
260
|
log_yield(sql){stmt.executeUpdate(sql)}
|
|
260
261
|
end
|
|
@@ -267,13 +268,17 @@ module Sequel
|
|
|
267
268
|
# Execute the given DDL SQL, which should not return any
|
|
268
269
|
# values or rows.
|
|
269
270
|
def execute_ddl(sql, opts=OPTS)
|
|
270
|
-
|
|
271
|
+
opts = Hash[opts]
|
|
272
|
+
opts[:type] = :ddl
|
|
273
|
+
execute(sql, opts)
|
|
271
274
|
end
|
|
272
275
|
|
|
273
276
|
# Execute the given INSERT SQL, returning the last inserted
|
|
274
277
|
# row id.
|
|
275
278
|
def execute_insert(sql, opts=OPTS)
|
|
276
|
-
|
|
279
|
+
opts = Hash[opts]
|
|
280
|
+
opts[:type] = :insert
|
|
281
|
+
execute(sql, opts)
|
|
277
282
|
end
|
|
278
283
|
|
|
279
284
|
# Use the JDBC metadata to get a list of foreign keys for the table.
|
|
@@ -434,7 +439,7 @@ module Sequel
|
|
|
434
439
|
log_yield(msg, args){cps.execute}
|
|
435
440
|
when :insert
|
|
436
441
|
log_yield(msg, args){execute_prepared_statement_insert(cps)}
|
|
437
|
-
last_insert_id(conn, opts.merge(:prepared=>true, :stmt=>cps))
|
|
442
|
+
last_insert_id(conn, Hash[opts].merge!(:prepared=>true, :stmt=>cps))
|
|
438
443
|
else
|
|
439
444
|
log_yield(msg, args){cps.executeUpdate}
|
|
440
445
|
end
|
|
@@ -666,53 +671,36 @@ module Sequel
|
|
|
666
671
|
|
|
667
672
|
Database::DatasetClass = self
|
|
668
673
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
# Same as execute, explicit due to intricacies of alias and super.
|
|
685
|
-
def execute_dui(sql, opts=OPTS, &block)
|
|
686
|
-
super(self, {:arguments=>bind_arguments}.merge(opts), &block)
|
|
687
|
-
end
|
|
688
|
-
|
|
689
|
-
# Same as execute, explicit due to intricacies of alias and super.
|
|
690
|
-
def execute_insert(sql, opts=OPTS, &block)
|
|
691
|
-
super(self, {:arguments=>bind_arguments, :type=>:insert}.merge(opts), &block)
|
|
692
|
-
end
|
|
674
|
+
PreparedStatementMethods = prepared_statements_module(
|
|
675
|
+
"sql = self; opts = Hash[opts]; opts[:arguments] = bind_arguments",
|
|
676
|
+
Sequel::Dataset::UnnumberedArgumentMapper,
|
|
677
|
+
%w"execute execute_dui") do
|
|
678
|
+
private
|
|
679
|
+
|
|
680
|
+
# Same as execute, explicit due to intricacies of alias and super.
|
|
681
|
+
def execute_insert(sql, opts=OPTS)
|
|
682
|
+
sql = self
|
|
683
|
+
opts = Hash[opts]
|
|
684
|
+
opts[:arguments] = bind_arguments
|
|
685
|
+
opts[:type] = :insert
|
|
686
|
+
super
|
|
687
|
+
end
|
|
693
688
|
end
|
|
694
689
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
super(@sproc_name, {:args=>@sproc_args, :sproc=>true}.merge(opts), &block)
|
|
710
|
-
end
|
|
711
|
-
|
|
712
|
-
# Same as execute, explicit due to intricacies of alias and super.
|
|
713
|
-
def execute_insert(sql, opts=OPTS, &block)
|
|
714
|
-
super(@sproc_name, {:args=>@sproc_args, :sproc=>true, :type=>:insert}.merge(opts), &block)
|
|
715
|
-
end
|
|
690
|
+
StoredProcedureMethods = prepared_statements_module(
|
|
691
|
+
"sql = @sproc_name; opts = Hash[opts]; opts[:args] = @sproc_args; opts[:sproc] = true",
|
|
692
|
+
Sequel::Dataset::StoredProcedureMethods,
|
|
693
|
+
%w"execute execute_dui") do
|
|
694
|
+
private
|
|
695
|
+
|
|
696
|
+
# Same as execute, explicit due to intricacies of alias and super.
|
|
697
|
+
def execute_insert(sql, opts=OPTS)
|
|
698
|
+
sql = @sproc_name
|
|
699
|
+
opts = Hash[opts]
|
|
700
|
+
opts[:args] = @sproc_args
|
|
701
|
+
opts[:type] = :insert
|
|
702
|
+
super
|
|
703
|
+
end
|
|
716
704
|
end
|
|
717
705
|
|
|
718
706
|
# Whether to convert some Java types to ruby types when retrieving rows.
|