LIBPQ
LIBPQ
От:
"creid" <creid@netbcg.com>
Дата:
Can anyone help me understand what it is I need to do to simply retrieve date and time columns into C variables that are readable. All other columns are come across successfully but the date and time. I have tried double to store the pg date and char[9] for time, among other typedef tries. My psotgres columns are defined as: mytime time, mydate date. Thanks C
Re: LIBPQ
От:
Tomasz Myrta <jasiek@klaster.net>
Дата:
Dnia 2003-10-23 22:01, Użytkownik creid napisał: > Can anyone help me understand what it is I need to do to simply retrieve > date and time columns into C variables that are readable. All other columns > are come across successfully but the date and time. I have tried double to > store the pg date and char[9] for time, among other typedef tries. My > psotgres columns are defined as: mytime time, mydate date. > > Thanks > C 1. char[9] is too short for displaying time. Default text representation of time is: 08:06:05.474477 You can: - use longer variable char[16] - format your time to have 08:06:05 only using to_char(...) - change your columns from "time" to "time(0)" 2. char[9] is also too short for date. Default text representation for date (European format) is: 2003-10-27 You need char[11] for this. Regards, Tomasz Myrta
Re: LIBPQ
От:
"Anis W. Nugroho" <anis_wn@gawab.com>
Дата:
The efficient way to prepare your variables is test the query in the postgres front-end (psql) watch the result from the query and set your variable up according to that result. Good luck, Anis WN ________________________________ 15 Mbytes Free Web-based and POP3 Sign up now: http://www.gawab.com