From: drh Date: Wed, 16 Apr 2008 16:11:49 +0000 (+0000) Subject: Fix the bind.test test script so that the tests for zeros embedded in X-Git-Tag: version-3.6.10~1157 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78ddb7ceedc09daa7c6d7677462615e875188b11;p=thirdparty%2Fsqlite.git Fix the bind.test test script so that the tests for zeros embedded in strings work correctly for UTF-16 encoded databases. (CVS 5020) FossilOrigin-Name: 7c094c80b2439480ffc680b2d63031d1033b266a --- diff --git a/manifest b/manifest index de3cb651c6..184c0cdff1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.5.8\s(CVS\s5019) -D 2008-04-16T15:39:31 +C Fix\sthe\sbind.test\stest\sscript\sso\sthat\sthe\stests\sfor\szeros\sembedded\sin\nstrings\swork\scorrectly\sfor\sUTF-16\sencoded\sdatabases.\s(CVS\s5020) +D 2008-04-16T16:11:49 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -212,7 +212,7 @@ F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070 F test/bigfile.test 9a6a8346e4042d9c781ed6cb6553ac871ae30618 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 -F test/bind.test 991d5738c64e9627c09576dc18ff6cda46075563 +F test/bind.test 93e0b1e501bc2123d97749787e6a2c8abeb9f599 F test/bindxfer.test 995d2cf8df61204d748cde6960443121c4ccd2e1 F test/bitvec.test 62a512c3f7041d1df12558eb25990e5a19820571 F test/blob.test 2a38d867bdf08f9ce081776acec1ac8d4bca66be @@ -632,7 +632,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P bb0f9e92e427d4ae8ea143d3d3773c9552e63565 -R f57a0ca58b7ca1d3113ae2507d454a38 +P 6a2e3eb26af63386ce32594e24f1ce5605cd1068 +R b06fc0287c1d61e8732f4939621e2c8f U drh -Z b5912b7e46dead7f8f9ec0397ea2e300 +Z d6acd0c53329c6833eb13af2897a0d65 diff --git a/manifest.uuid b/manifest.uuid index 348ef027d7..776111aaf2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6a2e3eb26af63386ce32594e24f1ce5605cd1068 \ No newline at end of file +7c094c80b2439480ffc680b2d63031d1033b266a \ No newline at end of file diff --git a/test/bind.test b/test/bind.test index 0a38081b72..075ffd10c9 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.41 2008/04/16 12:58:54 drh Exp $ +# $Id: bind.test,v 1.42 2008/04/16 16:11:49 drh Exp $ # set testdir [file dirname $argv0] @@ -275,11 +275,26 @@ do_test bind-6.4 { sqlite3_bind_text $VM 3 hello\000there\000 -1 sqlite_step $VM N VALUES COLNAMES sqlite3_reset $VM - execsql {SELECT hex(a), hex(b), hex(c) FROM t1} -} {68656C6C6F00746865726500 68656C6C6F007468657265 68656C6C6F} -do_test bind-6.5 { execsql {SELECT * FROM t1} } {hello hello hello} +set enc [db eval {PRAGMA encoding}] +if {$enc=="UTF-8"} { + do_test bind-6.5 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {68656C6C6F00746865726500 68656C6C6F007468657265 68656C6C6F} +} elseif {$enc=="UTF-16le"} { + do_test bind-6.5 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {680065006C006C006F000000740068006500720065000000 680065006C006C006F00000074006800650072006500 680065006C006C006F00} +} elseif {$enc=="UTF-16be"} { + do_test bind-6.5 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {00680065006C006C006F0000007400680065007200650000 00680065006C006C006F000000740068006500720065 00680065006C006C006F} +} else { + do_test bind-6.5 { + set "Unknown database encoding: $::enc" + } {} +} do_test bind-6.6 { execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1} } {text text text} @@ -311,9 +326,19 @@ ifcapable {utf16} { sqlite3_reset $VM execsql {SELECT * FROM t1} } {hi hi hi} - do_test bind-7.4 { - execsql {SELECT hex(a), hex(b), hex(c) FROM t1} - } {68690079616C6C00 68690079616C6C 6869} + if {$enc=="UTF-8"} { + do_test bind-7.4 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {68690079616C6C00 68690079616C6C 6869} + } elseif {$enc=="UTF-16le"} { + do_test bind-7.4 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {680069000000790061006C006C000000 680069000000790061006C006C00 68006900} + } elseif {$enc=="UTF-16be"} { + do_test bind-7.4 { + execsql {SELECT hex(a), hex(b), hex(c) FROM t1} + } {00680069000000790061006C006C0000 00680069000000790061006C006C 00680069} + } do_test bind-7.5 { execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1} } {text text text}