ESQLiteError locate causing SQL-Query

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
noxe
Posts: 2
Joined: Wed 27 Jan 2021 13:08

ESQLiteError locate causing SQL-Query

Post by noxe » Wed 27 Jan 2021 14:12

Hello,
it is possible to determine and display the causing SQL command within an ESQLiteError command.
It would also suffice to find out the TLiteQuery components that caused it.

ESQLiteError.Component supplies the connection. Can I use it to determine the last command or TLiteQuery component that was executed. Anything like that would help me.

Or is it because of SQLite that it does not provide enough information and therefore LiteDac can no longer deliver.

Otherwise it would possibly be in the LiteDac source code in one of the next versions that for each TLiteQuery.Excecute / Open its name would be "noted" in the TLiteConnection. You can then access the information via ESQLiteError.Component.

This question also applies to MyDac. So everywhere in the above text replace Lite [/ i] with My [/ i] ..

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

Re: ESQLiteError locate causing SQL-Query

Post by MaximG » Fri 12 Feb 2021 10:54

You can use the UniConnection.OnError event when working with TMySQLUniProvider: https://www.devart.com/unidac/docs/deva ... nerror.htm
For example, you can find out the name of the component where an error occurred this way:

ShowMessage((E.Component as TCustomUniDataSet).Name);

We'll implement similar behavior for TSQLiteUniProvider in the next version of the components. Currently you can use our tool dbMonitor for this purpose.

Post Reply