SQLite

Check-in [85483c8fb3]
Login

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

Overview
Comment:Add a test to verify that IN(...) WHERE clause terms are not handled by virtual table implemetations. (CVS 5221)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 85483c8fb3b45281ce07e84349841fc80e560b1f
User & Date: danielk1977 2008-06-16 06:31:35.000
Context
2008-06-16
14:19
Fix a problem with the incremental blob API. sqlite3_blob_open() was always reading the data for the leftmost column of the row that the opened blob was stored in. If this column happened to contain a (the) large blob, sqlite would make a large memory allocation to read the data into. Which defeats the purpose of using incremental blobs. (CVS 5222) (check-in: 1b9478da2f user: danielk1977 tags: trunk)
06:31
Add a test to verify that IN(...) WHERE clause terms are not handled by virtual table implemetations. (CVS 5221) (check-in: 85483c8fb3 user: danielk1977 tags: trunk)
2008-06-15
02:51
Continuing work on the new memory allocation subsystem. Added routines for temporary memory allocation. Right the btree balance mechanism to only do one temporary allocation at a time. (CVS 5220) (check-in: 65fe7b62cf user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/vtab1.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2006 June 10
#
# 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 creating and dropping virtual tables.
#
# $Id: vtab1.test,v 1.52 2008/04/10 16:42:59 drh Exp $

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

ifcapable !vtab||!schema_pragmas {
  finish_test
  return













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2006 June 10
#
# 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 creating and dropping virtual tables.
#
# $Id: vtab1.test,v 1.53 2008/06/16 06:31:35 danielk1977 Exp $

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

ifcapable !vtab||!schema_pragmas {
  finish_test
  return
36
37
38
39
40
41
42


43
44
45
46
47
48
49
#
# This file uses the "echo" module (see src/test8.c). Refer to comments
# in that file for the special behaviour of the Tcl $echo_module variable.
#
# TODO: 
#   * How to test the sqlite3_index_constraint_usage.omit field?
#   * vtab1-5.*


#


#----------------------------------------------------------------------
# Test cases vtab1.1.*
#








>
>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# This file uses the "echo" module (see src/test8.c). Refer to comments
# in that file for the special behaviour of the Tcl $echo_module variable.
#
# TODO: 
#   * How to test the sqlite3_index_constraint_usage.omit field?
#   * vtab1-5.*
#
# vtab1-14.*: Test 'IN' constraints - i.e. "SELECT * FROM t1 WHERE id IN(...)"
#


#----------------------------------------------------------------------
# Test cases vtab1.1.*
#

1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
do_test vtab1.12-2 {
  catchsql { INSERT INTO echo_c SELECT * FROM b; }
} {1 {constraint failed}}
do_test vtab1.12-3 {
  execsql { SELECT * FROM c }
} {3 G H}

breakpoint

# Now the real test - wrapped in a transaction.
do_test vtab1.12-4 {
  execsql  {BEGIN}
  catchsql { INSERT INTO echo_c SELECT * FROM b; }
} {1 {constraint failed}}
do_test vtab1.12-5 {
  execsql { SELECT * FROM c }







<
<







1008
1009
1010
1011
1012
1013
1014


1015
1016
1017
1018
1019
1020
1021
do_test vtab1.12-2 {
  catchsql { INSERT INTO echo_c SELECT * FROM b; }
} {1 {constraint failed}}
do_test vtab1.12-3 {
  execsql { SELECT * FROM c }
} {3 G H}



# Now the real test - wrapped in a transaction.
do_test vtab1.12-4 {
  execsql  {BEGIN}
  catchsql { INSERT INTO echo_c SELECT * FROM b; }
} {1 {constraint failed}}
do_test vtab1.12-5 {
  execsql { SELECT * FROM c }
1051
1052
1053
1054
1055
1056
1057


























1058
1059
} {15 {} 16}
do_test vtab1.13-3 {
  execsql { 
    SELECT * FROM echo_c WHERE b IS NULL AND a = 15;
  }
} {15 {} 16}



























unset -nocomplain echo_module_begin_fail
finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
} {15 {} 16}
do_test vtab1.13-3 {
  execsql { 
    SELECT * FROM echo_c WHERE b IS NULL AND a = 15;
  }
} {15 {} 16}


do_test vtab1-14.1 {
  execsql { DELETE FROM c }
  set echo_module ""
  execsql { SELECT * FROM echo_c WHERE rowid IN (1, 2, 3) }
  set echo_module
} [list xBestIndex {SELECT rowid, * FROM 'c'} xFilter {SELECT rowid, * FROM 'c'}]

do_test vtab1-14.2 {
  set echo_module ""
  execsql { SELECT * FROM echo_c WHERE rowid = 1 }
  set echo_module
} [list xBestIndex {SELECT rowid, * FROM 'c' WHERE rowid = ?} xFilter {SELECT rowid, * FROM 'c' WHERE rowid = ?} 1]

do_test vtab1-14.3 {
  set echo_module ""
  execsql { SELECT * FROM echo_c WHERE a = 1 }
  set echo_module
} [list xBestIndex {SELECT rowid, * FROM 'c' WHERE a = ?} xFilter {SELECT rowid, * FROM 'c' WHERE a = ?} 1]

do_test vtab1-14.4 {
  set echo_module ""
  execsql { SELECT * FROM echo_c WHERE a IN (1, 2) }
  set echo_module
} [list xBestIndex {SELECT rowid, * FROM 'c'} xFilter {SELECT rowid, * FROM 'c'}]

unset -nocomplain echo_module_begin_fail
finish_test