sequel 3.40.0 → 3.41.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +40 -0
- data/README.rdoc +2 -2
- data/doc/advanced_associations.rdoc +12 -0
- data/doc/bin_sequel.rdoc +144 -0
- data/doc/migration.rdoc +1 -1
- data/doc/object_model.rdoc +29 -0
- data/doc/release_notes/3.41.0.txt +155 -0
- data/lib/sequel/adapters/ado.rb +4 -4
- data/lib/sequel/adapters/amalgalite.rb +0 -5
- data/lib/sequel/adapters/cubrid.rb +2 -2
- data/lib/sequel/adapters/db2.rb +9 -5
- data/lib/sequel/adapters/dbi.rb +4 -6
- data/lib/sequel/adapters/do.rb +4 -5
- data/lib/sequel/adapters/firebird.rb +8 -4
- data/lib/sequel/adapters/ibmdb.rb +2 -3
- data/lib/sequel/adapters/informix.rb +0 -6
- data/lib/sequel/adapters/jdbc.rb +11 -7
- data/lib/sequel/adapters/jdbc/db2.rb +22 -0
- data/lib/sequel/adapters/jdbc/derby.rb +5 -5
- data/lib/sequel/adapters/jdbc/h2.rb +0 -5
- data/lib/sequel/adapters/jdbc/jtds.rb +1 -1
- data/lib/sequel/adapters/jdbc/sqlserver.rb +6 -0
- data/lib/sequel/adapters/mock.rb +3 -3
- data/lib/sequel/adapters/mysql.rb +7 -7
- data/lib/sequel/adapters/mysql2.rb +0 -5
- data/lib/sequel/adapters/odbc.rb +4 -4
- data/lib/sequel/adapters/openbase.rb +4 -6
- data/lib/sequel/adapters/oracle.rb +14 -6
- data/lib/sequel/adapters/postgres.rb +12 -8
- data/lib/sequel/adapters/shared/db2.rb +5 -0
- data/lib/sequel/adapters/shared/firebird.rb +10 -0
- data/lib/sequel/adapters/shared/mssql.rb +43 -1
- data/lib/sequel/adapters/shared/mysql.rb +1 -0
- data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +1 -1
- data/lib/sequel/adapters/shared/postgres.rb +12 -0
- data/lib/sequel/adapters/shared/sqlite.rb +32 -0
- data/lib/sequel/adapters/sqlite.rb +9 -8
- data/lib/sequel/adapters/swift.rb +3 -8
- data/lib/sequel/adapters/tinytds.rb +5 -5
- data/lib/sequel/connection_pool.rb +13 -19
- data/lib/sequel/connection_pool/sharded_single.rb +12 -12
- data/lib/sequel/connection_pool/sharded_threaded.rb +37 -17
- data/lib/sequel/connection_pool/single.rb +6 -3
- data/lib/sequel/connection_pool/threaded.rb +33 -13
- data/lib/sequel/database/connecting.rb +28 -1
- data/lib/sequel/database/logging.rb +1 -1
- data/lib/sequel/database/misc.rb +2 -5
- data/lib/sequel/database/query.rb +2 -2
- data/lib/sequel/database/schema_generator.rb +1 -1
- data/lib/sequel/database/schema_methods.rb +3 -0
- data/lib/sequel/dataset/query.rb +8 -4
- data/lib/sequel/dataset/sql.rb +7 -0
- data/lib/sequel/extensions/arbitrary_servers.rb +1 -1
- data/lib/sequel/extensions/connection_validator.rb +109 -0
- data/lib/sequel/extensions/pg_array.rb +2 -0
- data/lib/sequel/extensions/pg_hstore.rb +2 -0
- data/lib/sequel/extensions/pg_json.rb +4 -0
- data/lib/sequel/extensions/pg_range.rb +1 -0
- data/lib/sequel/extensions/pg_row.rb +4 -0
- data/lib/sequel/plugins/prepared_statements.rb +2 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +53 -10
- data/lib/sequel/plugins/touch.rb +18 -6
- data/lib/sequel/plugins/validation_class_methods.rb +1 -0
- data/lib/sequel/plugins/validation_helpers.rb +3 -1
- data/lib/sequel/sql.rb +61 -19
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/firebird_spec.rb +52 -38
- data/spec/adapters/mssql_spec.rb +67 -0
- data/spec/adapters/mysql_spec.rb +192 -116
- data/spec/adapters/postgres_spec.rb +133 -70
- data/spec/adapters/spec_helper.rb +7 -0
- data/spec/adapters/sqlite_spec.rb +34 -1
- data/spec/core/connection_pool_spec.rb +79 -75
- data/spec/core/database_spec.rb +9 -4
- data/spec/core/dataset_spec.rb +15 -0
- data/spec/core/expression_filters_spec.rb +40 -2
- data/spec/extensions/connection_validator_spec.rb +118 -0
- data/spec/extensions/pg_array_spec.rb +4 -0
- data/spec/extensions/single_table_inheritance_spec.rb +42 -0
- data/spec/extensions/touch_spec.rb +40 -0
- data/spec/extensions/validation_class_methods_spec.rb +19 -1
- data/spec/extensions/validation_helpers_spec.rb +17 -0
- data/spec/integration/database_test.rb +14 -0
- data/spec/integration/dataset_test.rb +3 -3
- data/spec/integration/plugin_test.rb +41 -12
- data/spec/integration/schema_test.rb +14 -0
- data/spec/integration/spec_helper.rb +7 -0
- data/spec/integration/type_test.rb +3 -0
- metadata +9 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,43 @@
|
|
1
|
+
=== 3.41.0 (2012-11-01)
|
2
|
+
|
3
|
+
* Add bin/sequel usage guide (jeremyevans)
|
4
|
+
|
5
|
+
* Make Dataset#reverse and #reverse_order accept virtual row blocks (jeremyevans)
|
6
|
+
|
7
|
+
* Add Sequel.delay for generic delayed evaluation (jeremyevans)
|
8
|
+
|
9
|
+
* Make uniqueness validations correctly handle nil values (jeremyevans)
|
10
|
+
|
11
|
+
* Support :unlogged option for create_table on PostgreSQL (JonathanTron) (#575)
|
12
|
+
|
13
|
+
* Add ConnectionPool#pool_type to get the type of connection pool in use (jeremyevans)
|
14
|
+
|
15
|
+
* Explicitly mark primary keys as NOT NULL on SQLite (jeremyevans)
|
16
|
+
|
17
|
+
* Add support for renaming primary key columns on MySQL (jeremyevans)
|
18
|
+
|
19
|
+
* Add connection_validator extension for automatically checking connections and transparently handling disconnects (jeremyevans)
|
20
|
+
|
21
|
+
* Add Database#valid_connection? for checking whether a given connection is valid (jeremyevans)
|
22
|
+
|
23
|
+
* Make dataset.limit(nil, nil) reset offset as well as limit (jeremyevans) (#571)
|
24
|
+
|
25
|
+
* Support IMMEDIATE/EXCLUSIVE/DEFERRED transaction modes on SQLite (Eric Wong)
|
26
|
+
|
27
|
+
* Major change in the Database <-> ConnectionPool interface (jeremyevans)
|
28
|
+
|
29
|
+
* Make touch plugin handle touching of many_*_many associations (jeremyevans)
|
30
|
+
|
31
|
+
* Make single_table_inheritance plugin handle non-bijective mappings (hannesg) (#567)
|
32
|
+
|
33
|
+
* Support foreign key parsing on MSSQL (munkyboy) (#564)
|
34
|
+
|
35
|
+
* Include SQL::AliasMethods in most pg_* extension objects (treydempsey, jeremyevans) (#563)
|
36
|
+
|
37
|
+
* Handle failure to create a prepared statement better in the postgres, mysql, and mysql2 adapters (jeremyevans) (#560)
|
38
|
+
|
39
|
+
* Treat clob columns as strings instead of blobs (jeremyevans)
|
40
|
+
|
1
41
|
=== 3.40.0 (2012-09-26)
|
2
42
|
|
3
43
|
* Add a cubrid adapter for accessing CUBRID databases via the cubrid gem (jeremyevans)
|
data/README.rdoc
CHANGED
@@ -71,7 +71,7 @@ Sequel includes an IRB console for quick access to databases (usually referred t
|
|
71
71
|
|
72
72
|
You get an IRB session with the database object stored in DB.
|
73
73
|
|
74
|
-
In addition to providing an IRB shell (the default behavior), bin/sequel also has support for migrating databases
|
74
|
+
In addition to providing an IRB shell (the default behavior), bin/sequel also has support for migrating databases, dumping schema migrations, and copying databases. See the {bin/sequel guide}[link:files/doc/bin_sequel_rdoc.html] for more details.
|
75
75
|
|
76
76
|
== An Introduction
|
77
77
|
|
@@ -242,7 +242,7 @@ After filtering, you can retrieve the matching records by using any of the retri
|
|
242
242
|
|
243
243
|
my_posts.each{|row| p row}
|
244
244
|
|
245
|
-
See the doc/
|
245
|
+
See the {Dataset Filtering}[link:files/doc/dataset_filtering_rdoc.html] file for more details.
|
246
246
|
|
247
247
|
=== Summarizing Records
|
248
248
|
|
@@ -65,6 +65,18 @@ Remember, using +eager_graph+ is generally only necessary when you need to
|
|
65
65
|
filter/order based on columns in an associated table, it is recommended to
|
66
66
|
use +eager+ for eager loading if possible.
|
67
67
|
|
68
|
+
One advantage of using +eager_graph+ is that you can easily filter/order
|
69
|
+
on columns in an associated table on a per-query basis, using regular
|
70
|
+
Sequel dataset methods. For example, if you only want to retrieve artists
|
71
|
+
who have albums that start with A, and eager load just those albums,
|
72
|
+
ordered by the albums name, you can do:
|
73
|
+
|
74
|
+
albums = Artist.
|
75
|
+
eager_graph(:albums).
|
76
|
+
where(Sequel.like(:albums__name, 'A%')).
|
77
|
+
order(:albums__name).
|
78
|
+
all
|
79
|
+
|
68
80
|
For lazy loading (e.g. Model[1].association), the <tt>:dataset</tt> option can be used
|
69
81
|
to specify an arbitrary dataset (one that uses different keys, multiple keys,
|
70
82
|
joins to other tables, etc.).
|
data/doc/bin_sequel.rdoc
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
= bin/sequel
|
2
|
+
|
3
|
+
bin/sequel is the name used to refer to the "sequel" command line tool that ships with the sequel gem. By default, bin/sequel provides an IRB shell with the +DB+ constant set to a Sequel::Database object created using the database connection string provided on the command line. For example, to connect to a new in-memory SQLite database using the sqlite adapter, you can use the following:
|
4
|
+
|
5
|
+
sequel sqlite:/
|
6
|
+
|
7
|
+
This is very useful for quick testing of ideas, and does not affect the environment, since the in-memory SQLite database is destroyed when the program exits.
|
8
|
+
|
9
|
+
== Running from a git checkout
|
10
|
+
|
11
|
+
If you've installed the sequel gem, then just running "sequel" should load the program, since rubygems should place the sequel binary in your load path. However, if you want to run bin/sequel from the root of a repository checkout, you should probably do:
|
12
|
+
|
13
|
+
ruby -I lib bin/sequel
|
14
|
+
|
15
|
+
The -I lib makes sure that you are using the repository checkout's code.
|
16
|
+
|
17
|
+
== Choosing the Database to Connect to
|
18
|
+
|
19
|
+
=== Connection String
|
20
|
+
|
21
|
+
In general, you probably want to provide a connection string argument to bin/sequel, indicating the adapter and database connection information you want to use. For example:
|
22
|
+
|
23
|
+
sequel sqlite:/
|
24
|
+
sequel postgres://user:pass@host/database_name
|
25
|
+
sequel mysql2://user:pass@host/database_name
|
26
|
+
|
27
|
+
See the {Connecting to a database guide}[link:files/doc/opening_databases_rdoc.html] for more details about and examples of connection strings.
|
28
|
+
|
29
|
+
=== YAML Connection File
|
30
|
+
|
31
|
+
Instead of specifying the database connection using a connection string, you can provide the path to a YAML configuration file containing the connection information. This YAML file can contain a single options hash, or it can contain a nested hash, where the top-level hash uses environment keys with hash values for
|
32
|
+
each environment. Using the -e option with a yaml connection file, you can choose which environment to use if using a nested hash.
|
33
|
+
|
34
|
+
sequel -e production config/database.yml
|
35
|
+
|
36
|
+
Note that bin/sequel does not directly support ActiveRecord YAML configuration files, as they use different names for some options.
|
37
|
+
|
38
|
+
=== Mock Connection
|
39
|
+
|
40
|
+
If you don't provide a connection string or YAML connection file, Sequel will start with a mock database. The mock database allows you to play around with Sequel without any database at all, and can be useful if you just want to test things out and generate SQL without actually getting results from a database.
|
41
|
+
|
42
|
+
sequel
|
43
|
+
|
44
|
+
Sequel also has the ability to use the mock adapter with database-specific syntax, allowing you to pretend you are connecting to a specific type of database without actually connecting to one. To do that, you need to use a connection string:
|
45
|
+
|
46
|
+
sequel mock://postgres
|
47
|
+
|
48
|
+
== Not Just an IRB shell
|
49
|
+
|
50
|
+
bin/sequel is not just an IRB shell, it can also do far more.
|
51
|
+
|
52
|
+
=== Execute Code
|
53
|
+
|
54
|
+
bin/sequel can also be used to execute other ruby files with +DB+ preset to the database given on the command line:
|
55
|
+
|
56
|
+
sequel postgres://host/database_name path/to/some_file.rb
|
57
|
+
|
58
|
+
On modern versions of Linux, this means that you can use bin/sequel in a shebang line:
|
59
|
+
|
60
|
+
#!/path/to/bin/sequel postgres://host/database_name
|
61
|
+
|
62
|
+
If you want to quickly execute a small piece of ruby code, you can use the -c option:
|
63
|
+
|
64
|
+
sequel -c "p DB.tables" postgres://host/database_name
|
65
|
+
|
66
|
+
Similarly, if data is piped into bin/sequel, it will be executed:
|
67
|
+
|
68
|
+
echo "p DB.tables" | sequel postgres://host/database_name
|
69
|
+
|
70
|
+
=== Migrate Databases
|
71
|
+
|
72
|
+
With -m option, Sequel will migrate the database given using the migration directory provided by -m:
|
73
|
+
|
74
|
+
sequel -m /path/to/migrations/dir postgres://host/database
|
75
|
+
|
76
|
+
You can use the -M attribute to set the version to migrate to:
|
77
|
+
|
78
|
+
sequel -m /path/to/migrations/dir -M 3 postgres://host/database
|
79
|
+
|
80
|
+
See the {migration guide}[link:files/doc/migration_rdoc.html] for more details about migrations.
|
81
|
+
|
82
|
+
=== Dump Schemas
|
83
|
+
|
84
|
+
Using the -d or -D options, Sequel will dump the database's schema in Sequel migration format to the standard output:
|
85
|
+
|
86
|
+
sequel -d postgres://host/database
|
87
|
+
|
88
|
+
To save this information to a file, use a standard shell redirection:
|
89
|
+
|
90
|
+
sequel -d postgres://host/database > /path/to/migrations/dir/001_base_schema.rb
|
91
|
+
|
92
|
+
The -d option dumps the migration in database-independent format, the -D option dumps it in database-specific format.
|
93
|
+
|
94
|
+
The -S option dumps the schema cache for all tables in the database, which can speed up the usage of Sequel with models when using the schema_caching extension. You should provide this option with the path to which to dump the schema:
|
95
|
+
|
96
|
+
sequel -S /path/to/schema_cache.db postgres://host/database
|
97
|
+
|
98
|
+
=== Copy Databases
|
99
|
+
|
100
|
+
Using the -C option, Sequel can copy the contents of one database to another, even between different database types. Using this option, you provide two connection strings on the command line:
|
101
|
+
|
102
|
+
sequel -C mysql://host1/database postgres://host2/database2
|
103
|
+
|
104
|
+
This copies the table structure, table data, indexes, and foreign keys from the MySQL database to the PostgreSQL database.
|
105
|
+
|
106
|
+
== Other Options
|
107
|
+
|
108
|
+
Other options not mentioned above are explained briefly here.
|
109
|
+
|
110
|
+
=== -E
|
111
|
+
|
112
|
+
-E logs all SQL queries to the standard output, so you can see all SQL that Sequel is sending the database.
|
113
|
+
|
114
|
+
=== -I include_directory
|
115
|
+
|
116
|
+
-I is similar to ruby -I, and specifies an additional $LOAD_PATH directory.
|
117
|
+
|
118
|
+
=== -l log_file
|
119
|
+
|
120
|
+
-l is similar to -E, but logs all SQL queries to the given file.
|
121
|
+
|
122
|
+
=== -L load_directory
|
123
|
+
|
124
|
+
-L loads all *.rb files under the given directory. This is usually used to load Sequel::Model classes into bin/sequel.
|
125
|
+
|
126
|
+
=== -N
|
127
|
+
|
128
|
+
-N skips testing the connection when creating the Database object. This is rarely needed.
|
129
|
+
|
130
|
+
=== -r require_lib
|
131
|
+
|
132
|
+
-r is similar to ruby -r, requiring the given library.
|
133
|
+
|
134
|
+
=== -t
|
135
|
+
|
136
|
+
-t tells bin/sequel to output full backtraces in the case of an error, which can aid in debugging.
|
137
|
+
|
138
|
+
=== -h
|
139
|
+
|
140
|
+
-h prints the usage information for bin/sequel.
|
141
|
+
|
142
|
+
=== -v
|
143
|
+
|
144
|
+
-v prints the Sequel version in use.
|
data/doc/migration.rdoc
CHANGED
@@ -524,7 +524,7 @@ with the database independent ruby class types, while <tt>-D</tt> will use
|
|
524
524
|
the +column+ method with string types.
|
525
525
|
|
526
526
|
Note that Sequel cannot dump constraints other than primary key and possibly
|
527
|
-
foreign key constraints
|
527
|
+
foreign key constraints. If you are using database features such
|
528
528
|
as constraints or triggers, you should use your database's dump and restore
|
529
529
|
programs instead of Sequel's schema dumper.
|
530
530
|
|
data/doc/object_model.rdoc
CHANGED
@@ -395,6 +395,35 @@ These objects are usually used as values in queries:
|
|
395
395
|
|
396
396
|
DB[:table].insert(:time=>Sequel::CURRENT_TIMESTAMP)
|
397
397
|
|
398
|
+
=== Sequel::SQL::DelayedEvaluation
|
399
|
+
|
400
|
+
Sequel::SQL::DelayedEvaluation objects represent an evaluation that is delayed
|
401
|
+
until query literalization.
|
402
|
+
|
403
|
+
Sequel::SQL::DelayedEvaluation.new(proc{some_model.updated_at})
|
404
|
+
|
405
|
+
The following shortcut exists for creating Sequel::SQL::DelayedEvaluation
|
406
|
+
objects:
|
407
|
+
|
408
|
+
Sequel.delay{some_model.updated_at}
|
409
|
+
|
410
|
+
Note how Sequel.delay requires a block, while Sequel::SQL::DelayedEvaluation.new
|
411
|
+
accepts a generic callable object.
|
412
|
+
|
413
|
+
Let's say you wanted a dataset for the number of objects greater than some
|
414
|
+
attribute of another object:
|
415
|
+
|
416
|
+
ds = DB[:table].where{updated_at > some_model.updated_at}
|
417
|
+
|
418
|
+
The problem with the above query is that it evaluates "some_model.updated_at"
|
419
|
+
statically, so if you change some_model.updated_at later, it won't affect this
|
420
|
+
dataset. You can use Sequel.delay to fix this:
|
421
|
+
|
422
|
+
ds = DB[:table].where{updated_at > Sequel.delay{some_model.updated_at}}
|
423
|
+
|
424
|
+
This will evaluate "some_model.updated_at" every time you literalize the
|
425
|
+
dataset (usually every time it is executed).
|
426
|
+
|
398
427
|
=== Sequel::SQL::Function
|
399
428
|
|
400
429
|
Sequel::SQL::Function objects represents database function calls, which take a function
|
@@ -0,0 +1,155 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A connection_validator extension has been added, which
|
4
|
+
automatically determines if connections checked out from the pool
|
5
|
+
are still valid. If they are not valid, the connection is
|
6
|
+
disconnected and another connection is used automatically,
|
7
|
+
transparent to user code.
|
8
|
+
|
9
|
+
Checking if connections are valid requires a query, so this
|
10
|
+
extension causes a performance hit. For that reason, connections
|
11
|
+
are only checked by default if they have been inactive for more than
|
12
|
+
a configured amount of time (1 hour by default). You can choose to
|
13
|
+
validate connections on every checkout via:
|
14
|
+
|
15
|
+
DB.pool.connection_validation_timeout = -1
|
16
|
+
|
17
|
+
However, this can cause a substantial performance hit unless you are
|
18
|
+
purposely using coarse connection checkouts via manual calls to
|
19
|
+
Database#synchronize (for example, in a Rack middleware). Using
|
20
|
+
coarse checkouts can greatly reduce the amount of concurrency that
|
21
|
+
Sequel supports (for example, limiting the number of concurrent
|
22
|
+
requests to the number of database connections), so this method is
|
23
|
+
not without its tradeoffs.
|
24
|
+
|
25
|
+
* Sequel.delay has been added for a generic form of delayed
|
26
|
+
evaluation. This method takes a block and delays evaluating it
|
27
|
+
until query literalization. By default, Sequel evaluates most
|
28
|
+
arguments immediately:
|
29
|
+
|
30
|
+
foo = 1
|
31
|
+
ds = DB[:bar].where(:baz=>foo)
|
32
|
+
# SELECT * FROM bar WHERE (baz = 1)
|
33
|
+
foo = 2
|
34
|
+
ds
|
35
|
+
# SELECT * FROM bar WHERE (baz = 1)
|
36
|
+
|
37
|
+
Using Sequel.delay, you can delay the evaluation:
|
38
|
+
|
39
|
+
foo = 1
|
40
|
+
ds = DB[:bar].where(:baz=>Sequel.delay{foo})
|
41
|
+
# SELECT * FROM bar WHERE (baz = 1)
|
42
|
+
foo = 2
|
43
|
+
ds
|
44
|
+
# SELECT * FROM bar WHERE (baz = 2)
|
45
|
+
|
46
|
+
* Sequel now supports the :unlogged option when creating tables on
|
47
|
+
PostgreSQL, to create an UNLOGGED table.
|
48
|
+
|
49
|
+
* On SQLite, Database#transaction now supports a :mode option for
|
50
|
+
setting up IMMEDIATE/EXCLUSIVE SQLite transactions. Sequel also
|
51
|
+
supports a Database#transaction_mode accessor for setting the
|
52
|
+
default transaction mode on SQLite.
|
53
|
+
|
54
|
+
* Most pg_* extension objects (e.g. PGArray) now support the #as
|
55
|
+
method for creating an SQL::AliasedExpression object.
|
56
|
+
|
57
|
+
* The single_table_inheritance plugin now supports non-bijective
|
58
|
+
mappings. In lay terms, this means that a one-to-one mapping
|
59
|
+
of column values to classes is no longer required. You can now
|
60
|
+
have multiple column values that map to a single class in the
|
61
|
+
:model_map option, and specify a :key_chooser option to choose
|
62
|
+
which column value to use for the given model class.
|
63
|
+
|
64
|
+
* The touch plugin now handles the touching of many_to_many
|
65
|
+
associations, and other associations that use joined datasets.
|
66
|
+
|
67
|
+
* ConnectionPool#pool_type has been added. It returns a symbol
|
68
|
+
representing the type of connection pool in use (similar to
|
69
|
+
Database#database_type).
|
70
|
+
|
71
|
+
* Database#valid_connection? has been added for checking if a given
|
72
|
+
connection is still valid.
|
73
|
+
|
74
|
+
* Database#disconnect_connection is now part of the public API, and
|
75
|
+
can be used to disconnect a given connection.
|
76
|
+
|
77
|
+
= Other Improvements
|
78
|
+
|
79
|
+
* Uniqueness validation now correctly handles nil values.
|
80
|
+
Previously, it checked the underlying table for other rows where
|
81
|
+
the column IS NULL, but that is incorrect behavior. Sequel's new
|
82
|
+
(correct) behavior is to skip the uniqueness check if the column
|
83
|
+
is nil.
|
84
|
+
|
85
|
+
* Foreign key parsing is now supported on Microsoft SQL Server.
|
86
|
+
|
87
|
+
* Dataset#reverse and #reverse_order now accept virtual row blocks.
|
88
|
+
|
89
|
+
* Changing the name of the primary key column, and possibly other
|
90
|
+
schema changes on the primary key column, are now supported on
|
91
|
+
MySQL.
|
92
|
+
|
93
|
+
* Primary key columns are now specifically marked as NOT NULL on
|
94
|
+
SQLite, as non-integer primary keys on SQLite are not considered
|
95
|
+
NOT NULL by default.
|
96
|
+
|
97
|
+
* Failure to create a native prepared statement is now handled
|
98
|
+
better in the postgres, mysql, and mysql2 adapters.
|
99
|
+
|
100
|
+
* Firebird now emulates selecting data without an underlying table
|
101
|
+
(e.g. DB.get(1)).
|
102
|
+
|
103
|
+
* Finding the name of the constraint that sets column defaults on
|
104
|
+
Microsoft SQL Server now works correctly on JRuby 1.7.
|
105
|
+
|
106
|
+
* An additional type of disconnect error is now recognized in the
|
107
|
+
jdbc/sqlserver adapter.
|
108
|
+
|
109
|
+
* Many adapters have been fixed so that they don't raise an exception
|
110
|
+
if trying to disconnect an already disconnected connection.
|
111
|
+
|
112
|
+
* Many adapters have been fixed so that
|
113
|
+
Database#log_connection_execute logs and executes the given SQL
|
114
|
+
on the connection.
|
115
|
+
|
116
|
+
* Many adapters have been fixed so that
|
117
|
+
Database#database_error_classes returns an array of database
|
118
|
+
exception classes for that adapter.
|
119
|
+
|
120
|
+
* Database#log_exception now handles a nil exception message.
|
121
|
+
|
122
|
+
* Dataset#limit(nil, nil) now resets offset in addition to limit, but
|
123
|
+
you should still use Dataset#unlimited instead.
|
124
|
+
|
125
|
+
* A bin/sequel usage quide has been added to the documentation.
|
126
|
+
|
127
|
+
= Backwards Compatibility
|
128
|
+
|
129
|
+
* Sequel now treats clob columns as strings instead of blobs
|
130
|
+
(except on DB2 when use_clob_as_blob = true). This can make it
|
131
|
+
so the values are returned as strings instead of SQL::Blob values.
|
132
|
+
Since SQL::Blob is a String subclass, this generally will
|
133
|
+
not affect user code unless you are passing the values as input
|
134
|
+
to a separate blob column.
|
135
|
+
|
136
|
+
* The Database <-> ConnectionPool interface was completely changed.
|
137
|
+
Sequel no longer supports custom connection procs or disconnection
|
138
|
+
procs in the connection pools. The :disconnection_proc Database
|
139
|
+
option is no longer respected, and blocks passed to Database.new
|
140
|
+
are now ignored.
|
141
|
+
|
142
|
+
This change should not be user-visible, but if you had any code
|
143
|
+
that was monkeying with the connection pool internals, you may
|
144
|
+
need to modify it.
|
145
|
+
|
146
|
+
* Code that was using the uniqueness check to also check for presence
|
147
|
+
should add a separate check for presence. Such code was broken,
|
148
|
+
as it only worked if there was already a NULL column value in the
|
149
|
+
table. If you were relying on this broken behavior, you should
|
150
|
+
clean up the NULL data in the column and then mark the database
|
151
|
+
column as NOT NULL.
|
152
|
+
|
153
|
+
* If you have code that specifically abuses the fact that non-integer
|
154
|
+
primary keys on SQLite allow NULL values by default, it will no
|
155
|
+
longer work.
|
data/lib/sequel/adapters/ado.rb
CHANGED
@@ -57,6 +57,10 @@ module Sequel
|
|
57
57
|
handle
|
58
58
|
end
|
59
59
|
|
60
|
+
def disconnect_connection(conn)
|
61
|
+
conn.Close
|
62
|
+
end
|
63
|
+
|
60
64
|
# Just execute so it doesn't attempt to return the number of rows modified.
|
61
65
|
def execute_ddl(sql, opts={})
|
62
66
|
execute(sql, opts)
|
@@ -113,10 +117,6 @@ module Sequel
|
|
113
117
|
[::WIN32OLERuntimeError]
|
114
118
|
end
|
115
119
|
|
116
|
-
def disconnect_connection(conn)
|
117
|
-
conn.Close
|
118
|
-
end
|
119
|
-
|
120
120
|
def disconnect_error?(e, opts)
|
121
121
|
super || (e.is_a?(::WIN32OLERuntimeError) && e.message =~ DISCONNECT_ERROR_RE)
|
122
122
|
end
|