Re: [sqlite] Backing up a SQLite database without the CLI

2019-04-04 Thread Bohwaz/Fossil
If you're trying to copy a file while connections still have it open then you should use SQLite API calls to do it. The obvious ones are in the SQLite Online Backup API, which is the set of calls underlying the '.backup' command you mentioned. You can find documentation for this here:

Re: [sqlite] Backing up a SQLite database without the CLI

2019-03-22 Thread Scott Perry
`ATTACH` and iterating over all tables with `INSERT INTO SELECT` is how `VACUUM INTO` is implemented (see src/vacuum.c). A less complicated way to back up the database might be to run `BEGIN` followed by `PRAGMA user_version` to acquire a read lock, after which you can safely copy the database

Re: [sqlite] Backing up a SQLite database without the CLI

2019-03-18 Thread Simon Slavin
On 18 Mar 2019, at 3:21pm, Jonathan Moules wrote: > At this point I'm starting to think that the best option is to create a new > database with the requisite structure and copy the data across via an ATTACH > (there are only two tables and one will almost always be empty at this point). That c

Re: [sqlite] Backing up a SQLite database without the CLI

2019-03-18 Thread Shawn Wagner
If the php sqlite bindings are incomplete and don't support the backup functions, write a small program in C that uses them to copy a database, and execute that from the php code? On Mon, Mar 18, 2019, 8:24 AM Jonathan Moules wrote: > Hi Simon, > > Thanks for your thoughts. Sorry, I should have

Re: [sqlite] Backing up a SQLite database without the CLI

2019-03-18 Thread Jonathan Moules
Hi Simon, Thanks for your thoughts. Sorry, I should have been clearer: I have no way of knowing if there are other open connections to the file - there may be as it's a web-application. So I'll assume there are connections. At this point I'm starting to think that the best option is to create

Re: [sqlite] Backing up a SQLite database without the CLI

2019-03-18 Thread Simon Slavin
On 18 Mar 2019, at 1:10pm, Jonathan Moules wrote: > I was wondering if there was a good way of backing up an SQLite database if > you do *not* have access to the SQLite command line tool (which I know has > .backup - https://stackoverflow.com/a/25684912). [snip] > I've considered simply runnin

RE: [sqlite] Backing up a SQlite database

2007-02-12 Thread Brandon, Nicholas \(UK\)
>Derrell, >Just to clarify, you don't need to use an exclusive transaction. That will acquire a write lock and unnecessarily block >all other readers as well. You only need to hold a read lock to prevent any other process from acquiring a write lock. >Dennis Cote I asked a similar question la

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Dennis Cote
[EMAIL PROTECTED] wrote: You should either have your backup application open the database and do a BEGIN EXCLUSIVE; statement to ensure that no other processes can write to it while you're backing it up Derrell, Just to clarify, you don't need to use an exclusive transaction. That will a

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Dennis Cote
[EMAIL PROTECTED] wrote: You should either have your backup application open the database and do a BEGIN EXCLUSIVE; statement to ensure that no other processes can write to it while you're backing it up, or if you don't want to do that, you can use the command line shell and do: sqlite3 .dump

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Rich Shepard
On Fri, 9 Feb 2007, Christian Smith wrote: No, no, no! Copying the file is not atomic, and a live database may be updated part way through the copy. Mea culpa! My response was based on my own use of sqlite, which is embedded in models. Therefore, when I do any copying of the database file it

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Derrell . Lipman
Rich Shepard <[EMAIL PROTECTED]> writes: > On Fri, 9 Feb 2007, Mikey C wrote: > >> This might be a dumb question, but is taking a backup of a live database >> simply a matter of copying the file to a backup device/drive? > > Yes. It's a regular file to your OS. As a matter of fact, you can copy

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Christian Smith
Rich Shepard uttered: On Fri, 9 Feb 2007, Mikey C wrote: This might be a dumb question, but is taking a backup of a live database simply a matter of copying the file to a backup device/drive? Yes. It's a regular file to your OS. As a matter of fact, you can copy the file to another name and

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Will Leshner
On 2/9/07, Rich Shepard <[EMAIL PROTECTED]> wrote: On Fri, 9 Feb 2007, Mikey C wrote: > This might be a dumb question, but is taking a backup of a live database > simply a matter of copying the file to a backup device/drive? Yes. It's a regular file to your OS. As a matter of fact, you can c

Re: [sqlite] Backing up a SQlite database

2007-02-09 Thread Rich Shepard
On Fri, 9 Feb 2007, Mikey C wrote: This might be a dumb question, but is taking a backup of a live database simply a matter of copying the file to a backup device/drive? Yes. It's a regular file to your OS. As a matter of fact, you can copy the file to another name and open that other name t