/ Check-in [85e3c734]
Login

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

Overview
Comment:Fixed some TCL test cases to work if SQLITE_OMIT_TRIGGER is defined.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 85e3c73497d72d09becf728efe81041277ca1730
User & Date: shaneh 2009-12-17 22:12:52
Context
2009-12-17
22:17
Modified statement machine in sqlite3_complete() to return 0 on empty string. Added/updated tests for same. Ticket [356c885b0b]. check-in: 76eca729 user: shaneh tags: trunk
22:12
Fixed some TCL test cases to work if SQLITE_OMIT_TRIGGER is defined. check-in: 85e3c734 user: shaneh tags: trunk
21:07
Updated and added new test cases for CLI. check-in: 29e3c8da user: shaneh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/tester.tcl.

956
957
958
959
960
961
962

963
964

965
966
967
968
969
970

971

972
973
974
975
976
977
978
979
    close $t
    close $f
  }
}

# Drop all tables in database [db]
proc drop_all_tables {{db db}} {

  set pk [$db one "PRAGMA foreign_keys"]
  $db eval "PRAGMA foreign_keys = OFF"

  foreach {t type} [$db eval {
    SELECT name, type FROM sqlite_master 
    WHERE type IN('table', 'view') AND name NOT like 'sqlite_%'
  }] {
    $db eval "DROP $type $t"
  }

  $db eval " PRAGMA foreign_keys = $pk "

}


# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)

source $testdir/thread_common.tcl







>
|
|
>






>
|
>








956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
    close $t
    close $f
  }
}

# Drop all tables in database [db]
proc drop_all_tables {{db db}} {
  ifcapable trigger&&foreignkey {
    set pk [$db one "PRAGMA foreign_keys"]
    $db eval "PRAGMA foreign_keys = OFF"
  }
  foreach {t type} [$db eval {
    SELECT name, type FROM sqlite_master 
    WHERE type IN('table', 'view') AND name NOT like 'sqlite_%'
  }] {
    $db eval "DROP $type $t"
  }
  ifcapable trigger&&foreignkey {
    $db eval "PRAGMA foreign_keys = $pk"
  }
}


# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)

source $testdir/thread_common.tcl

Changes to test/trace.test.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156
157
158
...
231
232
233
234
235
236
237
238
239
240
241
242
243
db close
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
do_test trace-2.1 {
  set STMT [sqlite3_prepare $DB {INSERT INTO t1 VALUES(2,3)} -1 TAIL]
  db trace trace_proc
  proc trace_proc sql {
    global TRACE_OUT
    set TRACE_OUT $sql
  }
  set TRACE_OUT {}
  sqlite3_step $STMT
  set TRACE_OUT
} {INSERT INTO t1 VALUES(2,3)}
do_test trace-2.2 {
  set TRACE_OUT {}
  sqlite3_reset $STMT
  set TRACE_OUT 
} {}
do_test trace-2.3 {
  sqlite3_step $STMT
  set TRACE_OUT
} {INSERT INTO t1 VALUES(2,3)}
do_test trace-2.4 {

  execsql {SELECT * FROM t1}
} {1 2 2 3 2 3}
do_test trace-2.5 {
  set TRACE_OUT
} {SELECT * FROM t1}
catch {sqlite3_finalize $STMT}

do_test trace-2.6 {
  set TRACE_OUT {}
  db eval VACUUM
  set TRACE_OUT
} {VACUUM}
................................................................................
db close
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
do_test trace-4.1 {
  set STMT [sqlite3_prepare $DB {INSERT INTO t2 VALUES(2,3)} -1 TAIL]
  db trace trace_proc
  proc profile_proc {sql tm} {
    global TRACE_OUT
    set TRACE_OUT $sql
  }
  set TRACE_OUT {}
  sqlite3_step $STMT
  set TRACE_OUT
} {INSERT INTO t2 VALUES(2,3)}
do_test trace-4.2 {
  set TRACE_OUT {}
  sqlite3_reset $STMT
  set TRACE_OUT 
} {}
do_test trace-4.3 {
  sqlite3_step $STMT
  set TRACE_OUT
} {INSERT INTO t2 VALUES(2,3)}
do_test trace-4.4 {

  execsql {SELECT * FROM t1}
} {1 2 2 3 2 3}
do_test trace-4.5 {
  set TRACE_OUT
} {SELECT * FROM t1}
catch {sqlite3_finalize $STMT}

