Small. Fast. Reliable.
Choose any three.

SQLite C 接口

SQL语句对象
SQL Statement Object

typedef struct sqlite3_stmt sqlite3_stmt;

这个对象的实例表示一个SQL语句。这个对象在不同地方可能会称为“预编译语句(prepared statement)”或“已编译SQL语句(compiled SQL statement)”或“语句(statement)”。
An instance of this object represents a single SQL statement. This object is variously known as a "prepared statement" or a "compiled SQL statement" or simply as a "statement".

一个语句对象的生命期大概是这样的:
The life of a statement object goes something like this:

  1. 使用sqlite3_prepare_v2()或相关函数创建这个对象。
    Create the object using sqlite3_prepare_v2() or a related function.
  2. 使用sqlite3_bind_*()接口将值绑定到主参数上。
    Bind values to host parameters using the sqlite3_bind_*() interfaces.
  3. 调用一次或多次 sqlite3_step()来运行SQL。
    Run the SQL by calling sqlite3_step() one or more times.
  4. 使用sqlite3_reset()重置语句,然后回到第2步。执行零次或多次。
    Reset the statement using sqlite3_reset() then go back to step 2. Do this zero or more times.
  5. 使用sqlite3_finalize()销毁这个对象。
    Destroy the object using sqlite3_finalize().

更多信息,请参考上面每个方法的文档。
Refer to documentation on individual methods above for additional information.

另行参见ObjectsConstantsFunctions的列表。
See also lists of Objects, Constants, and Functions.