Get result after executing queries

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
DmitriNL
Posts: 15
Joined: Fri 26 Nov 2010 15:47

Get result after executing queries

Post by DmitriNL » Tue 23 Jun 2020 12:27

Hi,

Is it possible to get some kind of result after a query has been executed? For example, when a query executes for dropping a table and creating a table, it would be nice if there is an event which can inform the application what the query did. I found the onafter events but only OnAfterExecute seems triggert.

Below you find my code for dropping and creating a table in SQLite.

Code: Select all

UniQuery->SQL->Text = 
	"DROP TABLE IF EXISTS [contacts];"
	"\r\n"
	"CREATE TABLE [contacts] ("
	"[contact_id] INTEGER PRIMARY KEY,"
	"[first_name] TEXT NOT NULL,"
	"[last_name] TEXT NOT NULL,"
	"[email] TEXT NOT NULL UNIQUE,"
	"[phone] TEXT NOT NULL UNIQUE"
	");";
UniQuery->Execute();
For this project I am using C++ Builder 10.4, UniDac 8.2.5 and SQLite. Can you please inform me if there is a solution? Thank you in advance for your support.

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

Re: Get result after executing queries

Post by MaximG » Tue 07 Jul 2020 09:11

You can implement such functionality in the OnAfterExecute event handler https://www.devart.com/unidac/docs/deva ... eevent.htm, which is triggered after successfully executing a query. If an error occurs during execution, an exception will be raised, which you can handle according to the error type.

Post Reply