[sqlite] FW: mutex assert_fail in sqlite3BtreeHoldsMutex in a heavily load DB access in 3.7.5 but not in 3.6.22

2011-05-10 Thread ChingChang Hsiao
There is a problem for reply in the web. So I resend again. Please neglect the previous one. It's 3.7.5. Journal mode is delete not WAL. A script was running for a heavy load DB access. As you can see the sql statement "select * from service_table where service_no = '13';" in the log. There

Re: [sqlite] mutex assert_fail in sqlite3BtreeHoldsMutex in a heavily load DB access in 3.5.7 but not in 3.6.22

2011-05-10 Thread Richard Hipp
On Tue, May 10, 2011 at 10:15 PM, ChingChang Hsiao < chingchang.hs...@overturenetworks.com> wrote: > A script was running for a heavy load DB access. As you can see the sql > statement "select * from service_table where service_no = '13';" in the log. > There is no rows for service_no 13 or 7

[sqlite] mutex assert_fail in sqlite3BtreeHoldsMutex in a heavily load DB access in 3.5.7 but not in 3.6.22

2011-05-10 Thread ChingChang Hsiao
A script was running for a heavy load DB access. As you can see the sql statement "select * from service_table where service_no = '13';" in the log. There is no rows for service_no 13 or 7 in service_table when it is accessed. The logic is check the entry is there or not, if not then insert

Re: [sqlite] Licensing and copyright info?

2011-05-10 Thread Simon Slavin
On 10 May 2011, at 8:03pm, Mr. Puneet Kishor wrote: > On May 10, 2011, at 1:59 PM, Don Ireland wrote: > >> I am writing an app and plan to embed SQLite in my app as a means to store >> the data. >> >> What licensing/copyright statements do I need to make RE SQLite? > > Nothing. sqlite, the

Re: [sqlite] Transaction triggers?

2011-05-10 Thread Nico Williams
FWIW, I'm making progress. I've got BEGIN and COMMIT triggers firing, but there's issues related to auto-commit which imply that I need to be able to skip -at runtime- the trigger firing that I code with each OP_Transaction and OP_AutoCommit operation, which I think means I need a new op, but

Re: [sqlite] Licensing and copyright info?

2011-05-10 Thread Don Ireland
Ok thanks. Don Ireland -Original Message- From: "Mr. Puneet Kishor" To: General Discussion of SQLite Database Sent: Tue, 10 May 2011 2:03 PM Subject: Re: [sqlite] Licensing and copyright info? On May 10, 2011, at 1:59 PM, Don Ireland

[sqlite] Example/Tutorial for "extension_functions.c" in C/C++ Prog With "sqlite3.c"

2011-05-10 Thread Mays, Steve
I have searched the web and I have looked through the subjects of all the archived posts and I cannot find any examples showing me how to use the "extension_functions.c" code in a C/C++ program with "sqlite3.c". I am aware of the compilation instructions included in the "extension_functions.c"

Re: [sqlite] Licensing and copyright info?

2011-05-10 Thread Mr. Puneet Kishor
On May 10, 2011, at 1:59 PM, Don Ireland wrote: > I am writing an app and plan to embed SQLite in my app as a means to store > the data. > > What licensing/copyright statements do I need to make RE SQLite? Nothing. sqlite, the program, is in the Public Domain. SQLite, the term, is

[sqlite] Licensing and copyright info?

