ZeosDBO in Lazarus

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Edwin
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 17.08.2005, 15:50
Location: Spain

ZeosDBO in Lazarus

Post 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
Stevie
Zeos Dev Team
Zeos Dev Team
Posts: 37
Joined: 16.08.2005, 10:53
Location: Soest
Contact:

Post 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?
Edwin
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 17.08.2005, 15:50
Location: Spain

Post 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'.
Stevie
Zeos Dev Team
Zeos Dev Team
Posts: 37
Joined: 16.08.2005, 10:53
Location: Soest
Contact:

Post by Stevie »

:shock: 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 :(
Edwin
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 17.08.2005, 15:50
Location: Spain

Post 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
Stevie
Zeos Dev Team
Zeos Dev Team
Posts: 37
Joined: 16.08.2005, 10:53
Location: Soest
Contact:

Post 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.
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
Edwin
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 17.08.2005, 15:50
Location: Spain

Post 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).
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
Stevie
Zeos Dev Team
Zeos Dev Team
Posts: 37
Joined: 16.08.2005, 10:53
Location: Soest
Contact:

Post 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
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. (Albert Einstein)
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
You do not have the required permissions to view the files attached to this post.
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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.
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
rubenjavier
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 17.08.2005, 13:09

Post 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
Post Reply