ANN: Sequel 0.3.2 Released

C

ciconia

Sequel version 0.3.2 has just been released. This release includes new
Dataset functionality, magic methods and a few other minor
improvements and bug fixes.

Following is a discussion of the changes:

=== New Dataset functionality

A few new methods have been added to the Dataset class. The
#group_and_count methods returns a dataset grouped by the given
column, along with a count for each group:

posts.group_and_count:)category).sql
#=> "SELECT category, count(category) AS count FROM posts GROUP BY
category ORDER BY count"

The #range method returns a Range object made from the minimum and
maximum values for the given column:

posts.filter:)category => 'ruby').range:)view_count)
#=> 11..35

The #interval method returns the interval between the minimum and
maximum values for the given column:

posts.filter:)category => 'ruby').interval:)view_count)
#=> 24

=== Dataset magic methods

The Dataset class now supports magic methods: order_by_xxx,
first_by_xxx, last_by_xxx, filter_by_xxx, group_by_xxx and
count_by_xxx. These methods can be used :

posts.order_by_stamp.sql
#=> "SELECT * FROM posts ORDER BY stamp"

posts.first_by_stamp #=> first row ordered by stamp
posts.last_by_stamp #=> last row ordered by stamp

posts.filter_by_category('ruby').sql
#=> "SELECT * FROM posts WHERE (category = 'ruby')"

posts.group_by_category.sql
#=> "SELECT * FROM posts GROUP BY category"

posts.count_by_category.sql
#=> "SELECT category, count(category) AS count FROM posts GROUP BY
category ORDER BY count"

=== Other improvements and bug fixes

* Model.create and Model.new can now accept a block:

Post.new do |p|
p.title = "Hello world"
p.save
end

* Added Dataset#set as alias to Dataset#update.

* Fixed Oracle::Database#execute (#84).

* Fixed timestamp translation in SQLite adapter (#83).

* Experimental DB2 adapter.

* Removed long deprecated expressions.rb code.

* More documentation.

* Revised code to refer to 'columns' instead of 'fields'.

=== More info

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
 

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,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top