2011-05-10 Thread Don Ireland
I am writing an app and plan to embed SQLite in my app as a means to store the data. What licensing/copyright statements do I need to make RE SQLite? TIA! Don Ireland ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Gerry Snyder
If this has already been suggested, I apologize. Add an integer column with a UNIQUE ON CONFLICT REPLACE constraint.Then after you figure out how many entries are enough (maxcount), insert each row, specifying that column as mod((lastinsertrowid()+1),maxcount) or however you specify a modulus

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi Jay, Wow, thanks for your detailed message below.much appreciated ;-) I will try the PRAGMA and also the "msg_seq".great. Lynton On 10/05/2011 19:00, Jay A. Kreibich wrote: > On Tue, May 10, 2011 at 12:42:14PM +0200, Lynton Grice scratched on the wall: >> Hi all, >> >>

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Nico Williams
On Tue, May 10, 2011 at 12:00 PM, Jay A. Kreibich wrote: >> I guess I am looking for a "round robin queue" here? > >  I'd do something like this.  This keeps a constant number of messages >  in the log.  The "msg_id" provides a message counter, while the >  "msg_seq" is used to

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Jean-Christophe Deschamps
Without a view (but with a trigger) and certainly open to improvement (9 is the MAX_ENTRIES parameter): CREATE TABLE "log" ( "id" INTEGER NOT NULL PRIMARY KEY ON CONFLICT REPLACE AUTOINCREMENT, "seq" INTEGER CONSTRAINT "ix1Seq" UNIQUE ON CONFLICT REPLACE, "data" CHAR); CREATE TRIGGER

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Jay A. Kreibich
On Tue, May 10, 2011 at 12:42:14PM +0200, Lynton Grice scratched on the wall: > > Hi all, > > Thanks for your comments...much appreciated.. > > BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use > to say FIX the sqlite database size to say "5 MB"? PRAGMA

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Yup, fair enough...what I think would be better is to have s variable set called something like "history_retain_time" (like Nico said)..and perhaps a "log_check_interval" in DAYS or HOURS or MINUTESwhatever suits the application. Then perhaps on each insert you get the code

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hey NIco, Now this is great.in fact I was playing with an "update hook" the other dayand was going to put the deletion logic under the SQLITE_INSERT below But your code looks better ;-) Thanks ! void update_callback( void* udp, int type, const char* db_name, const char*

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Stephan Beal
On Tue, May 10, 2011 at 4:32 PM, Lynton Grice wrote: > I like the ON INSERT trigger.good idea. So perhaps you have a > "setLogMaxSize" type function in C that allows the client program to say > "hey, I only want the log to hold a max of 10 000 records".and

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi Enrico, I like the ON INSERT trigger.good idea. So perhaps you have a "setLogMaxSize" type function in C that allows the client program to say "hey, I only want the log to hold a max of 10 000 records".and then I do a select count(*) inside the ON INSERT type trigger and delete

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi Simon, Thanks for the feedback below, I will write some "delete logic" to run from time to time...;-) Lynton On 10/05/2011 13:34, Simon Slavin wrote: > On 10 May 2011, at 11:42am, Lynton Grice wrote: > >> BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use >> to say

Re: [sqlite] Question: Memory-Based Databases

2011-05-10 Thread Tito Ciuro
Thanks Pavel! -- Tito On May 10, 2011, at 11:12 AM, Pavel Ivanov wrote: > Until you reach limit set by 'pragma cache_size' memory usage would be > the same for in-memory database and on-disk database. When the size of > your database grows beyond 'pragma cache_size' in-memory database > starts

Re: [sqlite] Question: Memory-Based Databases

2011-05-10 Thread Pavel Ivanov
> Is this true, or is the memory usage pretty much similar? Until you reach limit set by 'pragma cache_size' memory usage would be the same for in-memory database and on-disk database. When the size of your database grows beyond 'pragma cache_size' in-memory database starts to consume more memory

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Danny
Why not have TWO tables? Log_A and Log_B? When Log_A is full, DELETE everything from Log_B and start logging to it. When Lob_B is full, DELETE everything from Log_A and start logging to it again. If you want, while logging to one, the other can be archived ... --- On Tue, 5/10/11, Simon

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Nico Williams
Or just a function to return the size of the current DB. Mind you, automatically deleting rows from a log table isn't enough: you may have to periodically VACUUM the DB, or you may have to setup auto_vacuum (and incremental_vacuum). I have code like this in one DB: CREATE TABLE IF NOT EXISTS

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
> > A round robin queue is fine. Every so often, to kill off old records do > > SELECT max(rowid) FROM myTable > > then in your code subtract from it however many rows you want to keep, then do > > DELETE FROM myTable WHERE rowid < firstToRetain > > It won't work perfectly but it's simple

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Adam DeVita
Why not use INSERT OR REPLACE to your advantage? If you set the maximum number of log entries you wanted to keep, then kept track of your log insert statement, you could wrap by int this_log_entry_id=1; //initialize.. actually could be initialized by getting the log entry id of the min date in

[sqlite] Question: Memory-Based Databases

2011-05-10 Thread Tito Ciuro
Hello, I have been using memory-based databases (opened via :memory:) and performance is great. However, one of the things I assumed with memory-based databases was that memory usage would be higher than the temporary or persistent databases stored on disk. Is this true, or is the memory usage

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Simon Slavin
On 10 May 2011, at 1:57pm, Lauri Nurmi wrote: > El mar, 10-05-2011 a las 12:34 +0100, Simon Slavin escribió: >> On 10 May 2011, at 11:42am, Lynton Grice wrote: >> >>> BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use >>> to say FIX the sqlite database size to say "5 MB"?

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lauri Nurmi
El mar, 10-05-2011 a las 12:34 +0100, Simon Slavin escribió: > On 10 May 2011, at 11:42am, Lynton Grice wrote: > > > BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use > > to say FIX the sqlite database size to say "5 MB"? > > There isn't one. SQLite would not know which

