Re: [gnome-db] GDA_TypeDbTimestamp
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Juan Andrés Bentancour <jabentancour uol com ar>
- Cc: GnomeDB <gnome-db-list gnome org>
- Subject: Re: [gnome-db] GDA_TypeDbTimestamp
- Date: 04 Jan 2002 17:12:37 +0100
On Fri, 2002-01-04 at 06:59, Juan Andrés Bentancour wrote:
> En dom, 2001-12-23 a 22:40, Rodrigo Moya escribio:
> > On Fri, 2001-12-21 at 16:54, Juan Andrés Bentancour wrote:
> > > Hi friends...
> > >
> > > I have a postgres table like this:
> > >
> > > CREATE TABLE "test" ( "timedate" timestamp NOT NULL);
> > >
> > > INSERT INTO test VALUES ('25/12/2001');
> > > INSERT INTO test VALUES ('31/12/2001');
> > > INSERT INTO test VALUES ('31/12/2001 23:59:59');
> > >
> > > and this source code:
> > >
> > > GdaRecordset *rs = gda_recordset_new ();
> > > time_t t;
> > > gda_recordset_set_connection (rs, cnc);
> > > gda_recordset_open_txt (rs, "select * from test",
> > > GDA_OPEN_FWDONLY, GDA_LOCK_PESSIMISTIC, 0);
> > > gda_recordset_move_first (rs);
> > > while (!gda_recordset_eof (rs))
> > > {
> > > t = gda_field_get_timestamp_value (gda_recordset_field_idx (rs, 0));
> > > g_print ("timedate: %s\n",str_timedate_from_time_t(t));
> > > gda_recordset_move_next(rs);
> > > }
> > >
> > > char *
> > > str_timedate_from_time_t (time_t t)
> > > {
> > > struct tm *tm;
> > > static char isotime [40];
> > >
> > > tm = localtime (&t);
> > > strftime (isotime, sizeof (isotime)-1, "%d/%m/%Y-%H:%M:%S", tm);
> > > return isotime;
> > > }lmail.com.ar
> > >
> > >
> > > the output is:
> > >
> > > timedate: 31/12/1969-20:59:59
> > > timedate: 31/12/1969-20:59:59
> > > timedate: 31/12/1969-20:59:59
> > >
> > >
> > > with a dbgrid:
> > > ( snapshot.jpg )
> > >
> > > what is the problem ???
> > >
> > hmm, this looks like the postgres provider is not managing that data
> > type. I'll have a look at it next week, and hope to have a patch for it.
> >
>
> I've been probing the postgres provider, looking for a bug , but I don't
> found anything, I probed "fill_field_values" funtion for a TimeStamp
> value and works good for it.
> Ahhh... the "date" and "time" (GDA_TypeDbDate & GDA_TypeDbTime ) data
> types works properly.
>
you mean the fill_field_values function in gda-postgres-recordset.c? If
so, I've also looked, and can't find anything wrong, although I don't
know very well that code, so I may be wrong.
I'm afraid we'll have to wait for Vivien's opinion (Vivien wrote that
code), so please Vivien, tell us something! :-)
cheers
--
Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com>
http://www.gnome-db.org/ - http://www.ximian.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]