<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 --> <refentry id="function.pg-send-execute"> <refnamediv> <refname>pg_send_execute</refname> <refpurpose>Asynchronously execute a previously prepared query</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>resource</type><methodname>pg_send_execute</methodname> <methodparam><type>string</type><parameter>stmtname</parameter></methodparam> <methodparam><type>array</type><parameter>params</parameter></methodparam> </methodsynopsis> <methodsynopsis> <type>resource</type><methodname>pg_send_execute</methodname> <methodparam><type>resource</type><parameter>connection</parameter></methodparam> <methodparam><type>string</type><parameter>stmtname</parameter></methodparam> <methodparam><type>array</type><parameter>params</parameter></methodparam> </methodsynopsis> <para> <function>pg_send_execute</function> executes a previously prepared named query on the <parameter>connection</parameter>, with the specified parameters. Unlike <function>pg_execute</function>, script execution is not blocked while the query is executing. </para> <para> <function>pg_send_execute</function> returns a query result resource if the named prepared query could be executed with the given parameters. It returns &false; on failure or if connection is not a valid connection. It is identical to <function>pg_send_query_params</function> except that it takes the name of a previously prepared query instead of an actual query. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Using <function>pg_send_execute</function></title> <programlisting role="php"> <![CDATA[ <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); // Prepare a query for execution if (!pg_connection_busy($dbconn)) { pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1'); $res1 = pg_get_result($dbconn); } // Execute the prepared query. Note that it is not necessary to escape // the string "Joe's Widgets" in any way if (!pg_connection_busy($dbconn)) { pg_send_execute($dbconn, "my_query", array("Joe's Widgets")); $res2 = pg_get_result($dbconn); } // Execute the same prepared query, this time with a different parameter if (!pg_connection_busy($dbconn)) { pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes")); $res3 = pg_get_result($dbconn); } ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>pg_connect</function></member> <member><function>pg_pconnect</function></member> <member><function>pg_prepare</function></member> <member><function>pg_send_prepare</function></member> <member><function>pg_execute</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->