Subject | Calling php function from sql |
---|---|
Author | Anatol Ogórek |
Post date | 2004-12-01T08:24:21Z |
Hello.
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 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....