SQLite query logs implementation
I try implement a query log by hook sqlite3Step, is this the only function that I need to take care to log all database changes?
I will try disable date/random/PRAGMA function in database.
I will use sqlite3_expanded_sql to get the query SQL, skip SQLITE_SCHEMA result.
I will skip sqlite3_stmt_readonly(stmt) step, except BEGIN/COMMIT/Rollback/SAVEPOINT/RELEASE query. Is there any other readonly query I should not skip?
I will use sqlite3_commit_hook/sqlite3_rollback_hook to save the query logs or drop the query logs.
I want to make sure to execute them one by one will results in same database. (I will make sure execute them in same SQLite version)
With this logs I can reduplicate it to raft group, or master/slave node.
Maybe with sqlite3_commit_hook/sqlite3_rollback_hook log I can skip log all sqlite3_stmt_readonly(stmt) SQL ?
I am not sure this can handle sqlite embed transaction.
I need a hook to know a transaction is started so I know the position of embed transaction, and only remove the query logs for the last transaction with rollback hook. (I can do it from sqlite3Step, is there a more easy way?)