勇芳软件工作室.汉化:  SQLite3 API Functions > Statements >

sqlite3_clear_bindings

Previous pageReturn to chapter overviewNext page

描述

 

将编译的SQL语句中的所有参数设置为NULL。与许多人的直觉相反,sqlite3_reset不会重置预准备语句的绑定。使用此函数将所有主机参数重置为NULL。

 

C / C ++语法

 

int sqlite3_clear_bindings(sqlite3_stmt*);

 

PB语法

 

FUNCTION sqlite3_clear_bindings ( _

BYVAL hStmt AS DWORD _

) AS LONG

 

参数

 

pStmt

 

[in]语句句柄。

 

返回值

 

SQLITE_OK成功或错误代码如果出现问题。

 

C ++实现代码

 

/*

** Set all the parameters in the compiled SQL statement to NULL.

*/

SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){

int i;

int rc = SQLITE_OK;

Vdbe *p = (Vdbe*)pStmt;

#if SQLITE_THREADSAFE

sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;

#endif

sqlite3_mutex_enter(mutex);

for(i=0; i<p->nVar; i++){

  sqlite3VdbeMemRelease(&p->aVar[i]);

  p->aVar[i].flags = MEM_Null;

}

if( p->isPrepareV2 && p->expmask ){

  p->expired = 1;

}

sqlite3_mutex_leave(mutex);

return rc;

}