Sequel version 0.1.9.6 has just been released. This release includes a
number of big fixes and improvements, among which better schema
definitions and better paginated datasets. I’d like to thank all of
the people who made the effort to file bug reports, thus making Sequel
better.
Following is a discussion of the main changes:
Improvements to Paginated Datasets
Paginated datasets now provide a bit more information about
themselves. The new methods are #pagination_record_count, #page_range
and #current_page_record_range:
get page 4, 50 records per page
paginated = DB[:items].reverse_order(:stamp).paginate(4, 50)
really just a cache of paginated.count
paginated.pagination_record_count #=> 153
range of available pages
paginated.page_range #=> 1…4
range of records in current page
paginated.current_page_record_range #=> 151…153
Refactored Schema Definition Code
The schema definition code has been re-factored and greatly simplified
in order to provide better support for adapter-specific quirks and
behaviors. This means that you no longer need to coerce Sequel to do
what you want. For example, AUTO INCREMENT fields are now done
correctly for each adapter, and primary keys default to the correct
adapter-specific definition.
Support for Specifying Field Sizes and SET/ENUM Columns
Sequel now allows you to specify the field size:
DB.create_table :items do
varchar :name, :size => 64
end
Note that if you define a varchar field and don’t specify a size,
Sequel will assume a field size of 255.
There’s also support for MySQL SET/ENUM fields:
DB.create_table :items do
enum :category, :elements => [‘ruby’, ‘java’, ‘other’]
end
Sequel.dbi Convenience Method
DBI users now have an easier way to open databases using DBI. The old
method involved doing something ugly like:
Sequel.open ‘dbi:/ado’, {
:database =>
‘DBI:ADO:Provider=SQLNCLI;Data Source=(local)
\sqlexpress;Integrated Security=SSPI’
}
The new Sequel.dbi method makes it look nicer:
Sequel.dbi ‘ADO:Provider=SQLNCLI;Data Source=(local)
\sqlexpress;Integrated Security=SSPI’
Miscellanea
-
Changed MySQL adapter to automatically reconnect (issue #26).
-
Changed Sequel() to acccept variable arity.
=============================================
Sequel project page:
http://code.google.com/p/ruby-sequel
Sequel documentation:
http://sequel.rubyforge.org
Join the Sequel-talk group:
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 sequel
cd sequel
rake install