从sqlite3_stmt *中检索sqlite3 *

时间:2013-08-28 06:08:29

标签: c++ sqlite

如果我有一个准备好的陈述 - sqlite3_stmt*,有没有办法可以从中检索出准备好的sqlite3*数据库?

即。一个看起来像这样的函数:

sqlite3* sqlite3_get_database_from_statement(sqlite3_stmt* statement);

1 个答案:

答案 0 :(得分:3)

好的,在标题中搜索了一下之后找到了答案,这是我正在寻找的功能:

/*
** 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*);