Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tweaks to the test_intarray documentation and tests. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7107f0dacf4467430d1ca157cb848dde |
User & Date: | drh 2018-10-31 18:24:29.283 |
Context
2018-10-31
| ||
19:01 | Add support for the SQLITE_PREPARE_NORMALIZED flag and the sqlite3_normalized_sql() when compiling with SQLITE_ENABLE_NORMALIZE. Also remove unnecessary whitespace from Makefiles. (check-in: 790ea39a65 user: drh tags: trunk) | |
18:24 | Tweaks to the test_intarray documentation and tests. (check-in: 7107f0dacf user: drh tags: trunk) | |
01:12 | Merge fuzz test cases computed by dbfuzz2. (check-in: e0d30c1862 user: drh tags: trunk) | |
Changes
Changes to src/test_intarray.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file implements a read-only VIRTUAL TABLE that contains the ** content of a C-language array of integer values. See the corresponding ** header file for full details. */ #include "test_intarray.h" #include <string.h> #include <assert.h> /* | > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file implements a read-only VIRTUAL TABLE that contains the ** content of a C-language array of integer values. See the corresponding ** header file for full details. ** ** This virtual table is used for internal testing of SQLite only. It is ** not recommended for use in production. For a similar virtual table that ** is production-ready, see the "carray" virtual table over in ext/misc. */ #include "test_intarray.h" #include <string.h> #include <assert.h> /* |
︙ | ︙ | |||
311 312 313 314 315 316 317 | } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zName = Tcl_GetString(objv[2]); #ifndef SQLITE_OMIT_VIRTUALTABLE rc = sqlite3_intarray_create(db, zName, &pArray); #endif if( rc!=SQLITE_OK ){ | < | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; zName = Tcl_GetString(objv[2]); #ifndef SQLITE_OMIT_VIRTUALTABLE rc = sqlite3_intarray_create(db, zName, &pArray); #endif if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, sqlite3ErrName(rc), (char*)0); return TCL_ERROR; } sqlite3TestMakePointerStr(interp, zPtr, pArray); Tcl_AppendResult(interp, zPtr, (char*)0); return TCL_OK; } |
︙ | ︙ |
Changes to src/test_intarray.h.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This is the C-language interface definition for the "intarray" or ** integer array virtual table for SQLite. ** ** The intarray virtual table is designed to facilitate using an ** array of integers as the right-hand side of an IN operator. So ** instead of doing a prepared statement like this: ** ** SELECT * FROM table WHERE x IN (?,?,?,...,?); ** ** And then binding indivdual integers to each of ? slots, a C-language | > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This is the C-language interface definition for the "intarray" or ** integer array virtual table for SQLite. ** ** This virtual table is used for internal testing of SQLite only. It is ** not recommended for use in production. For a similar virtual table that ** is production-ready, see the "carray" virtual table over in ext/misc. ** ** The intarray virtual table is designed to facilitate using an ** array of integers as the right-hand side of an IN operator. So ** instead of doing a prepared statement like this: ** ** SELECT * FROM table WHERE x IN (?,?,?,...,?); ** ** And then binding indivdual integers to each of ? slots, a C-language |
︙ | ︙ | |||
68 69 70 71 72 73 74 | ** longer needed. The application must not change the intarray values ** while an intarray is in the middle of a query. ** ** The intarray object is automatically destroyed when its corresponding ** virtual table is dropped. Since the virtual tables are created in the ** TEMP database, they are automatically dropped when the database connection ** closes so the application does not normally need to take any special | | > > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | ** longer needed. The application must not change the intarray values ** while an intarray is in the middle of a query. ** ** The intarray object is automatically destroyed when its corresponding ** virtual table is dropped. Since the virtual tables are created in the ** TEMP database, they are automatically dropped when the database connection ** closes so the application does not normally need to take any special ** action to free the intarray objects. Because of the way virtual tables ** work and the (somewhat goofy) way that the intarray virtual table is ** implemented, it is not allowed to invoke sqlite3_intarray_create(D,N,P) ** more than once with the same D and N values. */ #include "sqlite3.h" #ifndef SQLITE_INTARRAY_H #define SQLITE_INTARRAY_H /* ** Make sure we can call this stuff from C++. |
︙ | ︙ |
Changes to test/intarray.test.
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | set ia3 [sqlite3_intarray_create db ia3] set ia4 [sqlite3_intarray_create db ia4] db eval { SELECT type, name FROM temp.sqlite_master ORDER BY name } } {table ia1 table ia2 table ia3 table ia4} do_test intarray-1.2 { db eval { SELECT b FROM t1 WHERE a IN ia3 ORDER BY a } } {} | > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | set ia3 [sqlite3_intarray_create db ia3] set ia4 [sqlite3_intarray_create db ia4] db eval { SELECT type, name FROM temp.sqlite_master ORDER BY name } } {table ia1 table ia2 table ia3 table ia4} # Verify the inability to DROP and recreate an intarray virtual table. do_test intarray-1.1b { db eval {DROP TABLE ia1} set rc [catch {sqlite3_intarray_create db ia1} msg] lappend rc $msg } {1 SQLITE_MISUSE} do_test intarray-1.2 { db eval { SELECT b FROM t1 WHERE a IN ia3 ORDER BY a } } {} |
︙ | ︙ |