Page 2 of 5

Posted: 13.07.2009, 15:53
by papelhigienico
Hi Mark!

How I send the patches for you?

Can you test in a 32 bit platform?

Regards,
Fabio

Posted: 14.07.2009, 05:10
by papelhigienico
Zeosbugs #190

Posted: 24.07.2009, 23:38
by mdaems
Fabio,

I did test. See the bug report...
Here's the comment on the report I wrote :
I did try to get your changes compiled. But I have very bad news for you. None of the patches was successful.

For ZAbstractRoDataset:
- First change compiles on all compilers I tested.
- Second one doesn't... (Delphi7, didn't test the other compilers)
D:\Data\Delphi\ZEOSTesting\src\component\ZAbstractRODataset.pas(2220) Error: Operator not applicable to this operand type
- Testing suite with only first change : starts spitting 'Bookmark not found' errors.
- No testing suite for Lazarus because the dunit the test suite is based on isn't fpc compatible.

For ZDbcMysqlResultSet:
- Compiles without problems...
- Test suite starts getting "mysql5/mysql-5: Stream sizes are not equal. Binary Stream, expected: <1024> but was: <4>"
- This seems a logical error as the patch you did send implies ignoring the data size returned by mysql. Can you explain what the exact 64-bit-problem was that you wanted to solve with this change? Maybe we can find a better solution.

Mark

Posted: 01.08.2009, 19:25
by papelhigienico
In ZDbcMysqlResultSet, before patch, I got the exception "Unknown MySQL data type", and after the patch it are working fine. I have debugged and I could see that variable Length becomes with 0 when tries to fetch the data type from resultset. I don't know what's wrong in this lines (LengthPointer NEVER is NULL):

- LengthPointer := FPlainDriver.FetchLengths(FQueryHandle);
- if LengthPointer <> nil then
->> Length := PLongInt(LongInt(LengthPointer) + ColumnIndex * SizeOf(LongInt))^
- else
- Length := 0;

But the content of var Buffer is right. Because of this, I created this patch.


Fabio

Posted: 08.08.2009, 06:51
by mdaems
Fabio,

I think this length problem may come from differences in integer lengths. Not sure if the problem is on the lengthbuffer returned by the library that's different between 32 and 64 bit or if the definitions of Longint/Plongnt differ between the fpc versions.

Mark

Posted: 12.08.2009, 04:09
by papelhigienico
Mark,

Yes, it have different sizes between. The type "unsigned long" (used in libmysql) have 32 bits and 64 bits (in C), but LongInt under FPC and Delphi always have 32 bits.

Fabio

Posted: 12.08.2009, 23:11
by mdaems
So, depending on the platform all unsigned long fields must be changed to the right longint replacement.
I'm quite a datatype dummy, so I'll ask, is there a pascal type having exactly the same behaviour? (eg. the generic Integer instead of longint?) Then the solution would be to replace the current references to longints in the interface to the 'variable' integer type.
If there's no comparable datatype we could change the way these integers are read by using IFDEFS.

Can you help here?

Mark

Posted: 13.08.2009, 00:54
by papelhigienico
Yes!

FPC Have QWord and Int64 and Delphi only Int64 (maybe I'm wrong).

To test, I created the following integer types in ZCompatibility:

ULong = unsigned long of C (it can be 32 and 64 bits, CPU dependent using FPC CPU64 defines. In delphi it are the LongWord type because delphi is 32 bits only. In FPC it can be LongWord (32) and QWord (64), depend if CPU64 is defined).

ULongLong = unsigned long long of C, used a lot in MySQL. It alway have 64 bits of size. Equivalent of QWord of FPC but don't have a same type in Delphi (I could be wrong!), so I created a type ULongLong = 0..18446744073709551615; in delphi.

Uint = unsigned int in C = LongWord in delphi and FPC. It always have 32 bits of size.

And theirs typed pointers;

PULong = ^ULong;
PULongLong = ^ULongLong;
PUInt = ^UInt;

I'm doing the translation between integer types to new integer types in MySQL. Using the new types, I solved the problem with wrong calculation of size of buffer in GetString.

I changed records to new types too.

All news, I will post here.

Fabio

Posted: 13.08.2009, 23:53
by papelhigienico
Mark,

Can you change (or add to) the title of topic to "ZeosLib 7 64 bits support"?

Fabio

Posted: 25.08.2009, 21:16
by mdaems
Done. Sorry for the delay...

Posted: 02.09.2009, 01:22
by papelhigienico
Hi!

I have a excelent news! I got ZeosLib working under Linux 64bit (at least with MySQL and Postgres).

I will test the changes in Delphi 7 and 2006 to correct some compiler errors.

The second patch will coming soon...

I found in FPC Platform dependent integers types, I will see if the same types exists in Delphi.

Regards,
Fabio

Posted: 02.09.2009, 01:26
by papelhigienico
If somebody can test it under other 64 bits platforms, this will be a great help!

Posted: 05.09.2009, 10:11
by pomalo
hello

how i can get the 64 bits version?

thank
Regards,
claude

Posted: 05.09.2009, 11:05
by mdaems
The patch is in the bug tracker at http://zeosbugs.firmos.at/ .
I applied the patch but got trouble running the test suite on the 32-bit compilers.
Out-of-the-box packages don't exist yet.

Mark

Posted: 24.09.2009, 13:47
by donaldshimoda
papelhigienico wrote:Hi Mark!

Good news! The exception "Bookmark was not found" has been removed when opening the table (tested in Postgres and MySQL). But when I try to update a field, I got another exception, but I will seek this problem.

And yes, the problem is related with some casting of integer to pointer.
Hi my friend, i am very dissapointed because i discover yesterday the first class dbo lib zeos have not support for 64 bits.
As always , i discover in the hard way. After migrate a complete project from delphi to lazarus, the project compiles fine, but get the infamous error "bookmark not found".

I do a simple test case and neither work.

Using Ubunty 9.04/FPC 2.2.4/Lazarus0.9.29/firebird 2.1, no luck.
Do the same test with sqldb components, work perfect...

I even try your patch papelhigienico (great nick, btw) and dont help.

I mind that one:

// Index := CurrentRows.IndexOf(PPointer(Bookmark)^);
Index := CurrentRows.IndexOf(Bookmark);

And index keep returning zero...

I really hope the way to solve that. Im stuck here. I have a great project using RemObjects/DataAsbtract, and the only problem is the lack of support for 64 bits in ZEOS!

Best Regards.