SQLite Forum

I Need a tool to support real-time tracking of database actions
Login

I Need a tool to support real-time tracking of database actions

(1) By fengquan888 on 2020-07-10 12:29:31 [link] [source]

A tool is needed to track the execution process of the database in real time. The actions are as follows: add to delete the update query, similar to the MSSQL profiler tool of SQL. thanks you

(2) By Larry Brasfield (LarryBrasfield) on 2020-07-10 14:49:15 in reply to 1 [source]

You can start by using the .timer meta-command of the SQLite shell. In that shell, enter ".help timer" to see what it does and how to use it.

(3) By Simon Slavin (slavin) on 2020-07-10 17:12:54 in reply to 1 [link] [source]

SQLite is not a server/client system. There is no central processor which makes all changes to the database. So there's no computer or process which can be used to track all changes made by all computers accessing the database. You can only track what your own connection is doing to the database.

You can use this hook to trace what your app is doing to the database:

https://sqlite.org/c3ref/trace_v2.html

Another way to do it is to use the authorization hook:

https://sqlite.org/c3ref/set_authorizer.html

But instead of using it to authorize or deny a statement being executed, just track what's being done and authorize everything.