ZeosLib 7 64 bits support
Moderators: gto, EgonHugeist, olehs
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
ZeosLib 7 64 bits support
After update to lastest revision (636), my applications that uses MySQL raises the exception:
Unknown MySQL data type!
Someone know how to solve this?
I was think that this is related with missing old functions (like mysql_connect) on MySQL client library, but that I could see, Zeos MySQL library is prepared for the new functions.
I'm using ubuntu Linux 9.04 x86_64. On Windows this not occurs.
Unknown MySQL data type!
Someone know how to solve this?
I was think that this is related with missing old functions (like mysql_connect) on MySQL client library, but that I could see, Zeos MySQL library is prepared for the new functions.
I'm using ubuntu Linux 9.04 x86_64. On Windows this not occurs.
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Can you debug into the ConvertMySQLHandleToSQLType (ZDbcMySqlUtils.pas) function to see what value is returned by PlainDriver.GetFieldType(FieldHandle)?
This is a very strange error to find now at once, as this message is also in the current stable branch since rev. 306. I'm running the test suite on this release before (almost) every commit. On 3 different mysql versions (but all on windows as the suite is Delphi based and doesn't compile on FPC).
BUT wait... I see you're running on Ubuntu x86_64. Did there change something recently in your configuration? Mysql or fpc? Zeoslib is know to be not working correctly in 64 bit environments. Im not sure if the 64 bit libmysql version has the same interface data sizes as the 32 bit versions I'm testing with on Windows.
Mark
This is a very strange error to find now at once, as this message is also in the current stable branch since rev. 306. I'm running the test suite on this release before (almost) every commit. On 3 different mysql versions (but all on windows as the suite is Delphi based and doesn't compile on FPC).
BUT wait... I see you're running on Ubuntu x86_64. Did there change something recently in your configuration? Mysql or fpc? Zeoslib is know to be not working correctly in 64 bit environments. Im not sure if the 64 bit libmysql version has the same interface data sizes as the 32 bit versions I'm testing with on Windows.
Mark
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
When Float/Double fields are present, the type returned by the PlainDriver.GetFieldType is 31 and the exception is raised in the line 246 of ZDbcMysqlUtils (function ConvertMySQLHandleToSQLType).
But when it's not present, the exception is raised in the line 392 of the ZDbcMysqlUtils unit (function ConvertMySQLTypeToSQLType). In these function, the parameters TypeName and TypeNameFull are came NIL.
But when it's not present, the exception is raised in the line 392 of the ZDbcMysqlUtils unit (function ConvertMySQLTypeToSQLType). In these function, the parameters TypeName and TypeNameFull are came NIL.
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Fabio, that's where your trouble comes from. As I said above : Zeoslib is known to be not working correctly in 64 bit environments. Don't ask me what's the reason exactly. Maybe some pointer and buffer size calculation errors?
I'm afraid I can't exactly help you with this issue directly. Of course, I can help to get the necessary changes in the official zeoslib version, but then I'll need somebody to tell me what's working...
To point you in the right direction : a long time ago hgourvest wrote about it on the forum. Also a search on "64 bit" may help you going.
BTW: I didn't know it even compiles on 64-bit compilers.
Mark
I'm afraid I can't exactly help you with this issue directly. Of course, I can help to get the necessary changes in the official zeoslib version, but then I'll need somebody to tell me what's working...
To point you in the right direction : a long time ago hgourvest wrote about it on the forum. Also a search on "64 bit" may help you going.
BTW: I didn't know it even compiles on 64-bit compilers.
Mark
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
I changed the function bellow (near of line 393 of ZDbcMySqlResultSet.pas) to:
function TZMySQLResultSet.GetString(ColumnIndex: Integer): AnsiString;
var
LengthPointer: PLongInt;
Buffer: PAnsiChar;
begin
{$IFNDEF DISABLE_CHECKING}
CheckClosed;
if FRowHandle = nil then
raise EZSQLException.Create(SRowDataIsNotAvailable);
{$ENDIF}
ColumnIndex := ColumnIndex - 1;
Buffer := FPlainDriver.GetFieldData(FRowHandle, ColumnIndex);
LastWasNull := Buffer = nil;
Result := '';
if not LastWasNull then
Result := Buffer;
end;
And the error " Unknown MySQL data type" are solved, but now the exception "Bookmark was not found" is raised...
What is bookmark in Zeos?
function TZMySQLResultSet.GetString(ColumnIndex: Integer): AnsiString;
var
LengthPointer: PLongInt;
Buffer: PAnsiChar;
begin
{$IFNDEF DISABLE_CHECKING}
CheckClosed;
if FRowHandle = nil then
raise EZSQLException.Create(SRowDataIsNotAvailable);
{$ENDIF}
ColumnIndex := ColumnIndex - 1;
Buffer := FPlainDriver.GetFieldData(FRowHandle, ColumnIndex);
LastWasNull := Buffer = nil;
Result := '';
if not LastWasNull then
Result := Buffer;
end;
And the error " Unknown MySQL data type" are solved, but now the exception "Bookmark was not found" is raised...
What is bookmark in Zeos?
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
skydiablo,
papelhigienico,
I think this can only be solved by making zeoslib 64-bit ready.
If you feel like helping us doing this?
I have no real idea what must change in order to do this. I think first thing to do is to check the places where integers are used to represent pointers and fix this.
papelhigienico,
did the change above make the program choose the right Mysqldata type? The I could try if it's safe on 32 bit systems and do the change anyway.
Mark
papelhigienico,
I think this can only be solved by making zeoslib 64-bit ready.
If you feel like helping us doing this?
I have no real idea what must change in order to do this. I think first thing to do is to check the places where integers are used to represent pointers and fix this.
papelhigienico,
did the change above make the program choose the right Mysqldata type? The I could try if it's safe on 32 bit systems and do the change anyway.
Mark
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Fabio,
I'm afraid you're still not on the right track. In my opinion this is a 64-bit incompatibility problem.
The bookmark object/method is just he Bookmark property defined on TDataset level. A qyuick scan says me there's some pointer code involved in zeoslib. This may explain the trouble you have.
Mark
I'm afraid you're still not on the right track. In my opinion this is a 64-bit incompatibility problem.
The bookmark object/method is just he Bookmark property defined on TDataset level. A qyuick scan says me there's some pointer code involved in zeoslib. This may explain the trouble you have.
Mark
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
Yes, I'm wrong... but I want to understand what is a Bookmark to seek the problem...
And seeking this, I found some casting of pointer to Integer. Near of line 880 of ZAbstractRODataSet.pas is wrote
if FilterRow(ResultSet.GetRow) then
CurrentRows.Add(Pointer(ResultSet.GetRow))
else
Continue;
And ResultSet.GetRow is a Integer function defined in IZResultSet interface.
I will do the changes and see how many Access Violations I can do
And seeking this, I found some casting of pointer to Integer. Near of line 880 of ZAbstractRODataSet.pas is wrote
if FilterRow(ResultSet.GetRow) then
CurrentRows.Add(Pointer(ResultSet.GetRow))
else
Continue;
And ResultSet.GetRow is a Integer function defined in IZResultSet interface.
I will do the changes and see how many Access Violations I can do
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact: