SQLite

Check-in [ace8ba8177]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add tests to make sure "PRAGMA table_info" works using sqlite3_prepare16. Ticket #1606. (CVS 2932)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ace8ba817766f9da270cd7f06b68cc537768a8be
User & Date: drh 2006-01-13 01:25:06.000
Context
2006-01-13
01:48
Add a high-speed version of sqlite3GetVarint32 to vdbe.c for a 3% performance gain. (CVS 2933) (check-in: a64e8251a6 user: drh tags: trunk)
01:25
Add tests to make sure "PRAGMA table_info" works using sqlite3_prepare16. Ticket #1606. (CVS 2932) (check-in: ace8ba8177 user: drh tags: trunk)
01:17
Terminate the va_start in the getDigits function of date.c. (CVS 2931) (check-in: 94eac140f2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/capi3.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2003 January 29
#
# 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 script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.37 2006/01/09 23:40:25 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2003 January 29
#
# 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 script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.38 2006/01/13 01:25:06 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113












114
115
116
117
118
119
120
  sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi3-1.7 {
  sqlite3_errmsg $DB
} {no such column: namex}

ifcapable {utf16} {
do_test capi3-2.1 {
  set sql16 [utf16 {SELECT name FROM sqlite_master}]
  set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL]
  sqlite3_finalize $STMT
  utf8 $::TAIL
} {}
do_test capi3-2.2 {
  set sql [utf16 {SELECT name FROM sqlite_master;SELECT 10}]
  set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
  sqlite3_finalize $STMT
  utf8 $TAIL
} {SELECT 10}
do_test capi3-2.3 {
  set sql [utf16 {SELECT namex FROM sqlite_master}]
  catch {
    set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
  }
} {1}
do_test capi3-2.4 {
  sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi3-2.5 {
  sqlite3_errmsg $DB
} {no such column: namex}












} ;# endif utf16

# rename sqlite3_open sqlite3_open_old
# proc sqlite3_open {fname options} {sqlite3_open_new $fname $options}

do_test capi3-3.1 {
  set db2 [sqlite3_open test.db {}]







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
  sqlite3_errcode $DB
} {SQLITE_ERROR}
do_test capi3-1.7 {
  sqlite3_errmsg $DB
} {no such column: namex}

ifcapable {utf16} {
  do_test capi3-2.1 {
    set sql16 [utf16 {SELECT name FROM sqlite_master}]
    set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL]
    sqlite3_finalize $STMT
    utf8 $::TAIL
  } {}
  do_test capi3-2.2 {
    set sql [utf16 {SELECT name FROM sqlite_master;SELECT 10}]
    set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
    sqlite3_finalize $STMT
    utf8 $TAIL
  } {SELECT 10}
  do_test capi3-2.3 {
    set sql [utf16 {SELECT namex FROM sqlite_master}]
    catch {
      set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
    }
  } {1}
  do_test capi3-2.4 {
    sqlite3_errcode $DB
  } {SQLITE_ERROR}
  do_test capi3-2.5 {
    sqlite3_errmsg $DB
  } {no such column: namex}
  do_test capi3-2.6 {
    execsql {CREATE TABLE tablename(x)}
    set sql16 [utf16 {PRAGMA table_info("TableName")}]
    set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
    sqlite3_step $STMT
  } SQLITE_ROW
  do_test capi3-2.7 {
    sqlite3_step $STMT
  } SQLITE_DONE
  do_test capi3-2.8 {
    sqlite3_finalize $STMT
  } SQLITE_OK
} ;# endif utf16

# rename sqlite3_open sqlite3_open_old
# proc sqlite3_open {fname options} {sqlite3_open_new $fname $options}

do_test capi3-3.1 {
  set db2 [sqlite3_open test.db {}]