SqlStatement 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/doc/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
  =Change Log
2
+ ==1.0.2
3
+ * Make the methods in SQLHelpers available as module functions too, so
4
+ not only can you call "include SQLHelpers; sql_func", you can call
5
+ "SQLHelpers.sql_func" as well.
6
+ * Need to pass any block given when patching the dbi functions.
7
+ * Fix a typo in the dbi functions
2
8
  ==1.0.1
3
9
  * +add_fields+ and +add_tables+ now support hashes too, so no more of
4
10
  this silly <tt>stmt.fields.merge!</tt> stuff is requred anymore
@@ -6,18 +6,18 @@ class DBI::DatabaseHandle
6
6
  alias_method :kenbloom_sqlstatement_old_do, :"do"
7
7
  alias_method :kenbloom_sqlstatement_old_execute, :execute
8
8
 
9
- def do(stmt,*args)
10
- if stmt.respond_to?(:placeheld)
11
- kenbloom_sqlstatement_old_do(stmt.to_s,*stmt.placeheld)
9
+ def do(stmt,*args,&block)
10
+ if stmt.is_a?(SQLStatement::Select) or stmt.is_a?(SQLStatement::Insert)
11
+ kenbloom_sqlstatement_old_do(stmt.to_s,*stmt.placeheld,&block)
12
12
  else
13
- kenbloom_sqlstatement_old_do(stmt,*args)
13
+ kenbloom_sqlstatement_old_do(stmt,*args,&block)
14
14
  end
15
15
  end
16
- def execute(stmt,*args)
17
- if stmt.respond_to?(:placeheld)
18
- kenbloom_sqlstatement_old_execute(stmt.to_s,*stmt.placeheld)
16
+ def execute(stmt,*args,&block)
17
+ if stmt.is_a?(SQLStatement::Select) or stmt.is_a?(SQLStatement::Insert)
18
+ kenbloom_sqlstatement_old_execute(stmt.to_s,*stmt.placeheld,&block)
19
19
  else
20
- kenbloom_sqlstatement_old_execute(stmt,*args)
20
+ kenbloom_sqlstatement_old_execute(stmt,*args,&block)
21
21
  end
22
22
  end
23
23
 
data/lib/sql/statement.rb CHANGED
@@ -490,4 +490,5 @@ module SQLHelpers
490
490
  def string_func(str,placeheld=[])
491
491
  SQLStatement::Function.new(str,placeheld)
492
492
  end
493
+ extend self
493
494
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: SqlStatement
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2006-11-20 00:00:00 -06:00
6
+ version: 1.0.2
7
+ date: 2006-12-18 00:00:00 -06:00
8
8
  summary: A library for generating arbitrary SQL statements using convenient Ruby objects.
9
9
  require_paths:
10
10
  - lib