On Fri, Jan 14, 2011 at 1:57 PM, Philip Graham Willoughby < phil.willoug...@strawberrycat.com> wrote:
> > On 14 Jan 2011, at 10:45, Max Vlasov wrote: > > > Phil, it's an interesting solution. I will probably use it, but the > current > > problem is that I have to resolve object context from non-oop function. > It's > > possible (maybe even by hard-coding pointer as one of parameters in the > > trigger statement), but your variant is very elegant so I should think > also > > of something similarly elegant :) You also mentioned at least one sane > way > > of using select inside the trigger body. I'm not so familiar with > triggers, > > just wondering is there some other examples of useful selects inside > > triggers bodies > > I use SQLite from Objective-C, so I also have to restore the oo-context I > want when user-defined functions are invoked. The 5th parameter to > sqlite3_create_function & friends (void *pApp) is your friend. You retrieve > it at invocation-time with sqlite3_user_data(ctx) where ctx is the > sqlite3_context pointer passed to your non-OO wrapper routine. > > I understand this, but in my case the tables are objects also. So when I create a temporary trigger I should pass the table object context. I can solve this if I create function temporary also. But in this case the elegance is lost a little since your solution suggested decreasing the number of temporary entities and making the user function temporal increases it back. Max _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users