[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ANN: Sequel 0.3.2 Released

Sharon Rosner

11/1/2007 7:34:00 PM

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 documentation:
<http://sequel.rubyfor...

Join the Sequel-talk group:
<http://groups.google.com/group/seque...

Install the gem:
sudo gem install sequel

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