Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-02 Thread Trevor Talbot
On 10/31/07, Bill Gatliff [EMAIL PROTECTED] wrote: Trevor Talbot wrote: If your platform has a file modification notification mechanism, you may be able to sleep on that instead. Of course the problem with this approach is that it's only a coarse-grained something changed notification,

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-02 Thread Bill Gatliff
Trevor Talbot wrote: It's a pre-commit hook, so it has the same problem as the triggers. I haven't tried modifying the code to add a post-commit hook, but sqlite3_commit_hook() is actually a good place to start: in main.c it sets db-xCommitCallback, which is called by vdbeCommit() in vdbeaux.c.

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-01 Thread John Stanton
Bill Gatliff wrote: Guys: I'm a relatively-new SQLite user, but I'm luuuvin' it! :) My application is a mobile platform with a GUI that wants to display frequently-updated data in a database. The GUI is a separate process from the one providing the data, and is one of several consumers

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-01 Thread Dennis Cote
Bill Gatliff wrote: The problem I'm seeing is that the GUI process is getting stale data in its SELECT, unless it does a brief sleep between the sem_wait() and the sqlite3_exec(). Specifically, the value returned is the value immediately before the UPDATE. It's as if the trigger in the

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-01 Thread Bill Gatliff
John Stanton wrote: Perhaps your application sjould post its signal after the COMMIT has executed. A pause to give time for the COMMIT is a fragile approach. It is indeed! And just for the record, it's an approach that deserves absolutely no consideration by any system you want to depend

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-01 Thread John Stanton
Bill, You have an interesting situation, and a general one since you have data distributed across a network. I would be tempted to define a remote procedure call using TCP/IP or whatever and use that to notify database changes. Use a message passing approach. BTW, in a new system you

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-11-01 Thread Bill Gatliff
John Stanton wrote: Bill, You have an interesting situation, and a general one since you have data distributed across a network. I would be tempted to define a remote procedure call using TCP/IP or whatever and use that to notify database changes. Use a message passing approach. The

[sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-10-31 Thread Bill Gatliff
Guys: I'm a relatively-new SQLite user, but I'm luuuvin' it! :) My application is a mobile platform with a GUI that wants to display frequently-updated data in a database. The GUI is a separate process from the one providing the data, and is one of several consumers of that data. I

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-10-31 Thread Trevor Talbot
On 10/31/07, Bill Gatliff [EMAIL PROTECTED] wrote: My application is a mobile platform with a GUI that wants to display frequently-updated data in a database. The GUI is a separate process from the one providing the data, and is one of several consumers of that data. I prefer not to poll

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-10-31 Thread Bill Gatliff
Trevor Talbot wrote: On 10/31/07, Bill Gatliff [EMAIL PROTECTED] wrote: I prefer not to poll for changes, because the system is performance-constrained. So instead, I'm using an AFTER UPDATE trigger in the data-generating process to launch a C function that posts to a semaphore. The GUI

Re: [sqlite] Problem using POSIX semaphores and triggers to signal updates

2007-10-31 Thread Joe Wilson
Have the trigger function set a flag or put an item in a work queue after it updates the database. After the commit, check/clear the flag or empty the work queue, raising the semaphore if necessary. --- Bill Gatliff [EMAIL PROTECTED] wrote: My application is a mobile platform with a GUI that