Jump to content

Continuous Polling of Sqlite3 Database Without Getting Locked


makotoshishio

Recommended Posts

Hi everyone, I would like to ask if there's a way to continuously poll a database without it getting locked? What I've done is a database and two tables in it. The first table db1 has 3 columns: ID, Name, Addr; the 2nd table db2 has only 1 column: ID. I want to change the value of ID stored in db2 and when it is changed, my program should detect it instantly and retrieve the information stored in db1 that correspond to the new value of ID in db2. I already created a program that continuously polls the database but when I try to change the ID in db2, an error occurs that say: database is locked. Is there a way to make the database unlocked so that I could change the information inside db2 while my program is polling it at the same time? Or instead of continuously polling the database, is there a way to "notify" my program that the information in the database has changed? I'm using sqlite3 and C programming language. Linux is my OS. Answers will be greatly appreciated. Thank you.

Share this post


Link to post
Share on other sites

I think you can do this with Stored procedures. Don't know anything about SqlLite3 to be of more help.

 

If you are using unique autogenerated primary keys on your ID columns you might run into issues.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...