func2.test 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. # 2009 November 11
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. # This file implements regression tests for SQLite library. The
  12. # focus of this file is testing built-in functions.
  13. #
  14. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. # Test plan:
  17. #
  18. # func2-1.*: substr implementation (ascii)
  19. # func2-2.*: substr implementation (utf8)
  20. # func2-3.*: substr implementation (blob)
  21. #
  22. proc bin_to_hex {blob} {
  23. set bytes {}
  24. binary scan $blob \c* bytes
  25. set bytes2 [list]
  26. foreach b $bytes {lappend bytes2 [format %02X [expr $b & 0xFF]]}
  27. join $bytes2 {}
  28. }
  29. #----------------------------------------------------------------------------
  30. # Test cases func2-1.*: substr implementation (ascii)
  31. #
  32. do_test func2-1.1 {
  33. execsql {SELECT 'Supercalifragilisticexpialidocious'}
  34. } {Supercalifragilisticexpialidocious}
  35. # substr(x,y), substr(x,y,z)
  36. do_test func2-1.2.1 {
  37. catchsql {SELECT SUBSTR()}
  38. } {1 {wrong number of arguments to function SUBSTR()}}
  39. do_test func2-1.2.2 {
  40. catchsql {SELECT SUBSTR('Supercalifragilisticexpialidocious')}
  41. } {1 {wrong number of arguments to function SUBSTR()}}
  42. do_test func2-1.2.3 {
  43. catchsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1,1,1)}
  44. } {1 {wrong number of arguments to function SUBSTR()}}
  45. # p1 is 1-indexed
  46. do_test func2-1.3 {
  47. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0)}
  48. } {Supercalifragilisticexpialidocious}
  49. do_test func2-1.4 {
  50. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1)}
  51. } {Supercalifragilisticexpialidocious}
  52. do_test func2-1.5 {
  53. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2)}
  54. } {upercalifragilisticexpialidocious}
  55. do_test func2-1.6 {
  56. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30)}
  57. } {cious}
  58. do_test func2-1.7 {
  59. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34)}
  60. } {s}
  61. do_test func2-1.8 {
  62. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35)}
  63. } {{}}
  64. do_test func2-1.9 {
  65. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36)}
  66. } {{}}
  67. # if p1<0, start from right
  68. do_test func2-1.10 {
  69. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -0)}
  70. } {Supercalifragilisticexpialidocious}
  71. do_test func2-1.11 {
  72. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1)}
  73. } {s}
  74. do_test func2-1.12 {
  75. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -2)}
  76. } {us}
  77. do_test func2-1.13 {
  78. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -30)}
  79. } {rcalifragilisticexpialidocious}
  80. do_test func2-1.14 {
  81. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34)}
  82. } {Supercalifragilisticexpialidocious}
  83. do_test func2-1.15 {
  84. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35)}
  85. } {Supercalifragilisticexpialidocious}
  86. do_test func2-1.16 {
  87. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36)}
  88. } {Supercalifragilisticexpialidocious}
  89. # p1 is 1-indexed, p2 length to return
  90. do_test func2-1.17.1 {
  91. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 1)}
  92. } {{}}
  93. do_test func2-1.17.2 {
  94. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 2)}
  95. } {S}
  96. do_test func2-1.18 {
  97. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, 1)}
  98. } {S}
  99. do_test func2-1.19.0 {
  100. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 0)}
  101. } {{}}
  102. do_test func2-1.19.1 {
  103. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 1)}
  104. } {u}
  105. do_test func2-1.19.2 {
  106. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 2)}
  107. } {up}
  108. do_test func2-1.20 {
  109. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, 1)}
  110. } {c}
  111. do_test func2-1.21 {
  112. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34, 1)}
  113. } {s}
  114. do_test func2-1.22 {
  115. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35, 1)}
  116. } {{}}
  117. do_test func2-1.23 {
  118. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, 1)}
  119. } {{}}
  120. # if p1<0, start from right, p2 length to return
  121. do_test func2-1.24 {
  122. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -0, 1)}
  123. } {{}}
  124. do_test func2-1.25.0 {
  125. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 0)}
  126. } {{}}
  127. do_test func2-1.25.1 {
  128. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 1)}
  129. } {s}
  130. do_test func2-1.25.2 {
  131. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -1, 2)}
  132. } {s}
  133. do_test func2-1.26 {
  134. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -2, 1)}
  135. } {u}
  136. do_test func2-1.27 {
  137. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -30, 1)}
  138. } {r}
  139. do_test func2-1.28.0 {
  140. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 0)}
  141. } {{}}
  142. do_test func2-1.28.1 {
  143. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 1)}
  144. } {S}
  145. do_test func2-1.28.2 {
  146. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -34, 2)}
  147. } {Su}
  148. do_test func2-1.29.1 {
  149. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35, 1)}
  150. } {{}}
  151. do_test func2-1.29.2 {
  152. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -35, 2)}
  153. } {S}
  154. do_test func2-1.30.0 {
  155. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 0)}
  156. } {{}}
  157. do_test func2-1.30.1 {
  158. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 1)}
  159. } {{}}
  160. do_test func2-1.30.2 {
  161. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 2)}
  162. } {{}}
  163. do_test func2-1.30.3 {
  164. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', -36, 3)}
  165. } {S}
  166. # p1 is 1-indexed, p2 length to return, p2<0 return p2 chars before p1
  167. do_test func2-1.31.0 {
  168. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, 0)}
  169. } {{}}
  170. do_test func2-1.31.1 {
  171. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, -1)}
  172. } {{}}
  173. do_test func2-1.31.2 {
  174. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 0, -2)}
  175. } {{}}
  176. do_test func2-1.32.0 {
  177. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, 0)}
  178. } {{}}
  179. do_test func2-1.32.1 {
  180. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 1, -1)}
  181. } {{}}
  182. do_test func2-1.33.0 {
  183. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, 0)}
  184. } {{}}
  185. do_test func2-1.33.1 {
  186. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, -1)}
  187. } {S}
  188. do_test func2-1.33.2 {
  189. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 2, -2)}
  190. } {S}
  191. do_test func2-1.34.0 {
  192. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, 0)}
  193. } {{}}
  194. do_test func2-1.34.1 {
  195. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, -1)}
  196. } {u}
  197. do_test func2-1.34.2 {
  198. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 3, -2)}
  199. } {Su}
  200. do_test func2-1.35.1 {
  201. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, -1)}
  202. } {o}
  203. do_test func2-1.35.2 {
  204. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 30, -2)}
  205. } {do}
  206. do_test func2-1.36 {
  207. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 34, -1)}
  208. } {u}
  209. do_test func2-1.37 {
  210. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 35, -1)}
  211. } {s}
  212. do_test func2-1.38.0 {
  213. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, 0)}
  214. } {{}}
  215. do_test func2-1.38.1 {
  216. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, -1)}
  217. } {{}}
  218. do_test func2-1.38.2 {
  219. execsql {SELECT SUBSTR('Supercalifragilisticexpialidocious', 36, -2)}
  220. } {s}
  221. #----------------------------------------------------------------------------
  222. # Test cases func2-2.*: substr implementation (utf8)
  223. #
  224. # Only do the following tests if TCL has UTF-8 capabilities
  225. #
  226. if {"\u1234"!="u1234"} {
  227. do_test func2-2.1.1 {
  228. execsql "SELECT 'hi\u1234ho'"
  229. } "hi\u1234ho"
  230. # substr(x,y), substr(x,y,z)
  231. do_test func2-2.1.2 {
  232. catchsql "SELECT SUBSTR()"
  233. } {1 {wrong number of arguments to function SUBSTR()}}
  234. do_test func2-2.1.3 {
  235. catchsql "SELECT SUBSTR('hi\u1234ho')"
  236. } {1 {wrong number of arguments to function SUBSTR()}}
  237. do_test func2-2.1.4 {
  238. catchsql "SELECT SUBSTR('hi\u1234ho', 1,1,1)"
  239. } {1 {wrong number of arguments to function SUBSTR()}}
  240. do_test func2-2.2.0 {
  241. execsql "SELECT SUBSTR('hi\u1234ho', 0, 0)"
  242. } {{}}
  243. do_test func2-2.2.1 {
  244. execsql "SELECT SUBSTR('hi\u1234ho', 0, 1)"
  245. } {{}}
  246. do_test func2-2.2.2 {
  247. execsql "SELECT SUBSTR('hi\u1234ho', 0, 2)"
  248. } "h"
  249. do_test func2-2.2.3 {
  250. execsql "SELECT SUBSTR('hi\u1234ho', 0, 3)"
  251. } "hi"
  252. do_test func2-2.2.4 {
  253. execsql "SELECT SUBSTR('hi\u1234ho', 0, 4)"
  254. } "hi\u1234"
  255. do_test func2-2.2.5 {
  256. execsql "SELECT SUBSTR('hi\u1234ho', 0, 5)"
  257. } "hi\u1234h"
  258. do_test func2-2.2.6 {
  259. execsql "SELECT SUBSTR('hi\u1234ho', 0, 6)"
  260. } "hi\u1234ho"
  261. do_test func2-2.3.0 {
  262. execsql "SELECT SUBSTR('hi\u1234ho', 1, 0)"
  263. } {{}}
  264. do_test func2-2.3.1 {
  265. execsql "SELECT SUBSTR('hi\u1234ho', 1, 1)"
  266. } "h"
  267. do_test func2-2.3.2 {
  268. execsql "SELECT SUBSTR('hi\u1234ho', 1, 2)"
  269. } "hi"
  270. do_test func2-2.3.3 {
  271. execsql "SELECT SUBSTR('hi\u1234ho', 1, 3)"
  272. } "hi\u1234"
  273. do_test func2-2.3.4 {
  274. execsql "SELECT SUBSTR('hi\u1234ho', 1, 4)"
  275. } "hi\u1234h"
  276. do_test func2-2.3.5 {
  277. execsql "SELECT SUBSTR('hi\u1234ho', 1, 5)"
  278. } "hi\u1234ho"
  279. do_test func2-2.3.6 {
  280. execsql "SELECT SUBSTR('hi\u1234ho', 1, 6)"
  281. } "hi\u1234ho"
  282. do_test func2-2.4.0 {
  283. execsql "SELECT SUBSTR('hi\u1234ho', 3, 0)"
  284. } {{}}
  285. do_test func2-2.4.1 {
  286. execsql "SELECT SUBSTR('hi\u1234ho', 3, 1)"
  287. } "\u1234"
  288. do_test func2-2.4.2 {
  289. execsql "SELECT SUBSTR('hi\u1234ho', 3, 2)"
  290. } "\u1234h"
  291. do_test func2-2.5.0 {
  292. execsql "SELECT SUBSTR('\u1234', 0, 0)"
  293. } {{}}
  294. do_test func2-2.5.1 {
  295. execsql "SELECT SUBSTR('\u1234', 0, 1)"
  296. } {{}}
  297. do_test func2-2.5.2 {
  298. execsql "SELECT SUBSTR('\u1234', 0, 2)"
  299. } "\u1234"
  300. do_test func2-2.5.3 {
  301. execsql "SELECT SUBSTR('\u1234', 0, 3)"
  302. } "\u1234"
  303. do_test func2-2.6.0 {
  304. execsql "SELECT SUBSTR('\u1234', 1, 0)"
  305. } {{}}
  306. do_test func2-2.6.1 {
  307. execsql "SELECT SUBSTR('\u1234', 1, 1)"
  308. } "\u1234"
  309. do_test func2-2.6.2 {
  310. execsql "SELECT SUBSTR('\u1234', 1, 2)"
  311. } "\u1234"
  312. do_test func2-2.6.3 {
  313. execsql "SELECT SUBSTR('\u1234', 1, 3)"
  314. } "\u1234"
  315. do_test func2-2.7.0 {
  316. execsql "SELECT SUBSTR('\u1234', 2, 0)"
  317. } {{}}
  318. do_test func2-2.7.1 {
  319. execsql "SELECT SUBSTR('\u1234', 2, 1)"
  320. } {{}}
  321. do_test func2-2.7.2 {
  322. execsql "SELECT SUBSTR('\u1234', 2, 2)"
  323. } {{}}
  324. do_test func2-2.8.0 {
  325. execsql "SELECT SUBSTR('\u1234', -1, 0)"
  326. } {{}}
  327. do_test func2-2.8.1 {
  328. execsql "SELECT SUBSTR('\u1234', -1, 1)"
  329. } "\u1234"
  330. do_test func2-2.8.2 {
  331. execsql "SELECT SUBSTR('\u1234', -1, 2)"
  332. } "\u1234"
  333. do_test func2-2.8.3 {
  334. execsql "SELECT SUBSTR('\u1234', -1, 3)"
  335. } "\u1234"
  336. } ;# End \u1234!=u1234
  337. #----------------------------------------------------------------------------
  338. # Test cases func2-3.*: substr implementation (blob)
  339. #
  340. ifcapable {!bloblit} {
  341. finish_test
  342. return
  343. }
  344. do_test func2-3.1.1 {
  345. set blob [execsql "SELECT x'1234'"]
  346. bin_to_hex [lindex $blob 0]
  347. } "1234"
  348. # substr(x,y), substr(x,y,z)
  349. do_test func2-3.1.2 {
  350. catchsql {SELECT SUBSTR()}
  351. } {1 {wrong number of arguments to function SUBSTR()}}
  352. do_test func2-3.1.3 {
  353. catchsql {SELECT SUBSTR(x'1234')}
  354. } {1 {wrong number of arguments to function SUBSTR()}}
  355. do_test func2-3.1.4 {
  356. catchsql {SELECT SUBSTR(x'1234', 1,1,1)}
  357. } {1 {wrong number of arguments to function SUBSTR()}}
  358. do_test func2-3.2.0 {
  359. set blob [execsql "SELECT SUBSTR(x'1234', 0, 0)"]
  360. bin_to_hex [lindex $blob 0]
  361. } {}
  362. do_test func2-3.2.1 {
  363. set blob [execsql "SELECT SUBSTR(x'1234', 0, 1)"]
  364. bin_to_hex [lindex $blob 0]
  365. } {}
  366. do_test func2-3.2.2 {
  367. set blob [execsql "SELECT SUBSTR(x'1234', 0, 2)"]
  368. bin_to_hex [lindex $blob 0]
  369. } "12"
  370. do_test func2-3.2.3 {
  371. set blob [execsql "SELECT SUBSTR(x'1234', 0, 3)"]
  372. bin_to_hex [lindex $blob 0]
  373. } "1234"
  374. do_test func2-3.3.0 {
  375. set blob [execsql "SELECT SUBSTR(x'1234', 1, 0)"]
  376. bin_to_hex [lindex $blob 0]
  377. } {}
  378. do_test func2-3.3.1 {
  379. set blob [execsql "SELECT SUBSTR(x'1234', 1, 1)"]
  380. bin_to_hex [lindex $blob 0]
  381. } "12"
  382. do_test func2-3.3.2 {
  383. set blob [execsql "SELECT SUBSTR(x'1234', 1, 2)"]
  384. bin_to_hex [lindex $blob 0]
  385. } "1234"
  386. do_test func2-3.3.3 {
  387. set blob [execsql "SELECT SUBSTR(x'1234', 1, 3)"]
  388. bin_to_hex [lindex $blob 0]
  389. } "1234"
  390. do_test func2-3.4.0 {
  391. set blob [execsql "SELECT SUBSTR(x'1234', -1, 0)"]
  392. bin_to_hex [lindex $blob 0]
  393. } {}
  394. do_test func2-3.4.1 {
  395. set blob [execsql "SELECT SUBSTR(x'1234', -1, 1)"]
  396. bin_to_hex [lindex $blob 0]
  397. } "34"
  398. do_test func2-3.4.2 {
  399. set blob [execsql "SELECT SUBSTR(x'1234', -1, 2)"]
  400. bin_to_hex [lindex $blob 0]
  401. } "34"
  402. do_test func2-3.4.3 {
  403. set blob [execsql "SELECT SUBSTR(x'1234', -1, 3)"]
  404. bin_to_hex [lindex $blob 0]
  405. } "34"
  406. do_test func2-3.5.0 {
  407. set blob [execsql "SELECT SUBSTR(x'1234', -2, 0)"]
  408. bin_to_hex [lindex $blob 0]
  409. } {}
  410. do_test func2-3.5.1 {
  411. set blob [execsql "SELECT SUBSTR(x'1234', -2, 1)"]
  412. bin_to_hex [lindex $blob 0]
  413. } "12"
  414. do_test func2-3.5.2 {
  415. set blob [execsql "SELECT SUBSTR(x'1234', -2, 2)"]
  416. bin_to_hex [lindex $blob 0]
  417. } "1234"
  418. do_test func2-3.5.3 {
  419. set blob [execsql "SELECT SUBSTR(x'1234', -2, 3)"]
  420. bin_to_hex [lindex $blob 0]
  421. } "1234"
  422. do_test func2-3.6.0 {
  423. set blob [execsql "SELECT SUBSTR(x'1234', -1, 0)"]
  424. bin_to_hex [lindex $blob 0]
  425. } {}
  426. do_test func2-3.6.1 {
  427. set blob [execsql "SELECT SUBSTR(x'1234', -1, -1)"]
  428. bin_to_hex [lindex $blob 0]
  429. } "12"
  430. do_test func2-3.6.2 {
  431. set blob [execsql "SELECT SUBSTR(x'1234', -1, -2)"]
  432. bin_to_hex [lindex $blob 0]
  433. } "12"
  434. do_test func2-3.6.3 {
  435. set blob [execsql "SELECT SUBSTR(x'1234', -1, -3)"]
  436. bin_to_hex [lindex $blob 0]
  437. } "12"
  438. do_test func2-3.7.0 {
  439. set blob [execsql "SELECT SUBSTR(x'1234', -2, 0)"]
  440. bin_to_hex [lindex $blob 0]
  441. } {}
  442. do_test func2-3.7.1 {
  443. set blob [execsql "SELECT SUBSTR(x'1234', -2, -1)"]
  444. bin_to_hex [lindex $blob 0]
  445. } {}
  446. do_test func2-3.7.2 {
  447. set blob [execsql "SELECT SUBSTR(x'1234', -2, -2)"]
  448. bin_to_hex [lindex $blob 0]
  449. } {}
  450. do_test func2-3.8.0 {
  451. set blob [execsql "SELECT SUBSTR(x'1234', 1, 0)"]
  452. bin_to_hex [lindex $blob 0]
  453. } {}
  454. do_test func2-3.8.1 {
  455. set blob [execsql "SELECT SUBSTR(x'1234', 1, -1)"]
  456. bin_to_hex [lindex $blob 0]
  457. } {}
  458. do_test func2-3.8.2 {
  459. set blob [execsql "SELECT SUBSTR(x'1234', 1, -2)"]
  460. bin_to_hex [lindex $blob 0]
  461. } {}
  462. do_test func2-3.9.0 {
  463. set blob [execsql "SELECT SUBSTR(x'1234', 2, 0)"]
  464. bin_to_hex [lindex $blob 0]
  465. } {}
  466. do_test func2-3.9.1 {
  467. set blob [execsql "SELECT SUBSTR(x'1234', 2, -1)"]
  468. bin_to_hex [lindex $blob 0]
  469. } "12"
  470. do_test func2-3.9.2 {
  471. set blob [execsql "SELECT SUBSTR(x'1234', 2, -2)"]
  472. bin_to_hex [lindex $blob 0]
  473. } "12"
  474. finish_test