Modify the Tcl test command 'sqlite3_bind_blob' to make use of the Tcl_GetByteArrayFromObj() API.
FossilOrigin-Name: e03c81895e52096ab055d8231841e9070602ca84
This commit is contained in:
+11
-2
@@ -3633,7 +3633,7 @@ static int test_bind_blob(
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
int idx;
|
||||
int len, idx;
|
||||
int bytes;
|
||||
char *value;
|
||||
int rc;
|
||||
@@ -3652,9 +3652,18 @@ static int test_bind_blob(
|
||||
|
||||
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
|
||||
if( Tcl_GetIntFromObj(interp, objv[2], &idx) ) return TCL_ERROR;
|
||||
value = Tcl_GetString(objv[3]);
|
||||
|
||||
value = Tcl_GetByteArrayFromObj(objv[3], &len);
|
||||
if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR;
|
||||
|
||||
if( bytes>len ){
|
||||
char zBuf[200];
|
||||
sqlite3_snprintf(sizeof(zBuf), zBuf,
|
||||
"cannot use %d blob bytes, have %d", bytes, len);
|
||||
Tcl_AppendResult(interp, zBuf, -1);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
rc = sqlite3_bind_blob(pStmt, idx, value, bytes, xDestructor);
|
||||
if( sqlite3TestErrCode(interp, StmtToDb(pStmt), rc) ) return TCL_ERROR;
|
||||
if( rc!=SQLITE_OK ){
|
||||
|
||||
Reference in New Issue
Block a user