Make the CLI more tolerant of malformed schemas by setting the

writable_schema pragma prior to running the ".dump" command. (CVS 5554)

FossilOrigin-Name: 860babd841a7744eb8ba0e4f325fc10b348ed78b
This commit is contained in:
drh 2008-08-11 19:12:34 +00:00
parent c456e57af7
commit 93f41e591b
3 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Do\snot\sallow\sindexing\sof\sany\stable\swhose\sname\sbegins\swith\s"sqlite_".\nTicket\s#3284.\s\sImprove\shandling\sof\sdatabases\swith\smalformed\sschemas\s-\njust\sin\scase\ssomebody\shas\sactually\sindexed\sa\ssystem\stable.\s(CVS\s5553)
D 2008-08-11T18:44:58
C Make\sthe\sCLI\smore\stolerant\sof\smalformed\sschemas\sby\ssetting\sthe\nwritable_schema\spragma\sprior\sto\srunning\sthe\s".dump"\scommand.\s(CVS\s5554)
D 2008-08-11T19:12:35
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 2713ea64947be3b35f35d9a3158bb8299c90b019
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -143,7 +143,7 @@ F src/prepare.c fceb567b359daaa6c6e2a4d04a01dec01ac0c907
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/select.c 390d1bdde0c24f0225e369896da8e60ef2aeffbe
F src/shell.c 4b835fe734304ac22a3385868cd3790c1e4f7aa1
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in ba8920c272e3ddef424bc0627cbecaec5401ae47
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
F src/sqliteInt.h 685b9cf6537e59e4453269b43acb33c59b566346
@ -617,7 +617,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 90cae83169de980c6548ca6b57f4c65419e8eb13
R 679caa78525facd517eb682beb151c0a
P 0e1d8d14a153483e65bd0246d23db2b823a122d1
R 81e8937d2db82d3461db266a89371cd1
U drh
Z c1abcb802b7b42f4c0a5be91ca718e3a
Z 9d5c1e42d2af8bfee1919e66398a136d

View File

@ -1 +1 @@
0e1d8d14a153483e65bd0246d23db2b823a122d1
860babd841a7744eb8ba0e4f325fc10b348ed78b

View File

@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.184 2008/07/11 17:23:25 drh Exp $
** $Id: shell.c,v 1.185 2008/08/11 19:12:35 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
@ -1090,6 +1090,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
open_db(p);
fprintf(p->out, "BEGIN TRANSACTION;\n");
p->writableSchema = 0;
sqlite3_exec(p->db, "PRAGMA writable_schema=ON", 0, 0, 0);
if( nArg==1 ){
run_schema_dump_query(p,
"SELECT name, type, sql FROM sqlite_master "
@ -1120,6 +1121,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
p->writableSchema = 0;
}
sqlite3_exec(p->db, "PRAGMA writable_schema=OFF", 0, 0, 0);
if( zErrMsg ){
fprintf(stderr,"Error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);