Subject: | [PATCH] extend manual for 'do' method |
I'd like to offer a small patch that extends the manual entry for do
method.
With this patch one can understand what does this function
returns, without reading DBI manual.
May be it should be edited by native English speaker... But I did my
best writing it ;-)
Subject: | Pg.pm.diff |
--- Pg.pm.etalon 2008-06-23 13:33:39.000000000 +0400
+++ Pg.pm 2008-06-23 14:05:02.000000000 +0400
@@ -2467,13 +2467,19 @@
$rv = $dbh->do($statement, \%attr, @bind_values);
-Prepare and execute a single statement. Note that an empty statement
-(string with no length) will not be passed to the server; if you
-want a simple test, use "SELECT 123" or the ping() function. If
-neither attr nor bind_values is given, the query will be sent directly
+Prepare and execute a single statement. Returns the number of rows affected if the
+query were successful, undef if error occurred or -1 if the number of rows is
+not known, not applicable, or not available. Note that "do" will return '0E0' instead
+of 0 for 'no rows were affected', in order to always return true value if no error.
+
+If neither attr nor bind_values is given, the query will be sent directly
to the server without the overhead of creating a statement handle and
running prepare and execute.
+Note that an empty statement (string with no length) will not be passed to
+the server; if you want a simple test, use "SELECT 123" or the ping()
+function.
+
=item B<last_insert_id>
$rv = $dbh->last_insert_id($catalog, $schema, $table, $field);