sqlite - sqlite3 shell command '.backup' and transaction -
i have sqlite database on local host (win nt) , want up. want use shell command '.backup' accomplish task. seems can insert new rows database during backup process.
does '.backup' shell command starts new exclusive transaction on database?
i thought when execute '.backup' shell command locks database.
the sqlite3 backup method not lock database. suggest use following workaround if lock database:
- start transaction (shared lock)
- by using
insertstatement, database gets reserved lock. however,insertstatement can empty. - backup database.
- end transaction using
rollbackorcommit.
code:
begin; insert <anytable> select * <anytable> 1=0; .backup <database> <file> rollback; a less hacky way if using table named 'backup' , inserting row (date,..) each copy (if information relevant you).
Comments
Post a Comment