mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
134 lines
4.3 KiB
XML
134 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 9e6c3416c5c285f807a734e4663c399612777d7e Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.pg-send-query-params" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_send_query_params</refname>
|
|
<refpurpose>
|
|
Envía un comando y separa los parámetros al servidor sin esperar el/los resultado(s)
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>int</type><type>bool</type></type><methodname>pg_send_query_params</methodname>
|
|
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>params</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Envía un comando y separa los parámetros al servidor sin esperar el/los resultado(s).
|
|
</para>
|
|
<para>
|
|
Esta función es equivalente a <function>pg_send_query</function> con la excepción de que los parámetros de la consulta pueden especificarse por separado de la cadena de consulta <parameter>query</parameter>. Los parámetros de la función se gestionan de la misma manera que <function>pg_execute</function>. Como <function>pg_execute</function>, la función no funcionará en versiones anteriores a PostgreSQL 7.4 y solo permite un comando por consulta.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.connection;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>query</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La consulta SQL con sus parámetros. Debe contener solo una consulta. No se permiten múltiples consultas separadas por punto y coma. Si se utilizan parámetros, se hace referencia a ellos como $1, $2, etc.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>params</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un array de valores de parámetros para sustituir las variables $1, $2, etc. en la consulta preparada original. El número de elementos en el array debe coincidir con el número de variables a reemplazar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve &true; en caso de éxito, &false; o <literal>0</literal> en caso de fallo. Utilice <function>pg_get_result</function> para determinar el resultado de la consulta.
|
|
</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>Ejemplo con <function>pg_send_query_params</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect("dbname=publisher") or die("Conexión imposible");
|
|
|
|
// Con parámetros. Tenga en cuenta que no es necesario escapar la cadena del parámetro.
|
|
pg_send_query_params($dbconn, 'select count(*) from autores where ciudad = $1', array('Perth'));
|
|
|
|
// Comparar con el uso básico de pg_send_query
|
|
$str = pg_escape_string('Perth');
|
|
pg_send_query($dbconn, "select count(*) from autores where ciudad = '{$str}'");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_send_query</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
|
|
-->
|