On 04/08/2011 03:24 PM, Paolo Bonzini wrote: > Thanks! Hi, I have one more bugfix to make my code (first written for the SQLite backend) work.
There is one more issue when going from DBD-SQLite to Postgres. I wonder if the DBD-Sqlite code should call resetAndClear on a prepared query inside a ensure block. Right now I call resetAndClear before doing the next query but this is not available on the PGStatement. So I could either add it to the Statement base class, or add the ensure to the SQLite Statement impl. > I am only squashing this in: With the merged code. Is there a gurantee that gcNew: N will initialize the array with NULL? If not we might have an issue when an exception occurs when filling the array.
>From dee02985119b5062b131e7fdf7d7299a70518853 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther <[email protected]> Date: Sat, 9 Apr 2011 00:07:37 +0200 Subject: [PATCH] dbd-postgres: Fix the rowsAffected call. The return value of PGcmdTuples is a string (could be empty if the query was not a select) and not a integer. Parse the result into an integer. http://www.postgresql.org/docs/8.4/interactive/libpq-exec.html --- packages/dbd-postgresql/ChangeLog | 4 ++++ packages/dbd-postgresql/ResultSet.st | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/dbd-postgresql/ChangeLog b/packages/dbd-postgresql/ChangeLog index 0d68cec..23f1392 100644 --- a/packages/dbd-postgresql/ChangeLog +++ b/packages/dbd-postgresql/ChangeLog @@ -1,5 +1,9 @@ 2011-04-08 Holger Hans Peter Freyther <[email protected]> + * ResultSet.st: Fix the rowsAffected in PGResultSet. + +2011-04-08 Holger Hans Peter Freyther <[email protected]> + * Statements.st: Implement executeWithAll: * Connection.st: Invoke PQexecParams. diff --git a/packages/dbd-postgresql/ResultSet.st b/packages/dbd-postgresql/ResultSet.st index 996c5e1..a8432d5 100644 --- a/packages/dbd-postgresql/ResultSet.st +++ b/packages/dbd-postgresql/ResultSet.st @@ -166,7 +166,7 @@ ResultSet subclass: PGResultSet [ rowsAffected [ <category: 'accessing'> self isDML ifFalse: [super rowsAffected]. - ^handle numTuples + ^handle rowsAffected asInteger ] columnsArray [ @@ -293,7 +293,7 @@ CObject subclass: PQResultSet [ "DML results" rowsAffected [ - <cCall: 'PQcmdTuples' returning: #int args: #( #self)> + <cCall: 'PQcmdTuples' returning: #string args: #( #self)> ] lastOid [ -- 1.7.4
_______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
