Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the "multiplex_truncate" PRAGMA to the multiplexor extension, for querying and setting the truncate flag on a database connection. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d2962a5f388f30a02429e0c8b87399f4 |
User & Date: | drh 2014-09-23 18:30:00.961 |
Context
2014-09-23
| ||
21:25 | Simplify the CellInfo structure for a size reduction and performance improvement. (check-in: bf59df66b3 user: drh tags: trunk) | |
18:30 | Add the "multiplex_truncate" PRAGMA to the multiplexor extension, for querying and setting the truncate flag on a database connection. (check-in: d2962a5f38 user: drh tags: trunk) | |
01:40 | Adjust skip-scan cost estimates slightly so that a full table scan is preferred over a skip-scan to a column with only two distinct values. (check-in: ae9a42b268 user: drh tags: trunk) | |
Changes
Changes to src/test_multiplex.c.
︙ | ︙ | |||
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | rc = SQLITE_OK; break; case SQLITE_FCNTL_SIZE_HINT: case SQLITE_FCNTL_CHUNK_SIZE: /* no-op these */ rc = SQLITE_OK; break; default: pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL, 0); if( pSubOpen ){ rc = pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg); if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){ *(char**)pArg = sqlite3_mprintf("multiplex/%z", *(char**)pArg); } | > > > > > > > > > > > > > > > > > > > > | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | rc = SQLITE_OK; break; case SQLITE_FCNTL_SIZE_HINT: case SQLITE_FCNTL_CHUNK_SIZE: /* no-op these */ rc = SQLITE_OK; break; case SQLITE_FCNTL_PRAGMA: { char **aFcntl = (char**)pArg; if( aFcntl[1] && sqlite3_stricmp(aFcntl[1],"multiplex_truncate")==0 ){ if( aFcntl[2] && aFcntl[2][0] ){ if( sqlite3_stricmp(aFcntl[2], "on")==0 || sqlite3_stricmp(aFcntl[2], "1")==0 ){ pGroup->bTruncate = 1; }else if( sqlite3_stricmp(aFcntl[2], "off")==0 || sqlite3_stricmp(aFcntl[2], "0")==0 ){ pGroup->bTruncate = 0; } } aFcntl[0] = sqlite3_mprintf(pGroup->bTruncate ? "on" : "off"); rc = SQLITE_OK; break; } /* If the multiplexor does not handle the pragma, pass it through ** into the default case. */ } default: pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL, 0); if( pSubOpen ){ rc = pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg); if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){ *(char**)pArg = sqlite3_mprintf("multiplex/%z", *(char**)pArg); } |
︙ | ︙ |
Added test/multiplex4.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # 2014-09-25 # # 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 contains tests for the "truncate" option in the multiplexor. # set testdir [file dirname $argv0] source $testdir/tester.tcl set ::testprefix multiplex4 db close sqlite3_shutdown sqlite3_multiplex_initialize {} 0 # delete all filesl with the base name of $basename # proc multiplex_delete_db {basename} { foreach file [glob -nocomplain $basename.*] { forcedelete $file } } # Return a sorted list of all files with the base name of $basename. # Except, delete all text from the end of $basename through the NNN # suffix on the end of the filename. # proc multiplex_file_list {basename} { set x {} foreach file [glob -nocomplain $basename.*] { regsub "^$basename\\..*(\\d\\d\\d)\$" $file $basename.\\1 file lappend x $file } return [lsort $x] } do_test multiplex4-1.0 { multiplex_delete_db mx4test sqlite3 db {file:mx4test.db?chunksize=10&truncate=1} -uri 1 -vfs multiplex db eval { CREATE TABLE t1(x); INSERT INTO t1(x) VALUES(randomblob(250000)); } multiplex_file_list mx4test } {mx4test.001 mx4test.db} do_test multiplex4-1.1 { db eval { DELETE FROM t1; VACUUM; } multiplex_file_list mx4test } {mx4test.db} do_test multiplex4-1.2 { db eval {PRAGMA multiplex_truncate} } {on} do_test multiplex4-1.3 { db eval {PRAGMA multiplex_truncate=off} } {off} do_test multiplex4-1.4 { db eval {PRAGMA multiplex_truncate} } {off} do_test multiplex4-1.5 { db eval {PRAGMA multiplex_truncate=on} } {on} do_test multiplex4-1.6 { db eval {PRAGMA multiplex_truncate} } {on} do_test multiplex4-1.7 { db eval {PRAGMA multiplex_truncate=0} } {off} do_test multiplex4-1.8 { db eval {PRAGMA multiplex_truncate=1} } {on} do_test multiplex4-1.9 { db eval {PRAGMA multiplex_truncate=0} } {off} do_test multiplex4-1.10 { db eval { INSERT INTO t1(x) VALUES(randomblob(250000)); } multiplex_file_list mx4test } {mx4test.001 mx4test.db} do_test multiplex4-1.11 { db eval { DELETE FROM t1; VACUUM; } multiplex_file_list mx4test } {mx4test.001 mx4test.db} do_test multiplex4-1.12 { db eval { PRAGMA multiplex_truncate=ON; DROP TABLE t1; VACUUM; } multiplex_file_list mx4test } {mx4test.db} catch { db close } forcedelete mx4test.db sqlite3_multiplex_shutdown finish_test |