apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Rossi <bob_ro...@cox.net>
Subject postgres dbd_pgsql_open
Date Fri, 16 May 2008 20:32:35 GMT

I'm looking at dbd_pgsql_open. I noticed the comment,
    /* if there's an error in the connect string or something we get
     * back a * bogus connection object, and things like PQreset are
     * liable to segfault, so just close it out now.  it would be nice
     * if we could give an indication of why we failed to connect... */
    if (PQstatus(conn) != CONNECTION_OK) {
      return NULL;

I'm suprised to see such a comment, since a little bit of research
showed me this,
  /* Check to see that the backend connection was successfully made */
  if (PQstatus(conn) != CONNECTION_OK)
      fprintf(stderr, "Connection to database failed: %s",

So, I think that the function PQerrorMessage should be called bewtween the
PQstatus and the PQfinish. However, the api, 
  static apr_dbd_t *dbd_pgsql_open(apr_pool_t *pool, const char *params)
doesn't allow for a 'string' message to be returned.

What can we do? I find this interface useless, if I can't get an error
message when it fails.

Bob Rossi

View raw message