SQLQueryEx or unidac query

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
michaschumann
Posts: 44
Joined: Fri 14 Nov 2014 15:26

SQLQueryEx or unidac query

Post by michaschumann » Thu 24 Dec 2015 06:28

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: SQLQueryEx or unidac query

Post by AlexP » Fri 25 Dec 2015 08:55

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;

Post Reply