Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests and fixes for SELECT multiplex_control(op, val); |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | multiplex-enhancements |
Files: | files | file ages | folders |
SHA1: |
fee9734c193a8bec9599e02e16938179 |
User & Date: | shaneh 2011-03-31 13:14:12.476 |
Original Comment: | Tests and bug fixes for SELECT multiplex_control(op, val); Add tests and fixes for SELECT multiplex_control(op, val); |
Context
2011-03-31
| ||
15:11 | Enable/disable support. (check-in: b3c6d9aa9e user: shaneh tags: multiplex-enhancements) | |
13:14 | Add tests and fixes for SELECT multiplex_control(op, val); (check-in: fee9734c19 user: shaneh tags: multiplex-enhancements) | |
05:31 | Additional test cases; Round chunk size up to a multiple of max page size; (check-in: 36e364a3fe user: shaneh tags: multiplex-enhancements) | |
Changes
Changes to src/test_multiplex.c.
︙ | ︙ | |||
201 202 203 204 205 206 207 | static void multiplexControlFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ extern const char *sqlite3TestErrorName(int); extern int multiplexFileControl(sqlite3_file *, int, void *); | > > | > | > > > > | | < > | | | | | | | | | | | | | | > | < | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | static void multiplexControlFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ extern const char *sqlite3TestErrorName(int); extern int multiplexFileControl(sqlite3_file *, int, void *); int rc = SQLITE_OK; sqlite3 *db = sqlite3_context_db_handle(context); int op; int iVal; if( !db || argc!=2 ){ rc = SQLITE_ERROR; }else{ /* extract params */ op = sqlite3_value_int(argv[0]); iVal = sqlite3_value_int(argv[1]); /* map function op to file_control op */ switch( op ){ case 1: op = MULTIPLEX_CTRL_ENABLE; break; case 2: op = MULTIPLEX_CTRL_SET_CHUNK_SIZE; break; case 3: op = MULTIPLEX_CTRL_SET_MAX_CHUNKS; break; default: rc = SQLITE_ERROR; break; } } if( rc==SQLITE_OK ){ rc = sqlite3_file_control(db, 0, op, &iVal); } sqlite3_result_text(context, (char *)sqlite3TestErrorName(rc), -1, SQLITE_TRANSIENT); } /* ** This is the entry point to register the auto-extension for the multiplex_control() function. */ static int multiplexFuncInit( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ int rc; rc = sqlite3_create_function(db, "multiplex_control", 2, SQLITE_ANY, 0, multiplexControlFunc, 0, 0); return rc; } /************************* VFS Method Wrappers *****************************/ /* ** This is the xOpen method used for the "multiplex" VFS. |
︙ | ︙ |
Changes to src/test_multiplex.h.
︙ | ︙ | |||
52 53 54 55 56 57 58 | ** Use the VFS named zOrigVfsName as the VFS that does the actual work. ** Use the default if zOrigVfsName==NULL. ** ** The multiplex VFS shim is named "multiplex". It will become the default ** VFS if makeDefault is non-zero. ** ** An auto-extension is registered which will make the function | | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | ** Use the VFS named zOrigVfsName as the VFS that does the actual work. ** Use the default if zOrigVfsName==NULL. ** ** The multiplex VFS shim is named "multiplex". It will become the default ** VFS if makeDefault is non-zero. ** ** An auto-extension is registered which will make the function ** multiplex_control() available to database connections. This ** function gives access to the xFileControl interface of the ** multiplex VFS shim. ** ** SELECT multiplex_control(<op>,<val>) ; ** ** <op>=1 MULTIPLEX_CTRL_ENABLE ** <val>=0 disable ** <val>=1 enable ** ** <op>=1 MULTIPLEX_CTRL_SET_CHUNK_SIZE ** <val> int, chunk size ** ** <op>=1 MULTIPLEX_CTRL_SET_MAX_CHUNKS ** <val> int, max chunks ** |
︙ | ︙ |
Changes to test/multiplex.test.
︙ | ︙ | |||
82 83 84 85 86 87 88 | do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK} do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_MISUSE} do_test multiplex-1.9.8 { db close } {} do_test multiplex-1.9.9 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.10.2 { sqlite3 db test.db } {} | < < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK} do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_MISUSE} do_test multiplex-1.9.8 { db close } {} do_test multiplex-1.9.9 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.10.2 { sqlite3 db test.db } {} do_test multiplex-1.10.3 { execsql { SELECT multiplex_control(2, 32768); } } {SQLITE_OK} do_test multiplex-1.10.4 { execsql { SELECT multiplex_control(3, -1); } } {SQLITE_MISUSE} do_test multiplex-1.10.5 { execsql { SELECT multiplex_control(2, -1); } } {SQLITE_MISUSE} do_test multiplex-1.10.6 { execsql { SELECT multiplex_control(2, 31); } } {SQLITE_OK} do_test multiplex-1.10.7 { execsql { SELECT multiplex_control(3, 100); } } {SQLITE_MISUSE} do_test multiplex-1.10.8 { db close } {} do_test multiplex-1.10.9 { sqlite3_multiplex_shutdown } {SQLITE_OK} #------------------------------------------------------------------------- # Some simple warm-body tests with a single database file in rollback # mode: # |
︙ | ︙ |