Subject RE: [firebird-php] Calling php function from sql
Author Alan McDonald
Could you try this:
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.so';
Alan
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....







Yahoo! Groups Sponsor
ADVERTISEMENT





----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/

b.. To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]