Re: [sqlite] Sqlite handler in trigger
Thanks for clarification. My understanding: Process creating notified function has to create trigger do the other operation (Update, Insert and Delete) to get trigger logic execution. I understand it may not be in same sequence. Process can register function create trigger, But trigger operation may come on run time .(All by using common sqlite handler...) Which part of this sentence did you find unclear the first time round? It is all clear I was just checking for hint, if some one comes across to handle this kind of scenario by using combination of sqlite capability application logic!!! On Fri, Sep 6, 2013 at 10:34 AM, Igor Tandetnik i...@tandetnik.org wrote: On 9/6/2013 12:51 AM, techi eth wrote: I am not sure if my problem I have stated clearly, found below detail explanation!!! --**--** Process 1: Handler1 = OpenConn(); Sqlite_Createfunc(Handler1, my_notifier_function()..); CREATE TRIGGER Event_test1 AFTER Update ON test BEGIN SELECT my_notifier_function(); END; --**--** Proecss2: Handler2 = OpenConn(); Update test SET value; That last statement will fail with unknown function 'my_notifier_function' error. In this scenario when proecss2 will do update... In this scenario process2 will be unable to do update. If above will not happen then please suggest what is best I can get from sqlite3 to handle this kind of scenario. Once again: there is no mechanism built into SQLite that would allow one process to be automatically notified that another process made a change to the database. Which part of this sentence did you find unclear the first time round? -- Igor Tandetnik __**_ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**usershttp://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Sqlite handler in trigger
Hi, I would like to check sqlite handler usability while using trigger: I have register one function to sqlite by sqlite3_create_function().Now I am creating trigger on update selecting that function for callaback. In above scenario it is mandatory that sqlite3 handler used while create function setting trigger should use for update. I have case where one process is updating data with his private handler but trigger on update is created by other process by his private handler. Cheers - Techi ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Sqlite handler in trigger
On 9/5/2013 5:39 AM, techi eth wrote: I have case where one process is updating data with his private handler but trigger on update is created by other process by his private handler. I'm not sure I understand this sentence. When you run CREATE TRIGGER statement, the trigger you've just created becomes part of the database schema, visible to all connections (unless you do CREATE TEMP TRIGGER; is this what you are talking about?) On the other hand, sqlite3_create_function() registers a custom function just for this connection. If you create a trigger that calls this function, then those connections where the function is not registered will fail to even prepare an UPDATE statement - SQLite will issue an unknown function error. In general, there is no mechanism built into SQLite that would allow one process to be automatically notified that another process made a change to the database. If that's what you want, you would have to implement that in your application - you can't somehow trick SQLite into doing it for you. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Sqlite handler in trigger
I am not sure if my problem I have stated clearly, found below detail explanation!!! Process 1: Handler1 = OpenConn(); Sqlite_Createfunc(Handler1, my_notifier_function()..); CREATE TRIGGER Event_test1 AFTER Update ON test BEGIN SELECT my_notifier_function(); END; Proecss2: Handler2 = OpenConn(); Update test SET value; In this scenario when proecss2 will do update then trigger logic will get executed my_notifier_function() function may get called. If above will not happen then please suggest what is best I can get from sqlite3 to handle this kind of scenario. May be any other possible operation? Thanks.. On Thu, Sep 5, 2013 at 6:55 PM, Igor Tandetnik i...@tandetnik.org wrote: On 9/5/2013 5:39 AM, techi eth wrote: I have case where one process is updating data with his private handler but trigger on update is created by other process by his private handler. I'm not sure I understand this sentence. When you run CREATE TRIGGER statement, the trigger you've just created becomes part of the database schema, visible to all connections (unless you do CREATE TEMP TRIGGER; is this what you are talking about?) On the other hand, sqlite3_create_function() registers a custom function just for this connection. If you create a trigger that calls this function, then those connections where the function is not registered will fail to even prepare an UPDATE statement - SQLite will issue an unknown function error. In general, there is no mechanism built into SQLite that would allow one process to be automatically notified that another process made a change to the database. If that's what you want, you would have to implement that in your application - you can't somehow trick SQLite into doing it for you. -- Igor Tandetnik __**_ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**usershttp://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Sqlite handler in trigger
On 9/6/2013 12:51 AM, techi eth wrote: I am not sure if my problem I have stated clearly, found below detail explanation!!! Process 1: Handler1 = OpenConn(); Sqlite_Createfunc(Handler1, my_notifier_function()..); CREATE TRIGGER Event_test1 AFTER Update ON test BEGIN SELECT my_notifier_function(); END; Proecss2: Handler2 = OpenConn(); Update test SET value; That last statement will fail with unknown function 'my_notifier_function' error. In this scenario when proecss2 will do update... In this scenario process2 will be unable to do update. If above will not happen then please suggest what is best I can get from sqlite3 to handle this kind of scenario. Once again: there is no mechanism built into SQLite that would allow one process to be automatically notified that another process made a change to the database. Which part of this sentence did you find unclear the first time round? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users