sl@0
|
1 |
# 2006 September 4
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
# This file implements regression tests for SQLite library.
|
sl@0
|
12 |
#
|
sl@0
|
13 |
# This file implements tests to make sure sqlite3_value_text()
|
sl@0
|
14 |
# always returns a null-terminated string.
|
sl@0
|
15 |
#
|
sl@0
|
16 |
# $Id: misc6.test,v 1.3 2007/04/23 23:56:32 drh Exp $
|
sl@0
|
17 |
|
sl@0
|
18 |
set testdir [file dirname $argv0]
|
sl@0
|
19 |
source $testdir/tester.tcl
|
sl@0
|
20 |
|
sl@0
|
21 |
do_test misc6-1.1 {
|
sl@0
|
22 |
set DB [sqlite3_connection_pointer db]
|
sl@0
|
23 |
sqlite3_create_function $DB
|
sl@0
|
24 |
set STMT [sqlite3_prepare $DB {SELECT hex8(?)} -1 DUMMY]
|
sl@0
|
25 |
set sqlite_static_bind_value {0123456789}
|
sl@0
|
26 |
set sqlite_static_bind_nbyte 5
|
sl@0
|
27 |
sqlite_bind $STMT 1 {} static-nbytes
|
sl@0
|
28 |
sqlite3_step $STMT
|
sl@0
|
29 |
} SQLITE_ROW
|
sl@0
|
30 |
do_test misc6-1.2 {
|
sl@0
|
31 |
sqlite3_column_text $STMT 0
|
sl@0
|
32 |
} {3031323334}
|
sl@0
|
33 |
ifcapable utf16 {
|
sl@0
|
34 |
do_test misc6-1.3 {
|
sl@0
|
35 |
sqlite3_finalize $STMT
|
sl@0
|
36 |
set STMT [sqlite3_prepare $DB {SELECT hex16(?)} -1 DUMMY]
|
sl@0
|
37 |
set sqlite_static_bind_value {0123456789}
|
sl@0
|
38 |
set sqlite_static_bind_nbyte 5
|
sl@0
|
39 |
sqlite_bind $STMT 1 {} static-nbytes
|
sl@0
|
40 |
sqlite3_step $STMT
|
sl@0
|
41 |
} SQLITE_ROW
|
sl@0
|
42 |
do_test misc6-1.4 {
|
sl@0
|
43 |
sqlite3_column_text $STMT 0
|
sl@0
|
44 |
} {00300031003200330034}
|
sl@0
|
45 |
}
|
sl@0
|
46 |
sqlite3_finalize $STMT
|
sl@0
|
47 |
|
sl@0
|
48 |
finish_test
|