Have you tried issueing a vacum after n deletes?

Woody wizard at large(I'm in shape. Round is a shape)
Connected by MOTOBLUR™ on T-Mobile

-----Original message-----
From: Hemant Shah <[email protected]>
To: General Discussion of SQLite Database <[email protected]>
Sent: Wed, Sep 8, 2010 21:03:21 PDT
Subject: Re: [sqlite] In memory database and locking.

I forgot to mention, that I have set pragma journal_mode to off and for every 
insert I doprepare -> step -> finalize -> COMMIT.

Hemant Shah

E-mail: [email protected]

--- On Wed, 9/8/10, Hemant Shah <[email protected]> wrote:

From: Hemant Shah <[email protected]>
Subject: [sqlite] In memory database and locking.
To: [email protected]
Date: Wednesday, September 8, 2010, 10:55 PM

Folks,
I am trying to write an application that reads packets from the network and 
inserts it into sqlite database, I have a unique key which is combination of 
couple of columns. I want to find re-transmitted packets so I rely on the fact 
that if I violate unique key constraint then I have found the duplicate packet. 
Also, I just want to compare it with packets received within last minute. One 
of the column is timestamp.
I am using C API and statically link sqlite 3.7.2 with my application.
Here is what I am doing. When I start my application it creates the database 
and table and then forks two processes. One process reads packets from network 
and inserts information about it in the database, if insert fails then it has 
found re-transmission and it executes the select statement to get the 
information about previous packet and print information about both packets.
The other process wakes up every 60 seconds and deletes all row whose timestamp 
columns is less then (current timestamp - 60). The timestamp is number of 
seconds since epoch.
The first process is constantly inserting rows into the database, so the other 
process cannot delete any rows. When I use :memory: for database I do not get 
any error but it does not delete any rows as the memory footprint of my program 
keeps on increasing.If I use a file for database I get error that database is 
locked.
Both of these processes are sibling and have same database handle. When I read 
the documentation I found that in-memory database always uses EXCLUSIVE lock.
How do I solve this problem?
Thanks.


Hemant Shah

E-mail: [email protected]


      
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



      
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to