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

Do the ".dump" command inside of a transaction to prevent other processes

from modifying the database while the dump is underway.
Ticket [2466653295e65]

FossilOrigin-Name: 1c00d5454c85dfddb6c628c3742b4ddeaad6423a
This commit is contained in:
drh
2011-10-13 13:34:04 +00:00
parent b87a666315
commit 58c803b7f0
3 changed files with 9 additions and 9 deletions

View File

@@ -1580,7 +1580,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
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);
sqlite3_exec(p->db, "BEGIN; PRAGMA writable_schema=ON", 0, 0, 0);
p->nErr = 0;
if( nArg==1 ){
run_schema_dump_query(p,
@@ -1613,7 +1613,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
}
}
if( p->writableSchema ){
fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
fprintf(p->out, "PRAGMA writable_schema=OFF; COMMIT;\n");
p->writableSchema = 0;
}
sqlite3_exec(p->db, "PRAGMA writable_schema=OFF", 0, 0, 0);