1 | <HTML
|
---|
2 | ><HEAD
|
---|
3 | ><TITLE
|
---|
4 | >odbc_setoption</TITLE
|
---|
5 | ><META
|
---|
6 | NAME="GENERATOR"
|
---|
7 | CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
---|
8 | REL="HOME"
|
---|
9 | TITLE="Manuál PHP"
|
---|
10 | HREF="index.html"><LINK
|
---|
11 | REL="UP"
|
---|
12 | TITLE="Unified ODBC functions"
|
---|
13 | HREF="ref.odbc.html"><LINK
|
---|
14 | REL="PREVIOUS"
|
---|
15 | TITLE="odbc_rollback"
|
---|
16 | HREF="function.odbc-rollback.html"><LINK
|
---|
17 | REL="NEXT"
|
---|
18 | TITLE="odbc_specialcolumns"
|
---|
19 | HREF="function.odbc-specialcolumns.html"><META
|
---|
20 | HTTP-EQUIV="Content-type"
|
---|
21 | CONTENT="text/html; charset=ISO-8859-2"></HEAD
|
---|
22 | ><BODY
|
---|
23 | CLASS="refentry"
|
---|
24 | BGCOLOR="#FFFFFF"
|
---|
25 | TEXT="#000000"
|
---|
26 | LINK="#0000FF"
|
---|
27 | VLINK="#840084"
|
---|
28 | ALINK="#0000FF"
|
---|
29 | ><DIV
|
---|
30 | CLASS="NAVHEADER"
|
---|
31 | ><TABLE
|
---|
32 | SUMMARY="Header navigation table"
|
---|
33 | WIDTH="100%"
|
---|
34 | BORDER="0"
|
---|
35 | CELLPADDING="0"
|
---|
36 | CELLSPACING="0"
|
---|
37 | ><TR
|
---|
38 | ><TH
|
---|
39 | COLSPAN="3"
|
---|
40 | ALIGN="center"
|
---|
41 | >Manuál PHP</TH
|
---|
42 | ></TR
|
---|
43 | ><TR
|
---|
44 | ><TD
|
---|
45 | WIDTH="10%"
|
---|
46 | ALIGN="left"
|
---|
47 | VALIGN="bottom"
|
---|
48 | ><A
|
---|
49 | HREF="function.odbc-rollback.html"
|
---|
50 | ACCESSKEY="P"
|
---|
51 | >Pøedcházející</A
|
---|
52 | ></TD
|
---|
53 | ><TD
|
---|
54 | WIDTH="80%"
|
---|
55 | ALIGN="center"
|
---|
56 | VALIGN="bottom"
|
---|
57 | ></TD
|
---|
58 | ><TD
|
---|
59 | WIDTH="10%"
|
---|
60 | ALIGN="right"
|
---|
61 | VALIGN="bottom"
|
---|
62 | ><A
|
---|
63 | HREF="function.odbc-specialcolumns.html"
|
---|
64 | ACCESSKEY="N"
|
---|
65 | >Dal¹í</A
|
---|
66 | ></TD
|
---|
67 | ></TR
|
---|
68 | ></TABLE
|
---|
69 | ><HR
|
---|
70 | ALIGN="LEFT"
|
---|
71 | WIDTH="100%"></DIV
|
---|
72 | ><H1
|
---|
73 | ><A
|
---|
74 | NAME="function.odbc-setoption"
|
---|
75 | ></A
|
---|
76 | >odbc_setoption</H1
|
---|
77 | ><DIV
|
---|
78 | CLASS="refnamediv"
|
---|
79 | ><A
|
---|
80 | NAME="AEN61052"
|
---|
81 | ></A
|
---|
82 | ><P
|
---|
83 | > (PHP 3>= 3.0.6, PHP 4 )</P
|
---|
84 | >odbc_setoption --
|
---|
85 | Adjust ODBC settings. Returns <TT
|
---|
86 | CLASS="constant"
|
---|
87 | ><B
|
---|
88 | >FALSE</B
|
---|
89 | ></TT
|
---|
90 | > if an error occurs, otherwise
|
---|
91 | <TT
|
---|
92 | CLASS="constant"
|
---|
93 | ><B
|
---|
94 | >TRUE</B
|
---|
95 | ></TT
|
---|
96 | >.
|
---|
97 | </DIV
|
---|
98 | ><DIV
|
---|
99 | CLASS="refsect1"
|
---|
100 | ><A
|
---|
101 | NAME="AEN61057"
|
---|
102 | ></A
|
---|
103 | ><H2
|
---|
104 | >Description</H2
|
---|
105 | >int <B
|
---|
106 | CLASS="methodname"
|
---|
107 | >odbc_setoption</B
|
---|
108 | > ( resource id, int function, int option, int param)<BR
|
---|
109 | ></BR
|
---|
110 | ><P
|
---|
111 | > This function allows fiddling with the ODBC options for a
|
---|
112 | particular connection or query result. It was written to help
|
---|
113 | find work arounds to problems in quirky ODBC drivers. You should
|
---|
114 | probably only use this function if you are an ODBC programmer and
|
---|
115 | understand the effects the various options will have. You will
|
---|
116 | certainly need a good ODBC reference to explain all the different
|
---|
117 | options and values that can be used. Different driver versions
|
---|
118 | support different options.
|
---|
119 | </P
|
---|
120 | ><P
|
---|
121 | > Because the effects may vary depending on the ODBC driver, use of
|
---|
122 | this function in scripts to be made publicly available is
|
---|
123 | strongly discouraged. Also, some ODBC options are not available
|
---|
124 | to this function because they must be set before the connection
|
---|
125 | is established or the query is prepared. However, if on a
|
---|
126 | particular job it can make PHP work so your boss doesn't tell you
|
---|
127 | to use a commercial product, that's all that really
|
---|
128 | matters.
|
---|
129 | </P
|
---|
130 | ><P
|
---|
131 | > <TT
|
---|
132 | CLASS="parameter"
|
---|
133 | ><I
|
---|
134 | >id</I
|
---|
135 | ></TT
|
---|
136 | > is a connection id or result id on
|
---|
137 | which to change the settings.For SQLSetConnectOption(), this is a
|
---|
138 | connection id. For SQLSetStmtOption(), this is a result
|
---|
139 | id.
|
---|
140 | </P
|
---|
141 | ><P
|
---|
142 | > <TT
|
---|
143 | CLASS="parameter"
|
---|
144 | ><I
|
---|
145 | >Function</I
|
---|
146 | ></TT
|
---|
147 | > is the ODBC function to use. The
|
---|
148 | value should be 1 for SQLSetConnectOption() and 2 for
|
---|
149 | SQLSetStmtOption().
|
---|
150 | </P
|
---|
151 | ><P
|
---|
152 | > Parameter <TT
|
---|
153 | CLASS="parameter"
|
---|
154 | ><I
|
---|
155 | >option</I
|
---|
156 | ></TT
|
---|
157 | > is the option to set.</P
|
---|
158 | ><P
|
---|
159 | > Parameter <TT
|
---|
160 | CLASS="parameter"
|
---|
161 | ><I
|
---|
162 | >param</I
|
---|
163 | ></TT
|
---|
164 | > is the value for the
|
---|
165 | given <TT
|
---|
166 | CLASS="parameter"
|
---|
167 | ><I
|
---|
168 | >option</I
|
---|
169 | ></TT
|
---|
170 | >.
|
---|
171 | <TABLE
|
---|
172 | WIDTH="100%"
|
---|
173 | BORDER="0"
|
---|
174 | CELLPADDING="0"
|
---|
175 | CELLSPACING="0"
|
---|
176 | CLASS="EXAMPLE"
|
---|
177 | ><TR
|
---|
178 | ><TD
|
---|
179 | ><DIV
|
---|
180 | CLASS="example"
|
---|
181 | ><A
|
---|
182 | NAME="AEN61085"
|
---|
183 | ></A
|
---|
184 | ><P
|
---|
185 | ><B
|
---|
186 | >Pøíklad 1. ODBC Setoption Examples</B
|
---|
187 | ></P
|
---|
188 | ><TABLE
|
---|
189 | BORDER="0"
|
---|
190 | BGCOLOR="#E0E0E0"
|
---|
191 | CELLPADDING="5"
|
---|
192 | ><TR
|
---|
193 | ><TD
|
---|
194 | ><PRE
|
---|
195 | CLASS="php"
|
---|
196 | >// 1. Option 102 of SQLSetConnectOption() is SQL_AUTOCOMMIT.
|
---|
197 | // Value 1 of SQL_AUTOCOMMIT is SQL_AUTOCOMMIT_ON.
|
---|
198 | // This example has the same effect as
|
---|
199 | // odbc_autocommit($conn, true);
|
---|
200 |
|
---|
201 | odbc_setoption ($conn, 1, 102, 1);
|
---|
202 |
|
---|
203 | // 2. Option 0 of SQLSetStmtOption() is SQL_QUERY_TIMEOUT.
|
---|
204 | // This example sets the query to timeout after 30 seconds.
|
---|
205 |
|
---|
206 | $result = odbc_prepare ($conn, $sql);
|
---|
207 | odbc_setoption ($result, 2, 0, 30);
|
---|
208 | odbc_execute ($result);</PRE
|
---|
209 | ></TD
|
---|
210 | ></TR
|
---|
211 | ></TABLE
|
---|
212 | ></DIV
|
---|
213 | ></TD
|
---|
214 | ></TR
|
---|
215 | ></TABLE
|
---|
216 | >
|
---|
217 | </P
|
---|
218 | ></DIV
|
---|
219 | ><DIV
|
---|
220 | CLASS="NAVFOOTER"
|
---|
221 | ><HR
|
---|
222 | ALIGN="LEFT"
|
---|
223 | WIDTH="100%"><TABLE
|
---|
224 | SUMMARY="Footer navigation table"
|
---|
225 | WIDTH="100%"
|
---|
226 | BORDER="0"
|
---|
227 | CELLPADDING="0"
|
---|
228 | CELLSPACING="0"
|
---|
229 | ><TR
|
---|
230 | ><TD
|
---|
231 | WIDTH="33%"
|
---|
232 | ALIGN="left"
|
---|
233 | VALIGN="top"
|
---|
234 | ><A
|
---|
235 | HREF="function.odbc-rollback.html"
|
---|
236 | ACCESSKEY="P"
|
---|
237 | >Pøedcházející</A
|
---|
238 | ></TD
|
---|
239 | ><TD
|
---|
240 | WIDTH="34%"
|
---|
241 | ALIGN="center"
|
---|
242 | VALIGN="top"
|
---|
243 | ><A
|
---|
244 | HREF="index.html"
|
---|
245 | ACCESSKEY="H"
|
---|
246 | >Domù</A
|
---|
247 | ></TD
|
---|
248 | ><TD
|
---|
249 | WIDTH="33%"
|
---|
250 | ALIGN="right"
|
---|
251 | VALIGN="top"
|
---|
252 | ><A
|
---|
253 | HREF="function.odbc-specialcolumns.html"
|
---|
254 | ACCESSKEY="N"
|
---|
255 | >Dal¹í</A
|
---|
256 | ></TD
|
---|
257 | ></TR
|
---|
258 | ><TR
|
---|
259 | ><TD
|
---|
260 | WIDTH="33%"
|
---|
261 | ALIGN="left"
|
---|
262 | VALIGN="top"
|
---|
263 | >odbc_rollback</TD
|
---|
264 | ><TD
|
---|
265 | WIDTH="34%"
|
---|
266 | ALIGN="center"
|
---|
267 | VALIGN="top"
|
---|
268 | ><A
|
---|
269 | HREF="ref.odbc.html"
|
---|
270 | ACCESSKEY="U"
|
---|
271 | >Nahoru</A
|
---|
272 | ></TD
|
---|
273 | ><TD
|
---|
274 | WIDTH="33%"
|
---|
275 | ALIGN="right"
|
---|
276 | VALIGN="top"
|
---|
277 | >odbc_specialcolumns</TD
|
---|
278 | ></TR
|
---|
279 | ></TABLE
|
---|
280 | ></DIV
|
---|
281 | ></BODY
|
---|
282 | ></HTML
|
---|
283 | >
|
---|