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_countcategory).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.filtercategory => 'ruby').rangeview_count)
#=> 11..35
The #interval method returns the interval between the minimum and
maximum values for the given column:
posts.filtercategory => 'ruby').intervalview_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:atabase#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
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_countcategory).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.filtercategory => 'ruby').rangeview_count)
#=> 11..35
The #interval method returns the interval between the minimum and
maximum values for the given column:
posts.filtercategory => 'ruby').intervalview_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:atabase#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