]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the TCL bindings so that @aaa always treats the variable aaa as
authordrh <drh@noemail.net>
Tue, 19 Jun 2007 23:01:41 +0000 (23:01 +0000)
committerdrh <drh@noemail.net>
Tue, 19 Jun 2007 23:01:41 +0000 (23:01 +0000)
a bytearray and binds the value as a BLOB.  This change is backwards
compatible since the $ behavior is unchanged and @ was not accepted
until the current round of changes. (CVS 4094)

FossilOrigin-Name: 6f7d55acedc92eeaf988425c719addd56209187f

manifest
manifest.uuid
src/tclsqlite.c
test/tclsqlite.test

index 51ac1dc4be576a4cf94cc2b0f287cd1b61cef00b..5887d1e03c55a31f79fb79e5f3db9bf163f69734 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Cleanup\sthe\sTCL\sinterface\ssource\scode\sand\sadd\sdocumentation\sfor\srecently\nadded\smethods\son\sthe\sSQLite\sobject\sof\sTCL.\s(CVS\s4093)
-D 2007-06-19T17:48:57
+C Change\sthe\sTCL\sbindings\sso\sthat\s@aaa\salways\streats\sthe\svariable\saaa\sas\na\sbytearray\sand\sbinds\sthe\svalue\sas\sa\sBLOB.\s\sThis\schange\sis\sbackwards\ncompatible\ssince\sthe\s$\sbehavior\sis\sunchanged\sand\s@\swas\snot\saccepted\nuntil\sthe\scurrent\sround\sof\schanges.\s(CVS\s4094)
+D 2007-06-19T23:01:42
 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 df53bcb8239658c5ce45762c9837cc7f38c680de
+F src/tclsqlite.c 4bffe56752d2c24ade23340e46a91fd92c316e08
 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 649d4cec8a2393b2e5df7b2b29158cddc14bd3e5
+F test/tclsqlite.test 593f3b30221e85786965d9e5670ae4f96b4e4159
 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
 F test/tester.tcl 9382df472e0e86cbfddc44ab8c8cc02497bc9c8a
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@@ -507,7 +507,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P dcb104bd41f5e992d4c84b8947cb5099ae746891
-R 2c8e4d427c1a25e275d6ce32dba71a8d
+P d88b79818a6a9e0413b9560687ec3c79fcb3dacc
+R d21ca8a6dbb4862f845d47de835dc249
 U drh
-Z 100864d73ffe0c8bd7da587cd9106c28
+Z 0aaea6ffbf1a789df99e683345d7d3e2
index fad06ac2883c493d8b83be9abc89ba504c1036ac..cc1d774756f51e82fe8aa53072f874a5ff854e1d 100644 (file)
@@ -1 +1 @@
-d88b79818a6a9e0413b9560687ec3c79fcb3dacc
\ No newline at end of file
+6f7d55acedc92eeaf988425c719addd56209187f
\ No newline at end of file
index 49fd776e678cdecb1ccf86d2afed1bdb5a840b5b..dc01b533d4cebab0c9cd6f7db58fa9cdb32d95a5 100644 (file)
@@ -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.191 2007/06/19 17:48:57 drh Exp $
+** $Id: tclsqlite.c,v 1.192 2007/06/19 23:01:42 drh Exp $
 */
 #include "tcl.h"
 #include <errno.h>
@@ -1593,10 +1593,10 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
             u8 *data;
             char *zType = pVar->typePtr ? pVar->typePtr->name : "";
             char c = zType[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
-              ** either it has no string representation or the host
+            if( zVar[0]=='@' ||
+               (c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0) ){
+              /* Load a BLOB type if the Tcl variable is a bytearray and
+              ** 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);
index 6fd6d79fa026f9376ec8bd4c230667d1ba3e94a2..30eccdd76f8aef00a72a18eedb686168635e60d0 100644 (file)
@@ -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.58 2007/06/19 17:15:47 drh Exp $
+# $Id: tclsqlite.test,v 1.59 2007/06/19 23:01:42 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -456,8 +456,8 @@ do_test tcl-12.1 {
 
 
 # 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.
+# of $aaa, that objects are treated as bytearray and are inserted
+# as BLOBs.
 #
 do_test tcl-13.1 {
   db eval {CREATE TABLE t5(x BLOB)}
@@ -474,12 +474,20 @@ do_test tcl-13.2 {
   }
 } {text}
 do_test tcl-13.3 {
-btree_breakpoint
   db eval {
     DELETE FROM t5;
     INSERT INTO t5 VALUES(@x);
     SELECT typeof(x) FROM t5;
   }
 } {blob}
+do_test tcl-13.4 {
+  set y 1234
+  db eval {
+    DELETE FROM t5;
+    INSERT INTO t5 VALUES(@y);
+    SELECT hex(x), typeof(x) FROM t5
+  }
+} {31323334 blob}
+
 
 finish_test