Hi folks,
I encounter the following problem when trying to use the Delphi dbExpress driver for
SQLite :
TSQLQuery, which abstracts both the SQL request and its result, normally allows to refer to a result field by its column name, with the
FieldByName method.
So if I, for instance, do my request this way :
query.SQL.Text := 'select NAME, FNAME from PERSONS';
query.Open;
I can later request the FNAME field directly by its name :
fname := query.FieldByName('FNAME').AsString;
This works well, but the problem arises when defining aliases :
query.SQL.Text := 'select NAME, FNAME as FIRSTNAME from PERSONS';
query.Open;
fname := query.FieldByName('FIRSTNAME').AsString;
Apparently the FIRSTNAME alias I defined for FNAME cannot be requested, as this throws an
exception :
fname := query.FieldByName('FIRSTNAME').AsString;
Of course, this feature works well for other dbExpress drivers I used, such as the MySQL one.
Is this a bug ? A known limitation ? I tried the docs but they are very sparse.
(PS : here is a sample code if somebody wants to reproduce -tried it with Delphi 10.1 "Berlin" :
http://www.tarnyko.net/repo/SQLite3FieldByName_Bug.zip )
Connect with Us