pg_fetch_object
行をオブジェクトとして得る
&reftitle.description;
objectfalsepg_fetch_object
PgSql\Resultresult
intnullrow&null;
stringclass"stdClass"
arrayconstructor_args[]
pg_fetch_object は、取得した行のフィールド名に
対応するプロパティを有するオブジェクトを返します。オプションとして、
指定したクラスのコンストラクタにパラメータを渡してインスタンス化する
ことも可能です。
&database.fetch-null;
速度面では、この関数は pg_fetch_array と同じであり、
pg_fetch_row とほとんど同じ程度です
(違いはわずかです)。
&reftitle.parameters;
result
&pgsql.parameter.result;
row
取得する行番号。最初の行は 0 です。省略したり &null; を指定したりした場合は、
次の行を取得します。
class
インスタンス化し、プロパティを設定して戻り値とするクラスの名前。
指定しない場合は stdClass オブジェクトが返されます。
constructor_args
class オブジェクトのコンストラクタに
渡すオプションの配列。
&reftitle.returnvalues;
結果の各フィールドに対応する属性を持つ object を返します。
データベースの NULL 値は &null; として返します。
row が結果の行数より大きい場合・行が存在しない場合
、そしてそれ以外のエラーが発生した場合は &false; を返します。
&reftitle.changelog;
&Version;
&Description;
&pgsql.changelog.result-object;
&reftitle.examples;
pg_fetch_object の例
author . " (";
echo $data->year . "): ";
echo $data->title . "
";
}
pg_free_result($qu);
pg_close($db_conn);
?>
]]>
&reftitle.seealso;
pg_query
pg_fetch_array
pg_fetch_assoc
pg_fetch_row
pg_fetch_result