keeping a log table in sqlite database?

后端 未结 2 1037
暖寄归人
暖寄归人 2021-02-14 12:43

I\'m looking for a way to set up (via SQL) a log table containing everything that had been done to my sqlite database (preferably in terms of the insert, create table etc. state

2条回答
  •  半阙折子戏
    2021-02-14 13:31

    these function may be useful

    void *sqlite3_update_hook(
      sqlite3*, 
      void(*)(void *,int ,char const *,char const *,sqlite3_int64),
      void*
    );
    
    void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
    
    void *sqlite3_profile(
       sqlite3*,
       void(*xProfile)(void*,const char*,sqlite3_uint64), void*
    );
    

    they seem to act on individual dbs

    the only global way I can see is to use

    sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
    int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
    int sqlite3_vfs_unregister(sqlite3_vfs*);
    

提交回复
热议问题