/ Check-in [bcef48c5]
Login

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

Overview
Comment:Test cases for accessing virtual tables when the corresponding module is undefined. (CVS 3279)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bcef48c54dd01cf089db16192e670cb0717988ac
User & Date: danielk1977 2006-06-21 07:34:11
Context
2006-06-21
12:36
Add tests to make sure altering or adding an index to a virtual table is prohibited. (CVS 3280) check-in: 6c3e8852 user: danielk1977 tags: trunk
07:34
Test cases for accessing virtual tables when the corresponding module is undefined. (CVS 3279) check-in: bcef48c5 user: danielk1977 tags: trunk
07:02
Fix a problem with virtual tables and joins. (CVS 3278) check-in: 643e63e5 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
....
1901
1902
1903
1904
1905
1906
1907



1908
1909
1910
1911
1912
1913
1914
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.405 2006/06/20 11:01:07 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.
................................................................................
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_VIEW;
      }else{
        code = SQLITE_DROP_VIEW;
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    }else if( IsVirtual(pTab) ){



      code = SQLITE_DROP_VTABLE;
      zArg2 = pTab->pMod->zName;
#endif
    }else{
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_TABLE;
      }else{







|







 







>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
....
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.406 2006/06/21 07:34:11 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.
................................................................................
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_VIEW;
      }else{
        code = SQLITE_DROP_VIEW;
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    }else if( IsVirtual(pTab) ){
      if( sqlite3ViewGetColumnNames(pParse, pTab) ){
        goto exit_drop_table;
      }
      code = SQLITE_DROP_VTABLE;
      zArg2 = pTab->pMod->zName;
#endif
    }else{
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_TABLE;
      }else{

Changes to test/vtab1.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
113
114
115
116
117
118
119














































120
121
122
123
124
125
126
#    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.25 2006/06/21 07:02:34 danielk1977 Exp $

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

ifcapable !vtab||!schema_pragmas {
  finish_test
  return
................................................................................
} {1 {table treal already exists}}
do_test vtab1-1.9 {
  execsql {
    DROP TABLE treal;
    SELECT name FROM sqlite_master ORDER BY 1
  }
} {}















































#----------------------------------------------------------------------
# Test cases vtab1.2.*
#
# At this point, the database is completely empty. The echo module
# has already been registered.








|







 







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







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
113
114
115
116
117
118
119
120
121
122
123
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#    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.26 2006/06/21 07:34:11 danielk1977 Exp $

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

ifcapable !vtab||!schema_pragmas {
  finish_test
  return
................................................................................
} {1 {table treal already exists}}
do_test vtab1-1.9 {
  execsql {
    DROP TABLE treal;
    SELECT name FROM sqlite_master ORDER BY 1
  }
} {}

do_test vtab1-1.10 {
  execsql {
    CREATE TABLE treal(a, b, c);
    CREATE VIRTUAL TABLE techo USING echo(treal);
  }
  db close
  sqlite3 db test.db
  catchsql {
    SELECT * FROM techo;
  }
} {1 {no such module: echo}}
do_test vtab1-1.11 {
  catchsql {
    INSERT INTO techo VALUES(1, 2, 3);
  }
} {1 {no such module: echo}}
do_test vtab1-1.12 {
  catchsql {
    UPDATE techo SET a = 10;
  }
} {1 {no such module: echo}}
do_test vtab1-1.13 {
  catchsql {
    DELETE FROM techo;
  }
} {1 {no such module: echo}}
do_test vtab1-1.14 {
  catchsql {
    PRAGMA table_info(techo)
  }
} {1 {no such module: echo}}
do_test vtab1-1.15 {
  catchsql {
    DROP TABLE techo;
  }
} {1 {no such module: echo}}

register_echo_module [sqlite3_connection_pointer db]
do_test vtab1-1.X {
  execsql {
    DROP TABLE techo;
    DROP TABLE treal;
    SELECT sql FROM sqlite_master;
  }
} {}

#----------------------------------------------------------------------
# Test cases vtab1.2.*
#
# At this point, the database is completely empty. The echo module
# has already been registered.