Page 1 of 2
ZeosDBO in Lazarus
Posted: 17.08.2005, 16:03
by Edwin
Hello,
First of all: Zeos is great! Thanks for keeping it alive and thanks for porting it to Lazarus.
In the latest Lazarus Snapshot with the latest ZeosDBO, the Date field of a ZQuery is always shown as '30/12/1899'.
Long time ago this problem was solved but it seems to be back.
Is there a way to solve this?
BTW, I also posted this problem in the Lazarus forum, but I got no answer so I try it here.
Thanks,
Edwin
Posted: 17.08.2005, 16:09
by Stevie
Hello,
first of all, which Database are you using?
I know, there was a bug with null-values in MySQL.
Is it only shown as this date or is the field value = 0?
Posted: 17.08.2005, 16:34
by Edwin
Hello Stevie,
I am using Firebird 1.5.2.
The database contains dates from jan 2003 until may 2005 and they are all shown as '30/12/1899'.
Posted: 18.08.2005, 10:27
by Stevie
Seems to be a "new" problem with Lazarus, you are right... somewhere in the convertions the datetime-value is lost but for now it is very difficult to locate the error because watches are not working correctly in debug mode
Posted: 18.08.2005, 21:53
by Edwin
Thank you for your reply.
I checked and it seems that everything is still OK in the Lazarus snapshot of 05/08/2005. This snapshot uses the same FPC version as the latest snapshot, so at least we know the problem is not there.
Do you have any idea if, how and when this problem can be solved?
Thanks,
Edwin
Posted: 19.08.2005, 08:01
by Stevie
As soon a possible I will check with another database. I think it is a problem with a pointer not working correctly in lazarus.
Posted: 21.08.2005, 16:10
by rubenjavier
Lazarus requires that the pointers should be marked with ^ otherwise it will return trash
A:= ^B;
or
A:= C.^D;
because sometimes we have arrays of pointers and they must be defined too, Ill do some testing later
Posted: 22.08.2005, 19:11
by rubenjavier
I have a lot of zeosdbo_rework files with pointers and asm fixes... but when I use all of them at the same time I cant install zeos, maybe I mixed something because there were a lot of files that needed pointers fixes... If you tell me wich files contains the date data read/write procedures I'll send you the fixed file for testing
Cheers
Posted: 24.08.2005, 23:46
by Edwin
The problem might be in ZAbstractRODataset.pas (maybe Get/SetFieldData), ZDatasetUtils.pas (maybe DateTimeToNative or NativeToDateTime) or ZDbcCache (maybe Get/SetTimestamp or Get/SetDate).
Posted: 25.08.2005, 17:06
by rubenjavier
OK I'll take a look at the files today, and do some testing
The 3 files ZAbstractRODaraSet, ZDataSetUtils and ZDbCache have pointers fixes (^) according to my notes...
I'll post the results later
In case I need to upload some files I would be good to have a place even in this same new forum/page to host teh fixed files
Cheers
Posted: 26.08.2005, 09:21
by Stevie
rubenjavier wrote:In case I need to upload some files I would be good to have a place even in this same new forum/page to host teh fixed files
Hi ruben,
if you have completed your fixes you can send me these files, so I can check and add them to cvs.
Regards
Stevie
Posted: 27.08.2005, 17:21
by rubenjavier
ZDbcCache, ZAbstractRODataset and ZDatasetUtils wuth pointers Fixes
Hopefully this will solve the date issues
There are about 15 other files that have fixes and I need to test them before send them
Cheers
Posted: 28.08.2005, 19:33
by rubenjavier
I've done some testing with the new files but the dates still appears as 30/12/1899
I'm working with MySQL and there seems to be another problem with lazarus, I can only create valid dates fields by code sending the command:
ZQuery1.SQL.Text:='INSERT INTO xxx (XXX VALUES ("YYYY-MM-DD")';
ZQuery1.ExecSQL;
By writing the date over a dBGrid it wont let me write the dte with this format, it only accepts (DD/MM/YYY) with "/" instead of "-", any other format its rejected, and when I use this format a New record its created but its value its then "0000-00-00"
????
This 30/12/1899 date problem showed before right? as it with this same version of zeosdbo_rework from CVS?
maybe we should try using lazarus stable 0.9.8 and changing the "override"s that produce errors for "overload"s in ZAbstractRODataset as silvio said.
Posted: 28.08.2005, 20:15
by rubenjavier
the "overload" instead of "override" solution doesn't work, I've installed the 0.98 stable of lazarus and changed all the necessary override's for overload's during the compilation of zcomponent.lpk and then an error jumps out at:
function TZAbstractRODataset.GetFieldData
in the line:
Result := inherited GetFieldData(Field, Buffer, NativeFormat);
*Error: Wrong number of parameters specified
Because there are two procedures GetFieldData one with 2 parameters and the other with 3 parameters and we changed override for overload in their declaration
maybe silvio can tell us how he made it???
cheers
Posted: 28.08.2005, 20:38
by rubenjavier
Well I've done some more testing and with a version of lazarus from 20050731 it stills works ok, maybe somebody at the lazarus CVS changed something...
What we can do right now is to upload a lazarus version that works for the others to download it
as I said before I posses the version 20050731 win32 installer if anyone can give me place to upload I'll do so
I'm going to try to get the files from this version and put them into a .tar.bz2 overwriting the new ones to make a Linux version with working dates and times...
the problem obviously come from one of the clases used in ZAbstractRODataset, probably in the GetFieldData, SetFieldData, the same functions that presented override errors in previous lazarus versions, this tell us that some of the classes used here were modified between lazarus versions since 0.9.8 to 0.9.9 and then they were modified again in another 0.9.9 version and the classes stoped working correctly