1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-24 07:02:08 +01:00
Files
archived-doc-ja/reference/pgsql/functions/pg-send-query-params.xml
2024-02-18 10:13:20 +09:00

144 lines
4.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9e6c3416c5c285f807a734e4663c399612777d7e Maintainer: takagi Status: ready -->
<refentry xml:id="function.pg-send-query-params" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_send_query_params</refname>
<refpurpose>コマンドとパラメータを分割してサーバーに送信し、その結果を待たない</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>
コマンドとパラメータを分割してサーバーに送信します。その結果を待つことは
しません。
</para>
<para>
これは <function>pg_send_query</function> とほぼ同じですが、パラメータが
<parameter>query</parameter> とは別に分かれている点が違います。
関数のパラメータは、<function>pg_query_params</function> によって
完全に制御されます。<function>pg_query_params</function> と同様、
7.4 より前の 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>query</parameter></term>
<listitem>
<para>
パラメータ化した SQL 文。ひとつの文のみである必要があります
(複数の文をセミコロンで区切る形式は使用できません)。パラメータを
使用する際は $1、$2 などの形式で参照されます。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
プリペアドステートメント中の $1、$2 などのプレースホルダを
置き換えるパラメータの配列。配列の要素数はプレースホルダの
数と一致する必要があります。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功した場合に &true; 、失敗した場合に <literal>0</literal> を返します。
クエリの結果を確かめるには <function>pg_get_result</function> を使用します。
</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><function>pg_send_query_params</function> の使用法</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
// パラメータを使用する。パラメータにはクォートやエスケープが
// 必要ないことに注意
pg_send_query_params($dbconn, 'select count(*) from authors where city = $1', array('Perth'));
// 基本的な pg_send_query の使用法との比較
$str = pg_escape_string('Perth');
pg_send_query($dbconn, "select count(*) from authors where city = '{$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
-->