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: hj...@yahoo.com


      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to