guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 10/12] Guile-DBD-postgres: Fix off-by-one when fetching rows


From: Linas Vepstas
Subject: [PATCH 10/12] Guile-DBD-postgres: Fix off-by-one when fetching rows
Date: Fri, 19 Sep 2008 09:20:41 -0500
User-agent: Mutt/1.5.15+20070412 (2007-04-11)


It appears that the current postgres dbd code will return one less
row than the database actually contains, which is a disaster if 
the database holds only one row! Fix this.

Signed-off-by: Linas Vepstas <address@hidden>

---
 src/guile-dbd-postgresql.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: guile-dbd-postgresql-2.0.0/src/guile-dbd-postgresql.c
===================================================================
--- guile-dbd-postgresql-2.0.0.orig/src/guile-dbd-postgresql.c  2008-09-15 
14:10:33.000000000 -0500
+++ guile-dbd-postgresql-2.0.0/src/guile-dbd-postgresql.c       2008-09-15 
14:11:02.000000000 -0500
@@ -299,7 +299,7 @@ __postgresql_getrow_g_db_handle(gdbi_db_
       pgsqlP->lget = 0;
       return (SCM_BOOL_F);
     }
-  else if (pgsqlP->lget == (PQntuples(pgsqlP->res) - 1))
+  else if (pgsqlP->lget == PQntuples(pgsqlP->res))
     {
       pgsqlP->res = PQgetResult(pgsqlP->pgsql);
     }

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]