1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-27 16:42:17 +01:00
Files
archived-doc-ja/reference/pgsql/functions/pg-send-query-params.xml
TAKAGI Masahiro 4284d39ec2 s/サーバ[^ー]/サーバー/g
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@324072 c90b9560-bf6c-de11-be94-00142212c4b1
2012-03-10 01:47:36 +00:00

131 lines
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 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>bool</type><methodname>pg_send_query_params</methodname>
<methodparam><type>resource</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>
<para>
PostgreSQL データベースの接続リソース。
</para>
</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>&return.success;</para>
<para>
クエリの結果を判断するには <function>pg_get_result</function>
を使用します。
</para>
</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
-->