sequel 0.3.0 → 0.3.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.3.0.1 (2007-10-20)
2
+
3
+ * Changed Database#fetch to return a modified dataset.
4
+
1
5
  === 0.3 (2007-10-20)
2
6
 
3
7
  * Added stock transforms to Dataset#transform. Refactored Model.serialize.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  include FileUtils
7
7
 
8
8
  NAME = "sequel"
9
- VERS = "0.3.0"
9
+ VERS = "0.3.0.1"
10
10
  CLEAN.include ['**/.*.sw?', 'pkg/*', '.config', 'doc/*', 'coverage/*']
11
11
  RDOC_OPTS = ['--quiet', '--title', "Sequel: Concise ORM for Ruby",
12
12
  "--opname", "index.html",
@@ -74,7 +74,9 @@ module Sequel
74
74
  if block
75
75
  ds.fetch_rows(sql, &block)
76
76
  else
77
- Enumerable::Enumerator.new(ds, :fetch_rows, sql)
77
+ ds.meta_def(:select_sql) {|*args| sql}
78
+ ds.meta_def(:sql) {|*args| sql}
79
+ ds
78
80
  end
79
81
  end
80
82
  alias_method :>>, :fetch
@@ -547,14 +547,24 @@ context "Database#fetch" do
547
547
  sql.should == "select name from table where name = 'aman' or id in (3, 4, 7)"
548
548
  end
549
549
 
550
- specify "should return an enumerator if no block is given" do
551
- @db.fetch('select * from xyz').should respond_to(:each)
550
+ specify "should return the dataset if no block is given" do
551
+ @db.fetch('select * from xyz').should be_a_kind_of(Sequel::Dataset)
552
552
 
553
553
  @db.fetch('select a from b').map {|r| r[:sql]}.should == ['select a from b']
554
554
 
555
555
  @db.fetch('select c from d').inject([]) {|m, r| m << r; m}.should == \
556
556
  [{:sql => 'select c from d'}]
557
557
  end
558
+
559
+ specify "should return a dataset that always uses the given sql for SELECTs" do
560
+ ds = @db.fetch('select * from xyz')
561
+ ds.select_sql.should == 'select * from xyz'
562
+ ds.sql.should == 'select * from xyz'
563
+
564
+ ds.filter! {:price < 100}
565
+ ds.select_sql.should == 'select * from xyz'
566
+ ds.sql.should == 'select * from xyz'
567
+ end
558
568
  end
559
569
 
560
570
  context "Database#[]" do
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: sequel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
6
+ version: 0.3.0.1
7
7
  date: 2007-10-20 00:00:00 +02:00
8
8
  summary: Lightweight ORM library for Ruby
9
9
  require_paths: