1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Simplifications to the sqlite3_trace() bound parameter substitution logic.

FossilOrigin-Name: cb4b928648504ce29d751834e9ee3b5278dfca65
This commit is contained in:
drh
2009-11-26 14:01:53 +00:00
parent f7829ad0e9
commit 5f18a221a1
5 changed files with 38 additions and 44 deletions

View File

@@ -1120,8 +1120,7 @@ const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
** with that name. If there is no variable with the given name,
** return 0.
*/
int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
Vdbe *p = (Vdbe*)pStmt;
int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){
int i;
if( p==0 ){
return 0;
@@ -1130,13 +1129,16 @@ int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
if( zName ){
for(i=0; i<p->nVar; i++){
const char *z = p->azVar[i];
if( z && strcmp(z,zName)==0 ){
if( z && memcmp(z,zName,nName)==0 && z[nName]==0 ){
return i+1;
}
}
}
return 0;
}
int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));
}
/*
** Transfer all bindings from the first statement over to the second.