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 insert statement, database gets reserved lock. however, insert statement can empty.
  • backup database.
  • end transaction using rollback or commit.

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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -