Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Have the dbstat module dequote any argument passed to the CREATE VIRTUAL TABLE statement before attempting to match it against the names of attached databases. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e60461e984b8df09256bb0d733dbfae5 |
User & Date: | dan 2016-01-22 15:44:07.317 |
Context
2016-01-22
| ||
17:48 | Add the sqlite3TokenInit() utility function. (check-in: 7323175337 user: drh tags: trunk) | |
15:44 | Have the dbstat module dequote any argument passed to the CREATE VIRTUAL TABLE statement before attempting to match it against the names of attached databases. (check-in: e60461e984 user: dan tags: trunk) | |
04:22 | Enable FTS4 when building the shell with the MSVC makefile. (check-in: e4c07df557 user: mistachkin tags: trunk) | |
Changes
Changes to src/dbstat.c.
︙ | ︙ | |||
145 146 147 148 149 150 151 | char **pzErr ){ StatTable *pTab = 0; int rc = SQLITE_OK; int iDb; if( argc>=4 ){ | > > > | > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | char **pzErr ){ StatTable *pTab = 0; int rc = SQLITE_OK; int iDb; if( argc>=4 ){ char *zDb = sqlite3DbStrDup(db, argv[3]); if( zDb==0 ) return SQLITE_NOMEM; sqlite3Dequote(zDb); iDb = sqlite3FindDbName(db, zDb); sqlite3DbFree(db, zDb); if( iDb<0 ){ *pzErr = sqlite3_mprintf("no such database: %s", argv[3]); return SQLITE_ERROR; } }else{ iDb = 0; } |
︙ | ︙ |
Changes to test/stat.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab||!compound { finish_test return } | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix stat ifcapable !vtab||!compound { finish_test return } |
︙ | ︙ | |||
179 180 181 182 183 184 185 186 187 | t1 /000+000000 3 overflow 0 1020 0 0 \ t1 /001+000000 4 overflow 0 1020 0 0 \ ] do_catchsql_test stat-6.1 { CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx); } {1 {no such database: mainx}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 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 | t1 /000+000000 3 overflow 0 1020 0 0 \ t1 /001+000000 4 overflow 0 1020 0 0 \ ] do_catchsql_test stat-6.1 { CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx); } {1 {no such database: mainx}} #------------------------------------------------------------------------- # Test that the argument passed to the dbstat constructor is dequoted # before it is matched against the names of attached databases. # forcedelete test.db2 do_execsql_test 7.1 { ATTACH 'test.db2' AS '123'; CREATE TABLE "123".x1(a, b); INSERT INTO x1 VALUES(1, 2); } do_execsql_test 7.1.1 { SELECT * FROM dbstat('123'); } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_execsql_test 7.1.2 { SELECT * FROM dbstat(123); } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_execsql_test 7.1.3 { CREATE VIRTUAL TABLE x2 USING dbstat('123'); SELECT * FROM x2; } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_execsql_test 7.1.4 { CREATE VIRTUAL TABLE x3 USING dbstat(123); SELECT * FROM x3; } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_execsql_test 7.2 { DETACH 123; DROP TABLE x2; DROP TABLE x3; ATTACH 'test.db2' AS '123corp'; } do_execsql_test 7.2.1 { SELECT * FROM dbstat('123corp'); } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_catchsql_test 7.2.2 { SELECT * FROM dbstat(123corp); } {1 {unrecognized token: "123corp"}} do_execsql_test 7.2.3 { CREATE VIRTUAL TABLE x2 USING dbstat('123corp'); SELECT * FROM x2; } { sqlite_master / 1 leaf 1 37 875 37 0 1024 x1 / 2 leaf 1 4 1008 4 1024 1024 } do_catchsql_test 7.2.4 { CREATE VIRTUAL TABLE x3 USING dbstat(123corp); SELECT * FROM x3; } {1 {unrecognized token: "123corp"}} finish_test |