1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-05 04:30:38 +03:00

Modify the ".dump" command on the CLI so that it always issues a

PRAGMA foreign_keys=OFF at the top of the output.

FossilOrigin-Name: 0755b9b697d32292f378a4b934ca1cf9f56225cd
This commit is contained in:
drh
2009-09-23 15:51:35 +00:00
parent 6d4486ae9f
commit f1dfc4fbb3
3 changed files with 14 additions and 10 deletions

View File

@@ -2093,6 +2093,10 @@ static int do_meta_command(char *zLine, struct callback_data *p){
if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
char *zErrMsg = 0;
open_db(p);
/* When playing back a "dump", the content might appear in an order
** which causes immediate foreign key constraints to be violated.
** So disable foreign-key constraint enforcement to prevent problems. */
fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
fprintf(p->out, "BEGIN TRANSACTION;\n");
p->writableSchema = 0;
sqlite3_exec(p->db, "PRAGMA writable_schema=ON", 0, 0, 0);