Page 1 of 1

SQLQueryEx or unidac query

Posted: Thu 24 Dec 2015 06:28
by michaschumann
I would like to be able to use some more complex SQL on the Entitydac connection to make use of Firebird global temporary tables. Executing queries, scripts and stored procedures seem to work but how can I retrieve a single value like:

Code: Select all

select count(*) from abc where def=ghi...
It would be great if I could connect a UniQuery component or even better share the same database connection between one EntityDAC connection and one UniDAC connection (e.g. global temp tables). Also I have some situations where I generate a complex stored procedure at runtime that returns a dataset of a structure defined at runtime that cannot be served through entitydac but needs to be read by a query.

Re: SQLQueryEx or unidac query

Posted: Fri 25 Dec 2015 08:55
by AlexP
Hello,

You can use the ExecuteCursor method to retrieve the DataSet:

Code: Select all

var
  c: TEDCursor;
  f: TField;
begin
  c := TEDCursor(EntityConnection1.ExecuteCursor('select count(*) from abc where def=ghi...'));
  while not c.DataSet.Eof do begin
    for f in c.DataSet.Fields do
      ShowMessage(f.AsString);
    c.DataSet.Next;
  end;
end;