简体   繁体   中英

nodejs sqlite3 backup database

I have to backup a sqlite database with nodejs (sqlite3 library). My strategy is to close the connection, copy database file and re-open the connection. The problem is that after the open all query/updates cause a SQLITE_MISUSE. I have only 1 connection in all the application. What is the problem? How can i backup database if the library (and all other nodejs libraries) doesn't allow to execute the native C backup apis)?

There's one way I can think of, by creating another database, attaching it to the current connection, and run a joint insert/select operation between them. This SO answer has some information on copying databases in SQLite, and see here for general information on attaching databases

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM