Re: [sqlite] Problem invoking php functions from a trigger

2009-09-01 Thread Alejandro Ruiz-Oriol
Yes, but how do I know in the PHP fired by the trigger what's the PHP context of his parent?. Let me explain it. Inside the trigger I excute something like select test(); where test is a registered php function. When the trigger fires, the php function gets called, but the first thing I need

Re: [sqlite] Problem invoking php functions from a trigger

2009-09-01 Thread Kees Nuyt
On Tue, 1 Sep 2009 09:51:39 +0200, Alejandro Ruiz-Oriol aruiz...@itelsys.com wrote: Yes, but how do I know in the PHP fired by the trigger what's the PHP context of his parent?. Let me explain it. Inside the trigger I excute something like select test(); where test is a registered php

Re: [sqlite] Problem invoking php functions from a trigger

2009-09-01 Thread Alejandro Ruiz-Oriol
Ok, I got it!! In my php functions I use this code to connect to the DB (its in an include file) $dbh=$GLOBALS['dbh'];// Get Global Handle if ($dbh==null)// First time? no Handle? { $dbh = new PDO('sqlite:/var/www/domocenter.sqlite'); // Create new handle

Re: [sqlite] Problem invoking php functions from a trigger

2009-09-01 Thread Alejandro Ruiz-Oriol
Sorry I send it before time... 2009/9/2 Alejandro Ruiz-Oriol aruiz...@itelsys.com Ok, I got it!! In my php functions I use this code to connect to the DB (its in an include file) function OpenDB() { $dbh=$GLOBALS['dbh'];// Get Global Handle if ($dbh==null)//

Re: [sqlite] Problem invoking php functions from a trigger

2009-08-31 Thread Alejandro Ruiz-Oriol
Ok, you we're right!! The trigger fires a PHP function that connects back to de database and, in that connection I didn't register the php functions. Just in case someone runs in the same problem, this is a strange situation, because the function exists for PHP, but no for SQLite. So, the first

Re: [sqlite] Problem invoking php functions from a trigger

2009-08-31 Thread Kees Nuyt
On Mon, 31 Aug 2009 11:58:42 +0200, Alejandro Ruiz-Oriol aruiz...@itelsys.com wrote: I've been doing some further reading and I think that I already have the answer and it's No, no way to avoid this. As far as I've read, when you start any update function, SQLite makes an exclusive write lock to

[sqlite] Problem invoking php functions from a trigger

2009-08-28 Thread Alejandro Ruiz-Oriol
Hi everybody, I'm having a problem when I invoke a function developed in php from a trigger. I've been using SQLIteManager to develop and test my functions and everything work's perfect. I've created this function: *INSERT INTO user_function ( funct_name , funct_type , funct_code ,

Re: [sqlite] Problem invoking php functions from a trigger

2009-08-28 Thread Swithun Crowe
Hello AR if I run this php script AR AR *$dbh = new PDO('sqlite:/var/www/test.sqlite'); AR $sql=INSERT INTO Test ( Nombre , IP , MAC , Descripcion_Modulo ) VALUES ( AR '2221' , '2121' , '1212' , '1212' ) ; AR $modulo=$dbh-query($sql); AR print_r($dbh-errorInfo()); * AR AR from outside

Re: [sqlite] Problem invoking php functions from a trigger

2009-08-28 Thread Alejandro Ruiz-Oriol
Thank's Swithun but I still have trouble. Ok, I find out how to register functions with PDO_Sqlite extensions. Just in case someone is in the same situation, the way to do it is this: $dbh = new PDO('sqlite:/whatever.sqlite'); $dbh-sqliteCreateFunction('Test','Test'); But I still have a