From: | Alberto Cabello Sanchez <alberto(at)unex(dot)es> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | ColumnName and ColumnNumber in libpq (C interface) |
Date: | 2003-09-15 07:11:25 |
Message-ID: | 20030915071125.GA7389@guadiana.unex.es |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
I think this behaviour is not fine:
I create a table with
CREATE TABLE foo ("Bar" VARCHAR(1));
I thougth running this helloworldish C program:
#include <stdio.h>
#include <libpq-fe.h>
int main(int argc,char **argv)
{
PGconn * conn = PQconnectdb("dbname=pruebas");
PGresult * res = PQexec(conn,"SELECT * from foo");
printf("%s\n",PQfname(res,0));
printf("%d\n",PQfnumber(res,"Bar"));
PQfinish(conn);
}
should print
Bar
0
but stdout shows
Bar
-1
What is happening? Any ideas? Is this a bug, a feature or something I'm missing?
--
-----------------------
Alberto Cabello Sánchez
alberto(at)unex(dot)es
Servicio de Informática
924 289 351
-----------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Haller | 2003-09-15 07:59:22 | Re: ColumnName and ColumnNumber in libpq (C interface) |
Previous Message | Christian Valverde | 2003-09-13 18:12:16 | PQconnectdb question |