source: www/manuals/PHP_manual/function.ifx-query.html@ 1

Last change on this file since 1 was 1, checked in by george, 17 years ago

Prvotní import všeho

File size: 6.2 KB
Line 
1<HTML
2><HEAD
3><TITLE
4>ifx_query</TITLE
5><META
6NAME="GENERATOR"
7CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
8REL="HOME"
9TITLE="Manuál PHP"
10HREF="index.html"><LINK
11REL="UP"
12TITLE="Informix functions"
13HREF="ref.ifx.html"><LINK
14REL="PREVIOUS"
15TITLE="ifx_prepare"
16HREF="function.ifx-prepare.html"><LINK
17REL="NEXT"
18TITLE="ifx_textasvarchar"
19HREF="function.ifx-textasvarchar.html"><META
20HTTP-EQUIV="Content-type"
21CONTENT="text/html; charset=ISO-8859-2"></HEAD
22><BODY
23CLASS="refentry"
24BGCOLOR="#FFFFFF"
25TEXT="#000000"
26LINK="#0000FF"
27VLINK="#840084"
28ALINK="#0000FF"
29><DIV
30CLASS="NAVHEADER"
31><TABLE
32SUMMARY="Header navigation table"
33WIDTH="100%"
34BORDER="0"
35CELLPADDING="0"
36CELLSPACING="0"
37><TR
38><TH
39COLSPAN="3"
40ALIGN="center"
41>Manuál PHP</TH
42></TR
43><TR
44><TD
45WIDTH="10%"
46ALIGN="left"
47VALIGN="bottom"
48><A
49HREF="function.ifx-prepare.html"
50ACCESSKEY="P"
51>Pøedcházející</A
52></TD
53><TD
54WIDTH="80%"
55ALIGN="center"
56VALIGN="bottom"
57></TD
58><TD
59WIDTH="10%"
60ALIGN="right"
61VALIGN="bottom"
62><A
63HREF="function.ifx-textasvarchar.html"
64ACCESSKEY="N"
65>Dal¹í</A
66></TD
67></TR
68></TABLE
69><HR
70ALIGN="LEFT"
71WIDTH="100%"></DIV
72><H1
73><A
74NAME="function.ifx-query"
75></A
76>ifx_query</H1
77><DIV
78CLASS="refnamediv"
79><A
80NAME="AEN36233"
81></A
82><P
83> (PHP 3&#62;= 3.0.3, PHP 4 )</P
84>ifx_query&nbsp;--&nbsp;Send Informix query</DIV
85><DIV
86CLASS="refsect1"
87><A
88NAME="AEN36236"
89></A
90><H2
91>Description</H2
92>int <B
93CLASS="methodname"
94>ifx_query</B
95> ( string query, int link_identifier [, int cursor_type [, mixed blobidarray]])<BR
96></BR
97><P
98>
99 Returns: A positive Informix result identifier on success, or
100 <TT
101CLASS="constant"
102><B
103>FALSE</B
104></TT
105> on error.
106 </P
107><P
108>
109 A "result_id" resource used by other functions to retrieve the
110 query results. Sets "affected_rows" for retrieval by the
111 <A
112HREF="function.ifx-affected-rows.html"
113><B
114CLASS="function"
115>ifx_affected_rows()</B
116></A
117> function.
118 </P
119><P
120>
121 <B
122CLASS="function"
123>ifx_query()</B
124> sends a query to the currently
125 active database on the server that's associated with the
126 specified link identifier.
127 </P
128><P
129>&#13; Executes <TT
130CLASS="parameter"
131><I
132>query</I
133></TT
134> on connection
135 <TT
136CLASS="parameter"
137><I
138>conn_id</I
139></TT
140>. For "select-type" queries a
141 cursor is declared and opened. The optional
142 <TT
143CLASS="parameter"
144><I
145>cursor_type</I
146></TT
147> parameter allows you to make
148 this a "scroll" and/or "hold" cursor. It's a bitmask and can be
149 either IFX_SCROLL, IFX_HOLD, or both or'ed together. Non-select
150 queries are "execute immediate". IFX_SCROLL and IFX_HOLD are
151 symbolic constants and as such shouldn't be between quotes. I you
152 omit this parameter the cursor is a normal sequential cursor.
153 </P
154><P
155>&#13; For either query type the number of (estimated or real) affected
156 rows is saved for retrieval by
157 <A
158HREF="function.ifx-affected-rows.html"
159><B
160CLASS="function"
161>ifx_affected_rows()</B
162></A
163>.
164 </P
165><P
166>&#13; If you have BLOB (BYTE or TEXT) columns in an update query, you
167 can add a <TT
168CLASS="parameter"
169><I
170>blobidarray</I
171></TT
172> parameter containing
173 the corresponding "blob ids", and you should replace those
174 columns with a "?" in the query text.
175 </P
176><P
177>&#13; If the contents of the TEXT (or BYTE) column allow it, you can
178 also use "ifx_textasvarchar(1)" and "ifx_byteasvarchar(1)". This
179 allows you to treat TEXT (or BYTE) columns just as if they were
180 ordinary (but long) VARCHAR columns for select queries, and you
181 don't need to bother with blob id's.
182 </P
183><P
184>&#13; With ifx_textasvarchar(0) or ifx_byteasvarchar(0) (the default
185 situation), select queries will return BLOB columns as blob id's
186 (integer value). You can get the value of the blob as a string
187 or file with the blob functions (see below).
188 </P
189><P
190>&#13; See also: <A
191HREF="function.ifx-connect.html"
192><B
193CLASS="function"
194>ifx_connect()</B
195></A
196>.
197 <TABLE
198WIDTH="100%"
199BORDER="0"
200CELLPADDING="0"
201CELLSPACING="0"
202CLASS="EXAMPLE"
203><TR
204><TD
205><DIV
206CLASS="example"
207><A
208NAME="AEN36271"
209></A
210><P
211><B
212>Pøíklad 1.
213 Show all rows of the "orders" table as a html table
214 </B
215></P
216><TABLE
217BORDER="0"
218BGCOLOR="#E0E0E0"
219CELLPADDING="5"
220><TR
221><TD
222><PRE
223CLASS="php"
224>ifx_textasvarchar(1); // use "text mode" for blobs
225$res_id = ifx_query("select * from orders", $conn_id);
226if (! $res_id) {
227 printf("Can't select orders : %s\n&#60;br&#62;%s&#60;br&#62;\n", ifx_error());
228 ifx_errormsg();
229 die;
230}
231ifx_htmltbl_result($res_id, "border=\"1\"");
232ifx_free_result($res_id);</PRE
233></TD
234></TR
235></TABLE
236></DIV
237></TD
238></TR
239></TABLE
240>
241 <TABLE
242WIDTH="100%"
243BORDER="0"
244CELLPADDING="0"
245CELLSPACING="0"
246CLASS="EXAMPLE"
247><TR
248><TD
249><DIV
250CLASS="example"
251><A
252NAME="AEN36274"
253></A
254><P
255><B
256>Pøíklad 2. Insert some values into the "catalog" table</B
257></P
258><TABLE
259BORDER="0"
260BGCOLOR="#E0E0E0"
261CELLPADDING="5"
262><TR
263><TD
264><PRE
265CLASS="php"
266>// create blob id's for a byte and text column
267$textid = ifx_create_blob(0, 0, "Text column in memory");
268$byteid = ifx_create_blob(1, 0, "Byte column in memory");
269 // store blob id's in a blobid array
270$blobidarray[] = $textid;
271$blobidarray[] = $byteid;
272 // launch query
273$query = "insert into catalog (stock_num, manu_code, " .
274 "cat_descr,cat_picture) values(1,'HRO',?,?)";
275$res_id = ifx_query($query, $conn_id, $blobidarray);
276if (! $res_id) {
277 ... error ...
278}
279 // free result id
280ifx_free_result($res_id);</PRE
281></TD
282></TR
283></TABLE
284></DIV
285></TD
286></TR
287></TABLE
288>
289 </P
290></DIV
291><DIV
292CLASS="NAVFOOTER"
293><HR
294ALIGN="LEFT"
295WIDTH="100%"><TABLE
296SUMMARY="Footer navigation table"
297WIDTH="100%"
298BORDER="0"
299CELLPADDING="0"
300CELLSPACING="0"
301><TR
302><TD
303WIDTH="33%"
304ALIGN="left"
305VALIGN="top"
306><A
307HREF="function.ifx-prepare.html"
308ACCESSKEY="P"
309>Pøedcházející</A
310></TD
311><TD
312WIDTH="34%"
313ALIGN="center"
314VALIGN="top"
315><A
316HREF="index.html"
317ACCESSKEY="H"
318>Domù</A
319></TD
320><TD
321WIDTH="33%"
322ALIGN="right"
323VALIGN="top"
324><A
325HREF="function.ifx-textasvarchar.html"
326ACCESSKEY="N"
327>Dal¹í</A
328></TD
329></TR
330><TR
331><TD
332WIDTH="33%"
333ALIGN="left"
334VALIGN="top"
335>ifx_prepare</TD
336><TD
337WIDTH="34%"
338ALIGN="center"
339VALIGN="top"
340><A
341HREF="ref.ifx.html"
342ACCESSKEY="U"
343>Nahoru</A
344></TD
345><TD
346WIDTH="33%"
347ALIGN="right"
348VALIGN="top"
349>ifx_textasvarchar</TD
350></TR
351></TABLE
352></DIV
353></BODY
354></HTML
355>
Note: See TracBrowser for help on using the repository browser.