Update comment for substrFunc(). Added additional SUBSTR() test cases.
FossilOrigin-Name: d7b3801dc7fad1b002f892fb5d82047ebff98369
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
C Suppress\sunnecessary\sOP_Noop\sinstructions\son\swhen\sthe\sright\stable\sof\sa\s\nLEFT\sJOIN\suses\sthe\sindex-only\soptimization.
|
||||
D 2009-11-12T04:26:39
|
||||
C Update\scomment\sfor\ssubstrFunc().\s\sAdded\sadditional\sSUBSTR()\stest\scases.
|
||||
D 2009-11-12T05:04:50
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 53f3dfa49f28ab5b80cb083fb7c9051e596bcfa1
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -120,7 +117,7 @@ F src/delete.c ec04635d152debdab70d4b30c5516b59282075ea
|
||||
F src/expr.c be605c60ff84699f3087209f2f86a140a6a5e96c
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c 41219cba186bcf0a053e42327dfa23aaba4f834a
|
||||
F src/func.c 97cb15ef7a7c32293a938589c9eb6933f6688a21
|
||||
F src/func.c bf54e1202cbfb28bf4b1fd9b58899009ae76716f
|
||||
F src/global.c 271952d199a8cc59d4ce840b3bbbfd2f30c8ba32
|
||||
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
|
||||
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
|
||||
@@ -400,6 +397,7 @@ F test/fts3expr.test 05dab77387801e4900009917bb18f556037d82da
|
||||
F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
|
||||
F test/fts3near.test dc196dd17b4606f440c580d45b3d23aa975fd077
|
||||
F test/func.test af106ed834001738246d276659406823e35cde7b
|
||||
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
|
||||
F test/fuzz.test a4174c3009a3e2c2e14b31b364ebf7ddb49de2c9
|
||||
F test/fuzz2.test ea38692ce2da99ad79fe0be5eb1a452c1c4d37bb
|
||||
F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5
|
||||
@@ -770,14 +768,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P cff1b36ab2c417611f59e96694005c03762788d2
|
||||
R 27ea3cc9eb26b161a34ebbe34741190e
|
||||
U drh
|
||||
Z 1781a9afcc14917ad21934e90b64a6d9
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||
|
||||
iD8DBQFK+46CoxKgR168RlERAs2eAJ9q+CJ0pBp0WyIBy8gQXLRefcg5DACdH31c
|
||||
P01a4JtLngUfv/eThlehXws=
|
||||
=kK2G
|
||||
-----END PGP SIGNATURE-----
|
||||
P e8aec08bee1c8d593474561898037aed571e64ce
|
||||
R eff535e110e372495a1d64aaae18bfd2
|
||||
U shaneh
|
||||
Z 84a73f30a17aaa895fe2eee2c345ef85
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
e8aec08bee1c8d593474561898037aed571e64ce
|
||||
d7b3801dc7fad1b002f892fb5d82047ebff98369
|
||||
@@ -157,6 +157,8 @@ static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
** If x is a blob, then we count bytes.
|
||||
**
|
||||
** If p1 is negative, then we begin abs(p1) from the end of x[].
|
||||
**
|
||||
** If p2 is negative, return the p2 characters preceeding p1.
|
||||
*/
|
||||
static void substrFunc(
|
||||
sqlite3_context *context,
|
||||
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
# 2009 November 11
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing built-in functions.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# Test plan:
|
||||
#
|
||||
# func2-1.*: substr implementation (ascii)
|
||||
# func2-2.*: substr implementation (utf8)
|
||||
# func2-3.*: substr implementation (blob)
|
||||
#
|
||||
|
||||
proc bin_to_hex {blob} {
|
||||
set bytes {}
|
||||
binary scan $blob \c* bytes
|
||||
set bytes2 [list]
|
||||
foreach b $bytes {lappend bytes2 [format %02X [expr $b & 0xFF]]}
|
||||
join $bytes2 {}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test cases func2-1.*: substr implementation (ascii)
|
||||
#
|
||||
|
||||
do_test func2-1.1 {
|
||||
execsql {SELECT 'Supercalifragilisticexpialidocious'}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
|
||||
# substr(x,y), substr(x,y,z)
|
||||
do_test func2-1.2.1 {
|
||||
catchsql {SELECT SUBSTR()}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-1.2.2 {
|
||||
catchsql {SELECT SUBSTR('Supercalifragilisticexpialidocious')}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-1.2.3 {
|
||||
catchsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1,1,1)}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
|
||||
# p1 is 1-indexed
|
||||
do_test func2-1.3 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
do_test func2-1.4 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
do_test func2-1.5 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2)}
|
||||
} {upercalifragilisticexpialidocious}
|
||||
do_test func2-1.6 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30)}
|
||||
} {cious}
|
||||
do_test func2-1.7 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34)}
|
||||
} {s}
|
||||
do_test func2-1.8 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35)}
|
||||
} {{}}
|
||||
do_test func2-1.9 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36)}
|
||||
} {{}}
|
||||
|
||||
# if p1<0, start from right
|
||||
do_test func2-1.10 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -0)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
do_test func2-1.11 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1)}
|
||||
} {s}
|
||||
do_test func2-1.12 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -2)}
|
||||
} {us}
|
||||
do_test func2-1.13 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -30)}
|
||||
} {rcalifragilisticexpialidocious}
|
||||
do_test func2-1.14 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
do_test func2-1.15 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
do_test func2-1.16 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36)}
|
||||
} {Supercalifragilisticexpialidocious}
|
||||
|
||||
# p1 is 1-indexed, p2 length to return
|
||||
do_test func2-1.17.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 1)}
|
||||
} {{}}
|
||||
do_test func2-1.17.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 2)}
|
||||
} {S}
|
||||
do_test func2-1.18 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, 1)}
|
||||
} {S}
|
||||
do_test func2-1.19.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.19.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 1)}
|
||||
} {u}
|
||||
do_test func2-1.19.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 2)}
|
||||
} {up}
|
||||
do_test func2-1.20 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, 1)}
|
||||
} {c}
|
||||
do_test func2-1.21 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34, 1)}
|
||||
} {s}
|
||||
do_test func2-1.22 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35, 1)}
|
||||
} {{}}
|
||||
do_test func2-1.23 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, 1)}
|
||||
} {{}}
|
||||
|
||||
# if p1<0, start from right, p2 length to return
|
||||
do_test func2-1.24 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -0, 1)}
|
||||
} {{}}
|
||||
do_test func2-1.25.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.25.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 1)}
|
||||
} {s}
|
||||
do_test func2-1.25.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 2)}
|
||||
} {s}
|
||||
do_test func2-1.26 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -2, 1)}
|
||||
} {u}
|
||||
do_test func2-1.27 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -30, 1)}
|
||||
} {r}
|
||||
do_test func2-1.28.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.28.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 1)}
|
||||
} {S}
|
||||
do_test func2-1.28.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 2)}
|
||||
} {Su}
|
||||
do_test func2-1.29.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35, 1)}
|
||||
} {{}}
|
||||
do_test func2-1.29.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35, 2)}
|
||||
} {S}
|
||||
do_test func2-1.30.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.30.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 1)}
|
||||
} {{}}
|
||||
do_test func2-1.30.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 2)}
|
||||
} {{}}
|
||||
do_test func2-1.30.3 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 3)}
|
||||
} {S}
|
||||
|
||||
# p1 is 1-indexed, p2 length to return, p2<0 return p2 chars before p1
|
||||
do_test func2-1.31.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.31.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, -1)}
|
||||
} {{}}
|
||||
do_test func2-1.31.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, -2)}
|
||||
} {{}}
|
||||
do_test func2-1.32.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.32.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, -1)}
|
||||
} {{}}
|
||||
do_test func2-1.33.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.33.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, -1)}
|
||||
} {S}
|
||||
do_test func2-1.33.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, -2)}
|
||||
} {S}
|
||||
do_test func2-1.34.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.34.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, -1)}
|
||||
} {u}
|
||||
do_test func2-1.34.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, -2)}
|
||||
} {Su}
|
||||
do_test func2-1.35.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, -1)}
|
||||
} {o}
|
||||
do_test func2-1.35.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, -2)}
|
||||
} {do}
|
||||
do_test func2-1.36 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34, -1)}
|
||||
} {u}
|
||||
do_test func2-1.37 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35, -1)}
|
||||
} {s}
|
||||
do_test func2-1.38.0 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, 0)}
|
||||
} {{}}
|
||||
do_test func2-1.38.1 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, -1)}
|
||||
} {{}}
|
||||
do_test func2-1.38.2 {
|
||||
execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, -2)}
|
||||
} {s}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test cases func2-2.*: substr implementation (utf8)
|
||||
#
|
||||
|
||||
# Only do the following tests if TCL has UTF-8 capabilities
|
||||
#
|
||||
if {"\u1234"!="u1234"} {
|
||||
|
||||
do_test func2-2.1.1 {
|
||||
execsql "SELECT 'hi\u1234ho'"
|
||||
} "hi\u1234ho"
|
||||
|
||||
# substr(x,y), substr(x,y,z)
|
||||
do_test func2-2.1.2 {
|
||||
catchsql "SELECT SUBSTR()"
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-2.1.3 {
|
||||
catchsql "SELECT SUBSTR('hi\u1234ho')"
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-2.1.4 {
|
||||
catchsql "SELECT SUBSTR('hi\u1234ho', 1,1,1)"
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
|
||||
do_test func2-2.2.0 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.2.1 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 1)"
|
||||
} {{}}
|
||||
do_test func2-2.2.2 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 2)"
|
||||
} "h"
|
||||
do_test func2-2.2.3 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 3)"
|
||||
} "hi"
|
||||
do_test func2-2.2.4 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 4)"
|
||||
} "hi\u1234"
|
||||
do_test func2-2.2.5 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 5)"
|
||||
} "hi\u1234h"
|
||||
do_test func2-2.2.6 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 0, 6)"
|
||||
} "hi\u1234ho"
|
||||
|
||||
do_test func2-2.3.0 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.3.1 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 1)"
|
||||
} "h"
|
||||
do_test func2-2.3.2 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 2)"
|
||||
} "hi"
|
||||
do_test func2-2.3.3 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 3)"
|
||||
} "hi\u1234"
|
||||
do_test func2-2.3.4 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 4)"
|
||||
} "hi\u1234h"
|
||||
do_test func2-2.3.5 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 5)"
|
||||
} "hi\u1234ho"
|
||||
do_test func2-2.3.6 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 1, 6)"
|
||||
} "hi\u1234ho"
|
||||
|
||||
do_test func2-2.4.0 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 3, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.4.1 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 3, 1)"
|
||||
} "\u1234"
|
||||
do_test func2-2.4.2 {
|
||||
execsql "SELECT SUBSTR('hi\u1234ho', 3, 2)"
|
||||
} "\u1234h"
|
||||
|
||||
do_test func2-2.5.0 {
|
||||
execsql "SELECT SUBSTR('\u1234', 0, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.5.1 {
|
||||
execsql "SELECT SUBSTR('\u1234', 0, 1)"
|
||||
} {{}}
|
||||
do_test func2-2.5.2 {
|
||||
execsql "SELECT SUBSTR('\u1234', 0, 2)"
|
||||
} "\u1234"
|
||||
do_test func2-2.5.3 {
|
||||
execsql "SELECT SUBSTR('\u1234', 0, 3)"
|
||||
} "\u1234"
|
||||
|
||||
do_test func2-2.6.0 {
|
||||
execsql "SELECT SUBSTR('\u1234', 1, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.6.1 {
|
||||
execsql "SELECT SUBSTR('\u1234', 1, 1)"
|
||||
} "\u1234"
|
||||
do_test func2-2.6.2 {
|
||||
execsql "SELECT SUBSTR('\u1234', 1, 2)"
|
||||
} "\u1234"
|
||||
do_test func2-2.6.3 {
|
||||
execsql "SELECT SUBSTR('\u1234', 1, 3)"
|
||||
} "\u1234"
|
||||
|
||||
do_test func2-2.7.0 {
|
||||
execsql "SELECT SUBSTR('\u1234', 2, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.7.1 {
|
||||
execsql "SELECT SUBSTR('\u1234', 2, 1)"
|
||||
} {{}}
|
||||
do_test func2-2.7.2 {
|
||||
execsql "SELECT SUBSTR('\u1234', 2, 2)"
|
||||
} {{}}
|
||||
|
||||
do_test func2-2.8.0 {
|
||||
execsql "SELECT SUBSTR('\u1234', -1, 0)"
|
||||
} {{}}
|
||||
do_test func2-2.8.1 {
|
||||
execsql "SELECT SUBSTR('\u1234', -1, 1)"
|
||||
} "\u1234"
|
||||
do_test func2-2.8.2 {
|
||||
execsql "SELECT SUBSTR('\u1234', -1, 2)"
|
||||
} "\u1234"
|
||||
do_test func2-2.8.3 {
|
||||
execsql "SELECT SUBSTR('\u1234', -1, 3)"
|
||||
} "\u1234"
|
||||
|
||||
} ;# End \u1234!=u1234
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test cases func2-3.*: substr implementation (blob)
|
||||
#
|
||||
|
||||
ifcapable {!bloblit} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_test func2-3.1.1 {
|
||||
set blob [execsql "SELECT x'1234'"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
|
||||
# substr(x,y), substr(x,y,z)
|
||||
do_test func2-3.1.2 {
|
||||
catchsql {SELECT SUBSTR()}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-3.1.3 {
|
||||
catchsql {SELECT SUBSTR(x'1234')}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
do_test func2-3.1.4 {
|
||||
catchsql {SELECT SUBSTR(x'1234', 1,1,1)}
|
||||
} {1 {wrong number of arguments to function SUBSTR()}}
|
||||
|
||||
do_test func2-3.2.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 0, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.2.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 0, 1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.2.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 0, 2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.2.3 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 0, 3)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
|
||||
do_test func2-3.3.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.3.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, 1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.3.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, 2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
do_test func2-3.3.3 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, 3)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
|
||||
do_test func2-3.4.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.4.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, 1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "34"
|
||||
do_test func2-3.4.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, 2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "34"
|
||||
do_test func2-3.4.3 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, 3)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "34"
|
||||
|
||||
do_test func2-3.5.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.5.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, 1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.5.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, 2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
do_test func2-3.5.3 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, 3)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "1234"
|
||||
|
||||
do_test func2-3.6.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.6.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, -1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.6.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, -2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.6.3 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -1, -3)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
|
||||
do_test func2-3.7.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.7.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, -1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.7.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', -2, -2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
|
||||
do_test func2-3.8.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.8.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, -1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.8.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 1, -2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
|
||||
do_test func2-3.9.0 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 2, 0)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} {}
|
||||
do_test func2-3.9.1 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 2, -1)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
do_test func2-3.9.2 {
|
||||
set blob [execsql "SELECT SUBSTR(x'1234', 2, -2)"]
|
||||
bin_to_hex [lindex $blob 0]
|
||||
} "12"
|
||||
|
||||
finish_test
|
||||
Reference in New Issue
Block a user