# ANN: Sequel 2.11.0 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-2-11-0-released/161821>\
**Category:** Ruby\
**Created:** [March 2, 2009, 8:04pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-11-0-released/161821 "2009-03-02T20:04:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nerdmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c68b51/32.png) [@nerdmaster](https://www.ruby-forum.com/u/nerdmaster)\
**Post date:** [March 2, 2009, 8:04pm UTC](https://www.ruby-forum.com/t/ann-sequel-2-11-0-released/161821/1 "2009-03-02T20:04:31Z")

</div>

Sequel is a lightweight database access toolkit for Ruby.

- Sequel provides thread safety, connection pooling and a concise DSL  
for constructing database queries and table schemas.
- Sequel also includes a lightweight but 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, master/slave  
configurations, and database sharding.
- Sequel makes it easy to deal with multiple records without having  
to break your teeth on SQL.
- Sequel currently has adapters for ADO, DataObjects, DB2, DBI,  
Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle, PostgreSQL  
and SQLite3.

Sequel 2.11.0 has been released and should be available on the gem  
mirrors. The 2.11.0 release adds numerous improvements:

## Optimizations

- Model.[] was optimized to use static SQL in cases where doing so  
should result in the same output. This should result in a 30-40%  
performance increase. Since this can be the most significant or  
only method call in a web application action, this has potential  
to significantly enhance the performance of web application code.

- Dataset#literal was refactored for performance reasons to make  
overriding it in subclasses unnecessary. The changes made result  
in a 20-25% performance increase. Sequel can spend about 10% of  
it’s time in Dataset#literal, so this may be only a 2% overall  
performance improvement.

## New Features

- Association datasets now know about the model objects that created  
them, as well as the related association reflection. This makes  
association extensions much more powerful. For example, you can  
now create generic association extensions such as:

- A :conditions association option was added, which allows simple  
filters to be set up without defining :graph\_conditions and  
an association block:

- A :clone association option was added, which allows you to clone  
an existing association. This is most useful when you are dealing  
with a legacy schema and had to define the same options redundantly  
for each type of association. You can now do:

- Dataset#select, #select\_more, #order, #order\_more, and #get all  
take a block that yields a Sequel::SQL::VirtualRow instance,  
similar to the behavior of filter. This allows for the easier  
use of SQL functions on Ruby 1.9:

- String#lit can now accept arguments and return an SQL literal  
string. This allows you to do things that were previously hard  
or at least unnecessarily verbose. For example, you can now  
easily use the SQL standard SUBSTRING function:

- A validates\_inclusion\_of validation method was added to Model. You  
can provide a Range or an Array in the :in option to specify the  
allowed values:

- Dataset#with\_sql was added, which returns a copy of the dataset  
with static SQL. This is useful if you want to keep the same  
row\_proc/graph/transform/etc., but want to use your own custom  
SQL.

## Other Improvements

- You can now use Sequel’s database independent types when casting:

- Model#set\_associated\_object was added. The many\_to\_one association  
setter method calls it. This allows you to easily override the  
association setters for all many\_to\_one associations of a class  
by modifying a single method.

- Typecasting invalid date strings now raises a  
Sequel::Error::InvalidValue instead of an argument error, which  
means that you can use raise\_on\_typecast\_failure = false and not  
have an error raised when an invalid date format is used.

- String#to\_sequel\_blob was added and should now be used instead  
of String#to\_blob. sqlite3-ruby defines String#to\_blob  
differently, which could cause problems.

- Blob columns are now fully supported in the SQLite adapter, with  
the hex escape syntax being used for input, and returning columns  
of type Sequel::SQL::Blob on output.

- The SQLite adapter drop\_column support is now significantly more  
robust.

- The SQLite adapter now supports rename\_column.

- The MySQL adapter now supports stored procedures with multiple  
arguments.

- The MySQL adapter can now not use a compressed connection to the  
server via the :compress=\>false option.

- The MySQL adapter now sets a default timeout of 30 days to the  
database connection, you can change it via the :timeout option,  
which accepts a number of seconds.

- The MySQL adapter now sets SQL\_AUTO\_IS\_NULL to false by default,  
you can use the :auto\_is\_null=\>true option to not do this.

- The MySQL adapter now sets the encoding option on the database  
connection itself, so it works across reconnects.

- Sequel itself no longer uses String#lit or Symbol#\* internally, so  
it shouldn’t break if another library defines them.

- The default index name is now generated correctly if a non-String  
or Symbol column is used.

- Some ruby -w warnings have been fixed.

- INSERTs are now sent to the master database instead of the slave  
database(s) if using a master/slave database configuration and  
PostgreSQL 8.2+ or Firebird.

- DateTime literalization has been fixed in the Firebird adapter.

- Date literalization has been fixed in the H2 JDBC subadapter.

- Release notes for versions from 1.0 to the present are now included  
in the Sequel repository and the RDoc documentation, see  
[http://sequel.rubyforge.org/rdoc/files/doc/release\_notes/](http://sequel.rubyforge.org/rdoc/files/doc/release_notes/)

## Backwards Compatibilty

- The optimization of Model.[] may break if you modify the model’s  
dataset behind its back. Always use Model.set\_dataset if you  
want to change a Model’s dataset.

- Sequel::Dataset::UnsupportedExceptIntersect and  
Sequel::Dataset::UnsupportedExceptIntersectAll will now only be  
defined if you are using an adapter that requires them.

- The private Model#cache\_delete\_unless\_new method has been removed.

- Sequel::SQL::IrregularFunction was removed, as it was a bad hack  
that is not used by Sequel anymore. Unless you were instantiating  
it directly or using a plugin/extension that did, this shouldn’t  
affect you. Using a Sequel::SQL::Function with a  
Sequel::SQL::PlaceholderLiteralString is recommended instead, see  
the substring example above.

Thanks,  
Jeremy

- {Website}[[http://sequel.rubyforge.org](http://sequel.rubyforge.org)]
- {Source code}[[GitHub - jeremyevans/sequel: Sequel: The Database Toolkit for Ruby](http://github.com/jeremyevans/sequel)]
- {Bug tracking}[[Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/ruby-sequel/issues/list)]
- {Google group}[[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)]
- {RDoc}[[http://sequel.rubyforge.org/rdoc](http://sequel.rubyforge.org/rdoc)]
