VQ requires LIKE in 10.3.8 when in Backslash in Text field

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by FredS » Thu 19 Apr 2018 15:29

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.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by MaximG » Fri 20 Apr 2018 11:38

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)

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by FredS » Fri 20 Apr 2018 15:06

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.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by MaximG » Fri 27 Apr 2018 08:15

Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly.

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by FredS » Thu 17 May 2018 16:50

Any news on this yet?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: VQ requires LIKE in 10.3.8 when in Backslash in Text field

Post by MaximG » Fri 18 May 2018 14:15

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)

Post Reply