The ".dump" command from the shell correctly saves the state of the

sqlite_sequence and sqlite_stat1 tables, if they exist.  Ticket #1419. (CVS 2687)

FossilOrigin-Name: 3f191cf497e5798a8620ebc5a85e34187f58371c
This commit is contained in:
drh 2005-09-11 02:03:03 +00:00
parent 0c35667b02
commit 00b950d71e
3 changed files with 17 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C The\sshell\sdoes\snot\soutput\sthe\ssqlite_stat1\stable\son\s.dump\sor\s.schema.\nThe\sANALYZE\scommand\snow\sgathers\sstatistics\son\stables\sthat\shave\sonly\na\ssingle\sindex\sbecause\sthis\ssometimes\shelps\swhen\sreordering\stables\nin\sa\sjoin.\s(CVS\s2686)
D 2005-09-10T22:40:54
C The\s".dump"\scommand\sfrom\sthe\sshell\scorrectly\ssaves\sthe\sstate\sof\sthe\nsqlite_sequence\sand\ssqlite_stat1\stables,\sif\sthey\sexist.\s\sTicket\s#1419.\s(CVS\s2687)
D 2005-09-11T02:03:04
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -64,7 +64,7 @@ F src/prepare.c fc098db25d2a121affb08686cf04833fd50452d4
F src/printf.c c01e9ad473d79463fb1f483b1eca5c3cbed2a4e5
F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
F src/select.c a255ca7eddd14c68d966b6323234dd94fcc7a31f
F src/shell.c bf574fc9d8d28d39fcb862820a1578931310fdf1
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
F src/sqliteInt.h 0d38d50ebe15a16a1253c9a6f9ce4ad188e097fe
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 986efb7b12643800805ad4b1f1e90e30fcf6d38a
R 5a4264e3d05bbb86c25811d810ca46ee
P 26565b8931419031f9a8dd3947e1e2bd23ccbff2
R 9a963bfef0e17a1fd6c7beefb5ea8bc6
U drh
Z 685a0075e29420a1544272a50eb547bc
Z 37627707368565dca6f88fb92264a6dc

View File

@ -1 +1 @@
26565b8931419031f9a8dd3947e1e2bd23ccbff2
3f191cf497e5798a8620ebc5a85e34187f58371c

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.127 2005/09/10 22:40:54 drh Exp $
** $Id: shell.c,v 1.128 2005/09/11 02:03:04 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
@ -656,10 +656,14 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
zType = azArg[1];
zSql = azArg[2];
if( strcmp(zTable,"sqlite_sequence")!=0 ){
fprintf(p->out, "%s;\n", zSql);
}else{
if( strcmp(zTable, "sqlite_sequence")==0 ){
fprintf(p->out, "DELETE FROM sqlite_sequence;\n");
}else if( strcmp(zTable, "sqlite_stat1")==0 ){
fprintf(p->out, "ANALYZE sqlite_master;\n");
}else if( strncmp(zTable, "sqlite_", 7)==0 ){
return 0;
}else{
fprintf(p->out, "%s;\n", zSql);
}
if( strcmp(zType, "table")==0 ){
@ -905,12 +909,11 @@ static int do_meta_command(char *zLine, struct callback_data *p){
if( nArg==1 ){
run_schema_dump_query(p,
"SELECT name, type, sql FROM sqlite_master "
"WHERE sql NOT NULL AND type=='table' AND name NOT LIKE 'sqlite_%'", 0
"WHERE sql NOT NULL AND type=='table'", 0
);
run_schema_dump_query(p,
"SELECT name, type, sql FROM sqlite_master "
"WHERE sql NOT NULL AND type!='table' AND type!='meta' "
"AND name NOT LIKE 'sqlite_%'", 0
"WHERE sql NOT NULL AND type!='table' AND type!='meta'", 0
);
}else{
int i;