apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r704986 - in /apr/apr-util/trunk: CHANGES dbd/apr_dbd_pgsql.c
Date Wed, 15 Oct 2008 18:24:00 GMT
Author: niq
Date: Wed Oct 15 11:24:00 2008
New Revision: 704986

URL: http://svn.apache.org/viewvc?rev=704986&view=rev
Log:
Suppress pgsql column-out-of-range warning
PR 46012 - patch from Michiel van Loon.

Modified:
    apr/apr-util/trunk/CHANGES
    apr/apr-util/trunk/dbd/apr_dbd_pgsql.c

Modified: apr/apr-util/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/CHANGES?rev=704986&r1=704985&r2=704986&view=diff
==============================================================================
--- apr/apr-util/trunk/CHANGES [utf-8] (original)
+++ apr/apr-util/trunk/CHANGES [utf-8] Wed Oct 15 11:24:00 2008
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.4.0
 
+  *) Suppress pgsql column-out-of-range warning.
+     PR 46012 [Michiel van Loon <michiel van-loon.xs4all.nl>]
+
   *) Move APU_HAVE_CRYPTO from private apu_config.h to public apu.h.
      [Ruediger Pluem, Graham Leggett]
 

Modified: apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=704986&r1=704985&r2=704986&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Wed Oct 15 11:24:00 2008
@@ -218,7 +218,12 @@
 
 static const char *dbd_pgsql_get_name(const apr_dbd_results_t *res, int n)
 {
-    return (res->res ? PQfname(res->res, n) : NULL);
+    if (res->res) {
+        if ((n>=0) && (PQnfields(res->res) > n)) {
+            return PQfname(res->res,n);
+        }
+    }
+    return NULL;
 }
 
 static int dbd_pgsql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,



Mime
View raw message