Re: libpq - Mailing list pgsql-novice

From Bruno LEVEQUE
Subject Re: libpq
Date
Msg-id 3F98313A.4000002@net6d.com
Whole thread Raw
In response to libpq  ("creid" <creid@netbcg.com>)
Responses derive the sequence name of a column
List pgsql-novice

creid wrote:

>Can anyone explain to me how I can successfully fetch a date column defined
>in a 7.3 table into a c variable and have it store the date just as it is in
>the table?  platform linux, gnu C, pgsql 7.3
>
>
>
>

 From C to Postgres :


time_t                date_jour;
struct tm             *date_lisible;
time(&date_jour);
date_lisible = localtime(&date_jour);

sprintf(recherche,"DECLARE portal CURSOR FOR select lib from Thetable
where date = '01/%d/%d'::date and ....",
date_lisible->tm_mon+1,1900+date_lisible->tm_year);


res1 = PQexec(connexion,recherche);
PQclear(res1);

res1 = PQexec(connexion,"FETCH ALL in portal1");

Form Postgres to C:

use "declare portal" and not "declare portal binary" and ypu mut extract
the date like you want.

Bruno


>Thanks
>C
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly
>
>
>

--
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno.leveque@net6d.com
http://www.net6d.com



pgsql-novice by date:

Previous
From: "creid"
Date:
Subject: libpq
Next
From: "Mel Jamero"
Date:
Subject: derive the sequence name of a column