Sqlite3 中与加密相关接口

2017-08-01  本文已影响0人  环零弦
 #ifdef SQLITE_HAS_CODEC
 /*
  ** Specify the key for an encrypted database.  This routine should be
  ** called right after sqlite3_open().
  **
  ** The code to implement this API is not available in the public release
  ** of SQLite.
  */
  SQLITE_API int sqlite3_key(
    sqlite3 *db,                   /* Database to be rekeyed */
    const void *pKey, int nKey     /* The key */
  );
  SQLITE_API int sqlite3_key_v2(
    sqlite3 *db,                   /* Database to be rekeyed */
    const char *zDbName,           /* Name of the database */
    const void *pKey, int nKey     /* The key */
  );

  /*
  ** Change the key on an open database.  If the current database is not
  ** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
  ** database is decrypted.
  **
  ** The code to implement this API is not available in the public release
  ** of SQLite.
  */
  SQLITE_API int sqlite3_rekey(
    sqlite3 *db,                   /* Database to be rekeyed */
    const void *pKey, int nKey     /* The new key */
  );
  SQLITE_API int sqlite3_rekey_v2(
    sqlite3 *db,                   /* Database to be rekeyed */
    const char *zDbName,           /* Name of the database */
    const void *pKey, int nKey     /* The new key */
  );

  SQLITE_API int sqlite3_open(
    const char *filename,   /* Database filename (UTF-8) */
    sqlite3 **ppDb          /* OUT: SQLite db handle */
  );

  SQLITE_API int sqlite3_close(sqlite3*);

  SQLITE_API int sqlite3_exec(
    sqlite3*,                                  /* An open database */
    const char *sql,                           /* SQL to be evaluated */
    int (*callback)(void*,int,char**,char**),  /* Callback function */
    void *,                                    /* 1st argument to callback */
    char **errmsg                              /* Error msg written here */
  );

参考资料:

上一篇下一篇

猜你喜欢

热点阅读