Unidac 7.4.12 Delphi XE2 MySQL Problem

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Mon 28 Jan 2019 11:52

Hello ,
Our application is running on oracle 12c and MariaDB 5.5
Oracle is everything seems ok with charset euckr
but there are some problem on MariaDB.
I Attached sample project , including table creation.
Thank you in advance.

http://wbjsoft.com/down/UnidacEucKRError.zip

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Mon 28 Jan 2019 13:09

To solve the issue, please try to set the property UniConnection.SpecificOptions.Values['UseUnicode'] in True:

Code: Select all

UniConnection.SpecificOptions.Values['UseUnicode'] := 'True';

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Mon 28 Jan 2019 13:38

I cannot use that option Because of compatibility.

my customers use ansi DB.

please fix it. that is bug.

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Mon 28 Jan 2019 13:59

Your example does not demonstrate the issue. It contains only the script for table creation and lacks scripts for its population. Also, run of your example without modifications throws the 'Field BLOB not found' error.
In order for us to be able to give you a detailed answer please provide more detailed and clear description of the issue: what issues you face, what errors you get, exact steps to reproduce the issue. Also, please compose a full sample demonstrating the described behavior and send it to us.

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Mon 28 Jan 2019 15:40

0.Adjust Connection Infomation
1.Create Table Button -> Will Create Sample Table
2.Select Error Button -> Will demonstrate sql parse error.
3.Blob Error Button -> and choose a image file , and will demonstrate Blob error.

I will attach source.


procedure TForm2.Button1Click(Sender: TObject);
begin
cdsMariaEuckr.CommandText := 'CREATE TABLE `testtb` ( `COL1` VARCHAR(50) NULL, `PIC1` BLOB NULL ) COLLATE=''euckr_korean_ci'' ENGINE=InnoDB; ';
cdsMariaEuckr.Execute;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
cdsMariaEuckr.Close;
cdsMariaEucKr.CommandText := 'select * from testtb where COL1 = :COL1 and COL1 = ''접속'' ';
cdsMariaEucKr.Params.ParamByName('COL1').AsString := 'COL1';
cdsMariaEuckr.Open;
end;

procedure TForm2.Button3Click(Sender: TObject);
begin
if OpenDialog1.Execute then // BMP Load
begin
cdsMariaEuckr.CommandText := 'insert into testtb (COL1,PIC1) values (:COL1,:PIC1) ';
cdsMariaEuckr.Params.ParamByName('COL1').AsString := 'COL1';
cdsMariaEuckr.Params.ParamByName('PIC1').LoadFromFile(OpenDialog1.FileName,ftBlob);
cdsMariaEuckr.Execute;
end;
end;

object Button1: TButton
Left = 24
Top = 8
Width = 369
Height = 25
Caption = '1. Create Table'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 24
Top = 39
Width = 369
Height = 25
Caption = '2.Select Error'
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 24
Top = 70
Width = 369
Height = 25
Caption = '3.Blob Error'
TabOrder = 2
OnClick = Button3Click
end
object UniCon_MariaDB_euckr: TUniConnection
ProviderName = 'MySQL'
Database = 'testdb'
SpecificOptions.Strings = (
'MySQL.Charset=euckr')
Username = 'root'
Server = 'localhost'
LoginPrompt = False
Left = 64
Top = 112
EncryptedPassword = '8DFF90FF90FF8BFF'
end
object quMariaEucKR: TUniQuery
Connection = UniCon_MariaDB_euckr
SQL.Strings = (
'select * from testtb')
Left = 176
Top = 120
end
object dspMariaEucKR: TDataSetProvider
DataSet = quMariaEucKR
Options = [poPropogateChanges, poAllowCommandText]
UpdateMode = upWhereKeyOnly
Left = 280
Top = 120
end
object cdsMariaEuckr: TClientDataSet
Aggregates = <>
CommandText = 'select * from testtb'
FieldDefs = <
item
Name = 'COL1'
DataType = ftString
Size = 100
end
item
Name = 'BLOB'
DataType = ftBlob
end>
IndexDefs = <>
PacketRecords = 1
Params = <>
ProviderName = 'dspMariaEucKR'
StoreDefs = True
Left = 376
Top = 120
object cdsMariaEuckrCOL1: TStringField
FieldName = 'COL1'
Size = 100
end
object cdsMariaEuckrBLOB: TBlobField
FieldName = 'BLOB'
end
end
object MySQLUniProvider1: TMySQLUniProvider
Left = 456
Top = 208
end
object OpenDialog1: TOpenDialog
Left = 448
Top = 56
end

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Tue 29 Jan 2019 12:04

Thank you for the information. We will investigate this MyDAC behavior and let you know the result.

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Thu 31 Jan 2019 17:12

Hello,

I wonder when I get your fix?

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Fri 01 Feb 2019 13:01

We will set high-priority status to your question and inform you as soon as any results are available, but we can't tell any timeframe at the moment.

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Fri 01 Feb 2019 20:43

I Found bug.

procedure TMySQLCommand.PlaceParamValues(SQL: AnsiStringBuilder);

SQL.Append(AnsiString(FSQL), Prev - 1, Length(FSQL) - Prev + 1);
=>
SQL.Append(AnsiString(FSQL), Prev - 1, Length(AnsiString(FSQL)) - Prev + 1); // wbj modified

BLOB bug

function TMySQLConnection.EscapeAndQuoteStr(const p: PAnsiChar; Len: integer): AnsiString;

IsEuckr := FUsedCharset = 'euckr';
=>
IsEuckr := False; // FUsedCharset = 'euckr'; -- WBJ Modified 2014-12-14

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Fri 01 Feb 2019 20:51

I have mistake... above solution is not perfect.
anyway PlaceParamValues procedure has bug.

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Mon 04 Feb 2019 07:02

We have already fixed this issue.
We can send you MyDAC night build including the fix. Please send your license number and IDE version to us using the contact form https://devart.com/company/contactform.html and we will send you night build.

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Tue 05 Feb 2019 08:07

Thank you!

I just have posted contact form and i will wait.

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Tue 05 Feb 2019 08:20

We have answered you via e-mail.

wbjsoft
Posts: 21
Joined: Tue 08 Aug 2006 00:38

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by wbjsoft » Tue 05 Feb 2019 08:47

I have installed your night build.
BLOB problem is fixed! OK. Thank you.
Param parse problem is fixed. but I found another case.

select COL1 '컬럼1',PIC1 from testeuckr.testtb where COL1 = :COL1 and COL1 = '접속'

when SQL contains field alias , #42000 syntax error occured.

I will wait your night build. thank you.

ViktorV
Devart Team
Posts: 2880
Joined: Wed 30 Jul 2014 07:16

Re: Unidac 7.4.12 Delphi XE2 MySQL Problem

Post by ViktorV » Tue 05 Feb 2019 14:10

Thank you for the information. We will investigate this MyDAC behavior and let you know the result.

Post Reply