From: drh Date: Fri, 2 Dec 2005 02:44:05 +0000 (+0000) Subject: Add a test to verify that binding text with embedded '\000' works. Also X-Git-Tag: version-3.6.10~3363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf8aa2a6c5bb41934c18f902a146ee7bafd2b838;p=thirdparty%2Fsqlite.git Add a test to verify that binding text with embedded '\000' works. Also comment changes in os.h. (CVS 2797) FossilOrigin-Name: 31251a9098662ccf08af5bd5bc3afb282a149701 --- diff --git a/manifest b/manifest index feb80482d7..9f0c374d18 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Documentation\supdates.\s(CVS\s2796) -D 2005-12-02T01:57:43 +C Add\sa\stest\sto\sverify\sthat\sbinding\stext\swith\sembedded\s'\\000'\sworks.\s\sAlso\ncomment\schanges\sin\sos.h.\s(CVS\s2797) +D 2005-12-02T02:44:06 F Makefile.in e3c6b3a38d734d41574c04f2fc90d18de2b87102 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -51,7 +51,7 @@ F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b F src/main.c 7d719efe04b760c5e0faa9e910c6d4f00f85f2f3 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/os.c bdd3a2fd089777e7ad18b57c896f1141d5a0c1fd -F src/os.h c5decb84948b4ec614903caa8da31ce86c25031e +F src/os.h d5ae3f4c1c7731437b6cddec279b7c06f761c44e F src/os_common.h d74a11728ad2444b6b695b94c28c06881f049e49 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 @@ -72,7 +72,7 @@ F src/sqlite.h.in 8e648e1f386e4509f2f96c09ded7c07b0df0c9a2 F src/sqliteInt.h 4148c9778e350014c2e27b332d7a2ef7278fe62e F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316 F src/tclsqlite.c a497c3adfd2c85da6a934331ec0041e47884fbcb -F src/test1.c 014f00eda1007e21631148e4168f00c9ee2568ae +F src/test1.c 99b7c919ef00f57537554333329e4fdea513b001 F src/test2.c 36390cdfc70c08e5ee0b466d0654a117f398bbff F src/test3.c f4e6a16a602091696619a1171bda25c0e3df49f7 F src/test4.c a8fd681e139e1c61f22a77d07fc3a99cb28fff3f @@ -112,7 +112,7 @@ F test/autovacuum_ioerr2.test 2f8a3fb31f833fd0ca86ad4ad98913c73e807572 F test/between.test ca092fa28b665ca92172b182c6c360a92f7ca348 F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 -F test/bind.test 3169339a9fb7aaa8244d0ed8651fe6b6796d809c +F test/bind.test 4c68b9f37a98b274f365dae19ea6c16c76c2c1c5 F test/bindxfer.test 856830e9e5552b9882c9d5c6647f90e25bdae4ac F test/blob.test 0b4ee6fef7a50685b88d921e2992606999510881 F test/btree.test 8aa7424aeec844df990273fe36447e5d7e407261 @@ -324,7 +324,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P bd8740d1aecba69e1b5d64d43db07e8ad8841f07 -R 560e5f5f3270d23cafb702eb82b09cf1 +P 2ffb90c39d0b60de9a692326ca3f2595c1fc97d0 +R 002caed86b62b1fca9bd7852b43785e4 U drh -Z 01e62cd8f9861c89dbbdef8038a0568c +Z 4dfc99bb0a2a6963cbe2162482887434 diff --git a/manifest.uuid b/manifest.uuid index 48b0136768..2ca79ca582 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2ffb90c39d0b60de9a692326ca3f2595c1fc97d0 \ No newline at end of file +31251a9098662ccf08af5bd5bc3afb282a149701 \ No newline at end of file diff --git a/src/os.h b/src/os.h index 5bbc724177..dc0e8d88c4 100644 --- a/src/os.h +++ b/src/os.h @@ -72,9 +72,11 @@ struct IoMethod { /* ** The OsFile object describes an open disk file in an OS-dependent way. -** The version of OsFile defined here is a generic versions. Each Os +** The version of OsFile defined here is a generic version. Each OS ** implementation defines its own subclass of this structure that contains -** additional information needed to handle file I/O. +** additional information needed to handle file I/O. But the pMethod +** entry (pointing to the virtual function table) always occurs first +** so that we can always find the appropriate methods. */ struct OsFile { IoMethod const *pMethod; diff --git a/src/test1.c b/src/test1.c index 00c5772c75..14b16309ec 100644 --- a/src/test1.c +++ b/src/test1.c @@ -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.168 2005/11/30 03:20:32 drh Exp $ +** $Id: test1.c,v 1.169 2005/12/02 02:44:06 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -1064,7 +1064,8 @@ static char *sqlite_static_bind_value = 0; ** ignored and the value is set to NULL. If FLAGS=="static" then ** the value is set to the value of a static variable named ** "sqlite_static_bind_value". If FLAGS=="normal" then a copy -** of the VALUE is made. +** of the VALUE is made. If FLAGS=="blob10" then a VALUE is ignored +** an a 10-byte blob "abc\000xyz\000pq" is inserted. */ static int test_bind( void *NotUsed, @@ -1088,6 +1089,8 @@ static int test_bind( rc = sqlite3_bind_text(pStmt, idx, sqlite_static_bind_value, -1, 0); }else if( strcmp(argv[4],"normal")==0 ){ rc = sqlite3_bind_text(pStmt, idx, argv[3], -1, SQLITE_TRANSIENT); + }else if( strcmp(argv[4],"blob10")==0 ){ + rc = sqlite3_bind_text(pStmt, idx, "abc\000xyz\000pq", 10, SQLITE_STATIC); }else{ Tcl_AppendResult(interp, "4th argument should be " "\"null\" or \"static\" or \"normal\"", 0); diff --git a/test/bind.test b/test/bind.test index 5e7de8209d..01f009deeb 100644 --- a/test/bind.test +++ b/test/bind.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script testing the sqlite_bind API. # -# $Id: bind.test,v 1.32 2005/06/22 08:48:07 drh Exp $ +# $Id: bind.test,v 1.33 2005/12/02 02:44:06 drh Exp $ # set testdir [file dirname $argv0] @@ -500,4 +500,22 @@ ifcapable tclvar { } {1 {unrecognized token: "$abc(123"}} } +# Test the ability to bind text that contains embedded '\000' characters. +# Make sure we can recover the enter input string. +# +do_test bind-12.1 { + execsql { + CREATE TABLE t3(x BLOB); + } + set VM [sqlite3_prepare $DB {INSERT INTO t3 VALUES(?)} -1 TAIL] + sqlite_bind $VM 1 not-used blob10 + sqlite3_step $VM + sqlite3_finalize $VM + execsql { + SELECT typeof(x), length(x), quote(x), + length(cast(x AS BLOB)), quote(cast(x AS BLOB)) FROM t3 + } +} {text 3 'abc' 10 X'6162630078797A007071'} + + finish_test