In the CLI, give better error messages if something goes wrong

with the ".dbinfo" command.

FossilOrigin-Name: 3649a77b79001ea6c5defe882f9934521b20b9d36aab26d03b5d42006c7fa228
This commit is contained in:
drh 2019-03-20 18:22:51 +00:00
parent 2381f6d7e5
commit 87c889cfa5
3 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\spotential\sdangling\spointer\sdeference\sin\san\sALTER\sTABLE\srun\son\sa\sschema\sthat\scontains\sconstructs\sof\sthe\sform\s"PRIMARY\sKEY(column\sCOLLATE\scollation)".
D 2019-03-20T16:58:21.326
C In\sthe\sCLI,\sgive\sbetter\serror\smessages\sif\ssomething\sgoes\swrong\nwith\sthe\s".dbinfo"\scommand.
D 2019-03-20T18:22:51.910
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -517,7 +517,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 09419ad5c432190b69be7c0c326e03abb548a97c2c50675b81b459e1b382d1d2
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c 9263f5c30dd44c7ac2eb29f40a7ec64322a96885b71c00de6bc30b756c2e1c49
F src/shell.c.in 01c0cc01391d00d247fdf640052d38c267fc16d975bc4f3154a02277c232dbeb
F src/shell.c.in 576ba793cf166ea7055b7a1a2bea058242ca532ba84753e789b9c88790019b70
F src/sqlite.h.in e33a4df7e32d742aac29623b38a1edd7e07a2b964a5d0257e2923c8a724faddc
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
@ -1807,7 +1807,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f0f02d46e40667d0fc31c57eb26d459ce2f3a3c222c767fa371100b36e5335d1
R 92c0df543aea117c127876d55752268a
U dan
Z d663988bb4007d82fa838edb1e98afe4
P b9e2393cf201e3fc24519c5ae65d0a5953147d78884e53d44a7958747b4a7e13
R bac077ecc3827c57122ba7154b5e4a1d
U drh
Z 6a80d73acf1c73bf71a6659d9de2609c

View File

@ -1 +1 @@
b9e2393cf201e3fc24519c5ae65d0a5953147d78884e53d44a7958747b4a7e13
3649a77b79001ea6c5defe882f9934521b20b9d36aab26d03b5d42006c7fa228

View File

@ -4773,7 +4773,7 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
{ "schema size:",
"SELECT total(length(sql)) FROM %s" },
};
int i;
int i, rc;
unsigned iDataVersion;
char *zSchemaTab;
char *zDb = nArg>=2 ? azArg[1] : "main";
@ -4781,8 +4781,19 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
unsigned char aHdr[100];
open_db(p, 0);
if( p->db==0 ) return 1;
sqlite3_prepare_v2(p->db,"SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
-1, &pStmt, 0);
rc = sqlite3_prepare_v2(p->db,
"SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
-1, &pStmt, 0);
if( rc ){
if( !sqlite3_compileoption_used("ENABLE_DBPAGE_VTAB") ){
utf8_printf(stderr, "the \".dbinfo\" command requires the "
"-DSQLITE_ENABLE_DBPAGE_VTAB compile-time options\n");
}else{
utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db));
}
sqlite3_finalize(pStmt);
return 1;
}
sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
if( sqlite3_step(pStmt)==SQLITE_ROW
&& sqlite3_column_bytes(pStmt,0)>100