Page 1 of 1

Column names bug

Posted: Thu 06 Sep 2012 06:37
by TomekC
Hi.
In a query like this:

Code: Select all

  LiteQuery1.SQL.Clear;
  LiteQuery1.SQL.Add('SELECT `id`, `id5` FROM testtable WHERE `id5` = 10');
  LiteQuery1.SQL.Add('UNION ALL');
  LiteQuery1.SQL.Add('SELECT `id`, `id5` FROM testtable WHERE `id5` = 9');
  LiteQuery1.SQL.Add('ORDER BY `id`');
  LiteQuery1.Execute;
  if not LiteQuery1.Eof then
    LiteQuery1.FieldByName('id').AsInteger;
the last line produces an error, because column names in returned dataset are named: `id` `id5` instead of just: id id5.
The query has to contain "UNION ALL" and "ORDER BY" to reproduce this error.

Re: Column names bug

Posted: Thu 06 Sep 2012 11:49
by ZEuS
It seems that the problem is due to specificity of SQLite, not to LiteDAC.
We have reproduced the same result when executing the SQL-statement with UNION ALL and ORDER BY with several third-party database utilities.
For now, please try to avoid using such SQL-statements.