Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any sort of Interceptor implementation in sqlite

I'm wondering, is there a way to intercept DML operations in sqlite?? I'm looking to implement a something like a audit system to pickup inserts and updates on the database and log the changes on these events.

I've looked at using triggers but that didn't suffice as there was no way(that I know of) to define a global trigger, and manually managing triggers for over 100 tables doesn't sound like a good idea...longterm!

I'm open to any suggestions, so please fire away!

like image 481
gotomanners Avatar asked May 21 '12 09:05

gotomanners


1 Answers

Perhaps, this is what you would need SQLite Callback Function for Trace/Logging Query Statements

If you are coding your app in C/C++, then you have the luxury of adding a hook to the SQLite API by providing a callback function that would invoke sqlite_trace function for logging the query statements.

like image 153
Saasira Avatar answered Oct 06 '22 17:10

Saasira