Update of /cvsroot/ruby-dbi/src/lib/dbd_pg
In directory usw-pr-cvs1:/tmp/cvs-serv1354
Modified Files:
Pg.rb
Log Message:
Fixed semantic of method Statement#rows (affects also Database#do):
Now returns the Row Processed Count instead of the number of rows in the result.
The old behaviour is still available through method Statement#['pg_row_count'].
Index: Pg.rb
===================================================================
RCS file: /cvsroot/ruby-dbi/src/lib/dbd_pg/Pg.rb,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Pg.rb 3 Jul 2002 16:48:36 -0000 1.20
+++ Pg.rb 3 Jul 2002 19:22:47 -0000 1.21
@@ -470,12 +470,26 @@
# Return the row processed count (or nil if RPC not available)
def rows
if @result
- @result.row_count
+ @result.rows_affected
else
nil
end
end
+ def [](attr)
+ case attr
+ when 'pg_row_count'
+ if @result
+ @result.row_count
+ else
+ nil
+ end
+ else
+ @attr[attr]
+ end
+ end
+
+
private # ----------------------------------------------------
end # Statement
@@ -508,6 +522,10 @@
def row_count
@pg_result.num_tuples
end
+
+ def rows_affected
+ @pg_result.cmdtuples
+ end
def finish
@pg_result.clear
|