Thread: New News Entry

New News Entry

From
www@www.postgresql.com (World Wide Web Owner)
Date:
A new entry has been added to the news database.

Database Admin: http://www.postgresql.org/admin/edit_news.php?182

Submitted by: jd@commandprompt.com
Headline: plPHP RC1 is now available
Summary:

PL/PHP is a loadable procedural language that enables you to write PostgreSQL functions (store procedures) and triggers
inthe PHP programming language. It works with 7.3.x and 7.4.x. 

Story:

It currently supports SPI, composite types, SetOf function, triggers, trusted, and untrusted modes.

From the last release (Beta3) SPI, composite types, SetOf functions, and compile once have been added. Below are some
examplesof what the RC1 version of plPHP is currently capable of. 

Using global variables to store data between function callsL

<pre>
CREATE OR REPLACE FUNCTION set_var(text) RETURNS text AS \'
global $_SHARED;
$_SHARED[\'\'first\'\']=$args[0];
return \'\'ok\'\';
\' LANGUAGE plphp

CREATE OR REPLACE FUNCTION get_var() RETURNS text AS \'
global $_SHARED;
return $_SHARED[\'\'first\'\'];
\' LANGUAGE plphp;

SELECT set_var(\'hello plphp\');
SELECT get_var(); //will return \"hello plphp\" in our example

</pre>
Database Access (SPI):

$query = \"INSERT INTO my_table VALUES (1, \'\'test\'\')\";
$rv = spi_exec_query($query);

The result would be accessed as:

$res = $rv[\'\'status\'\']; //SPI_OK_INSERT in our example
$nrows = $rv[\'\'rows\'\'];
</pre>

SetOf functions:

<pre>
CREATE TYPE __testsetphp AS (f1 integer, f2 text, f3 text);

CREATE OR REPLACE FUNCTION php_set(integer) RETURNS SETOF __testsetphp AS \'
$ret[0][0]=$args[0];
$ret[0][1]=\"hello\";
$ret[0][2]=\"world\";
$ret[1][0]=2*$args[0];
$ret[1][1]=\"hello\";
$ret[1][2]=\"postgres\";
$ret[2][0]=3*$args[0];
$ret[2][1]=\"hello\";
$ret[2][2]=\"plphp\";
return $ret;
\' LANGUAGE \'plphp\';

SELECT * FROM php_set(1);

Will return:
 f1 |  f2   |    f3
----+-------+----------
  1 | hello | world
  2 | hello | postgres
  3 | hello | plphp

</pre>

plPHP can be found at the Command Prompt, Inc. community pages located <a
href=\"https://www.commandprompt.com/entry.lxp?lxpe=294\">here</a> 



Re: New News Entry

From
Peter Eisentraut
Date:
World Wide Web Owner wrote:
> Headline: plPHP RC1 is now available

I notice that the PHP license contains this:

  3. The name "PHP" must not be used to endorse or promote products
     derived from this software without prior written permission. For
     written permission, please contact group@php.net.

  4. Products derived from this software may not be called "PHP", nor
     may "PHP" appear in their name, without prior written permission
     from group@php.net.  You may indicate that your software works in
     conjunction with PHP by saying "Foo for PHP" instead of calling
     it "PHP Foo" or "phpfoo"

Has such a permission been obtained?


Re: New News Entry

From
Josh Berkus
Date:
Peter,

Word from Josh D:

Hello,

  I have sent a request to group however note that number 4 of the
license does allow what we are doing. It states:

Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net.  You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"

plPHP is derived from PHP thus we can't call it PHPpl but plPHP should
be o.k.

Sincerely,

Joshua D. Drake

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Re: New News Entry

From
Josh Berkus
Date:
Folks,

> Submitted by: jd@commandprompt.com
> Headline: plPHP RC1 is now available
> Summary:

Can someone approve this?  Thanks.

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: New News Entry

From
Devrim GUNDUZ
Date:
Hi,

On Thu, 29 Apr 2004, Josh Berkus wrote:

> > Submitted by: jd@commandprompt.com
> > Headline: plPHP RC1 is now available
> > Summary:
>
> Can someone approve this?  Thanks.

Done.
--
Devrim GUNDUZ
devrim~gunduz.org                devrim.gunduz~linux.org.tr
            http://www.TDMSoft.com
            http://www.gunduz.org