# ANN: Sequel 0.4.2 Released

**URL:** <https://www.ruby-forum.com/t/ann-sequel-0-4-2-released/122402>\
**Category:** Ruby\
**Created:** [December 7, 2007, 10:15am UTC](https://www.ruby-forum.com/t/ann-sequel-0-4-2-released/122402 "2007-12-07T10:15:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciconia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/71c47a/32.png) [@ciconia](https://www.ruby-forum.com/u/ciconia)\
**Post date:** [December 7, 2007, 10:15am UTC](https://www.ruby-forum.com/t/ann-sequel-0-4-2-released/122402/1 "2007-12-07T10:15:26Z")

</div>

Sequel version 0.4.1 has just been released. This release includes a  
new plugin system for models, new experimental adapters, and  
enhancements to Sequel models.

Sequel is a lightweight database access and ORM library for Ruby.  
Sequel provides thread safety, connection pooling and a simple and  
expressive API for constructing database queries and table schemas.

Following is a discussion of the changes.

=== Plugins for Sequel models

New in this release is as plugin system for enhancing model classes  
with common functionality. Plugins are automatically loaded when used  
in a model class, and enhance the model class with instance, class and  
dataset methods.

The first plugin for Sequel is orderable, which allows model instances  
to be part of an ordered list, based on a ‘position’ field in the  
database. Basic usage is as follows:

class Item \< Sequel::Model(:items)  
is :orderable  
end

You can also specify the field used for determining the position by  
specifying a :field option:

class Item \< Sequel::Model(:items)  
is :orderable, :field =\> :my\_pos\_field  
end

The orderable plugin is installed as a separate gem:

sudo gem install sequel\_orderable

More plugins are currently being developed, including: accountable,  
dequeue, linked\_list, poset, queue, searchable, stack, taggable, tree  
and versioned.

=== Experimental JDBC adapter

New in this release is an experimental adapter for JDBC, which might  
prove useful for JRuby users. Since JDBC requires explicit loading of  
drivers and has its own conventions for connection strings, connecting  
to a database is a bit different than other Sequel adapters:

require ‘sequel’  
require ‘sequel/adapters/jdbc’

Sequel::JDBC.load\_driver(“com.mysql.jdbc.Driver”)  
DB = Sequel.jdbc(“mysql://127.0.0.1:3306/mydb?user=root”)

The JDBC adapter will probably need more work, so feedback would be  
greatly appreciated.

=== Improvements to Sequel models

Model instances now keep track of changes to field values, provided  
values are changed using the attribute writer methods, or through  
Model#[]= calls. Changes can be tracked by calling  
Model#changed\_columns:

item = Item.first  
item.changed\_columns #=\> []  
item.category = ‘ruby’  
item.changed\_columns #=\> [:category]

Changes can be saved by calling Model#save\_changes:

item.category = ‘sequel’  
item.save\_changes # will update the category field only

Also, the Model#save method can now accept a list of specific fields  
to save, e.g.:

item.save(:category, :name)

=== Miscellanea

- Implemented experimental OpenBase adapter.

- Implemented odbc-mssql adapter (thanks Dusty.) This adapter offers  
support for limiting the number of records selected and using NO LOCK  
with MSSQL databases.

- Fixed Sequel. methods to accept options hash as well as  
database name. Fixed Sequel.connect to accept options hash as well as  
URI.

- Fixed #first and #last functionality in Informix::Dataset (thanks  
Gerardo S.).

=== More info

Sequel project page:  
[http://code.google.com/p/ruby-sequel](http://code.google.com/p/ruby-sequel)

Sequel documentation:  
[http://sequel.rubyforge.org](http://sequel.rubyforge.org)

Join the Sequel-talk group:  
[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)

Install the gem:  
sudo gem install sequel

Or check out the source and install manually:  
svn co [http://ruby-sequel.googlecode.com/svn/trunk](http://ruby-sequel.googlecode.com/svn/trunk) sequel  
cd sequel  
rake install
