Page 1 of 1
VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Thu 19 Apr 2018 15:29
by FredS
VQ fails when using Equal in a Where clause on a field that contains a backslash followed by text '\SomeText', it works with '\' and '<SomeText>'.
Code: Select all
Where MyField = '\SomeText' << Fails
Where MyField LIKE '\SomeText' << Works
An attempt to replace that with a Filter on a UniDac Query also failed.
Worse, Like also fails in a UniDac Filter, prefixing Like with '%' returns '\SomeText'
but of course fails on other paths '\SomeText\SomeText'
Escaping the Backslash works in UniDac Filter.
Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Fri 20 Apr 2018 11:38
by MaximG
To investigate the issue, please compose and send us a small sample, execution of which causes this issue, including test DB, using via the e-support form (
https://www.devart.com the "Support"\"Request Support" menu)
Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Fri 20 Apr 2018 15:06
by FredS
Code: Select all
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Winapi.Windows,
System.SysUtils,
System.StrUtils,
Data.DB,
VirtualTable;
var
vt : TVirtualTable;
value : string;
Data : TArray<string>;
begin
try
Data := TArray<string>.create('<Hey>','\','\Hey','\Hey\Mickey');
vt := TVirtualTable.Create(nil);
try
vt.FieldDefs.add('ONE', ftWidestring, 40);
vt.Open;
for value in Data do vt.AppendRecord([Value]);
Assert(vt.RecordCount = 4);
vt.first;
while not vt.eof do begin
OutputDebugString(Pchar(AnsiQuotedStr(vt.Fields[0].AsString, '"')));
vt.Next;
end;
{- Escape '\' }
for value in Data do begin
vt.Filter := 'ONE = ' + AnsiQuotedStr(Replacestr(Value, '\', '\\'), '''');
vt.Filtered := True;
OutputDebugString(Pchar('Filter: ' + vt.Filter));
Assert(vt.RecordCount = 1, vt.Filter + ' Failed!');
Assert(vt.Fields[0].AsString = value, vt.Filter + ' Failed!');
end;
{- Not Escaped}
for value in Data do begin
vt.Filter := 'ONE = ' + AnsiQuotedStr(Value, '''');
vt.Filtered := True;
OutputDebugString(Pchar('Filter: ' + vt.Filter));
Assert(vt.RecordCount = 1, vt.Filter + ' Failed!');
Assert(vt.Fields[0].AsString = value, vt.Filter + ' Failed!');
end;
finally
vt.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Fri 27 Apr 2018 08:15
by MaximG
Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly.
Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Thu 17 May 2018 16:50
by FredS
Any news on this yet?
Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field
Posted: Fri 18 May 2018 14:15
by MaximG
We have fixed this bug. The fix will be included in the next UniDAC build. Currently, we can send you a night build of VirtualDAC with the fix. For this, please specify your license number and the exact version of Delphi you are using via the e-support form (
https://www.devart.com/company/contactform.html)