1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Implement the experimental sqlite3_bind_parameter_count() API in support

of DBD::SQLite.  Also fix the sqlite3.def export list. (CVS 1797)

FossilOrigin-Name: c44943e6fe0c88830102253591a501dc7d724d2f
This commit is contained in:
drh
2004-07-15 14:15:00 +00:00
parent 939a16d622
commit 75f6a032c4
9 changed files with 151 additions and 171 deletions

View File

@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite.h.in,v 1.107 2004/06/25 10:25:11 danielk1977 Exp $
** @(#) $Id: sqlite.h.in,v 1.108 2004/07/15 14:15:02 drh Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
@@ -621,6 +621,14 @@ int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
/*
** Return the number of wildcards in a compiled SQL statement. This
** routine was added to support DBD::SQLite.
**
**** EXPERIMENTAL *****
*/
int sqlite3_bind_parameter_count(sqlite3_stmt*);
/*
** Return the number of columns in the result set returned by the compiled
** SQL statement. This routine returns 0 if pStmt is an SQL statement

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.92 2004/06/30 08:20:16 danielk1977 Exp $
** $Id: test1.c,v 1.93 2004/07/15 14:15:02 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -1527,6 +1527,28 @@ static int test_bind_blob(
return TCL_OK;
}
/*
** Usage: sqlite3_bind_parameter_count STMT
**
** Return the number of wildcards in the given statement.
*/
static int test_bind_parameter_count(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_stmt *pStmt;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "STMT");
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_bind_parameter_count(pStmt)));
return TCL_OK;
}
/*
** Usage: sqlite3_errcode DB
**
@@ -2295,6 +2317,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_bind_text", test_bind_text ,0 },
{ "sqlite3_bind_text16", test_bind_text16 ,0 },
{ "sqlite3_bind_blob", test_bind_blob ,0 },
{ "sqlite3_bind_parameter_count", test_bind_parameter_count, 0},
{ "sqlite3_errcode", test_errcode ,0 },
{ "sqlite3_errmsg", test_errmsg ,0 },
{ "sqlite3_errmsg16", test_errmsg16 ,0 },

View File

@@ -514,3 +514,13 @@ int sqlite3_bind_text16(
rc = sqlite3VdbeChangeEncoding(pVar, p->db->enc);
return rc;
}
/*
** 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;
}