# Trigger tracing.
#
ifcapable trigger {
  do_test trace-5.1 {
    db eval {
................................................................................
     CREATE TABLE t6([$::t6str],"?1");
     INSERT INTO t6 VALUES(1,2);
  }
  db trace trace_proc
  set TRACE_OUT {}
  execsql {SELECT '$::t6str', [$::t6str], $::t6str, ?1, "?1", $::t6str FROM t6}
} {{$::t6str} 1 {test-six y'all} {test-six y'all} 2 {test-six y'all}}
do_test trace-6.101 {
  set TRACE_OUT
} {{SELECT '$::t6str', [$::t6str], 'test-six y''all', 'test-six y''all', "?1", 'test-six y''all' FROM t6}}


finish_test







|




|








|

>




|







 







|




|








|

>




|







 







|





55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
...
233
234
235
236
237
238
239
240
241
242
243
244
245
db close
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
do_test trace-2.1 {
  set STMT [sqlite3_prepare $DB {INSERT INTO t1 VALUES(2,3)} -1 TAIL]
  db trace trace_proc
  proc trace_proc sql {
    global TRACE_OUT
    lappend TRACE_OUT [string trim $sql]
  }
  set TRACE_OUT {}
  sqlite3_step $STMT
  set TRACE_OUT
} {{INSERT INTO t1 VALUES(2,3)}}
do_test trace-2.2 {
  set TRACE_OUT {}
  sqlite3_reset $STMT
  set TRACE_OUT 
} {}
do_test trace-2.3 {
  sqlite3_step $STMT
  set TRACE_OUT
} {{INSERT INTO t1 VALUES(2,3)}}
do_test trace-2.4 {
  set TRACE_OUT {}
  execsql {SELECT * FROM t1}
} {1 2 2 3 2 3}
do_test trace-2.5 {
  set TRACE_OUT
} {{SELECT * FROM t1}}
catch {sqlite3_finalize $STMT}

do_test trace-2.6 {
  set TRACE_OUT {}
  db eval VACUUM
  set TRACE_OUT
} {VACUUM}
................................................................................
db close
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
do_test trace-4.1 {
  set STMT [sqlite3_prepare $DB {INSERT INTO t2 VALUES(2,3)} -1 TAIL]
  db trace trace_proc
  proc profile_proc {sql tm} {
    global TRACE_OUT
    lappend TRACE_OUT [string trim $sql]
  }
  set TRACE_OUT {}
  sqlite3_step $STMT
  set TRACE_OUT
} {{INSERT INTO t2 VALUES(2,3)}}
do_test trace-4.2 {
  set TRACE_OUT {}
  sqlite3_reset $STMT
  set TRACE_OUT 
} {}
do_test trace-4.3 {
  sqlite3_step $STMT
  set TRACE_OUT
} {{INSERT INTO t2 VALUES(2,3)}}
do_test trace-4.4 {
  set TRACE_OUT {}
  execsql {SELECT * FROM t1}
} {1 2 2 3 2 3}
do_test trace-4.5 {
  set TRACE_OUT
} {{SELECT * FROM t1}}
catch {sqlite3_finalize $STMT}

# Trigger tracing.
#
ifcapable trigger {
  do_test trace-5.1 {
    db eval {
................................................................................
     CREATE TABLE t6([$::t6str],"?1");
     INSERT INTO t6 VALUES(1,2);
  }
  db trace trace_proc
  set TRACE_OUT {}
  execsql {SELECT '$::t6str', [$::t6str], $::t6str, ?1, "?1", $::t6str FROM t6}
} {{$::t6str} 1 {test-six y'all} {test-six y'all} 2 {test-six y'all}}
do_test trace-6.201 {
  set TRACE_OUT
} {{SELECT '$::t6str', [$::t6str], 'test-six y''all', 'test-six y''all', "?1", 'test-six y''all' FROM t6}}


finish_test