开发者

SQL query logging for SQLite?

开发者 https://www.devze.com 2022-12-08 23:44 出处:网络
I ne开发者_开发问答ed to log queries, not only inserts/updates/deletes but also selects and other queries, from a number of applications that use SQLite. Introducing logging to the applications would

I ne开发者_开发问答ed to log queries, not only inserts/updates/deletes but also selects and other queries, from a number of applications that use SQLite. Introducing logging to the applications would in this case not be a feasible solution in practice. So how can I enable query logging in SQLite itself?


Take a look at the sqlite Trace API. You have to implement the callback yourself.

void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);

The callback function registered by sqlite3_trace() is invoked at various times when an SQL statement is being run by sqlite3_step(). The callback returns a UTF-8 rendering of the SQL statement text as the statement first begins executing. Additional callbacks occur as each triggered subprogram is entered.

0

精彩评论

暂无评论...
验证码 换一张
取 消