diff options
author | drh <> | 2025-01-07 16:36:47 +0000 |
---|---|---|
committer | drh <> | 2025-01-07 16:36:47 +0000 |
commit | fd11e5c082e98d865c46a4a0d1069f55a484537f (patch) | |
tree | f420c64fe0557e52188f47910c7f55ac31dd383c /src/tclsqlite.c | |
parent | ece17299582b7766d26422e91019fcc535ca93c9 (diff) | |
download | sqlite-fd11e5c082e98d865c46a4a0d1069f55a484537f.tar.gz sqlite-fd11e5c082e98d865c46a4a0d1069f55a484537f.zip |
Improvements to [14b38ae6ab86a314] so that the Tcl interface is better able
to work with boolean values in both Tcl86 and Tcl90.
FossilOrigin-Name: 4e85343d6107a46682b549667410c296d7f4d17e3ac04ded7357afcbbfbe3e6d
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 344b3e07c..598c9355f 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -1097,8 +1097,8 @@ static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv){ /* Only return a BLOB type if the Tcl variable is a bytearray and ** has no string representation. */ eType = SQLITE_BLOB; - }else if( (c=='b' && strcmp(zType,"boolean")==0) - || (c=='b' && strcmp(zType,"booleanString")==0 && pVar->bytes==0) + }else if( (c=='b' && pVar->bytes==0 && strcmp(zType,"boolean")==0 ) + || (c=='b' && pVar->bytes==0 && strcmp(zType,"booleanString")==0 ) || (c=='w' && strcmp(zType,"wideInt")==0) || (c=='i' && strcmp(zType,"int")==0) ){ @@ -1506,11 +1506,12 @@ static int dbPrepareAndBind( sqlite3_bind_blob(pStmt, i, data, n, SQLITE_STATIC); Tcl_IncrRefCount(pVar); pPreStmt->apParm[iParm++] = pVar; - }else if( (c=='b' && strcmp(zType,"boolean")==0) - || (c=='b' && strcmp(zType,"booleanString")==0 - && pVar->bytes==0) ){ + }else if( c=='b' && pVar->bytes==0 + && (strcmp(zType,"booleanString")==0 + || strcmp(zType,"boolean")==0) + ){ int nn; - Tcl_GetIntFromObj(interp, pVar, &nn); + Tcl_GetBooleanFromObj(interp, pVar, &nn); sqlite3_bind_int(pStmt, i, nn); }else if( c=='d' && strcmp(zType,"double")==0 ){ double r; |