Re: [sqlite] Memory leak in SQlite

2011-05-10 Thread Black, Michael (IS)
#1 I don't see where you're freeing m_szErrorString (not real sure if it gets malloc'd on success) -- but you do need to free it on errors for sure. And where's your Callback function? Why are you calling SaveResultSet (which you also don't show)? That should probably be done inside the

Re: [sqlite] Memory leak in SQlite

2011-05-10 Thread Stephan Beal
On Tue, May 10, 2011 at 2:17 PM, Ian Hardingham wrote: > I'm sure that this is to do with the way I am using SQLite. I do not > have time to radically change my methodology at this point, but I do > need to fix a rather severe memory leak I'm having. > > i don't see any

[sqlite] Memory leak in SQlite

2011-05-10 Thread Ian Hardingham
Hey guys. I'm sure that this is to do with the way I am using SQLite. I do not have time to radically change my methodology at this point, but I do need to fix a rather severe memory leak I'm having. (My apologies for the code) Any help is much appreciated. I query like this: int

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Simon Slavin
On 10 May 2011, at 11:42am, Lynton Grice wrote: > BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use > to say FIX the sqlite database size to say "5 MB"? There isn't one. SQLite would not know which records to delete. > Also, lets say I have a AUTOINCREMENT INTEGER

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Afriza N. Arief
On May 10, 2011 4:09 PM, "Lynton Grice" wrote: > > Hi there, > > how can I implement / > mimic a type of "rotating log"? > > So in my mind I am thinking that perhaps I can LIMIT the size of the > SQLIte DB to say 5 MB? And once the DB reaches that size it starts >

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Stephan Beal
On Tue, May 10, 2011 at 12:35 PM, Lynton Grice wrote: > Thanks for this, much appreciated. My application is written in pure C, > so I guess I will not be able to use your C++ code? > It's actually just a thin coating over C, and the whole class is quite small, so it

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi all, Thanks for your comments...much appreciated.. BTW: if I am using SQLIte as a logger, what PRAGMA statement can I use to say FIX the sqlite database size to say "5 MB"? Also, lets say I have a AUTOINCREMENT INTEGER PRIMARY KEY, what will happen when it reaches 5 MB? Will it just

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi Stephan, Thanks for this, much appreciated. My application is written in pure C, so I guess I will not be able to use your C++ code? Chat later Lynton On 10/05/2011 12:06, Stephan Beal wrote: > On Tue, May 10, 2011 at 11:52 AM, Enrico Thierbach wrote: > >> I don't

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi Enrico, Well I have been looking at using a nice light weight C logger.and played around with LOG4C, Panthious have and also checked out using syslog-ng, matlog and standard syslogbut in the end decided that for this specific application an SQLite logger would work well. I am

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
On 10.05.2011, at 12:06, Stephan Beal wrote: > On Tue, May 10, 2011 at 11:52 AM, Enrico Thierbach wrote: > >> I don't think sqlite (or any SQL database, for that matter) is a perfect >> fit for a logger, because there is a certain amount of write overhead. >> Why do you

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Stephan Beal
On Tue, May 10, 2011 at 11:52 AM, Enrico Thierbach wrote: > I don't think sqlite (or any SQL database, for that matter) is a perfect > fit for a logger, because there is a certain amount of write overhead. > Why do you think you would want to do this? > ALL db insertions in a

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Enrico Thierbach
Hi Lynton, I don't think sqlite (or any SQL database, for that matter) is a perfect fit for a logger, because there is a certain amount of write overhead. Why do you think you would want to do this? /eno On 10.05.2011, at 10:09, Lynton Grice wrote: > Hi there, > > SQLite is a perfect fit

Re: [sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Stephan Beal
On Tue, May 10, 2011 at 10:09 AM, Lynton Grice wrote: > So in my mind I am thinking that perhaps I can LIMIT the size of the > SQLIte DB to say 5 MB? And once the DB reaches that size it starts > INSERTING new logs over the earliest records in the database? > > Is

[sqlite] SQLite as a Logger: How to mimic "rotation of logs"?

2011-05-10 Thread Lynton Grice
Hi there, SQLite is a perfect fit for a logger, the only question I have is once it is in production my database will grow rapidly, how can I implement / mimic a type of "rotating log"? So in my mind I am thinking that perhaps I can LIMIT the size of the SQLIte DB to say 5 MB? And once the