Re: [gnome-db] GDA_TypeDbTimestamp



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.

I hope you can help me !

Bye

Juan Andrés
-------------------------------------------------------------------------
"Old C programmers never die. They just cast into void."
-------------------------------------------------------------------------






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]