如果我有一个准备好的语句 - sqlite3_stmt*
,有没有办法可以从中检索sqlite3*
它准备好的数据库?
即一个看起来像这样的函数:
sqlite3* sqlite3_get_database_from_statement(sqlite3_stmt* statement);
好的,在标题中搜索了一下后找到了答案,这是我正在寻找的功能:
/*
** CAPI3REF: Find The Database Handle Of A Prepared Statement
**
** ^The sqlite3_db_handle interface returns the [database connection] handle
** to which a [prepared statement] belongs. ^The [database connection]
** returned by sqlite3_db_handle is the same [database connection]
** that was the first argument
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
** create the statement in the first place.
*/
SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);