Compare commits

...

1 Commits

Author SHA1 Message Date
drh 6d5dbf45d5 Add new output columns to the "PRAGMA database_list" statement.
FossilOrigin-Name: 905085a75d49af972f0c6ec39ce29c575870261c10d3a68b85515d3c4ae16cf0
2021-05-10 13:28:45 +00:00
11 changed files with 109 additions and 85 deletions
+17 -14
View File
@@ -1,5 +1,5 @@
C Enable\sthe\ssqlite3_serialize()\sand\ssqlite3_deserialize()\sinterfaces\sby\ndefault.\s\sOmit\sthe\sSQLITE_ENABLE_DESERIALIZE\soption\sand\sreplace\sit\swith\nthe\sSQLITE_OMIT_DESERIALIZE\soption.
D 2021-05-08T17:18:23.807
C Add\snew\soutput\scolumns\sto\sthe\s"PRAGMA\sdatabase_list"\sstatement.
D 2021-05-10T13:28:45.694
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,8 +536,8 @@ F src/parse.y ac294bd2891c4310b0b23a67ea3bbca2d0bf5b7662c4444b6517c3986be4a437
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 388304fd2d91c39591080b5e0f3c62cfba87db20370e7e0554062bfb29740e9f
F src/pragma.c eb42cb9bec189cf18cef5d8fcae56e13bb73ef2b019b198fb48740ced81bce95
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/pragma.c e9b9ea5ff009af7ebe221b45a9b916a7513d00342b959af71be50f21a0251eab
F src/pragma.h bcc7d8fd7c2aad93fc9e4170f1e17bb8e4ea48aa27a19f2caebb2ba95eca3b2a
F src/prepare.c d778af9986f3b0107c5b255dcfe2696e8e99e00fb77c5115bbfea4e92c3302e7
F src/printf.c 78fabb49b9ac9a12dd1c89d744abdc9b67fd3205e62967e158f78b965a29ec4b
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
@@ -684,12 +684,12 @@ F test/atof1.test 10049623e77006691c4c2978c1dc8a3f75276377a53417811aa85bda7493f9
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
F test/atrc.c c388fac43dbba05c804432a7135ae688b32e8f25818e9994ffba4b64cf60c27c
F test/attach.test 54f8e49e88d0de48f6428267a678465863d2b8f72320612f35bd5c02e240bc2f
F test/attach2.test 256bd240da1835fb8408dd59fb7ef71f8358c7a756c46662434d11d07ba3a0ce
F test/attach3.test c59d92791070c59272e00183b7353eeb94915976
F test/attach.test 3a0e14ca69a31c137c6b42054094101a6f51aaf3fcda07b4604767d833dfc649
F test/attach2.test 4a7e6750a4182c8ed757f9622a122b5e581049390495a6726b3387b32c22b557
F test/attach3.test d27f735d496341299d982f1cb537ecde938279856acaa845c46d928254bf04e6
F test/attach4.test 00e754484859998d124d144de6d114d920f2ed6ca2f961e6a7f4183c714f885e
F test/attachmalloc.test 12c4f028e570acf9e0a4b0b7fe6f536e21f3d5ebddcece423603d0569beaf438
F test/auth.test 2154625c05bc79f0e0ea72cb2358395a8041243caa0fd7ce7617d50da4331794
F test/auth.test ac0bcee1c25de98939aeaca00760889d54782a745b4317d046c52905403559d5
F test/auth2.test 9eb7fce9f34bf1f50d3f366fb3e606be5a2000a1
F test/auth3.test db21405b95257c24d29273b6b31d0efc59e1d337e3d5804ba2d1fd4897b1ae49
F test/autoanalyze1.test b9cc3f32a990fa56669b668d237c6d53e983554ae80c0604992e18869a0b2dec
@@ -1267,7 +1267,7 @@ F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 9bb03106a024e9938d329a33380ea7fd91b6e45516881db68663505c444b3242
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 50b91bedea9324d3ab48e793f908ee7d2c7dcf84bfa2281e792838be59641ec8
F test/pragma.test 7abc3484f4f28167bb6f3ca970654f4667a065fa041eee2ebffeeb6aac6698c3
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31
F test/pragma4.test ca5e4dfc46adfe490f75d73734f70349d95a199e6510973899e502eef2c8b1f8
@@ -1450,7 +1450,7 @@ F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptable2.test d2940417496e2b9548e01d09990763fbe88c316504033256d51493e1f1a5ce6a
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 19d2a19a6dd55a2b4e2b943963959a05a2c088495dd5f5274b04e0494ce86d66
F test/tester.tcl 26dc337cf2ba689341d3aa9b776d5fe5217f2ca616aff9e8a68e3346bf63af73
F test/thread001.test b61a29dd87cf669f5f6ac96124a7c97d71b0c80d9012746072055877055cf9ef
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
@@ -1845,7 +1845,7 @@ F tool/mkmsvcmin.tcl 6ecab9fe22c2c8de4d82d4c46797bda3d2deac8e763885f5a38d0c44a89
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
F tool/mkpragmatab.tcl ae5585ae76ca26e4d6ccd5ea9cdebaf5efefb318bf989497a0e846cd711d9ab1
F tool/mkpragmatab.tcl 07c4824ea95b9a227a45a26eb4fe81d58d3cef3b547c0c239e45a686c2df4a9c
F tool/mkshellc.tcl 70a9978e363b0f3280ca9ce1c46d72563ff479c1930a12a7375e3881b7325712
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
@@ -1912,7 +1912,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 560753148a16a0032477e379af6f62d9357f69847f351cc9db6021ce1b5594ea
R 2599a26d56e1db68b4bf98f53c8053f1
P 6df3b03e00b1143be8fed3a39a58ce81063020275aa1ac13d87c84f1ceda6e27
R ccedc333aa022ce5152db1245c968af0
T *branch * database-list-enhancement
T *sym-database-list-enhancement *
T -sym-trunk *
U drh
Z aabbbb00e74a256a0714c7d678ee3f12
Z 86a5dc1ef0c4a4f975a19dcf0eef9146
+1 -1
View File
@@ -1 +1 @@
6df3b03e00b1143be8fed3a39a58ce81063020275aa1ac13d87c84f1ceda6e27
905085a75d49af972f0c6ec39ce29c575870261c10d3a68b85515d3c4ae16cf0
+19 -3
View File
@@ -1287,14 +1287,30 @@ void sqlite3Pragma(
case PragTyp_DATABASE_LIST: {
int i;
pParse->nMem = 3;
Pager *pPager;
char *zVfsname;
sqlite3_file *fd;
pParse->nMem = 7;
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt==0 ) continue;
assert( db->aDb[i].zDbSName!=0 );
sqlite3VdbeMultiLoad(v, 1, "iss",
assert( sqlite3BtreeHoldsMutex(db->aDb[i].pBt) );
pPager = sqlite3BtreePager(db->aDb[i].pBt);
assert( pPager!=0 );
fd = sqlite3PagerFile(pPager);
assert( fd!=0 );
zVfsname = 0;
sqlite3OsFileControl(fd, SQLITE_FCNTL_VFSNAME, &zVfsname);
sqlite3VdbeMultiLoad(v, 1, "issssii",
i,
db->aDb[i].zDbSName,
sqlite3BtreeGetFilename(db->aDb[i].pBt));
sqlite3BtreeGetFilename(db->aDb[i].pBt),
zVfsname,
sqlite3JournalModename(sqlite3PagerGetJournalMode(pPager)),
sqlite3PagerIsreadonly(pPager),
sqlite3BtreeGetPageSize(db->aDb[i].pBt)
);
sqlite3_free(zVfsname);
}
}
break;
+54 -50
View File
@@ -81,46 +81,50 @@ static const char *const pragCName[] = {
/* 12 */ "dflt_value",
/* 13 */ "pk",
/* 14 */ "hidden",
/* 15 */ "seq", /* Used by: database_list */
/* 16 */ "name",
/* 17 */ "file",
/* 18 */ "vfs",
/* 19 */ "jmode",
/* 20 */ "ro",
/* 21 */ "pgsz",
/* table_info reuses 8 */
/* 15 */ "seqno", /* Used by: index_xinfo */
/* 16 */ "cid",
/* 17 */ "name",
/* 18 */ "desc",
/* 19 */ "coll",
/* 20 */ "key",
/* 21 */ "name", /* Used by: function_list */
/* 22 */ "builtin",
/* 23 */ "type",
/* 24 */ "enc",
/* 25 */ "narg",
/* 26 */ "flags",
/* 27 */ "tbl", /* Used by: stats */
/* 28 */ "idx",
/* 29 */ "wdth",
/* 30 */ "hght",
/* 31 */ "flgs",
/* 32 */ "seq", /* Used by: index_list */
/* 33 */ "name",
/* 34 */ "unique",
/* 35 */ "origin",
/* 36 */ "partial",
/* 37 */ "table", /* Used by: foreign_key_check */
/* 38 */ "rowid",
/* 39 */ "parent",
/* 40 */ "fkid",
/* index_info reuses 15 */
/* 41 */ "seq", /* Used by: database_list */
/* 42 */ "name",
/* 43 */ "file",
/* 44 */ "busy", /* Used by: wal_checkpoint */
/* 45 */ "log",
/* 46 */ "checkpointed",
/* collation_list reuses 32 */
/* 47 */ "database", /* Used by: lock_status */
/* 48 */ "status",
/* 49 */ "cache_size", /* Used by: default_cache_size */
/* 22 */ "seqno", /* Used by: index_xinfo */
/* 23 */ "cid",
/* 24 */ "name",
/* 25 */ "desc",
/* 26 */ "coll",
/* 27 */ "key",
/* 28 */ "name", /* Used by: function_list */
/* 29 */ "builtin",
/* 30 */ "type",
/* 31 */ "enc",
/* 32 */ "narg",
/* 33 */ "flags",
/* 34 */ "tbl", /* Used by: stats */
/* 35 */ "idx",
/* 36 */ "wdth",
/* 37 */ "hght",
/* 38 */ "flgs",
/* 39 */ "seq", /* Used by: index_list */
/* 40 */ "name",
/* 41 */ "unique",
/* 42 */ "origin",
/* 43 */ "partial",
/* 44 */ "table", /* Used by: foreign_key_check */
/* 45 */ "rowid",
/* 46 */ "parent",
/* 47 */ "fkid",
/* index_info reuses 22 */
/* 48 */ "busy", /* Used by: wal_checkpoint */
/* 49 */ "log",
/* 50 */ "checkpointed",
/* collation_list reuses 15 */
/* 51 */ "database", /* Used by: lock_status */
/* 52 */ "status",
/* 53 */ "cache_size", /* Used by: default_cache_size */
/* module_list pragma_list reuses 9 */
/* 50 */ "timeout", /* Used by: busy_timeout */
/* 54 */ "timeout", /* Used by: busy_timeout */
};
/* Definitions of all built-in pragmas */
@@ -171,7 +175,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 50, 1,
/* ColNames: */ 54, 1,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{/* zName: */ "cache_size",
@@ -210,7 +214,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 32, 2,
/* ColNames: */ 15, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
@@ -245,14 +249,14 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
/* ColNames: */ 41, 3,
/* ColNames: */ 15, 7,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
{/* zName: */ "default_cache_size",
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
/* ColNames: */ 49, 1,
/* ColNames: */ 53, 1,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -282,7 +286,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 37, 4,
/* ColNames: */ 44, 4,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
@@ -325,7 +329,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "function_list",
/* ePragTyp: */ PragTyp_FUNCTION_LIST,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 21, 6,
/* ColNames: */ 28, 6,
/* iArg: */ 0 },
#endif
#endif
@@ -354,17 +358,17 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 15, 3,
/* ColNames: */ 22, 3,
/* iArg: */ 0 },
{/* zName: */ "index_list",
/* ePragTyp: */ PragTyp_INDEX_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 32, 5,
/* ColNames: */ 39, 5,
/* iArg: */ 0 },
{/* zName: */ "index_xinfo",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 15, 6,
/* ColNames: */ 22, 6,
/* iArg: */ 1 },
#endif
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
@@ -404,7 +408,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 47, 2,
/* ColNames: */ 51, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -543,7 +547,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 27, 5,
/* ColNames: */ 34, 5,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -634,7 +638,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 44, 3,
/* ColNames: */ 48, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
+5 -5
View File
@@ -120,8 +120,8 @@ do_test attach-1.11 {
} {}
proc db_list {db} {
set list {}
foreach {idx name file} [execsql {PRAGMA database_list} $db] {
lappend list $idx $name
db eval {PRAGMA database_list} {
lappend list $seq $name
}
return $list
}
@@ -877,9 +877,9 @@ do_test attach-10.1 {
}
} {noname inmem}
do_test attach-10.2 {
lrange [execsql {
PRAGMA database_list;
}] 9 end
execsql {
SELECT seq, name, file FROM pragma_database_list WHERE seq>=4
}
} {4 noname {} 5 inmem {}}
# Attach with a very long URI filename.
+2 -2
View File
@@ -49,8 +49,8 @@ do_test attach2-1.1 {
#
proc db_list {db} {
set list {}
foreach {idx name file} [execsql {PRAGMA database_list} $db] {
lappend list $idx $name
db eval {SELECT seq, name FROM pragma_database_list} {
lappend list $seq $name
}
return $list
}
+1 -1
View File
@@ -255,7 +255,7 @@ do_test attach3-11.2 {
#
proc db_list {} {
set x [execsql {
PRAGMA database_list;
SELECT seq, name, file FROM pragma_database_list;
}]
set y {}
foreach {n id file} $x {lappend y $id}
+5 -5
View File
@@ -1673,7 +1673,7 @@ ifcapable attach {
}
} {1 {not authorized}}
do_test auth-1.254 {
lindex [execsql {PRAGMA database_list}] 7
lindex [execsql {PRAGMA database_list}] 15
} {}
do_test auth-1.255 {
catchsql {DETACH DATABASE test1}
@@ -1689,7 +1689,7 @@ ifcapable attach {
}
} {0 {}}
do_test auth-1.256 {
lindex [execsql {PRAGMA database_list}] 7
lindex [execsql {PRAGMA database_list}] 15
} {}
do_test auth-1.257 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@@ -1705,7 +1705,7 @@ ifcapable attach {
}
} {0 {}}
do_test auth-1.258 {
lindex [execsql {PRAGMA database_list}] 7
lindex [execsql {PRAGMA database_list}] 15
} {}
do_test auth-1.259 {
execsql {ATTACH DATABASE ':memory:' AS test1}
@@ -1723,7 +1723,7 @@ ifcapable attach {
ifcapable tempdb {
ifcapable schema_pragmas {
do_test auth-1.260 {
lindex [execsql {PRAGMA database_list}] 7
lindex [execsql {PRAGMA database_list}] 15
} {test1}
} ;# ifcapable schema_pragmas
do_test auth-1.261 {
@@ -1740,7 +1740,7 @@ ifcapable attach {
} {1 {not authorized}}
ifcapable schema_pragmas {
do_test auth-1.262 {
lindex [execsql {PRAGMA database_list}] 7
lindex [execsql {PRAGMA database_list}] 15
} {test1}
} ;# ifcapable schema_pragmas
db authorizer {}
+2 -2
View File
@@ -656,8 +656,8 @@ ifcapable tempdb&&attach {
do_test pragma-6.1 {
set res {}
execsql {SELECT * FROM sqlite_temp_master}
foreach {idx name file} [execsql {pragma database_list}] {
lappend res $idx $name
db eval {SELECT seq, name FROM pragma_database_list} {
lappend res $seq $name
}
set res
} {0 main 1 temp 2 aux}
+2 -1
View File
@@ -2162,7 +2162,8 @@ proc drop_all_tables {{db db}} {
set pk [$db one "PRAGMA foreign_keys"]
$db eval "PRAGMA foreign_keys = OFF"
}
foreach {idx name file} [db eval {PRAGMA database_list}] {
foreach {idx name file} [db eval {
SELECT seq AS idx, name, file FROM pragma_database_list}] {
if {$idx==1} {
set master sqlite_temp_master
} else {
+1 -1
View File
@@ -257,7 +257,7 @@ set pragma_def {
NAME: database_list
FLAG: NeedSchema Result0
COLS: seq name file
COLS: seq name file vfs jmode ro pgsz
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: function_list