Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: pg_send_execute - Manual
[go: Go Back, main page]

PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<pg_selectpg_send_prepare" width="11" height="7"/>
view the version of this page
Last updated: Sun, 07 May 2006

pg_send_execute

(PHP 5 >= 5.1.0RC1)

pg_send_execute --  指定したパラメータでプリペアドステートメントを実行するリクエストを 送信し、その結果を待たない

説明

bool pg_send_execute ( resource connection, string stmtname, array params )

指定したパラメータでプリペアドステートメントを実行するリクエストを 送信し、その結果を待ちません。

これは pg_send_query_params() と似ています。 しかし、実行するコマンドは指定したクエリ文字列で決まるのではなく 事前に準備されたステートメントの名前で決まります。関数のパラメータは pg_execute() と同じように処理されます。 pg_execute() と同様に、7.4 より前のバージョンの PostgreSQL では動作しません。

パラメータ

connection

PostgreSQL データベース接続リソース。connection が指定されていない場合はデフォルトの接続が使用されます。 デフォルトの接続は、直近の pg_connect() あるいは pg_pconnect() によって作成されたものです。

stmtname

実行するプリペアドステートメントの名前。"" が指定された場合は 無名ステートメントが実行されます。名前は、事前に pg_prepare()pg_send_prepare() あるいは PREPARE SQL コマンドで準備されたものである 必要があります。

params

プリペアドステートメント中の $1、$2 などのプレースホルダを 置き換えるパラメータの配列。配列の要素数はプレースホルダの 数と一致する必要があります。

返り値

成功した場合に TRUE 、失敗した場合に FALSE を返します。 クエリの結果を確認するには pg_get_result() を使用します。

例 1. pg_send_execute() の使用法

<?php
  $dbconn
= pg_connect("dbname=publisher") or die("Could not connect");

 
// 実行するクエリを準備する
 
if (!pg_connection_busy($dbconn)) {
  
pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
  
$res1 = pg_get_result($dbconn);
  }

 
// プリペアドクエリを実行する。 文字列 "Joe's Widgets" は
  // エスケープの必要がないことに注意
 
if (!pg_connection_busy($dbconn)) {
  
pg_send_execute($dbconn, "my_query", array("Joe's Widgets"));
  
$res2 = pg_get_result($dbconn);
  }
 
 
// 同じプリペアドクエリを異なるパラメータで実行する
 
if (!pg_connection_busy($dbconn)) {
  
pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
  
$res3 = pg_get_result($dbconn);
  }
 
?>



add a note add a note User Contributed Notes
pg_send_execute
There are no user contributed notes for this page.

<pg_selectpg_send_prepare" width="11" height="7"/>
 Last updated: Sun, 07 May 2006
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2006 The PHP Group
All rights reserved.
This mirror generously provided by: PacketBusiness, Inc.
Last updated: Wed Jun 28 13:19:26 2006 JST