Обсуждение: timestamp/date in ecpg
I started working on date/timestamp in ecpg. So far I can read date types from the DB and I can insert date into the DB. However there seems to be a bug in converting timestamp to ascii or vice versa. If anyone of you knows more about timestamp2tm etc. could you please have a look at function PGTYPEStimestamp_ttoa in pgtypeslib/timestamp.c? Hmm, maybe the transformation in the other direction is the culprit. What I do is call ts1 = PGTYPEStimestamp_atot("2000-7-12 17:34:29", NULL); followed by a text = PGTYPEStimestamp_ttoa(ts1);Needless to say the resulting text is not "2000-7-12 17:34:29". :-( Maybe some of you have an idea. Michael -- Michael Meskes Email: Michael@Fam-Meskes.De ICQ: 179140304 Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
> > I started working on date/timestamp in ecpg. So far I can read date > types from the DB and I can insert date into the DB. However there seems > to be a bug in converting timestamp to ascii or vice versa. > > If anyone of you knows more about timestamp2tm etc. could you please > have a look at function PGTYPEStimestamp_ttoa in pgtypeslib/timestamp.c? > > Hmm, maybe the transformation in the other direction is the culprit. > What I do is call ts1 = PGTYPEStimestamp_atot("2000-7-12 17:34:29", NULL); followed by a text = PGTYPEStimestamp_ttoa (ts1); Needless to say the resulting text is not "2000-7-12 17:34:29". :-( > > Maybe some of you have an idea. > I am willing to have a look at the functions, but am failing in finding directory pgtypeslib/ within $PGSQLD (version 7.3.2). Regards, Christoph
> > Hmm, maybe the transformation in the other direction is the culprit. > What I do is call ts1 = PGTYPEStimestamp_atot("2000-7-12 17:34:29", NULL); followed by a text = PGTYPEStimestamp_ttoa (ts1); Needless to say the resulting text is not "2000-7-12 17:34:29". :-( > I could not dig too deep into the code until now, but isn't there a leading zero missing 2000-07-12 17:34:29 Regards, Christoph
On Fri, Mar 21, 2003 at 04:33:09PM +0100, Christoph Haller wrote: > > > > Hmm, maybe the transformation in the other direction is the culprit. > > What I do is call ts1 = PGTYPEStimestamp_atot("2000-7-12 17:34:29", > NULL); followed by a text = PGTYPEStimestamp_ttoa > (ts1); Needless to say the resulting text is not "2000-7-12 17:34:29". > :-( > > > I could not dig too deep into the code until now, > but isn't there a leading zero missing > 2000-07-12 17:34:29 Sure, but that shouldn't be a problem. Note, however, that I just ran a short test that worked as advertized. Right now it seems ecpglib does call the new functions incorrectly. When calling them directly it seems to work. Unfortunately I have no time to dig into it right now. But I surely will soon. Michael -- Michael Meskes Email: Michael@Fam-Meskes.De ICQ: 179140304 Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!