/ Check-in [7cc65ae5]
Login

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

Overview
Comment:Add tests for sqlite3_column_count().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7cc65ae57183b3c16f1102fca5603a36acda432e5d45e22a2996e5ebe069fc6a
User & Date: dan 2021-02-15 14:32:05
Context
2021-02-15
17:02
Fix an issue with the LIKE operator when it includes the "ESCAPE '_'" clause. Ticket [c0aeea67d58ae0fd]. (check-in: 27d41179 user: drh tags: trunk)
14:55
Merge minor fixes from trunk. (check-in: d876b287 user: drh tags: with-generated-as)
14:32
Add tests for sqlite3_column_count(). (check-in: 7cc65ae5 user: dan tags: trunk)
13:17
Ensure that the ALTER TABLE statements return 0 for sqlite3_column_count(). (check-in: 29c1932a user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/columncount.test.



















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 2021 February 15
#
# 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 the sqlite3_column_count() API.
#

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

proc do_ccsql_test {tn sql res} {

  uplevel [list do_test $tn [subst -nocommands {
    set stmt [sqlite3_prepare_v2 db {$sql} -1 dummy]
    set res [sqlite3_column_count [set stmt]]
    while {[sqlite3_step [set stmt]]=="SQLITE_ROW"} {
      for {set i 0} {[set i] < [sqlite3_data_count [set stmt]]} {incr i} {
        lappend res [sqlite3_column_text [set stmt] [set i]]
      }
    }
  
    set rc [sqlite3_finalize [set stmt]]
    if {[set rc]!="SQLITE_OK"} {
      error [sqlite3_errmsg db]
    }

    set res
  }] [list {*}$res]]

}

do_execsql_test 1.0 {
  CREATE TABLE t1(x, y, z);
  INSERT INTO t1 VALUES('a', 'b', 'c');
}

do_ccsql_test 1.1 { SELECT * FROM t1 }      {3    a b c}
do_ccsql_test 1.2 { CREATE TABLE t2(a, b) } {0}

do_ccsql_test 1.3 { ALTER TABLE t2 RENAME TO t3 } {0}
do_ccsql_test 1.4 { ALTER TABLE t3 RENAME b TO ccc } {0}
do_ccsql_test 1.5 { ALTER TABLE t3 ADD COLUMN d } {0}

do_ccsql_test 1.6 { DROP TABLE t3 } {0}



finish_test