*** pgsql/doc/src/sgml/plperl.sgml 2010/06/14 18:47:05 2.85 --- pgsql/doc/src/sgml/plperl.sgml 2010/07/08 21:35:33 2.86 *************** *** 1,4 **** ! PL/Perl - Perl Procedural Language --- 1,4 ---- ! PL/Perl - Perl Procedural Language *************** $$ LANGUAGE plperl; *** 173,179 **** Similarly, values passed back to PostgreSQL must be in the external text representation format. For example, the encode_bytea function can be used to ! to escape binary data for a return value of type bytea. --- 173,179 ---- Similarly, values passed back to PostgreSQL must be in the external text representation format. For example, the encode_bytea function can be used to ! escape binary data for a return value of type bytea. *************** SELECT * from lotsa_md5(500); *** 515,521 **** spi_prepare accepts a query string with numbered argument placeholders ($1, $2, etc) and a string list of argument types: ! $plan = spi_prepare('SELECT * FROM test WHERE id > $1 AND name = $2', 'INTEGER', 'TEXT'); Once a query plan is prepared by a call to spi_prepare, the plan can be used instead of the string query, either in spi_exec_prepared, where the result is the same as returned --- 515,522 ---- spi_prepare accepts a query string with numbered argument placeholders ($1, $2, etc) and a string list of argument types: ! $plan = spi_prepare('SELECT * FROM test WHERE id > $1 AND name = $2', ! 'INTEGER', 'TEXT'); Once a query plan is prepared by a call to spi_prepare, the plan can be used instead of the string query, either in spi_exec_prepared, where the result is the same as returned *************** $plan = spi_prepare('SELECT * FROM test *** 534,540 **** CREATE OR REPLACE FUNCTION init() RETURNS VOID AS $$ ! $_SHARED{my_plan} = spi_prepare( 'SELECT (now() + $1)::date AS now', 'INTERVAL'); $$ LANGUAGE plperl; CREATE OR REPLACE FUNCTION add_time( INTERVAL ) RETURNS TEXT AS $$ --- 535,542 ---- CREATE OR REPLACE FUNCTION init() RETURNS VOID AS $$ ! $_SHARED{my_plan} = spi_prepare('SELECT (now() + $1)::date AS now', ! 'INTERVAL'); $$ LANGUAGE plperl; CREATE OR REPLACE FUNCTION add_time( INTERVAL ) RETURNS TEXT AS $$ *************** SELECT done(); *** 571,580 **** ! CREATE TABLE hosts AS SELECT id, ('192.168.1.'||id)::inet AS address FROM generate_series(1,3) AS id; CREATE OR REPLACE FUNCTION init_hosts_query() RETURNS VOID AS $$ ! $_SHARED{plan} = spi_prepare('SELECT * FROM hosts WHERE address << $1', 'inet'); $$ LANGUAGE plperl; CREATE OR REPLACE FUNCTION query_hosts(inet) RETURNS SETOF hosts AS $$ --- 573,584 ---- ! CREATE TABLE hosts AS SELECT id, ('192.168.1.'||id)::inet AS address ! FROM generate_series(1,3) AS id; CREATE OR REPLACE FUNCTION init_hosts_query() RETURNS VOID AS $$ ! $_SHARED{plan} = spi_prepare('SELECT * FROM hosts ! WHERE address << $1', 'inet'); $$ LANGUAGE plperl; CREATE OR REPLACE FUNCTION query_hosts(inet) RETURNS SETOF hosts AS $$