Page 1 of 1
Option "BinaryAsString" and MySQL 4.1
Posted: Thu 16 Aug 2012 07:39
by upscene
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
Re: Option "BinaryAsString" and MySQL 4.1
Posted: Thu 16 Aug 2012 09:21
by AndreyZ
Hello,
Why the difference?
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.
Using .AsWideString on the field fails with access violations for MySQl 4.1.
I cannot reproduce this problem. Please specify the following:
- 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
Posted: Thu 16 Aug 2012 09:27
by upscene
AndreyZ wrote:Hello,
Why the difference?
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.
Using .AsWideString on the field fails with access violations for MySQl 4.1.
I cannot reproduce this problem. Please specify the following:
- 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.
OK, so it's MySQL at fault here in returning binary fields on version 4?
I'm using v6.10.0.7 in Delphi 2009.
When I use AsWideString on MySQL 4, it returns an AV.
Re: Option "BinaryAsString" and MySQL 4.1
Posted: Thu 16 Aug 2012 10:27
by AndreyZ
OK, so it's MySQL at fault here in returning binary fields on version 4?
Yes.
When I use AsWideString on MySQL 4, it returns an AV.
I checked this question in the following environment:
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: Direct
, and used the following code:
Code: Select all
MyQuery.Options.BinaryAsString := False;
MyQuery.SQL.Text := 'SHOW VARIABLES';
MyQuery.Open;
ShowMessage(MyQuery.Fields[0].AsWideString);
There were no AVs when using AsWideString. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .
Re: Option "BinaryAsString" and MySQL 4.1
Posted: Fri 17 Aug 2012 08:18
by upscene
AndreyZ wrote:OK, so it's MySQL at fault here in returning binary fields on version 4?
Yes.
When I use AsWideString on MySQL 4, it returns an AV.
I checked this question in the following environment:
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: Direct
, and used the following code:
Code: Select all
MyQuery.Options.BinaryAsString := False;
MyQuery.SQL.Text := 'SHOW VARIABLES';
MyQuery.Open;
ShowMessage(MyQuery.Fields[0].AsWideString);
There were no AVs when using AsWideString. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .
It seems that getting an AV depends on the actual data returned.
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
Re: Option "BinaryAsString" and MySQL 4.1
Posted: Fri 17 Aug 2012 08:47
by AndreyZ
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
Posted: Fri 17 Aug 2012 08:59
by upscene
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.
Try setting UseUnicode to TRUE, perhaps that makes the difference.
Re: Option "BinaryAsString" and MySQL 4.1
Posted: Fri 17 Aug 2012 09:15
by AndreyZ
I checked this question with both UseUnicode=True and UseUnicode=False . There were no problems in both situations.