From: dan Date: Sat, 28 Jan 2023 16:37:30 +0000 (+0000) Subject: Update sqllimits1.test to account for the fact that if an odd value is specified... X-Git-Tag: version-3.41.0~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54c9250b09c18507b0a169200219b2d351f6865f;p=thirdparty%2Fsqlite.git Update sqllimits1.test to account for the fact that if an odd value is specified as the length in bytes of a utf-16 string, it is truncated to the largest smaller even number. FossilOrigin-Name: 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 --- diff --git a/manifest b/manifest index 2da9056d6d..2df45c6199 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Makefile\sdoc\stouchups\s-\sno\scode/build\schanges. -D 2023-01-28T09:51:41.063 +C Update\ssqllimits1.test\sto\saccount\sfor\sthe\sfact\sthat\sif\san\sodd\svalue\sis\sspecified\sas\sthe\slength\sin\sbytes\sof\sa\sutf-16\sstring,\sit\sis\struncated\sto\sthe\slargest\ssmaller\seven\snumber. +D 2023-01-28T16:37:30.454 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1524,7 +1524,7 @@ F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 F test/spellfix4.test 51c7c26514ade169855c66bcf130bd5acfb4d7fd090cc624645ab275ae6a41fb F test/sqldiff1.test 182058e09c7082de5c6a470ff9c291337bbeb650052c2cc68fbb3d7e25861d91 -F test/sqllimits1.test 69d110987dbdb4bea9dbc3f151c93b4697ae6cd7e6c3a519119dc1140c8607fd +F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996fd413ac4 F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805 F test/stat.test 123212a20ceb496893d5254a5f6c76442ce549fdc08d1702d8288a2bbaac8408 @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682 -R 63fed4ef637e391371d6a01d8747792f -U stephan -Z ef029a1e60dbc16f9c5e60c686e321d3 +P 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 +R df4d514a8cefe2ba4ba7ec67cb263215 +U dan +Z 6dd497de705b6f37d14013dd4a408f6f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 499905f2a1..36a4397e7f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7 \ No newline at end of file +74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398 \ No newline at end of file diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 1c3f66b7fa..f16208f234 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -16,6 +16,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +set testprefix sqllimits1 # Verify that the default per-connection limits are the same as # the compile-time hard limits. @@ -347,7 +348,7 @@ do_test sqllimits1-5.14.6 { } {SQLITE_TOOBIG} ifcapable utf16 { do_test sqllimits1-5.14.7 { - catch {sqlite3_bind_text16 $::STMT 1 $::str1 $np1} res + catch {sqlite3_bind_text16 $::STMT 1 $::str1 [expr $np1+1]} res set res } {SQLITE_TOOBIG} } @@ -923,4 +924,55 @@ do_catchsql_test sqllimits1-18.2 { UNION VALUES(11); } {1 {too many terms in compound SELECT}} +#------------------------------------------------------------------------- +# +reset_db +ifcapable utf16 { + do_execsql_test 19.0 { + PRAGMA encoding = 'utf16'; + } + set bigstr [string repeat abcdefghij 5000] + set bigstr16 [encoding convertto unicode $bigstr] + + do_test 19.1 { + string length $bigstr16 + } {100000} + + do_test 19.2 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 + sqlite3_step $::stmt + set val [sqlite3_column_int $::stmt 0] + sqlite3_finalize $::stmt + set val + } {50000} + + sqlite3_limit db SQLITE_LIMIT_LENGTH 100000 + + do_test 19.3 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 + sqlite3_step $::stmt + set val [sqlite3_column_int $::stmt 0] + sqlite3_finalize $::stmt + set val + } {50000} + + sqlite3_limit db SQLITE_LIMIT_LENGTH 99999 + + do_test 19.4 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 } msg] $msg + } {1 SQLITE_TOOBIG} + sqlite3_finalize $::stmt + + sqlite3_limit db SQLITE_LIMIT_LENGTH 100000 + + do_test 19.5 { + set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL] + list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100002 } msg] $msg + } {1 SQLITE_TOOBIG} + sqlite3_finalize $::stmt +} + finish_test