Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-04 Thread Luca Ferrari
On Mon, Oct 3, 2016 at 11:51 AM, Richard Hipp wrote: > Safe way: In a separate process, use the backup API > (https://www.sqlite.org/backup.html) to copy the content of the main > DB over to a separate DB, then "DELETE FROM log;" on the main DB. > This will work without any cooperation on the par

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Domingo Alvarez Duarte
Hello Richard ! Ok I missed this point, but still while fighting to use sqlite3 with big databases I was thinking on some custom changes to allow sqlite relax some restrictions: 1- Create a new sqlite reserved table for register attached databases, this way every time a program try to open an

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Richard Hipp
On 10/3/16, Domingo Alvarez Duarte wrote: > Hello ! > > Thinking about this and the problem I'm experiencing with big databases > with sqlite3 "vacuum" probably could be a good idea to use a flag in the > sqlite3 header to inform other processes to reopen the database. > That might work on unix.

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Domingo Alvarez Duarte
Hello ! Thinking about this and the problem I'm experiencing with big databases with sqlite3 "vacuum" probably could be a good idea to use a flag in the sqlite3 header to inform other processes to reopen the database. Right now every time sqlite3 would perform an operation on a database it a

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Paul Sanderson
It seems that you just want to keep access to all of your historic logging so rather than copy/backup the entire database you could just create a new archive DB (or open an old one), attach it, copy x records to the archive and then delete the same x records from the master. How big is your log da

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Stephen Chrzanowski
Are you looking to keep the logs in the same file, or, are you looking to put your log entries in a new file? If you're interested in just keeping a single file, and if you've got access to change your code that is writing to the database, then, what I would do is "create table if not exists Logs

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Florian Weimer
* Richard Hipp: > You cannot rename a database file while another process has that > database open. Windows simply will not allow that. If you do it on > Unix, then the process that has the file open will not know that the > file has been renamed and will continue to write to the original file.

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Petite Abeille
> On Oct 3, 2016, at 11:18 AM, Luca Ferrari wrote: > > What is the right way to do it without having to stop the application > (and therefore without knowing when a new I/O operation will be > issued)? You could use the attach/detach [1] functionality to transparently roll the logs over. Some

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Richard Hipp
On 10/3/16, Luca Ferrari wrote: > Hi all, > in one of my application I use a sqlite3 database as a log of > activity. As you can imagine the file grows as time goes by, so I'm > figuring I've to substitute it with an empty one once a good size is > reached. > What is the right way to do it without

Re: [sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Niall O'Reilly
On 3 Oct 2016, at 10:18, Luca Ferrari wrote: > in one of my application I use a sqlite3 database as a log of > activity. As you can imagine the file grows as time goes by, so I'm > figuring I've to substitute it with an empty one once a good size is > reached. > What is the right way to do it with

[sqlite] smartest way to exchange a sqlite3 database with another empty

2016-10-03 Thread Luca Ferrari
Hi all, in one of my application I use a sqlite3 database as a log of activity. As you can imagine the file grows as time goes by, so I'm figuring I've to substitute it with an empty one once a good size is reached. What is the right way to do it without having to stop the application (and therefor