Re: libpq

From: Bruno LEVEQUE <bruno(dot)leveque(at)net6d(dot)com>
To: creid <creid(at)netbcg(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: libpq
Date: 2003-10-23 19:51:22
Message-ID: 3F98313A.4000002@net6d.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
>

--
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno(dot)leveque(at)net6d(dot)com
http://www.net6d.com

In response to

  • libpq at 2003-10-23 19:14:23 from creid

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mel Jamero 2003-10-24 07:41:00 derive the sequence name of a column
Previous Message creid 2003-10-23 19:14:23 libpq