Option "BinaryAsString" and MySQL 4.1
Option "BinaryAsString" and MySQL 4.1
Hi,
In MySQL 4.1, with "BinaryAsString" OFF, a command SHOW VARIABLES returns a result set with datatype ftVarBytes.
In MySQL 5.x, this returns ftWideString.
Why the difference? Using .AsWideString on the field fails with access violations for MySQl 4.1.
With regards,
Martijn Tonies
In MySQL 4.1, with "BinaryAsString" OFF, a command SHOW VARIABLES returns a result set with datatype ftVarBytes.
In MySQL 5.x, this returns ftWideString.
Why the difference? Using .AsWideString on the field fails with access violations for MySQl 4.1.
With regards,
Martijn Tonies
-
AndreyZ
Re: Option "BinaryAsString" and MySQL 4.1
Hello,
- the exact version of MyDAC. You can learn it from the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can learn it from the Info sheet of TMyConnection Editor.
The point is that MySQL 4 returns the fields of the SHOW VARIABLES statement as binary fields, when MySQL 5 returns them as string fields.Why the difference?
I cannot reproduce this problem. Please specify the following:Using .AsWideString on the field fails with access violations for MySQl 4.1.
- the exact version of MyDAC. You can learn it from the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can learn it from the Info sheet of TMyConnection Editor.
Re: Option "BinaryAsString" and MySQL 4.1
OK, so it's MySQL at fault here in returning binary fields on version 4?AndreyZ wrote:Hello,The point is that MySQL 4 returns the fields of the SHOW VARIABLES statement as binary fields, when MySQL 5 returns them as string fields.Why the difference?I cannot reproduce this problem. Please specify the following:Using .AsWideString on the field fails with access violations for MySQl 4.1.
- the exact version of MyDAC. You can learn it from the About sheet of TMyConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can learn it from the Info sheet of TMyConnection Editor.
I'm using v6.10.0.7 in Delphi 2009.
When I use AsWideString on MySQL 4, it returns an AV.
-
AndreyZ
Re: Option "BinaryAsString" and MySQL 4.1
Yes.OK, so it's MySQL at fault here in returning binary fields on version 4?
I checked this question in the following environment:When I use AsWideString on MySQL 4, it returns an AV.
Code: Select all
Delphi 2009 12.0.3170.16989 Architect
MyDAC 6.10.0.7
MySQL server version: 4.1.22-community
MySQL client version: DirectCode: Select all
MyQuery.Options.BinaryAsString := False;
MyQuery.SQL.Text := 'SHOW VARIABLES';
MyQuery.Open;
ShowMessage(MyQuery.Fields[0].AsWideString);Re: Option "BinaryAsString" and MySQL 4.1
It seems that getting an AV depends on the actual data returned.AndreyZ wrote:Yes.OK, so it's MySQL at fault here in returning binary fields on version 4?I checked this question in the following environment:When I use AsWideString on MySQL 4, it returns an AV., and used the following code:Code: Select all
Delphi 2009 12.0.3170.16989 Architect MyDAC 6.10.0.7 MySQL server version: 4.1.22-community MySQL client version: DirectThere were no AVs when using AsWideString. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .Code: Select all
MyQuery.Options.BinaryAsString := False; MyQuery.SQL.Text := 'SHOW VARIABLES'; MyQuery.Open; ShowMessage(MyQuery.Fields[0].AsWideString);
I've solved it differently now, checking to see if it's MySQL 4 and if it's a metadata statement of sorts.
Thanks for the explanation.
With regards,
Martijn Tonies
-
AndreyZ
Re: Option "BinaryAsString" and MySQL 4.1
We are interested in solving of this problem, so if you reproduce it in a small test project, please send it to andreyz*devart*com . We are looking forward to receiving this project from you.
Re: Option "BinaryAsString" and MySQL 4.1
Try setting UseUnicode to TRUE, perhaps that makes the difference.AndreyZ wrote:We are interested in solving of this problem, so if you reproduce it in a small test project, please send it to andreyz*devart*com . We are looking forward to receiving this project from you.
-
AndreyZ
Re: Option "BinaryAsString" and MySQL 4.1
I checked this question with both UseUnicode=True and UseUnicode=False . There were no problems in both situations.