Result of TUniQuery.ExecSQL

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

Result of TUniQuery.ExecSQL

Post by m227 » Thu 20 Aug 2020 13:06

Hi, in topic below you wrote that it is possible to get result from ExecSQL.(SQLite)

https://www.devart.com/unidac/docs/deva ... ect[]).htm

It is not clear how, if I shall use ExecSQL function result or UniConnection Result. Anyway both below trials fail:

Code: Select all

// Solution 1:
  DstID := uc.ExecSQL('SELECT 1');

// Soultion 2:
  uc.ExecSQL('SELECT 1');
  DstID := uc.ParamByName('Result').AsInteger;
First one returns NULL
Second one returns error "No Result parameter".

Would you clarify the topic and fill missing data in a help?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Result of TUniQuery.ExecSQL

Post by MaximG » Mon 31 Aug 2020 11:38

The way of getting the value of a parameter named "Result", as described in our documentation, is only applicable to databases that allow assigning the query result to a variable. For example, you can return the necessary value in Oracle in the following way:

Code: Select all

...
var
  ResultValue: Integer;
...
  UniConnection.ExecSQL('BEGIN SELECT 1 INTO :RESULT FROM DUAL; END;', [0]);
  ResultValue := UniConnection.ParamByName('RESULT').AsInteger;
...
This method doesn't work for SQLite.

Post Reply