Re: [sqlite] Trigger's actions and callbacks
D. Richard Hipp wrote: > > > SQLite is not reentrant through the update hook. > > > D. Richard Hipp > [EMAIL PROTECTED] > > Thanks a lot. I would consider using user-defined functions as callbacks with updated data in its parameters. -- View this message in context: http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16467330.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Trigger's actions and callbacks
Igor Tandetnik wrote: > > >> >> sqlite3_update_hook(db, Callback, db); >> >> and when trying to access to the db inside callback >> >> sqlite3_prepare((sqlite3*)data_arg_3, [...]) > > Show how Callback is declared. Did you really name its first parameter > data_arg_3? > > Igor Tandetnik > > void Callback( void* data_arg_3, int operation, char const * szDatabase, char const * szTable, sqlite_int64 rowID ); And what could be wrong with declaration of local variable name? data_arg_3 because this is third argument to sqlite3_update_hook(). -- View this message in context: http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16467325.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Trigger's actions and callbacks
>If you are trying to use a different connection, you would only see >changes once the first connection committed its transaction - so don't >do that. >> sqlite_update_hook() returnes rowID, but I didn't >> find any API to use this value... >You just run a statement along the lines of >select * from dbName.tableName where rowid=? >You need to run this statement on the same connection the hook is >installed on. Thanks. But I am experiensing some problems here. When I am using the same connection (I store it as third parameter to callback registering function sqlite3_update_hook(db, Callback, db); and when trying to access to the db inside callback sqlite3_prepare((sqlite3*)data_arg_3, [...]) , an error SQLITE_MISUSE is returned to me (from sqlite3_prepare() as well as sqlite3_step() ). And finally I have got a Segmentation Fault from sqlite3_column_*(). The same with db connection as a global variable, when it is used during registering callback and inside one. So I supposed earlier that it is prohibited to use the same connection inside callback. And a really I used another connection and got nothing. So the question is - how to use the same connection correctry inside the callback? -- View this message in context: http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16446898.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Trigger's actions and callbacks
Hi, all. I have the following problem: I have some processes that access the same db file. When one of them would change some data inside the db it must notify all other processes about change AND send them changed data (or it's unique description). But I didn't find any method to perform this using db triggers or callbacks. On some certain reasons I am not allowed to write wrapper that will send notifications using IPC. I would like db to perform this task. As for triggers and callbacks (hooks): they are fired before the data is stored to the db (file), so that I coudn't even read changed data back inside hook. sqlite_update_hook() returnes rowID, but I didn't find any API to use this value... I would appriciate any ideas or comments. Thanks in advance. -- View this message in context: http://www.nabble.com/Trigger%27s-actions-and-callbacks-tp16418413p16418413.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users