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

Add support for named wildcards in SQL statements. (CVS 1897)

FossilOrigin-Name: d3be0b7c5a39c02b9b2d6d85f1595d591984a569
This commit is contained in:
drh
2004-08-20 16:02:39 +00:00
parent e8cf2cacb1
commit 895d747226
14 changed files with 222 additions and 52 deletions

View File

@@ -518,9 +518,32 @@ int sqlite3_bind_text16(
/*
** Return the number of wildcards that can be potentially bound to.
** This routine is added to support DBD::SQLite.
**
******** EXPERIMENTAL *******
*/
int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
return ((Vdbe*)pStmt)->nVar;
}
/*
** Return the name of a wildcard parameter. Return NULL if the index
** is out of range or if the wildcard is unnamed.
**
** The result is always UTF-8.
*/
const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
Vdbe *p = (Vdbe*)pStmt;
if( i<1 || i>p->nVar ){
return 0;
}
if( !p->okVar ){
int j;
Op *pOp;
for(j=0, pOp=p->aOp; j<p->nOp; j++, pOp++){
if( pOp->opcode==OP_Variable ){
assert( pOp->p1>0 && pOp->p1<=p->nVar );
p->azVar[pOp->p1-1] = pOp->p3;
}
}
p->okVar = 1;
}
return p->azVar[i-1];
}