I am evaluating Delphi XE4 (compilation against win32, but the final platform will be iOS) and I need to create a SQLite database (no problem) and make some queries. This is one of the queries I would like to use:
select id as _id, name, note as description from notes
And this is my code:
q := TSQLQuery.Create(nil); try q.SQLConnection := MainForm.sqlite1; q.SQL.Text := sql; q.Open; finally q.Free; end;
The problem is that the query returns the original field names (id, name, note), and not the one I used (_id, name, description).
q.Fields[0].FieldName = 'id'
This creates all kinds of problems. Using
count(*) as myfield
returns
q.Fields[0].FieldName = Column0
which is unacceptable.
Did anyone have a problem?
source share