-
Notifications
You must be signed in to change notification settings - Fork 58
/
getattribute.xml
154 lines (143 loc) · 4.7 KB
/
getattribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="utf-8" ?>
<!-- $Revision$ -->
<!-- EN-Revision: 5bef6e3f51b6add9f9f27ad65409b66f6ab44af7 Maintainer: takagi Status: ready -->
<!-- CREDITS: shimooka -->
<refentry xml:id="pdo.getattribute" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>PDO::getAttribute</refname>
<refpurpose>
データベース接続の属性を取得する
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="PDO">
<modifier>public</modifier> <type>mixed</type><methodname>PDO::getAttribute</methodname>
<methodparam><type>int</type><parameter>attribute</parameter></methodparam>
</methodsynopsis>
<para>
この関数はデータベース接続の属性値を返します。PDOStatement
属性を取得する場合、<methodname>PDOStatement::getAttribute</methodname>
を参照ください。
</para>
<para>
いくつかのデータベースもしくはドライバは、
データベース接続の属性の全てのをサポートしていないかも知れないことに
注意してください。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>attribute</parameter></term>
<listitem>
<para>
<literal>PDO_ATTR_*</literal> 定数の 1 つを指定します。
データベース接続に適用される一般的な属性は以下の通りです。
<simplelist>
<member><literal>PDO::ATTR_AUTOCOMMIT</literal></member>
<member><literal>PDO::ATTR_CASE</literal></member>
<member><literal>PDO::ATTR_CLIENT_VERSION</literal></member>
<member><literal>PDO::ATTR_CONNECTION_STATUS</literal></member>
<member><literal>PDO::ATTR_DRIVER_NAME</literal></member>
<member><literal>PDO::ATTR_ERRMODE</literal></member>
<member><literal>PDO::ATTR_ORACLE_NULLS</literal></member>
<member><literal>PDO::ATTR_PERSISTENT</literal></member>
<member><literal>PDO::ATTR_PREFETCH</literal></member>
<member><literal>PDO::ATTR_SERVER_INFO</literal></member>
<member><literal>PDO::ATTR_SERVER_VERSION</literal></member>
<member><literal>PDO::ATTR_TIMEOUT</literal></member>
</simplelist>
</para>
<simpara>
ドライバによっては、
そのドライバ固有の属性を使っているかもしれません。
そういう属性は、他のドライバでは使っては
<emphasis>いけない</emphasis> ことに注意して下さい。
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
コールに成功した場合は要求された PDO 属性の値を返します。
コールに失敗した場合は <literal>null</literal> を返します。
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
ドライバが要求された <parameter>attribute</parameter>
をサポートしていない場合、
<methodname>PDO::getAttribute</methodname> は
<exceptionname>PDOException</exceptionname> をスローします。
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>データベース接続の属性を取得する</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
$attributes = array(
"AUTOCOMMIT", "ERRMODE", "CASE", "CLIENT_VERSION", "CONNECTION_STATUS",
"ORACLE_NULLS", "PERSISTENT", "PREFETCH", "SERVER_INFO", "SERVER_VERSION",
"TIMEOUT"
);
foreach ($attributes as $val) {
echo "PDO::ATTR_$val: ";
echo $conn->getAttribute(constant("PDO::ATTR_$val")) . "\n";
}
?>
]]>
</programlisting>
<!--
&example.outputs;
<screen>
<![CDATA[
Use the PEAR Coding Standards
]]>
</screen>
-->
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>PDO::setAttribute</methodname></member>
<member><methodname>PDOStatement::getAttribute</methodname></member>
<member><methodname>PDOStatement::setAttribute</methodname></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
-->