mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 19:08:54 +00:00
158 lines
4.7 KiB
XML
158 lines
4.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
|
<refentry xml:id="function.pg-send-execute" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_send_execute</refname>
|
|
<refpurpose>Sends a request to execute a prepared statement with given parameters, without waiting for the result(s)</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>int</type><type>bool</type></type><methodname>pg_send_execute</methodname>
|
|
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>statement_name</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>params</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Sends a request to execute a prepared statement with given parameters,
|
|
without waiting for the result(s).
|
|
</para>
|
|
<para>
|
|
This is similar to <function>pg_send_query_params</function>, but the command to be executed is specified
|
|
by naming a previously-prepared statement, instead of giving a query string. The
|
|
function's parameters are handled identically to <function>pg_execute</function>.
|
|
Like <function>pg_execute</function>, it will not work on pre-7.4 versions of
|
|
PostgreSQL.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.connection;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>statement_name</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The name of the prepared statement to execute. If
|
|
"" is specified, then the unnamed statement is executed. The name must have
|
|
been previously prepared using <function>pg_prepare</function>,
|
|
<function>pg_send_prepare</function> or a <literal>PREPARE</literal> SQL
|
|
command.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>params</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
An array of parameter values to substitute for the $1, $2, etc. placeholders
|
|
in the original prepared query string. The number of elements in the array
|
|
must match the number of placeholders.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns &true; on success, &false; or <literal>0</literal> on failure. Use <function>pg_get_result</function>
|
|
to determine the query result.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.connection-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</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_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:"~/.phpdoc/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
|
|
-->
|