[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] smartest way to exchange a sqlite3 database with another empty
From:       Stephen Chrzanowski <pontiac76 () gmail ! com>
Date:       2016-10-03 11:57:26
Message-ID: CAANptrFEboCOcyC8+-O8krCbNkSP=N9GgVkf8nO5YXh3mm43tQ () mail ! gmail ! com
[Download RAW message or body]

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 (LogDate, LogMessage)", then
do the insert.  Then you can purge previous logs with a simple DROP TABLE
whenever you want to clean things up.  No worries about OS file handling,
unless you have a burst of log entries, file sizes are going to pretty much
stay the same size, etc, since you'll be just freeing pages up internally
in the database.

As others have mentioned, if you plan on a log per day, then, you'll need
to close the file handle, reopen with a new file and database.

On Mon, Oct 3, 2016 at 5:18 AM, Luca Ferrari <fluca1978@infinito.it> 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 having to stop the application
> (and therefore without knowing when a new I/O operation will be
> issued)?
> Does sqlite3 provide some facility that could come into help (e.g.,
> connected databases)?
>
> Thanks,
> Luca
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic