Page 1 of 1

Get result after executing queries

Posted: Tue 23 Jun 2020 12:27
by DmitriNL
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.

Re: Get result after executing queries

Posted: Tue 07 Jul 2020 09:11
by MaximG
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.