diff --git a/manifest b/manifest index 4dee9f06e1..802e7f95f6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sname\sof\sthe\s"limits.h"\ssource\sfile\sto\s"sqliteLimit.h".\r\nTicket\s#2428.\s(CVS\s4091) -D 2007-06-19T15:23:48 +C In\sthe\sTCL\sbindings,\sif\sa\sTCL\svariable\shas\sa\sbytearray\srepresentation\sand\nthe\shost\sparameter\sstarts\swith\s@\sinstead\sof\s$,\sthen\salways\sstore\sthe\ncontent\sas\sa\sBLOB\snot\sas\sa\sstring\seven\sif\sa\sstring\srepresentation\sis\salso\navailable.\s(CVS\s4092) +D 2007-06-19T17:15:47 F Makefile.in 5babd49c427a0e82e849c89a4d3c3c1e607ec014 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -109,7 +109,7 @@ F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890 F src/sqliteInt.h 07b0f7a4b7e849c9b96d921e9c5b32fc8802072c F src/sqliteLimit.h f14609c27636ebc217c9603ade26dbdd7d0f6afa F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d -F src/tclsqlite.c 9f96385c5047b24afa7601ea4055aae97c3e25e3 +F src/tclsqlite.c 344e28bd3a1b7480a1cbf642911a99122b72ef8e F src/test1.c a83c097ee1353e8982745ee1b78612fea7425602 F src/test2.c 24458b17ab2f3c90cbc1c8446bd7ffe69be62f88 F src/test3.c a280931fb40222b7c90da45eea926459beee8904 @@ -361,7 +361,7 @@ F test/substr.test 9f26cfca74397b26ab217fb838c3d0549eb4bcf3 F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3 F test/table.test dbdfd06aef054ad5aed8e57a782137d57d5c5528 F test/tableapi.test 036575a98dcce7c92e9f39056839bbad8a715412 -F test/tclsqlite.test 726c301d35a2c1f4181fb772a607f785dd9e284e +F test/tclsqlite.test 649d4cec8a2393b2e5df7b2b29158cddc14bd3e5 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821 F test/tester.tcl 9382df472e0e86cbfddc44ab8c8cc02497bc9c8a F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 @@ -507,7 +507,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 783f19be387561fbca3ac7e223bdb7dedb5450c8 -R f61ebf06a1a8beeee76386cd58589428 +P 64bcc41f12e902fd025c9ba36c09dd6e4cf25923 +R 77fe303dc438055db8d268fdb3354536 U drh -Z c4d6065cec2901822a6c14d9f99cfb91 +Z 1386ace3ab85ad3dfcfb4f374c31ada6 diff --git a/manifest.uuid b/manifest.uuid index b4d1071a9d..e2b79cd165 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -64bcc41f12e902fd025c9ba36c09dd6e4cf25923 \ No newline at end of file +dcb104bd41f5e992d4c84b8947cb5099ae746891 \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index c065be6662..4eb131970a 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -12,7 +12,7 @@ ** A TCL Interface to SQLite. Append this file to sqlite3.c and ** compile the whole thing to build a TCL-enabled version of SQLite. ** -** $Id: tclsqlite.c,v 1.189 2007/06/15 18:53:14 drh Exp $ +** $Id: tclsqlite.c,v 1.190 2007/06/19 17:15:47 drh Exp $ */ #include "tcl.h" #include @@ -1587,16 +1587,18 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ } for(i=1; i<=nVar; i++){ const char *zVar = sqlite3_bind_parameter_name(pStmt, i); - if( zVar!=0 && (zVar[0]=='$' || zVar[0]==':') ){ + if( zVar!=0 && (zVar[0]=='$' || zVar[0]==':' || zVar[0]=='@') ){ Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0); if( pVar ){ int n; u8 *data; char *zType = pVar->typePtr ? pVar->typePtr->name : ""; char c = zType[0]; - if( c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0 ){ + if( c=='b' && strcmp(zType,"bytearray")==0 + && (pVar->bytes==0 || zVar[0]=='@') ){ /* Only load a BLOB type if the Tcl variable is a bytearray and - ** has no string representation. */ + ** either it has no string representation or the host + ** parameter name begins with "@". */ data = Tcl_GetByteArrayFromObj(pVar, &n); sqlite3_bind_blob(pStmt, i, data, n, SQLITE_STATIC); Tcl_IncrRefCount(pVar); diff --git a/test/tclsqlite.test b/test/tclsqlite.test index bbeec53b12..6fd6d79fa0 100644 --- a/test/tclsqlite.test +++ b/test/tclsqlite.test @@ -15,7 +15,7 @@ # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # -# $Id: tclsqlite.test,v 1.57 2007/05/01 17:49:49 danielk1977 Exp $ +# $Id: tclsqlite.test,v 1.58 2007/06/19 17:15:47 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -454,4 +454,32 @@ do_test tcl-12.1 { expr $a*1000000 + $b*1000 + $c } [sqlite3_libversion_number] + +# Check to see that when bindings of the form @aaa are used instead +# of $aaa, that objects with a bytearray representation are inserted +# as BLOBs even if they also have a string representation. +# +do_test tcl-13.1 { + db eval {CREATE TABLE t5(x BLOB)} + set x abc123 + db eval {INSERT INTO t5 VALUES($x)} + db eval {SELECT typeof(x) FROM t5} +} {text} +do_test tcl-13.2 { + binary scan $x H notUsed + db eval { + DELETE FROM t5; + INSERT INTO t5 VALUES($x); + SELECT typeof(x) FROM t5; + } +} {text} +do_test tcl-13.3 { +btree_breakpoint + db eval { + DELETE FROM t5; + INSERT INTO t5 VALUES(@x); + SELECT typeof(x) FROM t5; + } +} {blob} + finish_test