ANN: Sequel 3.14.0 Released

J

Jeremy Evans

Sequel is a lightweight database access toolkit for Ruby.

* Sequel provides thread safety, connection pooling and a concise
DSL for constructing SQL queries and table schemas.
* Sequel includes a comprehensive ORM layer for mapping records to
Ruby objects and handling associated records.
* Sequel supports advanced database features such as prepared
statements, bound variables, stored procedures, savepoints,
two-phase commit, transaction isolation, master/slave
configurations, and database sharding.
* Sequel currently has adapters for ADO, Amalgalite, DataObjects,
DB2, DBI, Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle,
PostgreSQL and SQLite3.

Sequel 3.14.0 has been released and should be available on the gem
mirrors.

= New Features

* Dataset#grep now accepts :all_patterns, :all_columns, and
:case_insensitive options. Previously, grep would use a case
sensitive search where it would match if any pattern matched any
column. These three options give you more control over how the
pattern matching will work:

dataset.grep([:a, :b], %w'%test% foo')
# WHERE ((a LIKE '%test%') OR (a LIKE 'foo')
# OR (b LIKE '%test%') OR (b LIKE 'foo'))

dataset.grep([:a, :b], %w'%foo% %bar%', :all_patterns=>true)
# WHERE (((a LIKE '%foo%') OR (b LIKE '%foo%'))
# AND ((a LIKE '%bar%') OR (b LIKE '%bar%')))

dataset.grep([:a, :b], %w'%foo% %bar%', :all_columns=>true)
# WHERE (((a LIKE '%foo%') OR (a LIKE '%bar%'))
# AND ((b LIKE '%foo%') OR (b LIKE '%bar%')))

dataset.grep([:a, :b], %w'%foo% %bar%',
:all_patterns=>true,:all_columns=>true)
# WHERE ((a LIKE '%foo%') AND (b LIKE '%foo%')
# AND (a LIKE '%bar%') AND (b LIKE '%bar%'))

dataset.grep([:a, :b], %w'%test% foo', :case_insensitive=>true)
# WHERE ((a ILIKE '%test%') OR (a ILIKE 'foo')
# OR (b ILIKE '%test%') OR (b ILIKE 'foo'))

* When using the schema plugin, you can now provide a block to the
create_table methods to set the schema and create the table
in the same call:

class Artist < Sequel::Model
create_table do
primary_key :id
String :name
end
end

* The tree plugin now accepts a :single_root option, which uses a
before_save hook to attempt to ensure that there is only a single
root in the tree. It also adds a Model.root method to get the
single root of the tree.

* The tree plugin now adds a Model#root? instance method to check
if the current node is a root of the tree.

* Model#save now takes a :raise_on_failure option which will
override the object's raise_on_save_failure setting. This makes
it easier to get the desired behavior (raise or just return false)
in library code without using a begin/ensure block.

* The Database#adapter_scheme instance method was added, which
operates the same as the class method.

* Sequel now handles the literalization of OCI8::CLOB objects in
the Oracle adapter.

= Other Improvements

* When using the timezone support, Sequel will now correctly load
times and datetimes in standard time when the current timezone is
in daylight time, or vice versa. Previously, if you tried to
to load a time or datetime in December when in July in a timezone
that used daylight time, it would be off by an hour.

* The rcte_tree plugin now works correctly when a :conditions option
is used.

* The single_table_inheritance plugin now works correctly when the
class discriminator column has the same name as an existing ruby
method (such as type).

* Database#each_server now works correctly when a connection string
is used to connect, instead of an options hash.

* Model#destroy now respects the object's use_transactions setting,
instead of always using a transaction.

* Model#exists? now uses a simpler and faster query.

* Sequel now handles the aggregate methods such as count and sum
correctly on Microsoft SQL Server when using an ordered dataset
with a clause such as DISTINCT or GROUP and without a limit.

* Sequel now handles rename_table correctly on Microsoft SQL Server
when using a case sensitive collation, or when qualifying the
table with a schema.

* Sequel now parses the schema correctly on Oracle when the same
table name is used in multiple schemas.

* Sequel now handles OCIInvalidHandle errors when disconnecting
in the Oracle adapter.

* Sequel now raises a Sequel::Error instead of an ArgumentError
if the current or target migration version does not exist.

* When a mismatched number of composite keys are used in
associations, Sequel now uses a more detailed error message.

* Significant improvements were made to the Dataset and Model
RDoc documentation.

= Backwards Compatibility

* Model#valid? now must accept an optional options hash.

* The Model#save_failure private method was renamed to
raise_hook_failure.

* The LOCAL_DATETIME_OFFSET_SECS and LOCAL_DATETIME_OFFSET constants
have been removed from the Sequel module.

* Sequel now uses obj.to_json instead of JSON.generate(obj). This
shouldn't affect backwards compatibility, but did fix a bug in
certain cases.

Thanks,
Jeremy

* {Website}[http://sequel.rubyforge.org]
* {Source code}[http://github.com/jeremyevans/sequel]
* {Blog}[http://sequel.heroku.com]
* {Bug tracking}[http://code.google.com/p/ruby-sequel/issues/list]
* {Google group}[http://groups.google.com/group/sequel-talk]
* {RDoc}[http://sequel.rubyforge.org/rdoc]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,531
Members
45,004
Latest member
KetoBoostGummies

Latest Threads

Top