Subject | Re: [firebird-php] Calling php function from sql |
---|---|
Author | Uwe Grauer |
Post date | 2004-12-01T09:08:55Z |
Anatol Ogórek wrote:
I wouldn't try something like Php as UDF.
A UDF is just for small thinks you can't do with internal Functions.
What are you trying to do?
How to open a Transaction for diferent connections:
Pseudocode:
con1.StartTransaction()
con2.StartTransaction()
Transactions work on connections.
So what are your Problems?
Uwe
>Hello.Anatol,
>
>I noticed, that in the newest PHP release there was added udf file for
>interbase/firebird , that allows to execute php functions from sql. I
>got interested in it, but after few hours of trying I gave up...
>I use Firebidr 1.5 default instalation.
>
>I compile udf file as it is written in c file:
> gcc -shared `php-config --includes` `php-config --ldflags`
>`php-config --libs` -o php_ibase_udf.so php_ibase_udf.c
>
>...being in ext/interbase directory.
>
>Everything compiled well. File php_ibase_udf.so was created.
>So I copied it to /opt/firebird/UDF
>and started isql as SYSDBA with some database file...
>And I written:
> DECLARE EXTERNAL FUNCTION CALL_PHP1
> CSTRING(100),
> CSTRING(100) BY DESCRIPTOR,
> INTEGER BY DESCRIPTOR
> RETURNS PARAMETER 2
> ENTRY_POINT 'udf_call_php1' MODULE_NAME 'php_ibase_udf';
>
>and external function was created...
>So I try to use this function...
>SQL> update FAKTURA set numer =CALL_PHP1('ucwords',numer);
>Statement failed, SQLCODE = -902
>
>Access to UDF library "libphp_ibase_udf.so" is denied by server administrator
>
>So I renamed php_ibase_udf.so to libphp_ibase_udf.so
>
>and tried again...update FAKTURA set numer =CALL_PHP1('ucwords',numer);
>Statement failed, SQLCODE = -104
>
>invalid request BLR at offset 16
>-function CALL_PHP1 is not defined
>-module name or entrypoint could not be found
>SQL>
>
>And that's it.... I do not know what to do next...
>
>Can You help me?
>
>Another question is how to open transaction for two different
>connections. I saw in changelog that it is possible in newest
>version....
>
>
I wouldn't try something like Php as UDF.
A UDF is just for small thinks you can't do with internal Functions.
What are you trying to do?
How to open a Transaction for diferent connections:
Pseudocode:
con1.StartTransaction()
con2.StartTransaction()
Transactions work on connections.
So what are your Problems?
Uwe