]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/docs/docs-adodb.htm
Upgrade adodb
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / docs / docs-adodb.htm
1 <html xmlns:v="urn:schemas-microsoft-com:vml"
2 xmlns:o="urn:schemas-microsoft-com:office:office"
3 xmlns:w="urn:schemas-microsoft-com:office:word"
4 xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
5 xmlns="http://www.w3.org/TR/REC-html40">
6
7 <head>
8 <meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
9 <meta name=ProgId content=Word.Document>
10 <meta name=Generator content="Microsoft Word 11">
11 <meta name=Originator content="Microsoft Word 11">
12 <link rel=File-List href="docs-adodb_files/filelist.xml">
13 <link rel=Edit-Time-Data href="docs-adodb_files/editdata.mso">
14 <!--[if !mso]>
15 <style>
16 v\:* {behavior:url(#default#VML);}
17 o\:* {behavior:url(#default#VML);}
18 w\:* {behavior:url(#default#VML);}
19 .shape {behavior:url(#default#VML);}
20 </style>
21 <![endif]-->
22 <title>ADODB Manual</title>
23 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
24  name="State"/>
25 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
26  name="PlaceType"/>
27 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
28  name="PlaceName"/>
29 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
30  name="country-region"/>
31 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
32  name="City"/>
33 <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
34  name="place"/>
35 <!--[if gte mso 9]><xml>
36  <o:DocumentProperties>
37   <o:Author>John</o:Author>
38   <o:LastAuthor>John</o:LastAuthor>
39   <o:Revision>3</o:Revision>
40   <o:TotalTime>3</o:TotalTime>
41   <o:Created>2008-12-24T10:43:00Z</o:Created>
42   <o:LastSaved>2008-12-24T10:46:00Z</o:LastSaved>
43   <o:Pages>73</o:Pages>
44   <o:Words>30239</o:Words>
45   <o:Characters>172366</o:Characters>
46   <o:Company> </o:Company>
47   <o:Lines>1436</o:Lines>
48   <o:Paragraphs>404</o:Paragraphs>
49   <o:CharactersWithSpaces>202201</o:CharactersWithSpaces>
50   <o:Version>11.9999</o:Version>
51  </o:DocumentProperties>
52 </xml><![endif]--><!--[if gte mso 9]><xml>
53  <w:WordDocument>
54   <w:Zoom>140</w:Zoom>
55   <w:FormsDesign/>
56   <w:ValidateAgainstSchemas/>
57   <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
58   <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
59   <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
60   <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
61  </w:WordDocument>
62 </xml><![endif]--><!--[if gte mso 9]><xml>
63  <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
64  </w:LatentStyles>
65 </xml><![endif]--><!--[if !mso]><object
66  classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
67 <style>
68 st1\:*{behavior:url(#ieooui) }
69 </style>
70 <![endif]-->
71 <style>
72 <!--
73 f
74
75
76  /* Font Definitions */
77  @font-face
78         {font-family:Helvetica;
79         panose-1:2 11 6 4 2 2 2 2 2 4;
80         mso-font-charset:0;
81         mso-generic-font-family:swiss;
82         mso-font-format:other;
83         mso-font-pitch:variable;
84         mso-font-signature:3 0 0 0 1 0;}
85 @font-face
86         {font-family:Courier;
87         panose-1:2 7 4 9 2 2 5 2 4 4;
88         mso-font-charset:0;
89         mso-generic-font-family:modern;
90         mso-font-format:other;
91         mso-font-pitch:fixed;
92         mso-font-signature:3 0 0 0 1 0;}
93 @font-face
94         {font-family:"Tms Rmn";
95         panose-1:2 2 6 3 4 5 5 2 3 4;
96         mso-font-charset:0;
97         mso-generic-font-family:roman;
98         mso-font-format:other;
99         mso-font-pitch:variable;
100         mso-font-signature:3 0 0 0 1 0;}
101 @font-face
102         {font-family:Helv;
103         panose-1:2 11 6 4 2 2 2 3 2 4;
104         mso-font-charset:0;
105         mso-generic-font-family:swiss;
106         mso-font-format:other;
107         mso-font-pitch:variable;
108         mso-font-signature:3 0 0 0 1 0;}
109 @font-face
110         {font-family:"New York";
111         panose-1:2 4 5 3 6 5 6 2 3 4;
112         mso-font-charset:0;
113         mso-generic-font-family:roman;
114         mso-font-format:other;
115         mso-font-pitch:variable;
116         mso-font-signature:3 0 0 0 1 0;}
117 @font-face
118         {font-family:System;
119         panose-1:0 0 0 0 0 0 0 0 0 0;
120         mso-font-charset:0;
121         mso-generic-font-family:swiss;
122         mso-font-format:other;
123         mso-font-pitch:variable;
124         mso-font-signature:3 0 0 0 1 0;}
125 @font-face
126         {font-family:Wingdings;
127         panose-1:5 0 0 0 0 0 0 0 0 0;
128         mso-font-charset:2;
129         mso-generic-font-family:auto;
130         mso-font-pitch:variable;
131         mso-font-signature:0 268435456 0 0 -2147483648 0;}
132 @font-face
133         {font-family:"MS Mincho";
134         panose-1:2 2 6 9 4 2 5 8 3 4;
135         mso-font-alt:"\FF2D\FF33 \660E\671D";
136         mso-font-charset:128;
137         mso-generic-font-family:roman;
138         mso-font-format:other;
139         mso-font-pitch:fixed;
140         mso-font-signature:1 134676480 16 0 131072 0;}
141 @font-face
142         {font-family:Batang;
143         panose-1:2 3 6 0 0 1 1 1 1 1;
144         mso-font-alt:\BC14\D0D5;
145         mso-font-charset:129;
146         mso-generic-font-family:auto;
147         mso-font-format:other;
148         mso-font-pitch:fixed;
149         mso-font-signature:1 151388160 16 0 524288 0;}
150 @font-face
151         {font-family:SimSun;
152         panose-1:2 1 6 0 3 1 1 1 1 1;
153         mso-font-alt:\5B8B\4F53;
154         mso-font-charset:134;
155         mso-generic-font-family:auto;
156         mso-font-format:other;
157         mso-font-pitch:variable;
158         mso-font-signature:1 135135232 16 0 262144 0;}
159 @font-face
160         {font-family:PMingLiU;
161         panose-1:2 2 3 0 0 0 0 0 0 0;
162         mso-font-alt:\65B0\7D30\660E\9AD4;
163         mso-font-charset:136;
164         mso-generic-font-family:auto;
165         mso-font-format:other;
166         mso-font-pitch:variable;
167         mso-font-signature:1 134742016 16 0 1048576 0;}
168 @font-face
169         {font-family:"MS Gothic";
170         panose-1:2 11 6 9 7 2 5 8 2 4;
171         mso-font-alt:"\FF2D\FF33 \30B4\30B7\30C3\30AF";
172         mso-font-charset:128;
173         mso-generic-font-family:modern;
174         mso-font-format:other;
175         mso-font-pitch:fixed;
176         mso-font-signature:1 134676480 16 0 131072 0;}
177 @font-face
178         {font-family:Dotum;
179         panose-1:2 11 6 0 0 1 1 1 1 1;
180         mso-font-alt:\B3CB\C6C0;
181         mso-font-charset:129;
182         mso-generic-font-family:modern;
183         mso-font-format:other;
184         mso-font-pitch:fixed;
185         mso-font-signature:1 151388160 16 0 524288 0;}
186 @font-face
187         {font-family:SimHei;
188         panose-1:2 1 6 0 3 1 1 1 1 1;
189         mso-font-alt:\9ED1\4F53;
190         mso-font-charset:134;
191         mso-generic-font-family:modern;
192         mso-font-format:other;
193         mso-font-pitch:fixed;
194         mso-font-signature:1 135135232 16 0 262144 0;}
195 @font-face
196         {font-family:MingLiU;
197         panose-1:2 2 3 9 0 0 0 0 0 0;
198         mso-font-alt:\7D30\660E\9AD4;
199         mso-font-charset:136;
200         mso-generic-font-family:modern;
201         mso-font-format:other;
202         mso-font-pitch:fixed;
203         mso-font-signature:1 134742016 16 0 1048576 0;}
204 @font-face
205         {font-family:Mincho;
206         panose-1:2 2 6 9 4 3 5 8 3 5;
207         mso-font-alt:\660E\671D;
208         mso-font-charset:128;
209         mso-generic-font-family:roman;
210         mso-font-format:other;
211         mso-font-pitch:fixed;
212         mso-font-signature:1 134676480 16 0 131072 0;}
213 @font-face
214         {font-family:Gulim;
215         panose-1:2 11 6 0 0 1 1 1 1 1;
216         mso-font-alt:\AD74\B9BC;
217         mso-font-charset:129;
218         mso-generic-font-family:roman;
219         mso-font-format:other;
220         mso-font-pitch:fixed;
221         mso-font-signature:1 151388160 16 0 524288 0;}
222 @font-face
223         {font-family:Century;
224         panose-1:2 4 6 4 5 5 5 2 3 4;
225         mso-font-charset:0;
226         mso-generic-font-family:roman;
227         mso-font-format:other;
228         mso-font-pitch:variable;
229         mso-font-signature:3 0 0 0 1 0;}
230 @font-face
231         {font-family:"Angsana New";
232         panose-1:2 2 6 3 5 4 5 2 3 4;
233         mso-font-charset:222;
234         mso-generic-font-family:roman;
235         mso-font-format:other;
236         mso-font-pitch:variable;
237         mso-font-signature:16777217 0 0 0 65536 0;}
238 @font-face
239         {font-family:"Cordia New";
240         panose-1:2 11 3 4 2 2 2 2 2 4;
241         mso-font-charset:222;
242         mso-generic-font-family:roman;
243         mso-font-format:other;
244         mso-font-pitch:variable;
245         mso-font-signature:16777217 0 0 0 65536 0;}
246 @font-face
247         {font-family:Mangal;
248         panose-1:0 0 4 0 0 0 0 0 0 0;
249         mso-font-charset:1;
250         mso-generic-font-family:roman;
251         mso-font-format:other;
252         mso-font-pitch:variable;
253         mso-font-signature:32768 0 0 0 0 0;}
254 @font-face
255         {font-family:Latha;
256         panose-1:2 0 4 0 0 0 0 0 0 0;
257         mso-font-charset:1;
258         mso-generic-font-family:roman;
259         mso-font-format:other;
260         mso-font-pitch:variable;
261         mso-font-signature:1048576 0 0 0 0 0;}
262 @font-face
263         {font-family:Sylfaen;
264         panose-1:1 10 5 2 5 3 6 3 3 3;
265         mso-font-charset:0;
266         mso-generic-font-family:roman;
267         mso-font-format:other;
268         mso-font-pitch:variable;
269         mso-font-signature:16778883 0 512 0 13 0;}
270 @font-face
271         {font-family:Vrinda;
272         panose-1:0 0 4 0 0 0 0 0 0 0;
273         mso-font-charset:1;
274         mso-generic-font-family:roman;
275         mso-font-format:other;
276         mso-font-pitch:variable;
277         mso-font-signature:0 0 0 0 0 0;}
278 @font-face
279         {font-family:Raavi;
280         panose-1:2 0 5 0 0 0 0 0 0 0;
281         mso-font-charset:1;
282         mso-generic-font-family:roman;
283         mso-font-format:other;
284         mso-font-pitch:variable;
285         mso-font-signature:0 0 0 0 0 0;}
286 @font-face
287         {font-family:Shruti;
288         panose-1:2 0 5 0 0 0 0 0 0 0;
289         mso-font-charset:1;
290         mso-generic-font-family:roman;
291         mso-font-format:other;
292         mso-font-pitch:variable;
293         mso-font-signature:0 0 0 0 0 0;}
294 @font-face
295         {font-family:Sendnya;
296         panose-1:0 0 4 0 0 0 0 0 0 0;
297         mso-font-charset:1;
298         mso-generic-font-family:roman;
299         mso-font-format:other;
300         mso-font-pitch:variable;
301         mso-font-signature:0 0 0 0 0 0;}
302 @font-face
303         {font-family:Gautami;
304         panose-1:2 0 5 0 0 0 0 0 0 0;
305         mso-font-charset:1;
306         mso-generic-font-family:roman;
307         mso-font-format:other;
308         mso-font-pitch:variable;
309         mso-font-signature:0 0 0 0 0 0;}
310 @font-face
311         {font-family:Tunga;
312         panose-1:0 0 4 0 0 0 0 0 0 0;
313         mso-font-charset:1;
314         mso-generic-font-family:roman;
315         mso-font-format:other;
316         mso-font-pitch:variable;
317         mso-font-signature:0 0 0 0 0 0;}
318 @font-face
319         {font-family:"Estrangelo Edessa";
320         panose-1:0 0 0 0 0 0 0 0 0 0;
321         mso-font-charset:1;
322         mso-generic-font-family:roman;
323         mso-font-format:other;
324         mso-font-pitch:variable;
325         mso-font-signature:0 0 0 0 0 0;}
326 @font-face
327         {font-family:Kartika;
328         panose-1:1 1 1 0 1 1 1 1 1 1;
329         mso-font-charset:1;
330         mso-generic-font-family:roman;
331         mso-font-format:other;
332         mso-font-pitch:variable;
333         mso-font-signature:0 0 0 0 0 0;}
334 @font-face
335         {font-family:"Arial Unicode MS";
336         panose-1:2 11 6 4 2 2 2 2 2 4;
337         mso-font-charset:0;
338         mso-generic-font-family:roman;
339         mso-font-format:other;
340         mso-font-pitch:variable;
341         mso-font-signature:3 0 0 0 1 0;}
342 @font-face
343         {font-family:Tahoma;
344         panose-1:2 11 6 4 3 5 4 4 2 4;
345         mso-font-charset:0;
346         mso-generic-font-family:swiss;
347         mso-font-format:other;
348         mso-font-pitch:variable;
349         mso-font-signature:3 0 0 0 1 0;}
350  /* Style Definitions */
351  p.MsoNormal, li.MsoNormal, div.MsoNormal
352         {mso-style-parent:"";
353         margin:0cm;
354         margin-bottom:.0001pt;
355         mso-pagination:widow-orphan;
356         font-size:12.0pt;
357         font-family:"Times New Roman";
358         mso-fareast-font-family:"Times New Roman";
359         color:black;}
360 h1
361         {mso-margin-top-alt:auto;
362         margin-right:0cm;
363         mso-margin-bottom-alt:auto;
364         margin-left:0cm;
365         mso-pagination:widow-orphan;
366         mso-outline-level:1;
367         font-size:24.0pt;
368         font-family:"Times New Roman";
369         color:black;
370         font-weight:bold;}
371 h2
372         {mso-margin-top-alt:auto;
373         margin-right:0cm;
374         mso-margin-bottom-alt:auto;
375         margin-left:0cm;
376         mso-pagination:widow-orphan;
377         mso-outline-level:2;
378         font-size:18.0pt;
379         font-family:"Times New Roman";
380         color:black;
381         font-weight:bold;}
382 h3
383         {mso-margin-top-alt:auto;
384         margin-right:0cm;
385         mso-margin-bottom-alt:auto;
386         margin-left:0cm;
387         mso-pagination:widow-orphan;
388         mso-outline-level:3;
389         font-size:13.5pt;
390         font-family:"Times New Roman";
391         color:black;
392         font-weight:bold;}
393 h4
394         {mso-margin-top-alt:auto;
395         margin-right:0cm;
396         mso-margin-bottom-alt:auto;
397         margin-left:0cm;
398         mso-pagination:widow-orphan;
399         mso-outline-level:4;
400         font-size:12.0pt;
401         font-family:"Times New Roman";
402         color:black;
403         font-weight:bold;}
404 a:link, span.MsoHyperlink
405         {color:blue;
406         text-decoration:underline;
407         text-underline:single;}
408 a:visited, span.MsoHyperlinkFollowed
409         {color:blue;
410         text-decoration:underline;
411         text-underline:single;}
412 p
413         {font-size:12.0pt;
414         font-family:"Times New Roman";
415         mso-fareast-font-family:"Times New Roman";
416         color:black;}
417 code
418         {font-family:"Courier New";
419         mso-ascii-font-family:"Courier New";
420         mso-fareast-font-family:"Times New Roman";
421         mso-hansi-font-family:"Courier New";
422         mso-bidi-font-family:"Courier New";}
423 pre
424         {margin:0cm;
425         margin-bottom:.0001pt;
426         mso-pagination:widow-orphan;
427         tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
428         background:#EEEEEE;
429         border:none;
430         mso-border-alt:solid #DDDDDD .75pt;
431         padding:0cm;
432         mso-padding-alt:9.0pt 18.0pt 9.0pt 18.0pt;
433         font-size:9.0pt;
434         font-family:"Courier New";
435         mso-fareast-font-family:"Times New Roman";
436         color:black;}
437 span.msoIns
438         {mso-style-type:export-only;
439         mso-style-name:"";
440         text-decoration:underline;
441         text-underline:single;
442         color:teal;}
443 span.msoDel
444         {mso-style-type:export-only;
445         mso-style-name:"";
446         text-decoration:line-through;
447         color:red;}
448 span.msoChangeProp
449         {mso-style-type:export-only;
450         mso-style-name:"";}
451 @page Section1
452         {size:612.0pt 792.0pt;
453         margin:72.0pt 90.0pt 72.0pt 90.0pt;
454         mso-header-margin:35.4pt;
455         mso-footer-margin:35.4pt;
456         mso-paper-source:0;}
457 div.Section1
458         {page:Section1;}
459  /* List Definitions */
460  @list l0
461         {mso-list-id:3098366;
462         mso-list-template-ids:-1654113918;}
463 @list l0:level1
464         {mso-level-number-format:bullet;
465         mso-level-text:\F0B7;
466         mso-level-tab-stop:36.0pt;
467         mso-level-number-position:left;
468         text-indent:-18.0pt;
469         mso-ansi-font-size:10.0pt;
470         font-family:Symbol;}
471 @list l1
472         {mso-list-id:118686534;
473         mso-list-template-ids:1789952844;}
474 @list l1:level1
475         {mso-level-number-format:bullet;
476         mso-level-text:\F0B7;
477         mso-level-tab-stop:36.0pt;
478         mso-level-number-position:left;
479         text-indent:-18.0pt;
480         mso-ansi-font-size:10.0pt;
481         font-family:Symbol;}
482 @list l2
483         {mso-list-id:325595838;
484         mso-list-template-ids:-924547596;}
485 @list l2:level1
486         {mso-level-number-format:bullet;
487         mso-level-text:\F0B7;
488         mso-level-tab-stop:36.0pt;
489         mso-level-number-position:left;
490         text-indent:-18.0pt;
491         mso-ansi-font-size:10.0pt;
492         font-family:Symbol;}
493 @list l3
494         {mso-list-id:577053254;
495         mso-list-template-ids:1006266472;}
496 @list l3:level1
497         {mso-level-number-format:bullet;
498         mso-level-text:\F0B7;
499         mso-level-tab-stop:36.0pt;
500         mso-level-number-position:left;
501         text-indent:-18.0pt;
502         mso-ansi-font-size:10.0pt;
503         font-family:Symbol;}
504 @list l4
505         {mso-list-id:584261941;
506         mso-list-template-ids:1672376844;}
507 @list l4:level1
508         {mso-level-number-format:bullet;
509         mso-level-text:\F0B7;
510         mso-level-tab-stop:36.0pt;
511         mso-level-number-position:left;
512         text-indent:-18.0pt;
513         mso-ansi-font-size:10.0pt;
514         font-family:Symbol;}
515 @list l5
516         {mso-list-id:678311197;
517         mso-list-template-ids:-1025849406;}
518 @list l5:level1
519         {mso-level-number-format:bullet;
520         mso-level-text:\F0B7;
521         mso-level-tab-stop:36.0pt;
522         mso-level-number-position:left;
523         text-indent:-18.0pt;
524         mso-ansi-font-size:10.0pt;
525         font-family:Symbol;}
526 @list l6
527         {mso-list-id:993068284;
528         mso-list-template-ids:-1149100626;}
529 @list l6:level1
530         {mso-level-number-format:bullet;
531         mso-level-text:\F0B7;
532         mso-level-tab-stop:36.0pt;
533         mso-level-number-position:left;
534         text-indent:-18.0pt;
535         mso-ansi-font-size:10.0pt;
536         font-family:Symbol;}
537 @list l7
538         {mso-list-id:1120344907;
539         mso-list-template-ids:-1732590280;}
540 @list l7:level1
541         {mso-level-number-format:bullet;
542         mso-level-text:\F0B7;
543         mso-level-tab-stop:36.0pt;
544         mso-level-number-position:left;
545         text-indent:-18.0pt;
546         mso-ansi-font-size:10.0pt;
547         font-family:Symbol;}
548 @list l8
549         {mso-list-id:1134718884;
550         mso-list-template-ids:-1854392276;}
551 @list l8:level1
552         {mso-level-number-format:bullet;
553         mso-level-text:\F0B7;
554         mso-level-tab-stop:36.0pt;
555         mso-level-number-position:left;
556         text-indent:-18.0pt;
557         mso-ansi-font-size:10.0pt;
558         font-family:Symbol;}
559 @list l9
560         {mso-list-id:1289897560;
561         mso-list-template-ids:-1284101662;}
562 @list l9:level1
563         {mso-level-number-format:bullet;
564         mso-level-text:\F0B7;
565         mso-level-tab-stop:36.0pt;
566         mso-level-number-position:left;
567         text-indent:-18.0pt;
568         mso-ansi-font-size:10.0pt;
569         font-family:Symbol;}
570 @list l10
571         {mso-list-id:1461026030;
572         mso-list-template-ids:65944450;}
573 @list l11
574         {mso-list-id:1566380536;
575         mso-list-template-ids:395727058;}
576 @list l11:level1
577         {mso-level-number-format:bullet;
578         mso-level-text:\F0B7;
579         mso-level-tab-stop:36.0pt;
580         mso-level-number-position:left;
581         text-indent:-18.0pt;
582         mso-ansi-font-size:10.0pt;
583         font-family:Symbol;}
584 ol
585         {margin-bottom:0cm;}
586 ul
587         {margin-bottom:0cm;}
588 -->
589 </style>
590 <!--[if gte mso 10]>
591 <style>
592  /* Style Definitions */
593  table.MsoNormalTable
594         {mso-style-name:"Table Normal";
595         mso-tstyle-rowband-size:0;
596         mso-tstyle-colband-size:0;
597         mso-style-noshow:yes;
598         mso-style-parent:"";
599         mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
600         mso-para-margin:0cm;
601         mso-para-margin-bottom:.0001pt;
602         mso-pagination:widow-orphan;
603         font-size:10.0pt;
604         font-family:"Times New Roman";
605         mso-ansi-language:#0400;
606         mso-fareast-language:#0400;
607         mso-bidi-language:#0400;}
608 </style>
609 <![endif]--><!--[if gte mso 9]><xml>
610  <o:shapedefaults v:ext="edit" spidmax="1026"/>
611 </xml><![endif]--><!--[if gte mso 9]><xml>
612  <o:shapelayout v:ext="edit">
613   <o:idmap v:ext="edit" data="1"/>
614  </o:shapelayout></xml><![endif]-->
615 </head>
616
617 <body bgcolor=white lang=EN-US link=blue vlink=blue style='tab-interval:36.0pt'>
618
619 <div class=Section1>
620
621 <h2>ADOdb Library for PHP</h2>
622
623 <p>V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com)</p>
624
625 <p><span style='font-size:7.5pt'>This software is dual licensed using BSD-Style
626 and LGPL. This means you can use it in compiled proprietary and commercial
627 products.</span></p>
628
629 <p>Useful ADOdb links: <a href="http://adodb.sourceforge.net/#download">Download</a>
630 &nbsp; <a href="http://adodb.sourceforge.net/#docs">Other Docs</a> </p>
631
632 <p><a href="#intro"><b>Introduction</b></a><b><br>
633 <a href="#features">Unique Features</a><br>
634 <a href="#users">How People are using ADOdb</a><br>
635 <a href="#bugs">Feature Requests and Bug Reports</a><br>
636 <a href="#install">Installation</a><br>
637 <a href="#mininstall">Minimum Install</a><br>
638 <a href="#coding">Initializing Code and Connectioning to Databases</a><br>
639 </b><span style='font-size:10.0pt'>&nbsp; <a href="#dsnsupport">Data Source
640 Name (DSN) Support</a></span> &nbsp; <a href="#connect_ex">Connection Examples</a>
641 <br>
642 <b><a href="#speed">High Speed ADOdb - tuning tips</a></b><br>
643 <b><a href="#hack">Hacking and Modifying ADOdb Safely</a><br>
644 <a href="#php5">PHP5 Features</a></b><br>
645 <span style='font-size:10.0pt'><a href="#php5iterators">foreach iterators</a> <a
646 href="#php5exceptions">exceptions</a></span><br>
647 <b><a href="#drivers">Supported Databases</a></b><br>
648 <b><a href="#quickstart">Tutorials</a></b><br>
649 <a href="#ex1">Example 1: Select</a><br>
650 <a href="#ex2">Example 2: Advanced Select</a><br>
651 <a href="#ex3">Example 3: Insert</a><br>
652 <a href="#ex4">Example 4: Debugging</a> &nbsp;<a href="#exrs2html">rs2html
653 example</a><br>
654 <a href="#ex5">Example 5: MySQL and Menus</a><br>
655 <a href="#ex6">Example 6: Connecting to Multiple Databases at once</a> <br>
656 <a href="#ex7">Example 7: Generating Update and Insert SQL</a> <br>
657 <a href="#ex8">Example 8: Implementing Scrolling with Next and Previous</a><br>
658 <a href="#ex9">Example 9: Exporting in CSV or Tab-Delimited Format</a> <br>
659 <a href="#ex10">Example 10: Custom filters</a><br>
660 <a href="#ex11">Example 11: Smart Transactions</a><br>
661 <br>
662 <b><a href="#errorhandling">Using Custom Error Handlers and PEAR_Error</a><br>
663 <a href="#DSN">Data Source Names</a><br>
664 <a href="#caching">Caching</a></b><br>
665 &nbsp; &nbsp; <a href="#memcache">MemCache</a><br>
666 &nbsp; &nbsp; <a href="#cacheapi">Caching API</a><br>
667 <b><a href="#pivot">Pivot Tables</a></b> </p>
668
669 <p><a href="#ref"><b>REFERENCE</b></a> </p>
670
671 <p><span style='font-size:10.0pt'>Variables: <a href="#adodb_countrecs">$ADODB_COUNTRECS</a>
672 <a href="#adodb_ansi_padding_off">$ADODB_ANSI_PADDING_OFF</a> <a
673 href="#adodb_cache_dir">$ADODB_CACHE_DIR</a> <br>
674 &nbsp; &nbsp; &nbsp; &nbsp; <a href="#force_type">$ADODB_FORCE_TYPE</a> <a
675 href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> <a href="#adodb_lang">$ADODB_LANG</a>
676 <a href="#adodb_auto_quote">ADODB_QUOTE_FIELDNAMES</a> <br>
677 Constants: <a href="#adodb_assoc_case">ADODB_ASSOC_CASE</a> </span><br>
678 <a href="#ADOConnection"><b>ADOConnection</b></a><br>
679 <span style='font-size:10.0pt'>Connections: <a href="#connect">Connect</a> <a
680 href="#pconnect">PConnect</a> <a href="#nconnect">NConnect</a> <a
681 href="#isconnected">IsConnected</a><br>
682 Executing SQL: <a href="#execute">Execute</a> <a href="#cacheexecute"><i>CacheExecute</i></a>
683 <a href="#selectlimit">SelectLimit</a> <a href="#cacheSelectLimit"><i>CacheSelectLimit</i></a>
684 <a href="#param">Param</a> <a href="#prepare">Prepare</a> <a href="#preparesp">PrepareSP</a>
685 <a href="#inparameter">InParameter</a> <a href="#outparameter">OutParameter</a>
686 <a href="#autoexecute">AutoExecute</a> <br>
687 &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
688 href="#getone">GetOne</a> <a href="#cachegetone"><i>CacheGetOne</i></a> <a
689 href="#getrow">GetRow</a> <a href="#cachegetrow"><i>CacheGetRow</i></a> <a
690 href="#getall">GetAll</a> <a href="#cachegetall"><i>CacheGetAll</i></a> <a
691 href="#getcol">GetCol</a> <a href="#cachegetcol"><i>CacheGetCol</i></a> <a
692 href="#getassoc1">GetAssoc</a> <a href="#cachegetassoc"><i>CacheGetAssoc</i></a>
693 <a href="#replace">Replace</a> <a href="#getmedian">GetMedian</a> <br>
694 &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a
695 href="#executecursor">ExecuteCursor</a> (oci8 only)<br>
696 Generates SQL strings: <a href="#getupdatesql">GetUpdateSQL</a> <a
697 href="#getinsertsql">GetInsertSQL</a> <a href="#concat">Concat</a> <a
698 href="#ifnull">IfNull</a> <a href="#length">length</a> <a href="#random">random</a>
699 <a href="#substr">substr</a> <a href="#qstr">qstr</a> <a href="#param">Param</a>
700 <a href="#OffsetDate">OffsetDate</a> <a href="#sqldate">SQLDate</a> <a
701 href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a
702 href="#binddate">BindDate</a> <a href="#bindtimestamp">BindTimeStamp</a> <br>
703 Blobs: <a href="#updateblob">UpdateBlob</a> <a href="#updateclob">UpdateClob</a>
704 <a href="#updateblobfile">UpdateBlobFile</a> <a href="#blobencode">BlobEncode</a>
705 <a href="#blobdecode">BlobDecode</a><br>
706 Paging/Scrolling: <a href="#pageexecute">PageExecute</a> <a
707 href="#cachepageexecute">CachePageExecute</a><br>
708 Cleanup: <a href="#cacheflush">CacheFlush</a> <a href="#Close">Close</a><br>
709 Transactions: <a href="#starttrans">StartTrans</a> <a href="#completetrans">CompleteTrans</a>
710 <a href="#failtrans">FailTrans</a> <a href="#hasfailedtrans">HasFailedTrans</a>
711 <a href="#begintrans">BeginTrans</a> <a href="#committrans">CommitTrans</a> <a
712 href="#rollbacktrans">RollbackTrans</a> <a href="#SetTransactionMode">SetTransactionMode</a><br>
713 Fetching Data: <a href="#setfetchmode">SetFetchMode</a><br>
714 Strings: <a href="#concat">concat</a> <a href="#length">length</a> <a
715 href="#qstr">qstr</a> <a href="#quote">quote</a> <a href="#substr">substr</a><br>
716 Dates: <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a
717 href="#unixdate">UnixDate</a> <a href="#binddate">BindDate</a> <a
718 href="#bindtimestamp">BindTimeStamp</a> <a href="#unixtimestamp">UnixTimeStamp</a>
719 <a href="#OffsetDate">OffsetDate</a> <a href="#SQLDate">SQLDate</a> <br>
720 Row Management: <a href="#affected_rows">Affected_Rows</a> <a
721 href="#inserted_id">Insert_ID</a> <a href="#rowlock">RowLock</a> <a
722 href="#genid">GenID</a> <a href="#createseq">CreateSequence</a> <a
723 href="#dropseq">DropSequence</a> <br>
724 Error Handling: <a href="#errormsg">ErrorMsg</a> <a href="#errorno">ErrorNo</a>
725 <a href="#metaerror">MetaError</a> <a href="#metaerrormsg">MetaErrorMsg</a> <a
726 href="#ignoreerrors">IgnoreErrors</a><br>
727 Data Dictionary (metadata): <a href="#metadatabases">MetaDatabases</a> <a
728 href="#metatables">MetaTables</a> <a href="#metacolumns">MetaColumns</a> <a
729 href="#metacolumnames">MetaColumnNames</a> <a href="#metaprimarykeys">MetaPrimaryKeys</a>
730 <a href="#metaforeignkeys">MetaForeignKeys</a> <a href="#serverinfo">ServerInfo</a> <a href="#setcharset">SetCharSet</a>
731 <br>
732 Statistics and Query-Rewriting: <a href="#logsql">LogSQL</a> <a
733 href="#fnexecute">fnExecute and fnCacheExecute</a><br>
734 Deprecated: <a href="#bind">Bind</a> <a href="#blankrecordset">BlankRecordSet</a>
735 <a href="#parameter">Parameter</a></span> <a href="#adorecordSet"><b><br>
736 ADORecordSet</b></a><br>
737 <span style='font-size:10.0pt'>Returns one field: <a href="#fields">Fields</a><br>
738 Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a>
739 <a href="#fetchobject">FetchObject</a> <a href="#fetchnextobject">FetchNextObject</a>
740 <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a> <a
741 href="#getrowassoc">GetRowAssoc</a> <br>
742 Returns all rows:<a href="#getarray">GetArray</a> <a href="#getrows">GetRows</a>
743 <a href="#getassoc">GetAssoc</a><br>
744 Scrolling:<a href="#move">Move</a> <a href="#movenext">MoveNext</a> <a
745 href="#movefirst">MoveFirst</a> <a href="#movelast">MoveLast</a> <a
746 href="#abspos">AbsolutePosition</a> <a href="#currentrow">CurrentRow</a> <a
747 href="#atfirstpage">AtFirstPage</a> <a href="#atlastpage">AtLastPage</a> <a
748 href="#absolutepage">AbsolutePage</a> <br>
749 Menu generation:<a href="#getmenu">GetMenu</a> <a href="#getmenu2">GetMenu2</a><br>
750 Dates:<a href="#userdate">UserDate</a> <a href="#usertimestamp">UserTimeStamp</a>
751 <a href="#unixdate">UnixDate</a> <a href="#unixtimestamp">UnixTimeStamp<br>
752 </a>Recordset Info:<a href="#recordcount">RecordCount</a> <a
753 href="#po_recordcount">PO_RecordCount</a> <a href="#nextrecordset">NextRecordSet</a><br>
754 Field Info:<a href="#fieldcount">FieldCount</a> <a href="#fetchfield">FetchField</a>
755 <a href="#metatype">MetaType</a><br>
756 Cleanup: <a href="#rsclose">Close</a></span> </p>
757
758 <p><span style='font-size:10.0pt'><a href="#rs2html"><b>rs2html</b></a>&nbsp; <a
759 href="#exrs2html">example</a></span><br>
760 <a href="#adodiff">Differences between ADOdb and ADO</a><br>
761 <a href="#driverguide"><b>Database Driver Guide<br>
762 </b></a><b><a href="#changes">Change Log</a></b></p>
763
764 <h2>Introduction<a name=intro></a></h2>
765
766 <p>PHP's database access functions are not standardised. This creates a need
767 for a database class library to hide the differences between the different
768 database API's (encapsulate the differences) so we can easily switch databases.
769 PHP 4.0.5 or later is now required (because we use array-based str_replace).</p>
770
771 <p>We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL
772 Anywhere, Informix, PostgreSQL, FrontBase, SQLite, Interbase (Firebird and
773 Borland variants), Foxpro, Access, <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>,
774 DB2, SAP DB and ODBC. We have had successful reports of connecting to Progress
775 and CacheLite via ODBC. We hope more people will contribute drivers to support
776 other databases.</p>
777
778 <p>PHP4 supports session variables. You can store your session information
779 using ADOdb for true portability and scalability. See adodb-session.php for
780 more information.</p>
781
782 <p>Also read <a href="http://phplens.com/lens/adodb/tips_portable_sql.htm">tips_portable_sql.htm</a>
783 for tips on writing portable SQL.</p>
784
785 <h2>Unique Features of ADOdb<a name=features></a></h2>
786
787 <ul type=disc>
788  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
789      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Easy for Windows
790      programmers</b> to adapt to because many of the conventions are similar to
791      Microsoft's <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>.</li>
792  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
793      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'>Unlike other PHP database
794      classes which focus only on select statements, <b>we provide support code
795      to handle inserts and updates which can be adapted to multiple databases
796      quickly.</b> Methods are provided for date handling, string concatenation
797      and string quoting characters for differing databases.</li>
798  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
799      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'>A<b> metatype system </b>is
800      built in so that we can figure out that types such as CHAR, TEXT and
801      STRING are equivalent in different databases.</li>
802  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
803      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Easy to port</b> because
804      all the database dependant code are stored in stub functions. You do not
805      need to port the core logic of the classes.</li>
806  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
807      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Portable table and index
808      creation</b> with the <a href="docs-datadict.htm">datadict</a> classes. </li>
809  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
810      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Database performance
811      monitoring and SQL tuning</b> with the <a href="docs-perf.htm">performance
812      monitoring</a> classes. </li>
813  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
814      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Database-backed sessions</b>
815      with the <a href="docs-session.htm">session management</a> classes.
816      Supports session expiry notification. </li>
817  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
818      mso-list:l2 level1 lfo1;tab-stops:list 36.0pt'><b>Object-Relational
819      Mapping</b> using <a href="docs-active-record.htm">ADOdb_Active_Record</a>
820      classes. </li>
821 </ul>
822
823 <h2>How People are using ADOdb<a name=users></a></h2>
824
825 <p class=MsoNormal>Here are some examples of how people are using ADOdb (for a
826 much longer list, visit <a
827 href="http://phplens.com/phpeverywhere/adodb-cool-apps">adodb-cool-apps</a>): </p>
828
829 <ul type=disc>
830  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
831      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
832      href="http://phplens.com/">PhpLens</a> is a commercial data grid component
833      that allows both cool Web designers and serious unshaved programmers to
834      develop and maintain databases on the Web easily. Developed by the author
835      of ADOdb.</li>
836  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
837      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
838      href="http://www.interakt.ro/phakt/">PHAkt: PHP Extension for DreamWeaver
839      Ultradev</a> allows you to script PHP in the popular Web page editor.
840      Database handling provided by ADOdb.</li>
841  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
842      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
843      href="http://www.andrew.cmu.edu/%7Erdanyliw/snort/snortacid.html">Analysis
844      Console for Intrusion Databases</a> (ACID): PHP-based analysis engine to
845      search and process a database of security incidents generated by
846      security-related software such as IDSes and firewalls (e.g. Snort,
847      ipchains). By Roman Danyliw.</li>
848  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
849      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
850      href="http://www.postnuke.com/">PostNuke</a> is a very popular free
851      content management system and weblog system. It offers full CSS support,
852      HTML 4.01 transitional compliance throughout, an advanced blocks system,
853      and is fully multi-lingual enabled. </li>
854  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
855      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
856      href="http://www.auto-net.no/easypublish.php?page=index&amp;lang_id=2">EasyPublish
857      CMS</a> is another free content management system for managing information
858      and integrated modules on your internet, intranet- and extranet-sites.
859      From <st1:country-region w:st="on"><st1:place w:st="on">Norway</st1:place></st1:country-region>.</li>
860  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
861      mso-list:l4 level1 lfo2;tab-stops:list 36.0pt'><a
862      href="http://nola.noguska.com/">NOLA</a> is a full featured accounting,
863      inventory, and job tracking application. It is licensed under the GPL, and
864      developed by Noguska. </li>
865 </ul>
866
867 <h2>Feature Requests and Bug Reports<a name=bugs></a></h2>
868
869 <p>Feature requests and bug reports can be emailed to <a
870 href="mailto:jlim#natsoft.com">jlim#natsoft.com</a> or posted to the ADOdb Help
871 forums at <a href="http://phplens.com/lens/lensforum/topics.php?id=4">http://phplens.com/lens/lensforum/topics.php?id=4</a>.</p>
872
873 <h2>Installation Guide<a name=install></a></h2>
874
875 <p>Make sure you are running PHP 4.0.5 or later. Unpack all the files into a
876 directory accessible by your webserver.</p>
877
878 <p>To test, try modifying some of the tutorial examples. Make sure you
879 customize the connection settings correctly. You can debug using <i>$db-&gt;debug
880 = true</i> as shown below:</p>
881
882 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
883 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
884 style='background:#EEEEEE'>&lt;?php<br>
885 <span style='mso-tab-count:1'>         </span>include('adodb/adodb.inc.php');<br>
886 <span style='mso-tab-count:1'>         </span>$db = <a href="#adonewconnection">ADONewConnection</a>($dbdriver); # eg 'mysql' or 'postgres'<br>
887 <span style='mso-tab-count:1'>         </span>$db-&gt;debug = true;<br>
888 <span style='mso-tab-count:1'>         </span>$db-&gt;<a href="#connect">Connect</a>($server, $user, $password, $database);<br>
889 <span style='mso-tab-count:1'>         </span>$rs = $db-&gt;<a href="#execute">Execute</a>('select * from some_small_table');<br>
890 <span style='mso-tab-count:1'>         </span>print &quot;&lt;pre&gt;&quot;;<br>
891 <span style='mso-tab-count:1'>         </span>print_r($rs-&gt;<a href="#getrows">GetRows</a>());<br>
892 <span style='mso-tab-count:1'>         </span>print &quot;&lt;/pre&gt;&quot;;<br>
893 ?&gt;</pre></div>
894
895 <h3>Minimum Install<a name=mininstall></a></h3>
896
897 <p>For developers who want to release a minimal install of ADOdb, you will
898 need: </p>
899
900 <ul type=disc>
901  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
902      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>adodb.inc.php </li>
903  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
904      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>adodb-lib.inc.php </li>
905  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
906      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>adodb-time.inc.php </li>
907  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
908      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>drivers/adodb-$database.inc.php
909      </li>
910  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
911      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>license.txt (for legal
912      reasons) </li>
913  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
914      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>adodb-php4.inc.php </li>
915  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
916      mso-list:l9 level1 lfo3;tab-stops:list 36.0pt'>adodb-iterator.inc.php
917      (php5 functionality) </li>
918 </ul>
919
920 <p class=MsoNormal>Optional: </p>
921
922 <ul type=disc>
923  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
924      mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'>adodb-error.inc.php and
925      lang/adodb-$lang.inc.php (if you use MetaError()) </li>
926  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
927      mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'>adodb-csvlib.inc.php (if
928      you use cached recordsets - CacheExecute(), etc) </li>
929  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
930      mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'>adodb-exceptions.inc.php
931      and adodb-errorhandler.inc.php (if you use adodb error handler or php5
932      exceptions). </li>
933  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
934      mso-list:l3 level1 lfo4;tab-stops:list 36.0pt'>adodb-active-record.inc.php
935      if you use <a href="docs-active-record.htm">Active Records</a>. </li>
936 </ul>
937
938 <h3>Code Initialization Examples<a name=coding></a></h3>
939
940 <p>When running ADOdb, at least two files are loaded. First is
941 adodb/adodb.inc.php, which contains all functions used by all database classes.
942 The code specific to a particular database is in the
943 adodb/driver/adodb-????.inc.php file.</p>
944
945 <p><a name=adonewconnection></a>For example, to connect to a mysql database:</p>
946
947 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
948 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
949 style='background:#EEEEEE'>include('/path/to/set/here/adodb.inc.php');<br>
950 $conn = &amp;ADONewConnection('mysql');</pre></div>
951
952 <p>Whenever you need to connect to a database, you create a Connection object
953 using the <b>ADONewConnection</b>($driver) function. <b>NewADOConnection</b>($driver)
954 is an alternative name for the same function.</p>
955
956 <p>At this point, you are not connected to the database (no longer true if you
957 pass in a <a href="#dsnsupport">dsn</a>). You will first need to decide whether
958 to use <i>persistent</i> or <i>non-persistent</i> connections. The advantage of
959 <i>persistent</i> connections is that they are faster, as the database
960 connection is never closed (even when you call Close()). <i>Non-persistent </i>connections
961 take up much fewer resources though, reducing the risk of your database and
962 your web-server becoming overloaded. </p>
963
964 <p>For persistent connections, use $conn-&gt;<a href="#pconnect">PConnect()</a>,
965 or $conn-&gt;<a href="#connect">Connect()</a> for non-persistent connections.
966 Some database drivers also support <a href="#nconnect">NConnect()</a>, which
967 forces the creation of a new connection. <a name="connection_gotcha"></a></p>
968
969 <p><b>Connection Gotcha</b>: If you create two connections, but both use the
970 same userid and password, PHP will share the same connection. This can cause
971 problems if the connections are meant to different databases. The solution is
972 to always use different userid's for different databases, or use NConnect(). <a
973 name=dsnsupport></a></p>
974
975 <h3>Data Source Name (DSN) Support</h3>
976
977 <p>Since ADOdb 4.51, you can connect to a database by passing a dsn to
978 NewADOConnection() (or ADONewConnection, which is the same function). The dsn
979 format is: </p>
980
981 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
982 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
983 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$driver://$username:$password@hostname/$database?options[=value]</pre></div>
984
985 <p>NewADOConnection() calls Connect() or PConnect() internally for you. If the
986 connection fails, false is returned. </p>
987
988 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
989 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
990 style='mso-tab-count:1'>         </span><span style='color:green'># non-persistent connection</span></pre><pre><span
991 style='mso-tab-count:1'>         </span>$dsn = 'mysql://root:pwd@localhost/mydb'; </pre><pre><span
992 style='mso-tab-count:1'>         </span>$db = NewADOConnection($dsn);</pre><pre><span
993 style='mso-tab-count:1'>         </span>if (!$db) die(&quot;Connection failed&quot;);<span style='mso-spacerun:yes'>   </span></pre><pre><span
994 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
995 1'>         </span><span style='color:green'># no need to call connect/pconnect!</span></pre><pre><span
996 style='mso-tab-count:1'>         </span>$arr = $db-&gt;GetArray(&quot;select * from table&quot;);</pre><pre><span
997 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
998 1'>         </span><span style='color:green'># persistent connection</span></pre>
999 <pre><span
1000 style='mso-tab-count:1'>         </span>$dsn2 = 'mysql://root:pwd@localhost/mydb?persist'; 
1001 <span
1002 style='mso-tab-count:1'></span></pre>
1003 <pre><span style='mso-tab-count:
1004 1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='color:green'># non-persistent connection on port 3000</span></pre>
1005 <pre><span
1006 style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$dsn2 = 'mysqli://root:pwd@localhost/mydb?persist=0&amp;port=3000';</pre>
1007 </div>
1008
1009 <p>If you have special characters such as /:?_ in your dsn, then you need to
1010 rawurlencode them first: </p>
1011
1012 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1013 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1014 style='mso-tab-count:1'>         </span>$pwd = rawurlencode($pwd);<br>
1015 <span style='mso-tab-count:1'>         </span>$dsn = &quot;mysql://root:$pwd@localhost/mydb&quot;;</pre><pre
1016 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$dsn2=rawurlencode(&quot;sybase_ase&quot;).&quot;://user:pass@host/path?query&quot;;</pre></div>
1017
1018 <p>Legal options are: </p>
1019
1020 <div align=center>
1021
1022 <table class=MsoNormalTable border=1 cellpadding=0 style='mso-cellspacing:1.5pt'>
1023  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
1024   <td style='padding:.75pt .75pt .75pt .75pt'>
1025   <p class=MsoNormal>For all drivers</p>
1026   </td>
1027   <td style='padding:.75pt .75pt .75pt .75pt'>
1028   <p class=MsoNormal>'persist', 'persistent', 'debug', 'fetchmode', 'new' , 'cachesecs', 'memcache'</p>
1029   </td>
1030  </tr>
1031  <tr style='mso-yfti-irow:1'>
1032   <td style='padding:.75pt .75pt .75pt .75pt'>
1033   <p class=MsoNormal>Interbase/Firebird </p>
1034   </td>
1035   <td style='padding:.75pt .75pt .75pt .75pt'>
1036   <p class=MsoNormal>'dialect','charset','buffers','role' </p>
1037   </td>
1038  </tr>
1039  <tr style='mso-yfti-irow:2'>
1040   <td style='padding:.75pt .75pt .75pt .75pt'>
1041   <p class=MsoNormal>M'soft <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City></p>
1042   </td>
1043   <td style='padding:.75pt .75pt .75pt .75pt'>
1044   <p class=MsoNormal>'charpage' </p>
1045   </td>
1046  </tr>
1047  <tr style='mso-yfti-irow:3'>
1048   <td style='padding:.75pt .75pt .75pt .75pt'>
1049   <p class=MsoNormal>MySQL</p>
1050   </td>
1051   <td style='padding:.75pt .75pt .75pt .75pt'>
1052   <p class=MsoNormal>'clientflags' </p>
1053   </td>
1054  </tr>
1055  <tr style='mso-yfti-irow:4'>
1056   <td style='padding:.75pt .75pt .75pt .75pt'>
1057   <p class=MsoNormal>MySQLi</p>
1058   </td>
1059   <td style='padding:.75pt .75pt .75pt .75pt'>
1060   <p class=MsoNormal>'port', 'socket', 'clientflags' </p>
1061   </td>
1062  </tr>
1063  <tr style='mso-yfti-irow:5;mso-yfti-lastrow:yes'>
1064   <td style='padding:.75pt .75pt .75pt .75pt'>
1065   <p class=MsoNormal>Oci8</p>
1066   </td>
1067   <td style='padding:.75pt .75pt .75pt .75pt'>
1068   <p class=MsoNormal>'nls_date_format','charset' </p>
1069   </td>
1070  </tr>
1071 </table>
1072
1073 </div>
1074
1075 <p>For all drivers, when the options <i>persist</i> or <i>persistent</i> are
1076 set, a persistent connection is forced; similarly, when <i>new</i> is set, then
1077 a new connection will be created using NConnect if the underlying driver
1078 supports it. The <i>debug</i> option enables debugging. The <i>fetchmode</i>
1079 calls <a href="#setfetchmode">SetFetchMode()</a>. If no value is defined for an
1080 option, then the value is set to 1. </p>
1081
1082 <p>Since ADOdb 5.09, we added 2 new parameters:</p>
1083 <ul>
1084 <li class=MsoNormal><i>cachesecs</i> which globally determines how many seconds to cache recordsets (default is 3600 secs if not defined) when
1085 CacheExecute() and CacheSelectLimit() are called and no cache-time parameter is passed into these functions.
1086 <li class=MsoNormal><i>memcache</i> which defines the memcache host, port and whether to use compression. For example:
1087 <pre>
1088         # we have a memcache server at 10.1.1.22 using default port 11211, no compression
1089         $dsn = 'mysql://user:pwd@localhost/mydb?memcache=10.1.1.22'; 
1090         
1091         # we have a memcache server 10.1.1.22 port 8888, compression=on
1092         $dsn = 'mysql://user:pwd@localhost/mydb?memcache=10.1.1.22:8888:1';
1093                 
1094         # we have a memcache servers mem1,mem2 on port 8888, compression=off
1095         $dsn = 'mysql://user:pwd@localhost/mydb?memcache=mem1,mem2:8888:0'; 
1096         
1097         # we have a memcache servers mem1,mem2 on port 8888, compression=off and cachesecs=120
1098         $dsn = 'mysql://user:pwd@localhost/mydb?memcache=mem1,mem2:8888:0&cachesecs=120';
1099 </pre>
1100 </ul>
1101
1102 <p>ADOdb DSN's are compatible with version 1.0 of PEAR DB's DSN format. <a
1103 name="connect_ex"></a></p>
1104
1105 <h3><span style='mso-bookmark:connect_ex'>Examples of Connecting to Databases</span></h3>
1106
1107 <h4><span style='mso-bookmark:connect_ex'>MySQL and Most Other Database Drivers</span></h4>
1108
1109 <p><span style='mso-bookmark:connect_ex'>MySQL connections are very
1110 straightforward, and the parameters are identical to mysql_connect:</span></p>
1111
1112 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1113 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1114 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$conn = &amp;ADONewConnection('mysql'); <br>
1115 <span style='mso-tab-count:1'>         </span>$conn-&gt;PConnect('localhost','userid','password','database');<br>
1116 <span style='mso-tab-count:1'>         </span><br>
1117 <span style='mso-tab-count:1'>         </span></span><span style='mso-bookmark:
1118 connect_ex'><span style='color:green'># or dsn </span></span></pre><pre><span
1119 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$dsn = 'mysql://user:pwd@localhost/mydb'; </span></pre><pre><span
1120 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for Connect()</span></pre><pre><span
1121 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span></span></pre><pre><span
1122 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span></span><span
1123 style='mso-bookmark:connect_ex'><span style='color:green'># or persistent dsn</span></span></pre><pre><span
1124 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$dsn = 'mysql://user:pwd@localhost/mydb?persist'; </span></pre><pre><span
1125 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for PConnect()</span></pre><pre><span
1126 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span></span></pre><pre><span
1127 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span></span><span
1128 style='mso-bookmark:connect_ex'><span style='color:green'># a more complex example:</span></span></pre><pre><span
1129 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$pwd = urlencode($pwd);</span></pre><pre><span
1130 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$flags =<span style='mso-spacerun:yes'>  </span>MYSQL_CLIENT_COMPRESS;</span></pre><pre><span
1131 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$dsn = &quot;mysql://user:$pwd@localhost/mydb?persist&amp;clientflags=$flags&quot;;</span></pre><pre><span
1132 style='mso-bookmark:connect_ex'><span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for PConnect()</span></pre><pre
1133 style='background:#EEEEEE'><span style='mso-bookmark:connect_ex'> </span></pre></div>
1134
1135 <p><span style='mso-bookmark:connect_ex'>For most drivers, you can use the
1136 standard function: Connect($server, $user, $password, $database), or a </span><a
1137 href="dsnsupport">DSN</a> since ADOdb 4.51. Exceptions to this are listed
1138 below. </p>
1139
1140 <h4><a name=pdo>PDO</a></h4>
1141
1142 <p><span style='mso-bookmark:pdo'>PDO, which only works with PHP5, accepts a
1143 driver specific connection string: </span></p>
1144
1145 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1146 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1147 style='mso-bookmark:pdo'><o:p>&nbsp;</o:p></span></pre><pre><span
1148 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$conn =&amp; NewADConnection('pdo');</span></pre><pre><span
1149 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect('mysql:host=localhost',$user,$pwd,$mydb);</span></pre><pre><span
1150 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect('mysql:host=localhost;dbname=mydb',$user,$pwd);</span></pre><pre><span
1151 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect(&quot;mysql:host=localhost;dbname=mydb;username=$user;password=$pwd&quot;);</span></pre></div>
1152
1153 <p><span style='mso-bookmark:pdo'>The DSN mechanism is also supported: </span></p>
1154
1155 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1156 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1157 style='mso-bookmark:pdo'><o:p>&nbsp;</o:p></span></pre><pre><span
1158 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$conn =&amp; NewADConnection(&quot;pdo_mysql://user:pwd@localhost/mydb?persist&quot;); # persist is optional</span></pre></div>
1159
1160 <h4><span style='mso-bookmark:pdo'>PostgreSQL</span></h4>
1161
1162 <p><span style='mso-bookmark:pdo'>PostgreSQL 7 and 8 accepts connections using:
1163 </span></p>
1164
1165 <p><span style='mso-bookmark:pdo'>a. the standard connection string:</span></p>
1166
1167 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1168 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1169 style='background:#EEEEEE'><span style='mso-bookmark:pdo'><span
1170 style='mso-tab-count:1'>         </span>$conn = &amp;ADONewConnection('postgres');<span style='mso-spacerun:yes'>  </span><br>
1171 <span style='mso-tab-count:1'>         </span>$conn-&gt;PConnect('host=localhost port=5432 dbname=mary');</span></pre></div>
1172
1173 <p><span style='mso-bookmark:pdo'>b. the classical 4 parameters:</span></p>
1174
1175 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1176 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1177 style='background:#EEEEEE'><span style='mso-bookmark:pdo'><span
1178 style='mso-tab-count:1'>         </span>$conn-&gt;PConnect('localhost','userid','password','database');<br>
1179 <span style='mso-spacerun:yes'> </span></span></pre></div>
1180
1181 <p><span style='mso-bookmark:pdo'>c. dsn: </span></p>
1182
1183 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1184 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1185 style='mso-bookmark:pdo'><span style='mso-tab-count:1'>         </span>$dsn = 'postgres://user:pwd@localhost/mydb?persist';<span style='mso-spacerun:yes'>  </span># persist is optional</span></pre><pre
1186 style='background:#EEEEEE'><span style='mso-bookmark:pdo'><span
1187 style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for Connect/PConnect</span></pre></div>
1188
1189 <span style='mso-bookmark:pdo'></span>
1190
1191 <h4><a name=ldap></a>LDAP</h4>
1192
1193 <p>Here is an example of querying a LDAP server. Thanks to Josh Eldridge for
1194 the driver and this example: </p>
1195
1196 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1197 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>require('/path/to/adodb.inc.php');</pre><pre><o:p>&nbsp;</o:p></pre><pre>/* Make sure to set this BEFORE calling Connect() */</pre><pre>$LDAP_CONNECT_OPTIONS = Array(</pre><pre><span
1198 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_DEREF, &quot;OPTION_VALUE&quot;=&gt;2),</pre><pre><span
1199 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_SIZELIMIT,&quot;OPTION_VALUE&quot;=&gt;100),</pre><pre><span
1200 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_TIMELIMIT,&quot;OPTION_VALUE&quot;=&gt;30),</pre><pre><span
1201 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_PROTOCOL_VERSION,&quot;OPTION_VALUE&quot;=&gt;3),</pre><pre><span
1202 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_ERROR_NUMBER,&quot;OPTION_VALUE&quot;=&gt;13),</pre><pre><span
1203 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_REFERRALS,&quot;OPTION_VALUE&quot;=&gt;FALSE),</pre><pre><span
1204 style='mso-tab-count:1'>         </span>Array (&quot;OPTION_NAME&quot;=&gt;LDAP_OPT_RESTART,&quot;OPTION_VALUE&quot;=&gt;FALSE)</pre><pre>);</pre><pre>$host = 'ldap.baylor.edu';</pre><pre>$ldapbase = 'ou=People,o=<st1:place
1205 w:st="on"><st1:PlaceName w:st="on">Baylor</st1:PlaceName> <st1:PlaceType w:st="on">University</st1:PlaceType></st1:place>,c=US';</pre><pre><o:p>&nbsp;</o:p></pre><pre>$ldap = NewADOConnection( 'ldap' );</pre><pre>$ldap-&gt;Connect( $host, $user_name='', $password='', $ldapbase );</pre><pre><o:p>&nbsp;</o:p></pre><pre>echo &quot;&lt;pre&gt;&quot;;</pre><pre><o:p>&nbsp;</o:p></pre><pre>print_r( $ldap-&gt;ServerInfo() );</pre><pre>$ldap-&gt;SetFetchMode(ADODB_FETCH_ASSOC);</pre><pre>$userName = 'eldridge';</pre><pre>$filter=&quot;(|(CN=$userName*)(sn=$userName*)(givenname=$userName*)(uid=$userName*))&quot;;</pre><pre><o:p>&nbsp;</o:p></pre><pre>$rs = $ldap-&gt;Execute( $filter );</pre><pre>if ($rs)</pre><pre><span
1206 style='mso-tab-count:1'>         </span>while ($arr = $rs-&gt;FetchRow()) {</pre><pre><span
1207 style='mso-tab-count:1'>         </span><span style='mso-spacerun:yes'>     </span>print_r($arr);<span
1208 style='mso-tab-count:1'>       </span></pre><pre><span style='mso-tab-count:
1209 1'>         </span>}</pre><pre><o:p>&nbsp;</o:p></pre><pre>$rs = $ldap-&gt;Execute( $filter );</pre><pre>if ($rs) </pre><pre><span
1210 style='mso-tab-count:1'>         </span>while (!$rs-&gt;EOF) {</pre><pre> <span
1211 style='mso-tab-count:2'>                </span>print_r($rs-&gt;fields);<span
1212 style='mso-tab-count:1'>     </span></pre><pre><span style='mso-tab-count:2'>                 </span>$rs-&gt;MoveNext();</pre><pre><span
1213 style='mso-tab-count:1'>         </span>} </pre><pre><span style='mso-tab-count:
1214 1'>         </span></pre><pre>print_r( $ldap-&gt;GetArray( $filter ) );</pre><pre>print_r( $ldap-&gt;GetRow( $filter ) );</pre><pre><o:p>&nbsp;</o:p></pre><pre>$ldap-&gt;Close();</pre><pre>echo &quot;&lt;/pre&gt;&quot;;</pre></div>
1215
1216 <p>Using DSN: </p>
1217
1218 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1219 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$dsn = &quot;ldap://ldap.baylor.edu/ou=People,o=<st1:place
1220 w:st="on"><st1:PlaceName w:st="on">Baylor</st1:PlaceName> <st1:PlaceType w:st="on">University</st1:PlaceType></st1:place>,c=US&quot;;</pre><pre>$db = NewADOConnection($dsn);</pre></div>
1221
1222 <h4>Interbase/Firebird</h4>
1223
1224 <p class=MsoNormal>You define the database in the $host parameter: </p>
1225
1226 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1227 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1228 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn = &amp;ADONewConnection('ibase'); <br>
1229 <span style='mso-tab-count:1'>         </span>$conn-&gt;PConnect('localhost:c:\ibase\employee.gdb','sysdba','masterkey');</pre></div>
1230
1231 <p>Or dsn: </p>
1232
1233 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1234 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1235 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$dsn = 'firebird://user:pwd@localhost/mydb?persist&amp;dialect=3';<span style='mso-spacerun:yes'>  </span># persist is optional<br>
1236 <span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for Connect/PConnect</pre></div>
1237
1238 <h4>SQLite</h4>
1239
1240 <p class=MsoNormal>Sqlite will create the database file if it does not exist. </p>
1241
1242 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1243 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1244 style='mso-tab-count:1'>         </span>$conn = &amp;ADONewConnection('sqlite');</pre><pre
1245 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;PConnect('c:\path\to\sqlite.db'); # sqlite will create if does not exist</pre></div>
1246
1247 <p>Or dsn: </p>
1248
1249 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1250 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1251 style='mso-tab-count:1'>         </span>$path = urlencode('c:\path\to\sqlite.db');</pre><pre><span
1252 style='mso-tab-count:1'>         </span>$dsn = &quot;sqlite://$path/?persist&quot;;<span style='mso-spacerun:yes'>  </span># persist is optional</pre><pre
1253 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for Connect/PConnect</pre></div>
1254
1255 <h4>Oracle (oci8)</h4>
1256
1257 <p>With oci8, you can connect in multiple ways. Note that oci8 works fine with
1258 newer versions of the Oracle, eg. 9i and 10g.</p>
1259
1260 <p>a. PHP and Oracle reside on the same machine, use default SID.</p>
1261
1262 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1263 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1264 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect(false, 'scott', 'tiger');</pre></div>
1265
1266 <p>b. TNS Name defined in tnsnames.ora (or ONAMES or HOSTNAMES), eg. 'myTNS'</p>
1267
1268 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1269 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1270 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;PConnect(false, 'scott', 'tiger', 'myTNS');</pre></div>
1271
1272 <p>or</p>
1273
1274 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1275 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1276 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span><span
1277 style='mso-tab-count:1'>        </span>$conn-&gt;PConnect('myTNS', 'scott', 'tiger');</pre></div>
1278
1279 <p>c. Host Address and SID</p>
1280
1281 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1282 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
1283 style='mso-tab-count:1'>         </span># with adodb 5.06 or 4.991 and later</pre><pre><span
1284 style='mso-tab-count:1'>         </span>$conn-&gt;Connect('192.168.0.1', 'scott', 'tiger', &quot;SID=$SID&quot;);</pre><pre><span
1285 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
1286 1'>         </span># OR with all versions of ADOdb</pre><pre><span
1287 style='mso-tab-count:1'>         </span>$conn-&gt;connectSID = true;</pre><pre><span
1288 style='mso-tab-count:1'>         </span>$conn-&gt;Connect('192.168.0.1', 'scott', 'tiger', $SID);</pre><pre
1289 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span></pre></div>
1290
1291 <p>d. Host Address and Service Name</p>
1292
1293 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1294 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1295 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect('192.168.0.1', 'scott', 'tiger', 'servicename');</pre></div>
1296
1297 <p>e. Oracle connection string: </p>
1298
1299 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1300 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1301 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$cstr = &quot;(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port))<br>
1302 <span style='mso-tab-count:3'>                          </span>(CONNECT_DATA=(SID=$sid)))&quot;;<br>
1303 <span style='mso-tab-count:1'>         </span>$conn-&gt;Connect($cstr, 'scott', 'tiger');</pre></div>
1304
1305 <p>f. ADOdb dsn: </p>
1306
1307 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1308 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1309 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$dsn = 'oci8://user:pwd@tnsname/?persist';<span style='mso-spacerun:yes'>  </span># persist is optional<br>
1310 <span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<span style='mso-spacerun:yes'>  </span># no need for Connect/PConnect<br>
1311 <span style='mso-tab-count:1'>         </span><br>
1312 <span style='mso-tab-count:1'>         </span>$dsn = 'oci8://user:pwd@host/sid';<br>
1313 <span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);<br>
1314 <span style='mso-tab-count:1'>         </span><br>
1315 <span style='mso-tab-count:1'>         </span>$dsn = 'oci8://user:pwd@/';<span style='mso-spacerun:yes'>   </span># oracle on local machine<br>
1316 <span style='mso-tab-count:1'>         </span>$conn = ADONewConnection($dsn);</pre></div>
1317
1318 <p>You can also set the charSet for Oracle 9.2 and later, supported since PHP
1319 4.3.2, ADOdb 4.54: </p>
1320
1321 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1322 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1323 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;charSet = 'we8iso8859p1';<br>
1324 <span style='mso-tab-count:1'>         </span>$conn-&gt;Connect(...);<br>
1325 <span style='mso-tab-count:1'>         </span><br>
1326 <span style='mso-tab-count:1'>         </span># or<br>
1327 <span style='mso-tab-count:1'>         </span>$dsn = 'oci8://user:pwd@tnsname/?charset=WE8MSWIN1252';<br>
1328 <span style='mso-tab-count:1'>         </span>$db = ADONewConnection($dsn);</pre></div>
1329
1330 <h4><a name=dsnless></a>DSN-less ODBC ( Access, MSSQL and DB2 examples)</h4>
1331
1332 <p>ODBC DSN's can be created in the ODBC control panel, or you can use a
1333 DSN-less connection.To use DSN-less connections with ODBC you need PHP 4.3 or
1334 later. </p>
1335
1336 <p>For Microsoft Access:</p>
1337
1338 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1339 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
1340 style='mso-tab-count:1'>         </span>$db =&amp; ADONewConnection('access');<br>
1341 <span style='mso-tab-count:1'>         </span>$dsn = <strong><span
1342 style='font-family:"Courier New"'>&quot;Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;&quot;;</span></strong></pre><pre><span
1343 style='mso-tab-count:1'>         </span>$db-&gt;Connect($dsn);</pre></div>
1344
1345 <p class=MsoNormal>For Microsoft SQL Server: </p>
1346
1347 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1348 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1349 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$db =&amp; ADONewConnection('odbc_mssql');<br>
1350 <span style='mso-tab-count:1'>         </span>$dsn = <strong><span
1351 style='font-family:"Courier New"'>&quot;Driver={SQL Server};Server=localhost;Database=northwind;&quot;</span></strong>;<br>
1352 <span style='mso-tab-count:1'>         </span>$db-&gt;Connect($dsn,'userid','password');</pre></div>
1353
1354 <p class=MsoNormal>or if you prefer to use the mssql extension (which is
1355 limited to mssql 6.5 functionality): </p>
1356
1357 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1358 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1359 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$db =&amp; ADONewConnection('mssql');<br>
1360 <span style='mso-tab-count:1'>         </span>$db-&gt;Execute('localhost', 'userid', 'password', 'northwind');</pre></div>
1361
1362 <p class=MsoNormal>For DB2: </p>
1363
1364 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1365 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
1366 style='mso-tab-count:1'>         </span>$dbms = 'db2'; # or 'odbc_db2' if db2 extension not available</pre><pre><span
1367 style='mso-tab-count:1'>         </span>$db =&amp; ADONewConnection($dbms);</pre><pre><span
1368 style='mso-tab-count:1'>         </span>$dsn = &quot;driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP;&quot;.</pre><pre><span
1369 style='mso-tab-count:4'>                                   </span>&quot;uid=root; pwd=secret&quot;;<br>
1370 <span style='mso-tab-count:1'>         </span>$db-&gt;Connect($dsn);<br>
1371                   # or connect and set schema
1372                   $db-&gt;Connect($dsn,null,null,$schema);</pre>
1373 </div>
1374
1375 <p class=MsoNormal><b>DSN-less Connections with <st1:City w:st="on">ADO</st1:City></b><br>
1376 If you are using versions of PHP earlier than PHP 4.3.0, DSN-less connections
1377 only work with Microsoft's <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>,
1378 which is Microsoft's COM based API. An example using the ADOdb library and
1379 Microsoft's <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>:
1380 </p>
1381
1382 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1383 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?php<br>
1384 <span style='mso-tab-count:1'>         </span>include('adodb.inc.php'); <br>
1385 <span style='mso-tab-count:1'>         </span>$db = &amp;ADONewConnection(&quot;ado_mssql&quot;);<br>
1386 <span style='mso-tab-count:1'>         </span>print &quot;&lt;h1&gt;Connecting DSN-less $db-&gt;databaseType...&lt;/h1&gt;&quot;;<br>
1387 <span style='mso-tab-count:2'>                 </span><br>
1388 <span style='mso-tab-count:1'>         </span><b>$myDSN=&quot;PROVIDER=MSDASQL;DRIVER={SQL Server};&quot;<br>
1389 <span style='mso-tab-count:2'>                 </span>. &quot;SERVER=flipper;DATABASE=ai;UID=sa;PWD=;&quot;<span style='mso-spacerun:yes'>  </span>;</b></pre><pre><span
1390 style='mso-tab-count:1'>         </span>$db-&gt;Connect($myDSN);</pre><pre><span
1391 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
1392 1'>         </span>$rs = $db-&gt;Execute(&quot;select * from table&quot;);</pre><pre><span
1393 style='mso-tab-count:1'>         </span>$arr = $rs-&gt;GetArray();</pre><pre><span
1394 style='mso-tab-count:1'>         </span>print_r($arr);</pre><pre>?&gt;</pre></div>
1395
1396 <h2><a name=speed></a>High Speed ADOdb - tuning tips</h2>
1397
1398 <p>ADOdb is a big class library, yet it <a href="http://phplens.com/lens/adodb/">consistently
1399 beats</a> all other PHP class libraries in performance. This is because it is
1400 designed in a layered fashion, like an onion, with the fastest functions in the
1401 innermost layer. Stick to the following functions for best performance:</p>
1402
1403 <div align=center>
1404
1405 <table class=MsoNormalTable border=1 cellpadding=0 width="40%"
1406  style='width:40.0%;mso-cellspacing:1.5pt'>
1407  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
1408   <td style='padding:.75pt .75pt .75pt .75pt'>
1409   <p class=MsoNormal align=center style='text-align:center'><b>Innermost Layer</b></p>
1410   </td>
1411  </tr>
1412  <tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>
1413   <td style='padding:.75pt .75pt .75pt .75pt'>
1414   <p align=center style='text-align:center'>Connect, PConnect, NConnect<br>
1415   Execute, CacheExecute<br>
1416   SelectLimit, CacheSelectLimit<br>
1417   MoveNext, Close <br>
1418   qstr, Affected_Rows, Insert_ID</p>
1419   </td>
1420  </tr>
1421 </table>
1422
1423 </div>
1424
1425 <p>The fastest way to access the field data is by accessing the array
1426 $recordset-&gt;fields directly. Also set the global variables <a
1427 href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> = ADODB_FETCH_NUM, and (for
1428 oci8, ibase/firebird and odbc) <a href="#adodb_countrecs">$ADODB_COUNTRECS</a>
1429 = false before you connect to your database.</p>
1430
1431 <p>Consider using bind parameters if your database supports it, as it improves
1432 query plan reuse. Use ADOdb's performance tuning system to identify bottlenecks
1433 quickly. At the time of writing (Dec 2003), this means oci8 and odbc drivers.</p>
1434
1435 <p>Lastly make sure you have a PHP accelerator cache installed such as APC,
1436 Turck MMCache, Zend Accelerator or ionCube.</p>
1437
1438 <p>Some examples:</p>
1439
1440 <div align=center>
1441
1442 <table class=MsoNormalTable border=1 cellpadding=0 style='mso-cellspacing:1.5pt'>
1443  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
1444   <td style='padding:.75pt .75pt .75pt .75pt'>
1445   <p class=MsoNormal><b>Fastest data retrieval using PHP</b></p>
1446   </td>
1447   <td style='padding:.75pt .75pt .75pt .75pt'>
1448   <p class=MsoNormal><b>Fastest data retrieval using ADOdb extension</b></p>
1449   </td>
1450  </tr>
1451  <tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>
1452   <td style='padding:.75pt .75pt .75pt .75pt'>
1453   <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;
1454   mso-border-alt:solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;
1455   background:#EEEEEE'><pre style='background:#EEEEEE'>$rs =&amp; $rs-&gt;Execute($sql);<br>
1456 while (!$rs-&gt;EOF) {<br>
1457   <span style='mso-tab-count:1'>         </span>var_dump($rs-&gt;fields);<br>
1458   <span style='mso-tab-count:1'>         </span>$rs-&gt;MoveNext();<br>
1459 }</pre></div>
1460   </td>
1461   <td style='padding:.75pt .75pt .75pt .75pt'>
1462   <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;
1463   mso-border-alt:solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;
1464   background:#EEEEEE'><pre style='margin-bottom:12.0pt;background:#EEEEEE'>$rs =&amp; $rs-&gt;Execute($sql);<br>
1465 $array = adodb_getall($rs);<br>
1466 var_dump($array);<br style='mso-special-character:line-break'>
1467   <![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
1468   <![endif]></pre></div>
1469   </td>
1470  </tr>
1471 </table>
1472
1473 </div>
1474
1475 <p><b>Advanced Tips</b> </p>
1476
1477 <p>If you have the <a href="http://adodb.sourceforge.net/#extension">ADOdb C
1478 extension</a> installed, you can replace your calls to $rs-&gt;MoveNext() with
1479 adodb_movenext($rs). This doubles the speed of this operation. For retrieving
1480 entire recordsets at once, use GetArray(), which uses the high speed extension
1481 function adodb_getall($rs) internally. </p>
1482
1483 <p>Execute() is the default way to run queries. You can use the low-level
1484 functions _Execute() and _query() to reduce query overhead. Both these
1485 functions share the same parameters as Execute(). </p>
1486
1487 <p>If you do not have any bind parameters or your database supports binding
1488 (without emulation), then you can call _Execute() directly. Calling this
1489 function bypasses bind emulation. Debugging is still supported in _Execute(). </p>
1490
1491 <p>If you do not require debugging facilities nor emulated binding, and do not
1492 require a recordset to be returned, then you can call _query. This is great for
1493 inserts, updates and deletes. Calling this function bypasses emulated binding,
1494 debugging, and recordset handling. Either the resultid, true or false are
1495 returned by _query(). </p>
1496
1497 <p>For Informix, you can disable scrollable cursors with $db-&gt;cursorType =
1498 0. </p>
1499
1500 <h2><a name=hack></a>Hacking ADOdb Safely</h2>
1501
1502 <p>You might want to modify ADOdb for your own purposes. Luckily you can still
1503 maintain backward compatibility by sub-classing ADOdb and using the
1504 $ADODB_NEWCONNECTION variable. $ADODB_NEWCONNECTION allows you to override the
1505 behaviour of ADONewConnection(). ADOConnection() checks for this variable and
1506 will call the function-name stored in this variable if it is defined. </p>
1507
1508 <p>In the following example, new functionality for the connection object is
1509 placed in the <i>hack_mysql</i> and <i>hack_postgres7</i> classes. The
1510 recordset class naming convention can be controlled using $rsPrefix. Here we
1511 set it to 'hack_rs_', which will make ADOdb use <i>hack_rs_mysql</i> and <i>hack_rs_postgres7</i>
1512 as the recordset classes. </p>
1513
1514 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1515 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
1516 style='background:#EEEEEE'>class hack_mysql extends adodb_mysql {<br>
1517 var $rsPrefix = 'hack_rs_';<br>
1518 <span style='mso-spacerun:yes'>  </span>/* Your mods here */<br>
1519 }<br>
1520 <br>
1521 class hack_rs_mysql extends ADORecordSet_mysql {<br>
1522 <span style='mso-tab-count:1'>         </span><span style='mso-spacerun:yes'> </span>/* Your mods here */<br>
1523 }<br>
1524 <br>
1525 class hack_postgres7 extends adodb_postgres7 {<br>
1526 var $rsPrefix = 'hack_rs_';<br>
1527 <span style='mso-spacerun:yes'>  </span>/* Your mods here */<br>
1528 }<br>
1529 <br>
1530 class hack_rs_postgres7 extends ADORecordSet_postgres7 {<br>
1531 <span style='mso-spacerun:yes'> </span>/* Your mods here */<br>
1532 }<br>
1533 <br>
1534 $ADODB_NEWCONNECTION = 'hack_factory';<br>
1535 <br>
1536 function&amp; hack_factory($driver)<br>
1537 {<br>
1538 <span style='mso-tab-count:1'>         </span>if ($driver !== 'mysql' &amp;&amp; $driver !== 'postgres7') return false;<br>
1539 <span style='mso-tab-count:1'>         </span><br>
1540 <span style='mso-tab-count:1'>         </span>$driver = 'hack_'.$driver;<br>
1541 <span style='mso-tab-count:1'>         </span>$obj = new $driver();<br>
1542 <span style='mso-tab-count:1'>         </span>return $obj;<br>
1543 }<br>
1544 <br>
1545 include_once('adodb.inc.php');</pre></div>
1546
1547 <p>Don't forget to call the constructor of the parent class in your
1548 constructor. If you want to use the default ADOdb drivers return false in the
1549 above hack_factory() function. Also you can define your own
1550 ADORecordSet_empty() class, by defining a class $$this-&gt;rsPrefix.'empty'
1551 since 4.96/5.02. <a name=php5></a></p>
1552
1553 <h2>PHP5 Features</h2>
1554
1555 <p class=MsoNormal>ADOdb 4.02 or later will transparently determine which
1556 version of PHP you are using. If PHP5 is detected, the following features become
1557 available: </p>
1558
1559 <ul type=disc>
1560  <li class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
1561      mso-list:l11 level1 lfo5;tab-stops:list 36.0pt'><b>PDO</b>: PDO drivers
1562      are available. See the <a href="#pdo">connection examples</a>. Currently
1563      PDO drivers are not as powerful as native drivers, and should be treated
1564      as experimental.<a name=php5iterators></a></li>
1565  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1566      mso-list:l11 level1 lfo5;tab-stops:list 36.0pt'><b>Foreach iterators</b>:
1567      This is a very natural way of going through a recordset: </li>
1568 </ul>
1569
1570 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1571 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE;
1572 margin-left:36.0pt;margin-right:0cm'><pre style='background:#EEEEEE'><span
1573 style='mso-tab-count:1'>  </span>$ADODB_FETCH_MODE = ADODB_FETCH_NUM;<br>
1574 <span style='mso-tab-count:1'>  </span>$rs = $db-&gt;Execute($sql);<br>
1575 <span style='mso-tab-count:1'>  </span>foreach($rs as $k =&gt; $row) {<br>
1576 <span style='mso-tab-count:2'>           </span>echo &quot;r1=&quot;.$row[0].&quot; r2=&quot;.$row[1].&quot;&lt;br&gt;&quot;;<br>
1577 <span style='mso-tab-count:1'>  </span>}</pre></div>
1578
1579 <ul type=disc>
1580  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
1581      mso-list:l11 level1 lfo5;tab-stops:list 36.0pt'><a name=php5exceptions></a><b>Exceptions</b>:
1582      Just include <i>adodb-exceptions.inc.php</i> and you can now catch
1583      exceptions on errors as they occur. </li>
1584 </ul>
1585
1586 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
1587 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE;
1588 margin-left:36.0pt;margin-right:0cm'><pre style='background:#EEEEEE'><span
1589 style='mso-tab-count:1'>  </span><b>include(&quot;../adodb-exceptions.inc.php&quot;);</b> <br>
1590 <span style='mso-tab-count:1'>  </span>include(&quot;../adodb.inc.php&quot;);<span
1591 style='mso-tab-count:1'>       </span> <br>
1592 <span style='mso-tab-count:1'>  </span>try { <br>
1593 <span style='mso-tab-count:2'>           </span>$db = NewADOConnection(&quot;oci8&quot;); <br>
1594 <span style='mso-tab-count:2'>           </span>$db-&gt;Connect('','scott','bad-password'); <br>
1595 <span style='mso-tab-count:1'>  </span>} catch (exception $e) { <br>
1596 <span style='mso-tab-count:2'>           </span>var_dump($e); <br>
1597 <span style='mso-tab-count:2'>           </span>adodb_backtrace($e-&gt;gettrace());<br>
1598 <span style='mso-tab-count:1'>  </span>} </pre></div>
1599
1600 <p style='margin-left:36.0pt'>Note that reaching EOF is <b>not</b> considered
1601 an error nor an exception. </p>
1602
1603 <h3><a name=drivers></a>Databases Supported</h3>
1604
1605 <p class=MsoNormal>The <i>name</i> below is the value you pass to
1606 NewADOConnection($name) to create a connection object for that database. </p>
1607
1608 <table class=MsoNormalTable border=1 cellpadding=0 width="100%"
1609  style='width:100.0%;mso-cellspacing:1.5pt'>
1610  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
1611   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1612   <p class=MsoNormal><b>Name</b></p>
1613   </td>
1614   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1615   <p class=MsoNormal><b>Tested</b></p>
1616   </td>
1617   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1618   <p class=MsoNormal><b>Database</b></p>
1619   </td>
1620   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1621   <p class=MsoNormal><b><span style='font-size:10.0pt'>RecordCount() usable</span></b></p>
1622   </td>
1623   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1624   <p class=MsoNormal><b>Prerequisites</b></p>
1625   </td>
1626   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1627   <p class=MsoNormal><b>Operating Systems</b></p>
1628   </td>
1629  </tr>
1630  <tr style='mso-yfti-irow:1'>
1631   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1632   <p class=MsoNormal><b><span style='font-size:10.0pt'>access</span></b></p>
1633   </td>
1634   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1635   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1636   </td>
1637   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1638   <p class=MsoNormal><span style='font-size:10.0pt'>Microsoft Access/Jet. You
1639   need to create an ODBC DSN.</span></p>
1640   </td>
1641   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1642   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1643   </td>
1644   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1645   <p class=MsoNormal><span style='font-size:10.0pt'>ODBC </span></p>
1646   </td>
1647   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1648   <p class=MsoNormal><span style='font-size:10.0pt'>Windows only</span></p>
1649   </td>
1650  </tr>
1651  <tr style='mso-yfti-irow:2'>
1652   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1653   <p class=MsoNormal><b><span style='font-size:10.0pt'>ado</span></b></p>
1654   </td>
1655   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1656   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1657   </td>
1658   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1659   <p><span style='font-size:10.0pt'>Generic <st1:City w:st="on"><st1:place
1660    w:st="on">ADO</st1:place></st1:City>, not tuned for specific databases.
1661   Allows DSN-less connections. For best performance, use an OLEDB provider.
1662   This is the base class for all ado drivers.</span></p>
1663   <p><span style='font-size:10.0pt'>You can set $db-&gt;codePage before
1664   connecting.</span></p>
1665   </td>
1666   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1667   <p class=MsoNormal><span style='font-size:10.0pt'>? depends on database</span></p>
1668   </td>
1669   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1670   <p class=MsoNormal><st1:City w:st="on"><st1:place w:st="on"><span
1671     style='font-size:10.0pt'>ADO</span></st1:place></st1:City><span
1672   style='font-size:10.0pt'> or OLEDB provider</span></p>
1673   </td>
1674   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1675   <p class=MsoNormal><span style='font-size:10.0pt'>Windows only</span></p>
1676   </td>
1677  </tr>
1678  <tr style='mso-yfti-irow:3'>
1679   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1680   <p class=MsoNormal><b><span style='font-size:10.0pt'>ado_access</span></b></p>
1681   </td>
1682   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1683   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1684   </td>
1685   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1686   <p class=MsoNormal><span style='font-size:10.0pt'>Microsoft Access/Jet using <st1:City
1687   w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>. Allows DSN-less
1688   connections. For best performance, use an OLEDB provider.</span></p>
1689   </td>
1690   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1691   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1692   </td>
1693   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1694   <p class=MsoNormal><st1:City w:st="on"><st1:place w:st="on"><span
1695     style='font-size:10.0pt'>ADO</span></st1:place></st1:City><span
1696   style='font-size:10.0pt'> or OLEDB provider</span></p>
1697   </td>
1698   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1699   <p class=MsoNormal><span style='font-size:10.0pt'>Windows only</span></p>
1700   </td>
1701  </tr>
1702  <tr style='mso-yfti-irow:4'>
1703   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1704   <p class=MsoNormal><b><span style='font-size:10.0pt'>ado_mssql</span></b></p>
1705   </td>
1706   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1707   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1708   </td>
1709   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1710   <p class=MsoNormal><span style='font-size:10.0pt'>Microsoft SQL Server using <st1:City
1711   w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>. Allows DSN-less
1712   connections. For best performance, use an OLEDB provider.</span></p>
1713   </td>
1714   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1715   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1716   </td>
1717   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1718   <p class=MsoNormal><st1:City w:st="on"><st1:place w:st="on"><span
1719     style='font-size:10.0pt'>ADO</span></st1:place></st1:City><span
1720   style='font-size:10.0pt'> or OLEDB provider</span></p>
1721   </td>
1722   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1723   <p class=MsoNormal><span style='font-size:10.0pt'>Windows only</span></p>
1724   </td>
1725  </tr>
1726  <tr style='mso-yfti-irow:5;height:40.5pt'>
1727   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1728   <p class=MsoNormal><b><span style='font-size:10.0pt'>db2</span></b></p>
1729   </td>
1730   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1731   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1732   </td>
1733   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1734   <p class=MsoNormal><span style='font-size:10.0pt'>Uses PHP's db2-specific
1735   extension for better performance.</span></p>
1736   </td>
1737   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1738   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1739   </td>
1740   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1741   <p class=MsoNormal><span style='font-size:10.0pt'>DB2 CLI/ODBC interface</span></p>
1742   </td>
1743   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1744   <p><span style='font-size:10.0pt'>Unix and Windows. Requires IBM DB2
1745   Universal Database client.</span></p>
1746   </td>
1747  </tr>
1748  
1749  <tr style='mso-yfti-irow:5;height:40.5pt'>
1750   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1751   <p class=MsoNormal><b><span style='font-size:10.0pt'>db2oci</span></b></p>
1752   </td>
1753   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1754   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1755   </td>
1756   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1757   <p class=MsoNormal><span style='font-size:10.0pt'>Based on db2 driver. Allows use of oracle style :0, :1, :2 bind variables. Used with DB2 9.7 or later with PL/SQL mode turned on.</span></p>
1758   </td>
1759   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1760   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1761   </td>
1762   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1763   <p class=MsoNormal><span style='font-size:10.0pt'>DB2 CLI/ODBC interface</span></p>
1764   </td>
1765   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1766   <p><span style='font-size:10.0pt'>Unix and Windows. Requires IBM DB2
1767   Universal Database client.</span></p>
1768   </td>
1769  </tr>
1770  
1771  <tr style='mso-yfti-irow:6;height:40.5pt'>
1772   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1773   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbc_db2</span></b></p>
1774   </td>
1775   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1776   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1777   </td>
1778   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1779   <p class=MsoNormal><span style='font-size:10.0pt'>Connects to DB2 using
1780   generic ODBC extension.</span></p>
1781   </td>
1782   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1783   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1784   </td>
1785   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1786   <p class=MsoNormal><span style='font-size:10.0pt'>DB2 CLI/ODBC interface</span></p>
1787   </td>
1788   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
1789   <p><span style='font-size:10.0pt'>Unix and Windows. <a
1790   href="http://www.faqts.com/knowledge_base/view.phtml/aid/6283/fid/14">Unix
1791   install hints</a>. I have had reports that the $host and $database params
1792   have to be reversed in Connect() when using the CLI interface.</span></p>
1793   </td>
1794  </tr>
1795  <tr style='mso-yfti-irow:7'>
1796   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1797   <p class=MsoNormal><b><span style='font-size:10.0pt'>vfp</span></b></p>
1798   </td>
1799   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1800   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
1801   </td>
1802   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1803   <p class=MsoNormal><span style='font-size:10.0pt'>Microsoft Visual FoxPro.
1804   You need to create an ODBC DSN.</span></p>
1805   </td>
1806   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1807   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1808   </td>
1809   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1810   <p class=MsoNormal><span style='font-size:10.0pt'>ODBC</span></p>
1811   </td>
1812   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1813   <p class=MsoNormal><span style='font-size:10.0pt'>Windows only</span></p>
1814   </td>
1815  </tr>
1816  <tr style='mso-yfti-irow:8'>
1817   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1818   <p class=MsoNormal><b><span style='font-size:10.0pt'>fbsql</span></b></p>
1819   </td>
1820   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1821   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1822   </td>
1823   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1824   <p class=MsoNormal><span style='font-size:10.0pt'>FrontBase. </span></p>
1825   </td>
1826   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1827   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
1828   </td>
1829   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1830   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
1831   </td>
1832   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1833   <p><span style='font-size:10.0pt'>Unix and Windows</span></p>
1834   </td>
1835  </tr>
1836  <tr style='mso-yfti-irow:9'>
1837   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1838   <p class=MsoNormal><b><span style='font-size:10.0pt'>ibase</span></b></p>
1839   </td>
1840   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1841   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
1842   </td>
1843   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1844   <p class=MsoNormal><span style='font-size:10.0pt'>Interbase 6 or earlier.
1845   Some users report you might need to use this<br>
1846   $db-&gt;PConnect('localhost:c:/ibase/employee.gdb', &quot;sysdba&quot;,
1847   &quot;masterkey&quot;) to connect. Lacks Affected_Rows currently.<br>
1848   <br>
1849   You can set $db-&gt;role, $db-&gt;dialect, $db-&gt;buffers and
1850   $db-&gt;charSet before connecting.</span></p>
1851   </td>
1852   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1853   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1854   </td>
1855   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1856   <p class=MsoNormal><span style='font-size:10.0pt'>Interbase client</span></p>
1857   </td>
1858   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1859   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
1860   </td>
1861  </tr>
1862  <tr style='mso-yfti-irow:10'>
1863   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1864   <p class=MsoNormal><b><i><span style='font-size:10.0pt'>firebird</span></i></b></p>
1865   </td>
1866   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1867   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1868   </td>
1869   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1870   <p class=MsoNormal><span style='font-size:10.0pt'>Firebird version of
1871   interbase.</span></p>
1872   </td>
1873   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1874   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1875   </td>
1876   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1877   <p class=MsoNormal><span style='font-size:10.0pt'>Interbase client</span></p>
1878   </td>
1879   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1880   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
1881   </td>
1882  </tr>
1883  <tr style='mso-yfti-irow:11'>
1884   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1885   <p class=MsoNormal><b><i><span style='font-size:10.0pt'>borland_ibase</span></i></b></p>
1886   </td>
1887   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1888   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1889   </td>
1890   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1891   <p class=MsoNormal><span style='font-size:10.0pt'>Borland version of
1892   Interbase 6.5 or later. Very sad that the forks differ.</span></p>
1893   </td>
1894   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1895   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1896   </td>
1897   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1898   <p class=MsoNormal><span style='font-size:10.0pt'>Interbase client</span></p>
1899   </td>
1900   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1901   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
1902   </td>
1903  </tr>
1904  <tr style='mso-yfti-irow:12'>
1905   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1906   <p class=MsoNormal><b><span style='font-size:10.0pt'>informix</span></b></p>
1907   </td>
1908   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1909   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1910   </td>
1911   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1912   <p class=MsoNormal><span style='font-size:10.0pt'>Generic informix driver.
1913   Use this if you are using Informix 7.3 or later.</span></p>
1914   </td>
1915   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1916   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1917   </td>
1918   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1919   <p class=MsoNormal><span style='font-size:10.0pt'>Informix client</span></p>
1920   </td>
1921   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1922   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
1923   </td>
1924  </tr>
1925  <tr style='mso-yfti-irow:13'>
1926   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1927   <p class=MsoNormal><b><span style='font-size:10.0pt'>informix72</span></b></p>
1928   </td>
1929   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1930   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1931   </td>
1932   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1933   <p class=MsoNormal><span style='font-size:10.0pt'>Informix databases before
1934   Informix 7.3 that do no support SELECT FIRST.</span></p>
1935   </td>
1936   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1937   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1938   </td>
1939   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1940   <p class=MsoNormal><span style='font-size:10.0pt'>Informix client</span></p>
1941   </td>
1942   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1943   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
1944   </td>
1945  </tr>
1946  <tr style='mso-yfti-irow:14'>
1947   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1948   <p class=MsoNormal><b><span style='font-size:10.0pt'>ldap</span></b></p>
1949   </td>
1950   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1951   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
1952   </td>
1953   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1954   <p class=MsoNormal><span style='font-size:10.0pt'>LDAP driver. See this
1955   example for usage information.</span></p>
1956   </td>
1957   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1958   <p class=MsoNormal>&nbsp;</p>
1959   </td>
1960   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1961   <p class=MsoNormal><span style='font-size:10.0pt'>LDAP extension</span></p>
1962   </td>
1963   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
1964   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
1965   </td>
1966  </tr>
1967  <tr style='mso-yfti-irow:15;height:54.75pt'>
1968   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1969   <p class=MsoNormal><b><span style='font-size:10.0pt'>mssql</span></b></p>
1970   </td>
1971   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1972   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
1973   </td>
1974   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1975   <p><span style='font-size:10.0pt'>Microsoft SQL Server 7 and later. Works
1976   with Microsoft SQL Server 2000 also. Note that date formating is problematic
1977   with this driver. For example, the PHP mssql extension does not return the
1978   seconds for datetime!</span></p>
1979   </td>
1980   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1981   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
1982   </td>
1983   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1984   <p class=MsoNormal><span style='font-size:10.0pt'>Mssql client</span></p>
1985   </td>
1986   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1987   <p><span style='font-size:10.0pt'>Unix and Windows. <br>
1988   <a href="http://phpbuilder.com/columns/alberto20000919.php3">Unix install
1989   howto</a> and <a
1990   href="http://linuxjournal.com/article.php?sid=6636&amp;mode=thread&amp;order=0">another
1991   one</a>. </span></p>
1992   </td>
1993  </tr>
1994  <tr style='mso-yfti-irow:16;height:54.75pt'>
1995   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1996   <p class=MsoNormal><b><span style='font-size:10.0pt'>mssqlpo</span></b></p>
1997   </td>
1998   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
1999   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2000   </td>
2001   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2002   <p><span style='font-size:10.0pt'>Portable mssql driver. Identical to above mssql
2003   driver, except that '||', the concatenation operator, is converted to '+'.
2004   Useful for porting scripts from most other sql variants that use ||.</span></p>
2005   </td>
2006   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2007   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2008   </td>
2009   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2010   <p class=MsoNormal><span style='font-size:10.0pt'>Mssql client</span></p>
2011   </td>
2012   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2013   <p><span style='font-size:10.0pt'>Unix and Windows. <a
2014   href="http://phpbuilder.com/columns/alberto20000919.php3"><br>
2015   Unix install howto</a>.</span></p>
2016   </td>
2017  </tr>
2018  <tr style='mso-yfti-irow:17;height:54.75pt'>
2019   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2020   <p class=MsoNormal><b><span style='font-size:10.0pt'>mssqlnative</span></b></p>
2021   </td>
2022   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2023   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2024   </td>
2025   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2026   <p><span style='font-size:10.0pt'>Native mssql driver from M'soft. Use with PHP 5.3 or later. </span></p>
2027   </td>
2028   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2029   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
2030   </td>
2031   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2032   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
2033   </td>
2034   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
2035   <p><span style='font-size:10.0pt'>Windows. Tq Garrett Serack of M'soft.</span></p>
2036   </td>
2037  </tr>
2038  <tr style='mso-yfti-irow:18'>
2039   <td style='padding:.75pt .75pt .75pt .75pt'>
2040   <p class=MsoNormal><o:p>&nbsp;</o:p></p>
2041   </td>
2042   <td style='border:none;padding:.75pt .75pt .75pt .75pt'>
2043   <p class=MsoNormal><span style='font-size:10.0pt;color:windowtext'><o:p>&nbsp;</o:p></span></p>
2044   </td>
2045   <td style='border:none;padding:.75pt .75pt .75pt .75pt'>
2046   <p class=MsoNormal><span style='font-size:10.0pt;color:windowtext'><o:p>&nbsp;</o:p></span></p>
2047   </td>
2048   <td style='border:none;padding:.75pt .75pt .75pt .75pt'>
2049   <p class=MsoNormal><span style='font-size:10.0pt;color:windowtext'><o:p>&nbsp;</o:p></span></p>
2050   </td>
2051   <td style='border:none;padding:.75pt .75pt .75pt .75pt'>
2052   <p class=MsoNormal><span style='font-size:10.0pt;color:windowtext'><o:p>&nbsp;</o:p></span></p>
2053   </td>
2054   <td style='border:none;padding:.75pt .75pt .75pt .75pt'>
2055   <p class=MsoNormal><span style='font-size:10.0pt;color:windowtext'><o:p>&nbsp;</o:p></span></p>
2056   </td>
2057  </tr>
2058  <tr style='mso-yfti-irow:19'>
2059   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2060   <p class=MsoNormal><b><span style='font-size:10.0pt'>mysql</span></b></p>
2061   </td>
2062   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2063   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2064   </td>
2065   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2066   <p class=MsoNormal><span style='font-size:10.0pt'>MySQL without transaction
2067   support. You can also set $db-&gt;clientFlags before connecting.</span></p>
2068   </td>
2069   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2070   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2071   </td>
2072   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2073   <p class=MsoNormal><span style='font-size:10.0pt'>MySQL client</span></p>
2074   </td>
2075   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2076   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2077   </td>
2078  </tr>
2079  <tr style='mso-yfti-irow:20'>
2080   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2081   <p class=MsoNormal><b><span style='font-size:10.0pt'>mysqlt</span></b><span
2082   style='font-size:10.0pt'> or <b>maxsql</b></span></p>
2083   </td>
2084   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2085   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2086   </td>
2087   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2088   <p><span style='font-size:10.0pt'>MySQL with transaction support. We
2089   recommend using || as the concat operator for best portability. This can be
2090   done by running MySQL using: <br>
2091   <i>mysqld --ansi</i> or <i>mysqld --sql-mode=PIPES_AS_CONCAT</i></span></p>
2092   </td>
2093   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2094   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2095   </td>
2096   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2097   <p class=MsoNormal><span style='font-size:10.0pt'>MySQL client</span></p>
2098   </td>
2099   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2100   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2101   </td>
2102  </tr>
2103  <tr style='mso-yfti-irow:21'>
2104   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2105   <p class=MsoNormal><b><span style='font-size:10.0pt'>oci8</span></b></p>
2106   </td>
2107   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2108   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2109   </td>
2110   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2111   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle 8/9. Has more
2112   functionality than <i>oracle</i> driver (eg. Affected_Rows). You might have
2113   to putenv('ORACLE_HOME=...') before Connect/PConnect. </span></p>
2114   <p><span style='font-size:10.0pt'>There are 2 ways of connecting - with
2115   server IP and service name: <br>
2116   <i>PConnect('serverip:1521','scott','tiger','service'</i>)<br>
2117   or using an entry in TNSNAMES.ORA or ONAMES or HOSTNAMES: <br>
2118   <i>PConnect(false, 'scott', 'tiger', $oraname)</i>. </span></p>
2119   <p><span style='font-size:10.0pt'>Since 2.31, we support Oracle REF cursor
2120   variables directly (see <a href="#executecursor">ExecuteCursor</a>).</span> </p>
2121   </td>
2122   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2123   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2124   </td>
2125   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2126   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle client</span></p>
2127   </td>
2128   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2129   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2130   </td>
2131  </tr>
2132  <tr style='mso-yfti-irow:22'>
2133   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2134   <p class=MsoNormal><b><span style='font-size:10.0pt'>oci805</span></b></p>
2135   </td>
2136   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2137   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2138   </td>
2139   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2140   <p class=MsoNormal><span style='font-size:10.0pt'>Supports reduced Oracle
2141   functionality for Oracle 8.0.5. SelectLimit is not as efficient as in the
2142   oci8 or oci8po drivers.</span></p>
2143   </td>
2144   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2145   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2146   </td>
2147   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2148   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle client</span></p>
2149   </td>
2150   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2151   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2152   </td>
2153  </tr>
2154  <tr style='mso-yfti-irow:23'>
2155   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2156   <p class=MsoNormal><b><span style='font-size:10.0pt'>oci8po</span></b></p>
2157   </td>
2158   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2159   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2160   </td>
2161   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2162   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle 8/9 portable driver.
2163   This is nearly identical with the oci8 driver except (a) bind variables in
2164   Prepare() use the ? convention, instead of :bindvar, (b) field names use the
2165   more common PHP convention of lowercase names. </span></p>
2166   <p><span style='font-size:10.0pt'>Use this driver if porting from other
2167   databases is important. Otherwise the oci8 driver offers better performance. </span></p>
2168   </td>
2169   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2170   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2171   </td>
2172   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2173   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle client</span></p>
2174   </td>
2175   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2176   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2177   </td>
2178  </tr>
2179  <tr style='mso-yfti-irow:24'>
2180   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2181   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbc</span></b></p>
2182   </td>
2183   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2184   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2185   </td>
2186   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2187   <p class=MsoNormal><span style='font-size:10.0pt'>Generic ODBC, not tuned for
2188   specific databases. To connect, use <br>
2189   PConnect('DSN','user','pwd'). This is the base class for all odbc derived
2190   drivers.</span></p>
2191   </td>
2192   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2193   <p class=MsoNormal><span style='font-size:10.0pt'>? depends on database</span></p>
2194   </td>
2195   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2196   <p class=MsoNormal><span style='font-size:10.0pt'>ODBC</span></p>
2197   </td>
2198   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2199   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. <a
2200   href="http://phpbuilder.com/columns/alberto20000919.php3?page=4">Unix hints.</a></span></p>
2201   </td>
2202  </tr>
2203  <tr style='mso-yfti-irow:25'>
2204   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2205   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbc_mssql</span></b></p>
2206   </td>
2207   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2208   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2209   </td>
2210   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2211   <p class=MsoNormal><span style='font-size:10.0pt'>Uses ODBC to connect to
2212   MSSQL</span></p>
2213   </td>
2214   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2215   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2216   </td>
2217   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2218   <p class=MsoNormal><span style='font-size:10.0pt'>ODBC</span></p>
2219   </td>
2220   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2221   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2222   </td>
2223  </tr>
2224  <tr style='mso-yfti-irow:26'>
2225   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2226   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbc_oracle</span></b></p>
2227   </td>
2228   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2229   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2230   </td>
2231   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2232   <p class=MsoNormal><span style='font-size:10.0pt'>Uses ODBC to connect to
2233   Oracle</span></p>
2234   </td>
2235   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2236   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2237   </td>
2238   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2239   <p class=MsoNormal><span style='font-size:10.0pt'>ODBC</span></p>
2240   </td>
2241   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2242   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2243   </td>
2244  </tr>
2245  <tr style='mso-yfti-irow:27'>
2246   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2247   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbtp</span></b></p>
2248   </td>
2249   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2250   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2251   </td>
2252   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2253   <p class=MsoNormal><span style='font-size:10.0pt'>Generic odbtp driver. <a
2254   href="http://odbtp.sourceforge.net/">Odbtp</a> is a software for accessing
2255   Windows ODBC data sources from other operating systems.</span></p>
2256   </td>
2257   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2258   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2259   </td>
2260   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2261   <p class=MsoNormal><span style='font-size:10.0pt'>odbtp</span></p>
2262   </td>
2263   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2264   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2265   </td>
2266  </tr>
2267  <tr style='mso-yfti-irow:28'>
2268   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2269   <p class=MsoNormal><b><span style='font-size:10.0pt'>odbtp_unicode</span></b></p>
2270   </td>
2271   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2272   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2273   </td>
2274   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2275   <p class=MsoNormal><span style='font-size:10.0pt'>Odtbp with unicode support</span></p>
2276   </td>
2277   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2278   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2279   </td>
2280   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2281   <p class=MsoNormal><span style='font-size:10.0pt'>odbtp</span></p>
2282   </td>
2283   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2284   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2285   </td>
2286  </tr>
2287  <tr style='mso-yfti-irow:29;height:25.5pt'>
2288   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2289   <p class=MsoNormal><b><span style='font-size:10.0pt'>oracle</span></b></p>
2290   </td>
2291   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2292   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2293   </td>
2294   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2295   <p class=MsoNormal><span style='font-size:10.0pt'>Implements old Oracle 7
2296   client API. Use oci8 driver if possible for better performance.</span></p>
2297   </td>
2298   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2299   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2300   </td>
2301   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2302   <p class=MsoNormal><span style='font-size:10.0pt'>Oracle client</span></p>
2303   </td>
2304   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2305   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows</span></p>
2306   </td>
2307  </tr>
2308  <tr style='mso-yfti-irow:30;height:25.5pt'>
2309   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2310   <p class=MsoNormal><b><span style='font-size:10.0pt'>netezza</span></b></p>
2311   </td>
2312   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2313   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2314   </td>
2315   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2316   <p class=MsoNormal><span style='font-size:10.0pt'>Netezza driver. Netezza is
2317   based on postgres code-base.</span></p>
2318   </td>
2319   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2320   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2321   </td>
2322   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2323   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
2324   </td>
2325   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:25.5pt'>
2326   <p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
2327   </td>
2328  </tr>
2329  <tr style='mso-yfti-irow:31'>
2330   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2331   <p class=MsoNormal><b><span style='font-size:10.0pt'>pdo</span></b></p>
2332   </td>
2333   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2334   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2335   </td>
2336   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2337   <p class=MsoNormal><span style='font-size:10.0pt'>Generic PDO driver for
2338   PHP5. </span></p>
2339   </td>
2340   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2341   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2342   </td>
2343   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2344   <p class=MsoNormal><span style='font-size:10.0pt'>PDO extension and database
2345   specific drivers</span></p>
2346   </td>
2347   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2348   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2349   </td>
2350  </tr>
2351  <tr style='mso-yfti-irow:32'>
2352   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2353   <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres</span></b></p>
2354   </td>
2355   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2356   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2357   </td>
2358   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2359   <p class=MsoNormal><span style='font-size:10.0pt'>Generic PostgreSQL driver.
2360   Currently identical to postgres7 driver.</span></p>
2361   </td>
2362   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2363   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2364   </td>
2365   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2366   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL client</span></p>
2367   </td>
2368   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2369   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2370   </td>
2371  </tr>
2372  <tr style='mso-yfti-irow:33'>
2373   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2374   <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres64</span></b></p>
2375   </td>
2376   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2377   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2378   </td>
2379   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2380   <p class=MsoNormal><span style='font-size:10.0pt'>For PostgreSQL 6.4 and
2381   earlier which does not support LIMIT internally.</span></p>
2382   </td>
2383   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2384   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2385   </td>
2386   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2387   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL client</span></p>
2388   </td>
2389   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2390   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2391   </td>
2392  </tr>
2393  <tr style='mso-yfti-irow:34'>
2394   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2395   <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres7</span></b></p>
2396   </td>
2397   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2398   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2399   </td>
2400   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2401   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL which supports
2402   LIMIT and other version 7 functionality.</span></p>
2403   </td>
2404   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2405   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2406   </td>
2407   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2408   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL client</span></p>
2409   </td>
2410   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2411   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2412   </td>
2413  </tr>
2414  <tr style='mso-yfti-irow:35'>
2415   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2416   <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres8</span></b></p>
2417   </td>
2418   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2419   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2420   </td>
2421   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2422   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL which supports
2423   version 8 functionality.</span></p>
2424   </td>
2425   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2426   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2427   </td>
2428   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2429   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL client</span></p>
2430   </td>
2431   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2432   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2433   </td>
2434  </tr>
2435   <tr style='mso-yfti-irow:35'>
2436   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2437   <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres9</span></b></p>
2438   </td>
2439   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2440   <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
2441   </td>
2442   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2443   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL which supports
2444   version 9 functionality.</span></p>
2445   </td>
2446   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2447   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2448   </td>
2449   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2450   <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL client</span></p>
2451   </td>
2452   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2453   <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows. </span></p>
2454   </td>
2455  </tr>
2456  <tr style='mso-yfti-irow:36'>
2457   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2458   <p class=MsoNormal><b><span style='font-size:10.0pt'>sapdb</span></b></p>
2459   </td>
2460   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2461   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2462   </td>
2463   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2464   <p class=MsoNormal><span style='font-size:10.0pt'>SAP DB. Should work
2465   reliably as based on ODBC driver.</span></p>
2466   </td>
2467   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2468   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2469   </td>
2470   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2471   <p class=MsoNormal><span style='font-size:10.0pt'>SAP ODBC client</span></p>
2472   </td>
2473   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2474   <p><span style='font-size:10.0pt'>?</span></p>
2475   </td>
2476  </tr>
2477  <tr style='mso-yfti-irow:37'>
2478   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2479   <p class=MsoNormal><b><span style='font-size:10.0pt'>sqlanywhere</span></b></p>
2480   </td>
2481   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2482   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2483   </td>
2484   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2485   <p class=MsoNormal><span style='font-size:10.0pt'>Sybase SQL Anywhere. Should
2486   work reliably as based on ODBC driver.</span></p>
2487   </td>
2488   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2489   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2490   </td>
2491   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2492   <p class=MsoNormal><span style='font-size:10.0pt'>SQL Anywhere ODBC client</span></p>
2493   </td>
2494   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2495   <p><span style='font-size:10.0pt'>?</span></p>
2496   </td>
2497  </tr>
2498  <tr style='mso-yfti-irow:38;height:40.5pt'>
2499   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2500   <p class=MsoNormal><b><span style='font-size:10.0pt'>sqlite</span></b></p>
2501   </td>
2502   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2503   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
2504   </td>
2505   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2506   <p class=MsoNormal><span style='font-size:10.0pt'>SQLite.</span></p>
2507   </td>
2508   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2509   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2510   </td>
2511   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2512   <p class=MsoNormal><span style='font-size:10.0pt'>-</span></p>
2513   </td>
2514   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2515   <p><span style='font-size:10.0pt'>Unix and Windows.</span></p>
2516   </td>
2517  </tr>
2518  <tr style='mso-yfti-irow:39;height:40.5pt'>
2519   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2520   <p class=MsoNormal><b><span style='font-size:10.0pt'>sqlitepo</span></b></p>
2521   </td>
2522   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2523   <p class=MsoNormal><span style='font-size:10.0pt'>B</span></p>
2524   </td>
2525   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2526   <p class=MsoNormal><span style='font-size:10.0pt'>Portable SQLite driver. This
2527   is because assoc mode does not work like other drivers in sqlite. Namely,
2528   when selecting (joining) multiple tables, the table names are included in the
2529   assoc keys in the &quot;sqlite&quot; driver.</span></p>
2530   <p><span style='font-size:10.0pt'>In &quot;sqlitepo&quot; driver, the table
2531   names are stripped from the returned column names. When this results in a
2532   conflict, the first field get preference. </span></p>
2533   </td>
2534   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2535   <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
2536   </td>
2537   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2538   <p class=MsoNormal><span style='font-size:10.0pt'>-</span></p>
2539   </td>
2540   <td valign=top style='padding:.75pt .75pt .75pt .75pt;height:40.5pt'>
2541   <p><span style='font-size:10.0pt'>Unix and Windows.</span></p>
2542   </td>
2543  </tr>
2544  <tr style='mso-yfti-irow:40'>
2545   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2546   <p class=MsoNormal><b><span style='font-size:10.0pt'>sybase</span></b></p>
2547   </td>
2548   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2549   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2550   </td>
2551   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2552   <p class=MsoNormal><span style='font-size:10.0pt'>Sybase. </span></p>
2553   </td>
2554   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2555   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2556   </td>
2557   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2558   <p class=MsoNormal><span style='font-size:10.0pt'>Sybase client</span></p>
2559   </td>
2560   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2561   <p><span style='font-size:10.0pt'>Unix and Windows.</span></p>
2562   </td>
2563  </tr>
2564  <tr style='mso-yfti-irow:41;mso-yfti-lastrow:yes'>
2565   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2566   <p class=MsoNormal><b><span style='font-size:10.0pt'>sybase_ase</span></b></p>
2567   </td>
2568   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2569   <p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
2570   </td>
2571   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2572   <p class=MsoNormal><span style='font-size:10.0pt'>Sybase ASE. </span></p>
2573   </td>
2574   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2575   <p class=MsoNormal><span style='font-size:10.0pt'>Y/N</span></p>
2576   </td>
2577   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2578   <p class=MsoNormal><span style='font-size:10.0pt'>Sybase client</span></p>
2579   </td>
2580   <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
2581   <p><span style='font-size:10.0pt'>Unix and Windows.</span></p>
2582   </td>
2583  </tr>
2584 </table>
2585
2586 <p>The &quot;Tested&quot; column indicates how extensively the code has been
2587 tested and used. <br>
2588 A = well tested and used by many people<br>
2589 B = tested and usable, but some features might not be implemented<br>
2590 C = user contributed or experimental driver. Might not fully support all of the
2591 latest features of ADOdb. </p>
2592
2593 <p>The column &quot;RecordCount() usable&quot; indicates whether RecordCount()
2594 return the number of rows, or returns -1 when a SELECT statement is executed.
2595 If this column displays Y/N then the RecordCount() is emulated when the global
2596 variable $ADODB_COUNTRECS=true (this is the default). Note that for large
2597 recordsets, it might be better to disable RecordCount() emulation because
2598 substantial amounts of memory are required to cache the recordset for counting.
2599 Also there is a speed penalty of 40-50% if emulation is required. This is
2600 emulated in most databases except for PostgreSQL and MySQL. This variable is
2601 checked every time a query is executed, so you can selectively choose which
2602 recordsets to count.</p>
2603
2604 <div class=MsoNormal align=center style='text-align:center'>
2605
2606 <hr size=2 width="100%" align=center>
2607
2608 </div>
2609
2610 <h1>Tutorials<a name=quickstart></a></h1>
2611
2612 <h3>Example 1: Select Statement<a name=ex1></a></h3>
2613
2614 <p>Task: Connect to the Access Northwind DSN, display the first 2 columns of
2615 each row.</p>
2616
2617 <p>In this example, we create a ADOConnection object, which represents the
2618 connection to the database. The connection is initiated with <a href="#pconnect"><span
2619 style='font-family:"Courier New"'>PConnect</span></a>, which is a persistent
2620 connection. Whenever we want to query the database, we call the <span
2621 style='font-family:"Courier New"'>ADOConnection.<a href="#execute">Execute</a>()</span>
2622 function. This returns an ADORecordSet object which is actually a cursor that
2623 holds the current row in the array <span style='font-family:"Courier New"'>fields[]</span>.
2624 We use <span style='font-family:"Courier New"'><a href="#movenext">MoveNext</a>()</span>
2625 to move from row to row.</p>
2626
2627 <p>NB: A useful function that is not used in this example is <span
2628 style='font-family:"Courier New"'><a href="#selectlimit">SelectLimit</a></span>,
2629 which allows us to limit the number of rows shown. </p>
2630
2631 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2632 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?<br>
2633 <b>include</b>('adodb.inc.php');<span style='mso-tab-count:1'> </span><span style='mso-spacerun:yes'>   </span># load code common to ADOdb<br>
2634 $<span style='color:#660000'>conn</span> = &amp;ADONewConnection('access');<span
2635 style='mso-tab-count:1'>        </span># create a connection<br>
2636 $<span style='color:#660000'>conn</span>-&gt;PConnect('northwind');<span style='mso-spacerun:yes'>   </span># connect to MS-Access, northwind DSN<br>
2637 $<span style='color:#660000'>recordSet</span> = &amp;$<span style='color:#660000'>conn</span>-&gt;Execute('select * from products');<br>
2638 if (!$<span style='color:#660000'>recordSet</span>) <br>
2639 <span style='mso-tab-count:1'>         </span>print $<span style='color:#660000'>conn</span>-&gt;ErrorMsg();<br>
2640 else<br>
2641 <b>while</b> (!$<span style='color:#660000'>recordSet</span>-&gt;EOF) {<br>
2642 <span style='mso-tab-count:1'>         </span><b>print</b> $<span
2643 style='color:#660000'>recordSet</span>-&gt;fields[0].' '.$<span
2644 style='color:#660000'>recordSet</span>-&gt;fields[1].'&lt;BR&gt;';<br>
2645 <span style='mso-tab-count:1'>         </span>$<span style='color:#660000'>recordSet</span>-&gt;MoveNext();<br>
2646 }</pre><pre><o:p>&nbsp;</o:p></pre><pre>$<span style='color:#660000'>recordSet</span>-&gt;Close(); # optional<br>
2647 $<span style='color:#660000'>conn</span>-&gt;Close(); # optional<br
2648 style='mso-special-character:line-break'>
2649 <![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
2650 <![endif]></pre><pre>?&gt;</pre></div>
2651
2652 <p>The $<span style='font-family:"Courier New"'>recordSet</span> returned
2653 stores the current row in the <span style='font-family:"Courier New"'>$recordSet-&gt;fields</span>
2654 array, indexed by column number (starting from zero). We use the <span
2655 style='font-family:"Courier New"'><a href="#movenext">MoveNext</a>()</span>
2656 function to move to the next row. The <span style='font-family:"Courier New"'>EOF</span>
2657 property is set to true when end-of-file is reached. If an error occurs in
2658 Execute(), we return false instead of a recordset.</p>
2659
2660 <p>The <code><span style='font-size:10.0pt'>$recordSet-&gt;fields[]</span></code>
2661 array is generated by the PHP database extension. Some database extensions only
2662 index by number and do not index the array by field name. To force indexing by
2663 name - that is associative arrays - use the SetFetchMode function. Each
2664 recordset saves and uses whatever fetch mode was set when the recordset was
2665 created in Execute() or SelectLimit(). </p>
2666
2667 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2668 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
2669 style='mso-tab-count:1'>         </span>$db-&gt;SetFetchMode(ADODB_FETCH_NUM);<br>
2670 <span style='mso-tab-count:1'>         </span>$rs1 = $db-&gt;Execute('select * from table');<br>
2671 <span style='mso-tab-count:1'>         </span>$db-&gt;SetFetchMode(ADODB_FETCH_ASSOC);<br>
2672 <span style='mso-tab-count:1'>         </span>$rs2 = $db-&gt;Execute('select * from table');<br>
2673 <span style='mso-tab-count:1'>         </span>print_r($rs1-&gt;fields); # shows <i>array([0]=&gt;'v0',[1] =&gt;'v1')</i></pre><pre><span
2674 style='mso-tab-count:1'>         </span>print_r($rs2-&gt;fields); # shows <i>array(['col1']=&gt;'v0',['col2'] =&gt;'v1')</i></pre></div>
2675
2676 <p>To get the number of rows in the select statement, you can use <span
2677 style='font-family:"Courier New"'>$recordSet-&gt;<a href="#recordcount">RecordCount</a>()</span>.
2678 Note that it can return -1 if the number of rows returned cannot be determined.</p>
2679
2680 <h3>Example 2: Advanced Select with Field Objects<a name=ex2></a></h3>
2681
2682 <p>Select a table, display the first two columns. If the second column is a
2683 date or timestamp, reformat the date to <st1:country-region w:st="on"><st1:place
2684  w:st="on">US</st1:place></st1:country-region> format.</p>
2685
2686 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2687 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?<br>
2688 <b>include</b>('adodb.inc.php');<span style='mso-tab-count:1'> </span><span style='mso-spacerun:yes'>   </span># load code common to ADOdb<br>
2689 $<span style='color:#660000'>conn</span> = &amp;ADONewConnection('access');<span
2690 style='mso-tab-count:1'>        </span># create a connection<br>
2691 $<span style='color:#660000'>conn</span>-&gt;PConnect('northwind');<span style='mso-spacerun:yes'>   </span># connect to MS-Access, northwind dsn<br>
2692 $<span style='color:#660000'>recordSet</span> = &amp;$<span style='color:#660000'>conn</span>-&gt;Execute('select CustomerID,OrderDate from Orders');<br>
2693 if (!$<span style='color:#660000'>recordSet</span>) <br>
2694 <span style='mso-tab-count:1'>         </span>print $<span style='color:#660000'>conn</span>-&gt;ErrorMsg();<br>
2695 else<br>
2696 <b>while</b> (!$<span style='color:#660000'>recordSet</span>-&gt;EOF) {<br>
2697 <span style='mso-tab-count:1'>         </span>$<span style='color:#660000'>fld</span> = <b><span
2698 style='color:#336600'>$</span></b><span style='color:#660000'>recordSet</span><b><span
2699 style='color:#336600'>-&gt;FetchField</span></b><span style='color:#006600'>(</span>1<span
2700 style='color:#006600'>);</span></pre><pre><span style='mso-tab-count:1'>         </span>$<span
2701 style='color:#660000'>type</span> = <b><span style='color:#336600'>$</span></b><span
2702 style='color:#660000'>recordSet</span><b><span style='color:#336600'>-&gt;MetaType</span></b>($fld-&gt;type);<br>
2703 <br>
2704 <span style='mso-tab-count:1'>         </span><b>if</b> ( $<span
2705 style='color:#660000'>type</span> == 'D' || $<span style='color:#660000'>type</span> == 'T') <br>
2706 <span style='mso-tab-count:2'>                 </span><b>print</b> $<span
2707 style='color:#660000'>recordSet</span>-&gt;fields[0].' '.<br>
2708 <span style='mso-tab-count:3'>                          </span><b><span
2709 style='color:#336600'>$</span></b><span style='color:#660000'>recordSet</span><b><span
2710 style='color:#336600'>-&gt;UserDate</span></b>($<span style='color:#660000'>recordSet</span>-&gt;fields[1],'<b>m/d/Y</b>').'&lt;BR&gt;';<br>
2711 <span style='mso-tab-count:1'>         </span><b>else </b></pre><pre><span
2712 style='mso-tab-count:2'>                 </span><b>print</b> $<span
2713 style='color:#660000'>recordSet</span>-&gt;fields[0].' '.$<span
2714 style='color:#660000'>recordSet</span>-&gt;fields[1].'&lt;BR&gt;';<br>
2715 <br>
2716 <span style='mso-tab-count:1'>         </span>$<span style='color:#660000'>recordSet</span>-&gt;MoveNext();<br>
2717 }</pre><pre>$<span style='color:#660000'>recordSet</span>-&gt;Close(); # optional<br>
2718 $<span style='color:#660000'>conn</span>-&gt;Close(); # optional<br
2719 style='mso-special-character:line-break'>
2720 <![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
2721 <![endif]></pre><pre>?&gt;</pre></div>
2722
2723 <p>In this example, we check the field type of the second column using <span
2724 style='font-family:"Courier New"'><a href="#fetchfield">FetchField</a>().</span>
2725 This returns an object with at least 3 fields.</p>
2726
2727 <ul type=disc>
2728  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2729      mso-list:l6 level1 lfo6;tab-stops:list 36.0pt'><b>name</b>: name of column</li>
2730  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2731      mso-list:l6 level1 lfo6;tab-stops:list 36.0pt'><b>type</b>: native field
2732      type of column</li>
2733  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2734      mso-list:l6 level1 lfo6;tab-stops:list 36.0pt'><b>max_length</b>: maximum
2735      length of field. Some databases such as MySQL do not return the maximum
2736      length of the field correctly. In these cases max_length will be set to
2737      -1.</li>
2738 </ul>
2739
2740 <p>We then use <span style='font-family:"Courier New"'><a href="#metatype">MetaType</a>()</span>
2741 to translate the native type to a <i>generic</i> type. Currently the following <i>generic</i>
2742 types are defined:</p>
2743
2744 <ul type=disc>
2745  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2746      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>C</b>: character fields
2747      that should be shown in a &lt;input type=&quot;text&quot;&gt; tag.</li>
2748  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2749      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>X</b>: TeXt, large text
2750      fields that should be shown in a &lt;textarea&gt;</li>
2751  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2752      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>B</b>: Blobs, or Binary
2753      Large Objects. Typically images. </li>
2754  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2755      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>D</b>: Date field</li>
2756  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2757      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>T</b>: Timestamp field</li>
2758  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2759      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>L</b>: Logical field
2760      (boolean or bit-field)</li>
2761  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2762      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>I</b>:&nbsp; Integer
2763      field</li>
2764  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2765      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>N</b>: Numeric field.
2766      Includes autoincrement, numeric, floating point, real and integer. </li>
2767  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
2768      mso-list:l0 level1 lfo7;tab-stops:list 36.0pt'><b>R</b>: Serial field.
2769      Includes serial, autoincrement integers. This works for selected
2770      databases. </li>
2771 </ul>
2772
2773 <p>If the metatype is of type date or timestamp, then we print it using the
2774 user defined date format with <span style='font-family:"Courier New"'><a
2775 href="#userdate">UserDate</a>(),</span> which converts the PHP SQL date string
2776 format to a user defined one. Another use for <span style='font-family:"Courier New"'><a
2777 href="#metatype">MetaType</a>()</span> is data validation before doing an SQL
2778 insert or update.</p>
2779
2780 <h3>Example 3: Inserting<a name=ex3></a></h3>
2781
2782 <p>Insert a row to the Orders table containing dates and strings that need to
2783 be quoted before they can be accepted by the database, eg: the single-quote in
2784 the word <i>John's</i>.</p>
2785
2786 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2787 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
2788 style='background:#EEEEEE'>&lt;?<br>
2789 <b>include</b>('adodb.inc.php');<span style='mso-tab-count:1'> </span><span style='mso-spacerun:yes'>   </span># load code common to ADOdb<br>
2790 $<span style='color:#660000'>conn</span> = &amp;ADONewConnection('access');<span
2791 style='mso-tab-count:1'>        </span># create a connection<br>
2792 <br>
2793 $<span style='color:#660000'>conn</span>-&gt;PConnect('northwind');<span style='mso-spacerun:yes'>   </span># connect to MS-Access, northwind dsn<br>
2794 $<span style='color:#660000'>shipto</span> = <b><span style='color:#006600'>$conn-&gt;qstr</span></b>(&quot;<i>John's Old Shoppe</i>&quot;);<br>
2795 <br>
2796 $<span style='color:#660000'>sql</span> = &quot;insert into orders (customerID,EmployeeID,OrderDate,ShipName) &quot;;<br>
2797 $<span style='color:#660000'>sql</span> .= &quot;values ('ANATR',2,&quot;.<b><span
2798 style='color:#006600'>$conn-&gt;DBDate(</span>time()</b><b><span
2799 style='color:#006600'>)</span></b><span style='color:#006600'>.</span>&quot;,$<span
2800 style='color:#660000'>shipto</span>)&quot;;<br>
2801 <br>
2802 <b>if</b> ($<span style='color:#660000'>conn</span>-&gt;Execute($<span
2803 style='color:#660000'>sql</span>) <b><span style='color:#336600'>=== false</span></b>) {<br>
2804 <span style='mso-tab-count:1'>         </span><b>print</b> 'error inserting: '.<b><span
2805 style='color:#336600'>$conn-&gt;ErrorMsg()</span></b>.'&lt;BR&gt;';<br>
2806 }<br>
2807 ?&gt;</pre></div>
2808
2809 <p>In this example, we see the advanced date and quote handling facilities of
2810 ADOdb. The unix timestamp (which is a long integer) is appropriately formated
2811 for Access with <span style='font-family:"Courier New"'><a href="#dbdate">DBDate</a>()</span>,
2812 and the right escape character is used for quoting the <i>John's Old Shoppe</i>,
2813 which is<b> </b><i>John'<b>'</b>s Old Shoppe</i> and not PHP's default <i>John<b>'</b>s
2814 Old Shoppe</i> with <span style='font-family:"Courier New"'><a href="#qstr">qstr</a>()</span>.
2815 </p>
2816
2817 <p>Observe the error-handling of the Execute statement. False is returned by<span
2818 style='font-family:"Courier New"'> <a href="#execute">Execute</a>() </span>if
2819 an error occured. The error message for the last error that occurred is
2820 displayed in <span style='font-family:"Courier New"'><a href="#errormsg">ErrorMsg</a>()</span>.
2821 Note: <i>php_track_errors</i> might have to be enabled for error messages to be
2822 saved.</p>
2823
2824 <h3>Example 4: Debugging<a name=ex4></a></h3>
2825
2826 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2827 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?<br>
2828 <b>include</b>('adodb.inc.php');<span style='mso-tab-count:1'> </span><span style='mso-spacerun:yes'>   </span># load code common to ADOdb<br>
2829 $<span style='color:#663300'>conn</span> = &amp;ADONewConnection('access');<span
2830 style='mso-tab-count:1'>        </span># create a connection<br>
2831 $<span style='color:#663300'>conn</span>-&gt;PConnect('northwind');<span style='mso-spacerun:yes'>   </span># connect to MS-Access, northwind dsn<br>
2832 $<span style='color:#663300'>shipto</span> = <b>$conn-&gt;qstr</b>(&quot;John's Old Shoppe&quot;);<br>
2833 $<span style='color:#663300'>sql</span> = &quot;insert into orders (customerID,EmployeeID,OrderDate,ShipName) &quot;;<br>
2834 $<span style='color:#663300'>sql</span> .= &quot;values ('ANATR',2,&quot;.$<span
2835 style='color:#663300'>conn</span>-&gt;FormatDate(time()).&quot;,$shipto)&quot;;<br>
2836 <b><span style='color:#336600'>$</span></b><b><span style='color:#663300'>conn</span></b><b><span
2837 style='color:#336600'>-&gt;debug = true;</span></b></pre><pre><b>if</b> ($<span
2838 style='color:#663300'>conn</span>-&gt;Execute($sql) <b>=== false</b>) <b>print</b> 'error inserting';</pre><pre>?&gt;</pre></div>
2839
2840 <p>In the above example, we have turned on debugging by setting <b>debug = true</b>.
2841 This will display the SQL statement before execution, and also show any error
2842 messages. There is no need to call <span style='font-family:"Courier New"'><a
2843 href="#errormsg">ErrorMsg</a>()</span> in this case. For displaying the
2844 recordset, see the <span style='font-family:"Courier New"'><a href="#exrs2html">rs2html</a>()
2845 </span>example.</p>
2846
2847 <p>Also see the section on <a href="#errorhandling">Custom Error Handlers</a>.</p>
2848
2849 <h3>Example 5: MySQL and Menus<a name=ex5></a></h3>
2850
2851 <p>Connect to MySQL database <i>agora</i>, and generate a &lt;select&gt; menu
2852 from an SQL statement where the &lt;option&gt; captions are in the 1st column,
2853 and the value to send back to the server is in the 2nd column.</p>
2854
2855 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2856 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
2857 style='background:#EEEEEE'>&lt;?<br>
2858 <b>include</b>('adodb.inc.php'); # load code common to ADOdb<br>
2859 $<span style='color:#663300'>conn</span> = &amp;ADONewConnection('mysql');<span style='mso-spacerun:yes'>  </span># create a connection<br>
2860 $<span style='color:#663300'>conn</span>-&gt;PConnect('localhost','userid','','agora');# connect to MySQL, agora db<br>
2861 $<span style='color:#663300'>sql</span> = 'select CustomerName, CustomerID from customers';<br>
2862 $<span style='color:#663300'>rs</span> = $<span style='color:#663300'>conn</span>-&gt;Execute($sql);<br>
2863 <b>print</b> <b><span style='color:#336600'>$</span></b><b><span
2864 style='color:#663300'>rs</span></b><b><span style='color:#336600'>-&gt;GetMenu('GetCust','Mary Rosli');<br>
2865 ?&gt;</span></b></pre></div>
2866
2867 <p>Here we define a menu named GetCust, with the menu option 'Mary Rosli'
2868 selected. See <a href="#getmenu"><span style='font-family:"Courier New"'>GetMenu</span></a><span
2869 style='font-family:"Courier New"'>()</span>. We also have functions that return
2870 the recordset as an array: <span style='font-family:"Courier New"'><a
2871 href="#getarray">GetArray</a>()</span>, and as an associative array with the
2872 key being the first column: <a href="#getassoc1">GetAssoc</a>().</p>
2873
2874 <h3>Example 6: Connecting to 2 Databases At Once<a name=ex6></a></h3>
2875
2876 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2877 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
2878 style='background:#EEEEEE'>&lt;?<br>
2879 <b>include</b>('adodb.inc.php');<span style='mso-tab-count:1'> </span> # load code common to ADOdb<br>
2880 $<span style='color:#663300'>conn1</span> = &amp;ADONewConnection('mysql');<span style='mso-spacerun:yes'>  </span># create a mysql connection<br>
2881 $<span style='color:#663300'>conn2</span> = &amp;ADONewConnection('oracle');<span style='mso-spacerun:yes'>  </span># create a oracle connection<br>
2882 <br>
2883 $conn1-&gt;PConnect($server, $userid, $password, $database);<br>
2884 $conn2-&gt;PConnect(false, $ora_userid, $ora_pwd, $oraname);<br>
2885 <br>
2886 $conn1-&gt;Execute('insert ...');<br>
2887 $conn2-&gt;Execute('update ...');<br>
2888 ?&gt;</pre></div>
2889
2890 <h3>Example 7: Generating Update and Insert SQL<a name=ex7></a></h3>
2891
2892 <p>Since ADOdb 4.56, we support <a
2893 href="reference.functions.getupdatesql.html#autoexecute">AutoExecute()</a>,
2894 which simplifies things by providing an advanced wrapper for GetInsertSQL() and
2895 GetUpdateSQL(). For example, an INSERT can be carried out with: </p>
2896
2897 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2898 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span style='mso-spacerun:yes'>    </span>$record[&quot;firstname&quot;] = &quot;Bob&quot;; </pre><pre><span style='mso-spacerun:yes'>    </span>$record[&quot;lastname&quot;] = &quot;Smith&quot;; </pre><pre><span style='mso-spacerun:yes'>    </span>$record[&quot;created&quot;] = time(); </pre><pre><span style='mso-spacerun:yes'>    </span>$insertSQL = $conn-&gt;AutoExecute($rs, $record, 'INSERT'); </pre></div>
2899
2900 <p class=MsoNormal>and an UPDATE with: </p>
2901
2902 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2903 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span style='mso-spacerun:yes'>    </span>$record[&quot;firstname&quot;] = &quot;Caroline&quot;; </pre><pre><span style='mso-spacerun:yes'>    </span>$record[&quot;lastname&quot;] = &quot;Smith&quot;; # Update Caroline's lastname from Miranda to Smith </pre><pre><span style='mso-spacerun:yes'>    </span>$insertSQL = $conn-&gt;AutoExecute($rs, $record, 'UPDATE', 'id = 1'); </pre></div>
2904
2905 <p>The rest of this section is out-of-date: </p>
2906
2907 <p>ADOdb 1.31 and later supports two new recordset functions: GetUpdateSQL( )
2908 and GetInsertSQL( ). This allow you to perform a &quot;SELECT * FROM table
2909 query WHERE...&quot;, make a copy of the $rs-&gt;fields, modify the fields, and
2910 then generate the SQL to update or insert into the table automatically. </p>
2911
2912 <p>We show how the functions can be used when accessing a table with the
2913 following fields: (ID, FirstName, LastName, Created). </p>
2914
2915 <p>Before these functions can be called, you need to initialize the recordset by
2916 performing a select on the table. Idea and code by Jonathan Younger
2917 jyounger#unilab.com. Since ADOdb 2.42, you can pass a table name instead of a
2918 recordset into GetInsertSQL (in $rs), and it will generate an insert statement
2919 for that table. </p>
2920
2921 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2922 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
2923 style='background:#EEEEEE'>&lt;?<br>
2924 #==============================================<br>
2925 # SAMPLE GetUpdateSQL() and GetInsertSQL() code<br>
2926 #==============================================<br>
2927 include('adodb.inc.php');<br>
2928 include('tohtml.inc.php');<br>
2929 <br>
2930 #==========================<br>
2931 # This code tests an insert<br>
2932 <br>
2933 $sql = &quot;SELECT * FROM ADOXYZ WHERE id = -1&quot;; <br>
2934 # Select an empty record from the database<br>
2935 <br>
2936 $conn = &amp;ADONewConnection(&quot;mysql&quot;);<span style='mso-spacerun:yes'>  </span># create a connection<br>
2937 $conn-&gt;debug=1;<br>
2938 $conn-&gt;PConnect(&quot;localhost&quot;, &quot;admin&quot;, &quot;&quot;, &quot;test&quot;); # connect to MySQL, testdb<br>
2939 $rs = $conn-&gt;Execute($sql); # Execute the query and get the empty recordset<br>
2940 <br>
2941 $record = array(); # Initialize an array to hold the record data to insert<br>
2942 <br>
2943 # Set the values for the fields in the record<br>
2944 # Note that field names are case-insensitive<br>
2945 $record[&quot;firstname&quot;] = &quot;Bob&quot;;<br>
2946 $record[&quot;lastNamE&quot;] = &quot;Smith&quot;;<br>
2947 $record[&quot;creaTed&quot;] = time();<br>
2948 <br>
2949 # Pass the empty recordset and the array containing the data to insert<br>
2950 # into the GetInsertSQL function. The function will process the data and return<br>
2951 # a fully formatted insert sql statement.<br>
2952 $insertSQL = $conn-&gt;GetInsertSQL($rs, $record);<br>
2953 <br>
2954 $conn-&gt;Execute($insertSQL); # Insert the record into the database<br>
2955 <br>
2956 #==========================<br>
2957 # This code tests an update<br>
2958 <br>
2959 $sql = &quot;SELECT * FROM ADOXYZ WHERE id = 1&quot;; <br>
2960 # Select a record to update<br>
2961 <br>
2962 $rs = $conn-&gt;Execute($sql); # Execute the query and get the existing record to update<br>
2963 <br>
2964 $record = array(); # Initialize an array to hold the record data to update<br>
2965 <br>
2966 # Set the values for the fields in the record<br>
2967 # Note that field names are case-insensitive<br>
2968 $record[&quot;firstname&quot;] = &quot;Caroline&quot;;<br>
2969 $record[&quot;LasTnAme&quot;] = &quot;Smith&quot;; # Update Caroline's lastname from Miranda to Smith<br>
2970 <br>
2971 # Pass the single record recordset and the array containing the data to update<br>
2972 # into the GetUpdateSQL function. The function will process the data and return<br>
2973 # a fully formatted update sql statement with the correct WHERE clause.<br>
2974 # If the data has not changed, no recordset is returned<br>
2975 $updateSQL = $conn-&gt;GetUpdateSQL($rs, $record);<br>
2976 <br>
2977 $conn-&gt;Execute($updateSQL); # Update the record in the database<br>
2978 $conn-&gt;Close();<br>
2979 ?&gt;</pre></div>
2980
2981 <p class=MsoNormal><a name="ADODB_FORCE_TYPE"></a><b>$ADODB_FORCE_TYPE</b></p>
2982
2983 <p>The behaviour of AutoExecute(), GetUpdateSQL() and GetInsertSQL() when
2984 converting empty or null PHP variables to SQL is controlled by the global
2985 $ADODB_FORCE_TYPE variable. Set it to one of the values below. Default is
2986 ADODB_FORCE_VALUE (3): </p>
2987
2988 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
2989 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
2990 style='background:#EEEEEE'>0 = ignore empty fields. All empty fields in array are ignored.<br>
2991 1 = force null. All empty, php null and string 'null' fields are changed to sql NULL values.<br>
2992 2 = force empty. All empty, php null and string 'null' fields are changed to sql empty '' or 0 values.<br>
2993 3 = force value. Value is left as it is. Php null and string 'null' are set to sql NULL values and <br>
2994 <span style='mso-spacerun:yes'>    </span>empty fields '' are set to empty '' sql values.<br>
2995 <br>
2996 define('ADODB_FORCE_IGNORE',0);<br>
2997 define('ADODB_FORCE_NULL',1);<br>
2998 define('ADODB_FORCE_EMPTY',2);<br>
2999 define('ADODB_FORCE_VALUE',3);</pre></div>
3000
3001 <p>Thanks to Niko (nuko#mbnet.fi) for the $ADODB_FORCE_TYPE code. </p>
3002
3003 <p>Note: the constant ADODB_FORCE_NULLS is obsolete since 4.52 and is ignored.
3004 Set $ADODB_FORCE_TYPE = ADODB_FORCE_NULL for equivalent behaviour. </p>
3005
3006 <p>Since 4.62, the table name to be used can be overridden by setting
3007 $rs-&gt;tableName before AutoExecute(), GetInsertSQL() or GetUpdateSQL() is
3008 called. </p>
3009
3010 <h3>Example 8: Implementing Scrolling with Next and Previous<a name=ex8></a></h3>
3011
3012 <p>The following code creates a very simple recordset pager, where you can
3013 scroll from page to page of a recordset.</p>
3014
3015 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3016 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3017 style='background:#EEEEEE'>include_once('../adodb.inc.php');<br>
3018 include_once('../adodb-pager.inc.php');<br>
3019 session_start();<br>
3020 <br>
3021 $db = NewADOConnection('mysql');<br>
3022 <br>
3023 $db-&gt;Connect('localhost','root','','xphplens');<br>
3024 <br>
3025 $sql = &quot;select * from adoxyz &quot;;<br>
3026 <br>
3027 $pager = new ADODB_Pager($db,$sql);<br>
3028 $pager-&gt;Render($rows_per_page=5);</pre></div>
3029
3030 <p>This will create a basic record pager that looks like this: <a name=scr></a></p>
3031
3032 <table class=MsoNormalTable border=1 cellpadding=0 style='mso-cellspacing:1.5pt;
3033  background:beige'>
3034  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
3035   <td style='padding:.75pt .75pt .75pt .75pt'>
3036   <p class=MsoNormal><a href="#scr"><code><span style='font-size:10.0pt'>|&lt;</span></code></a>
3037   &nbsp; <a href="#scr"><code><span style='font-size:10.0pt'>&lt;&lt;</span></code></a>
3038   &nbsp; <a href="#scr"><code><span style='font-size:10.0pt'>&gt;&gt;</span></code></a>
3039   &nbsp; <a href="#scr"><code><span style='font-size:10.0pt'>&gt;|</span></code></a>
3040   &nbsp; </p>
3041   </td>
3042  </tr>
3043  <tr style='mso-yfti-irow:1'>
3044   <td style='padding:.75pt .75pt .75pt .75pt'>
3045   <table class=MsoNormalTable border=1 cellpadding=0 width="100%"
3046    style='width:100.0%;mso-cellspacing:1.5pt;background:white' cols=4>
3047    <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
3048     <td style='padding:.75pt .75pt .75pt .75pt'>
3049     <p class=MsoNormal align=center style='text-align:center'><b>ID<o:p></o:p></b></p>
3050     </td>
3051     <td style='padding:.75pt .75pt .75pt .75pt'>
3052     <p class=MsoNormal align=center style='text-align:center'><b>First Name<o:p></o:p></b></p>
3053     </td>
3054     <td style='padding:.75pt .75pt .75pt .75pt'>
3055     <p class=MsoNormal align=center style='text-align:center'><b>Last Name<o:p></o:p></b></p>
3056     </td>
3057     <td style='padding:.75pt .75pt .75pt .75pt'>
3058     <p class=MsoNormal align=center style='text-align:center'><b>Date Created<o:p></o:p></b></p>
3059     </td>
3060    </tr>
3061    <tr style='mso-yfti-irow:1'>
3062     <td style='padding:.75pt .75pt .75pt .75pt'>
3063     <p class=MsoNormal align=right style='text-align:right'>36&nbsp;</p>
3064     </td>
3065     <td style='padding:.75pt .75pt .75pt .75pt'>
3066     <p class=MsoNormal>Alan&nbsp;</p>
3067     </td>
3068     <td style='padding:.75pt .75pt .75pt .75pt'>
3069     <p class=MsoNormal>Turing&nbsp;</p>
3070     </td>
3071     <td style='padding:.75pt .75pt .75pt .75pt'>
3072     <p class=MsoNormal>Sat 06, Oct 2001&nbsp;</p>
3073     </td>
3074    </tr>
3075    <tr style='mso-yfti-irow:2'>
3076     <td style='padding:.75pt .75pt .75pt .75pt'>
3077     <p class=MsoNormal align=right style='text-align:right'>37&nbsp;</p>
3078     </td>
3079     <td style='padding:.75pt .75pt .75pt .75pt'>
3080     <p class=MsoNormal>Serena&nbsp;</p>
3081     </td>
3082     <td style='padding:.75pt .75pt .75pt .75pt'>
3083     <p class=MsoNormal>Williams&nbsp;</p>
3084     </td>
3085     <td style='padding:.75pt .75pt .75pt .75pt'>
3086     <p class=MsoNormal>Sat 06, Oct 2001&nbsp;</p>
3087     </td>
3088    </tr>
3089    <tr style='mso-yfti-irow:3'>
3090     <td style='padding:.75pt .75pt .75pt .75pt'>
3091     <p class=MsoNormal align=right style='text-align:right'>38&nbsp;</p>
3092     </td>
3093     <td style='padding:.75pt .75pt .75pt .75pt'>
3094     <p class=MsoNormal>Yat Sun&nbsp;</p>
3095     </td>
3096     <td style='padding:.75pt .75pt .75pt .75pt'>
3097     <p class=MsoNormal>Sun&nbsp;</p>
3098     </td>
3099     <td style='padding:.75pt .75pt .75pt .75pt'>
3100     <p class=MsoNormal>Sat 06, Oct 2001&nbsp;</p>
3101     </td>
3102    </tr>
3103    <tr style='mso-yfti-irow:4'>
3104     <td style='padding:.75pt .75pt .75pt .75pt'>
3105     <p class=MsoNormal align=right style='text-align:right'>39&nbsp;</p>
3106     </td>
3107     <td style='padding:.75pt .75pt .75pt .75pt'>
3108     <p class=MsoNormal>Wai Hun&nbsp;</p>
3109     </td>
3110     <td style='padding:.75pt .75pt .75pt .75pt'>
3111     <p class=MsoNormal>See&nbsp;</p>
3112     </td>
3113     <td style='padding:.75pt .75pt .75pt .75pt'>
3114     <p class=MsoNormal>Sat 06, Oct 2001&nbsp;</p>
3115     </td>
3116    </tr>
3117    <tr style='mso-yfti-irow:5;mso-yfti-lastrow:yes'>
3118     <td style='padding:.75pt .75pt .75pt .75pt'>
3119     <p class=MsoNormal align=right style='text-align:right'>40&nbsp;</p>
3120     </td>
3121     <td style='padding:.75pt .75pt .75pt .75pt'>
3122     <p class=MsoNormal>Steven&nbsp;</p>
3123     </td>
3124     <td style='padding:.75pt .75pt .75pt .75pt'>
3125     <p class=MsoNormal>Oey&nbsp;</p>
3126     </td>
3127     <td style='padding:.75pt .75pt .75pt .75pt'>
3128     <p class=MsoNormal>Sat 06, Oct 2001&nbsp;</p>
3129     </td>
3130    </tr>
3131   </table>
3132   <p class=MsoNormal><o:p></o:p></p>
3133   </td>
3134  </tr>
3135  <tr style='mso-yfti-irow:2;mso-yfti-lastrow:yes'>
3136   <td style='padding:.75pt .75pt .75pt .75pt'>
3137   <p class=MsoNormal><span style='font-size:10.0pt'>Page 8/10</span></p>
3138   </td>
3139  </tr>
3140 </table>
3141
3142 <p>The number of rows to display at one time is controled by the Render($rows)
3143 method. If you do not pass any value to Render(), ADODB_Pager will default to
3144 10 records per page. </p>
3145
3146 <p>You can control the column titles by modifying your SQL (supported by most
3147 databases): </p>
3148
3149 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3150 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3151 style='background:#EEEEEE'>$sql = 'select id as &quot;ID&quot;, firstname as &quot;First Name&quot;, <br>
3152 <span style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>lastname as &quot;Last Name&quot;, created as &quot;Date Created&quot; <br>
3153 <span style='mso-tab-count:2'>                 </span>from adoxyz';</pre></div>
3154
3155 <p>The above code can be found in the <i>adodb/tests/testpaging.php</i> example
3156 included with this release, and the class ADODB_Pager in <i>adodb/adodb-pager.inc.php</i>.
3157 The ADODB_Pager code can be adapted by a programmer so that the text links can
3158 be replaced by images, and the dull white background be replaced with more
3159 interesting colors. </p>
3160
3161 <p>You can also allow display of html by setting $pager-&gt;htmlSpecialChars =
3162 false. </p>
3163
3164 <p>Some of the code used here was contributed by Iván Oliva and Cornel G. </p>
3165
3166 <h3><a name=ex9></a>Example 9: Exporting in CSV or Tab-Delimited Format</h3>
3167
3168 <p>We provide some helper functions to export in comma-separated-value (CSV)
3169 and tab-delimited formats:</p>
3170
3171 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3172 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><b>include_once('/path/to/adodb/toexport.inc.php');</b><br>
3173 include_once('/path/to/adodb/adodb.inc.php');<br style='mso-special-character:
3174 line-break'>
3175 <![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
3176 <![endif]></pre><pre style='background:#EEEEEE'>$db = &amp;NewADOConnection('mysql');<br>
3177 $db-&gt;Connect($server, $userid, $password, $database);<br>
3178 <br>
3179 $rs = $db-&gt;Execute('select fname as &quot;First Name&quot;, surname as &quot;Surname&quot; from table');<br>
3180 <br>
3181 print &quot;&lt;pre&gt;&quot;;<br>
3182 print <b>rs2csv</b>($rs); # return a string, CSV format</pre>
3183
3184 <p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
3185 background:#EEEEEE;border:none;mso-border-alt:solid #DDDDDD .75pt;padding:0cm;
3186 mso-padding-alt:9.0pt 18.0pt 9.0pt 18.0pt'><span style='font-size:9.0pt;
3187 font-family:"Courier New"'>print '&lt;hr&gt;';<br>
3188 <br>
3189 $rs-&gt;MoveFirst(); # note, some databases do not support MoveFirst<br>
3190 print <b>rs2tab</b>($rs,<i>false</i>); # return a string, tab-delimited<br>
3191 <span style='mso-tab-count:6'>                                                    </span><span
3192 style='mso-spacerun:yes'> </span># false == suppress field names in first line<o:p></o:p></span></p>
3193
3194 <pre style='background:#EEEEEE'>print '&lt;hr&gt;';<br>
3195 $rs-&gt;MoveFirst();<br>
3196 <b>rs2tabout</b>($rs); # send to stdout directly (there is also an rs2csvout function)<br>
3197 print &quot;&lt;/pre&gt;&quot;;<br>
3198 <br>
3199 $rs-&gt;MoveFirst();<br>
3200 $fp = fopen($path, &quot;w&quot;);<br>
3201 if ($fp) {<br>
3202 <span style='mso-spacerun:yes'>  </span><b>rs2csvfile</b>($rs, $fp); # write to file (there is also an rs2tabfile function)<br>
3203 <span style='mso-spacerun:yes'>  </span>fclose($fp);<br>
3204 }</pre></div>
3205
3206 <p>Carriage-returns or newlines are converted to spaces. Field names are
3207 returned in the first line of text. Strings containing the delimiter character
3208 are quoted with double-quotes. Double-quotes are double-quoted again. This
3209 conforms to Excel import and export guide-lines. </p>
3210
3211 <p>All the above functions take as an optional last parameter, $addtitles which
3212 defaults to <i>true</i>. When set to <i>false</i> field names in the first line
3213 are suppressed. </p>
3214
3215 <h3>Example 10: Recordset Filters<a name=ex10></a></h3>
3216
3217 <p>Sometimes we want to pre-process all rows in a recordset before we use it.
3218 For example, we want to ucwords all text in recordset. </p>
3219
3220 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3221 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3222 style='background:#EEEEEE'>include_once('adodb/rsfilter.inc.php');<br>
3223 include_once('adodb/adodb.inc.php');<br>
3224 <br>
3225 // ucwords() every element in the recordset<br>
3226 function do_ucwords(&amp;$arr,$rs)<br>
3227 {<br>
3228 <span style='mso-tab-count:1'>         </span>foreach($arr as $k =&gt; $v) {<br>
3229 <span style='mso-tab-count:2'>                 </span>$arr[$k] = ucwords($v);<br>
3230 <span style='mso-tab-count:1'>         </span>}<br>
3231 }<br>
3232 <br>
3233 $db = NewADOConnection('mysql');<br>
3234 $db-&gt;PConnect('server','user','pwd','db');<br>
3235 <br>
3236 $rs = $db-&gt;Execute('select ... from table');<br>
3237 $rs = <b>RSFilter</b>($rs,'do_ucwords');</pre></div>
3238
3239 <p>The <i>RSFilter</i> function takes 2 parameters, the recordset, and the name
3240 of the <i>filter</i> function. It returns the processed recordset scrolled to
3241 the first record. The <i>filter</i> function takes two parameters, the current
3242 row as an array, and the recordset object. For future compatibility, you should
3243 not use the original recordset object. </p>
3244
3245 <h3>Example 11:<a name=ex11></a> Smart Transactions</h3>
3246
3247 <p class=MsoNormal>The old way of doing transactions required you to use </p>
3248
3249 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3250 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3251 style='background:#EEEEEE'>$conn-&gt;<b>BeginTrans</b>();<br>
3252 $ok = $conn-&gt;Execute($sql);<br>
3253 if ($ok) $ok = $conn-&gt;Execute($sql2);<br>
3254 if (!$ok) $conn-&gt;<b>RollbackTrans</b>();<br>
3255 else $conn-&gt;<b>CommitTrans</b>();</pre></div>
3256
3257 <p class=MsoNormal>This is very complicated for large projects because you have
3258 to track the error status. Smart Transactions is much simpler. You start a
3259 smart transaction by calling StartTrans(): </p>
3260
3261 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3262 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3263 style='background:#EEEEEE'>$conn-&gt;<b>StartTrans</b>();<br>
3264 $conn-&gt;Execute($sql);<br>
3265 $conn-&gt;Execute($Sql2);<br>
3266 $conn-&gt;<b>CompleteTrans</b>();</pre></div>
3267
3268 <p class=MsoNormal>CompleteTrans() detects when an SQL error occurs, and will
3269 Rollback/Commit as appropriate. To specificly force a rollback even if no error
3270 occured, use FailTrans(). Note that the rollback is done in CompleteTrans(),
3271 and not in FailTrans(). </p>
3272
3273 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3274 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3275 style='background:#EEEEEE'>$conn-&gt;<b>StartTrans</b>();<br>
3276 $conn-&gt;Execute($sql);<br>
3277 if (!CheckRecords()) $conn-&gt;<strong><span style='font-family:"Courier New"'>FailTrans</span></strong>();<br>
3278 $conn-&gt;Execute($Sql2);<br>
3279 $conn-&gt;<b>CompleteTrans</b>();</pre></div>
3280
3281 <p>You can also check if a transaction has failed, using HasFailedTrans(),
3282 which returns true if FailTrans() was called, or there was an error in the SQL
3283 execution. Make sure you call HasFailedTrans() before you call CompleteTrans(),
3284 as it is only works between StartTrans/CompleteTrans. </p>
3285
3286 <p>Lastly, StartTrans/CompleteTrans is nestable, and only the outermost block
3287 is executed. In contrast, BeginTrans/CommitTrans/RollbackTrans is NOT nestable.
3288 </p>
3289
3290 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3291 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>$conn-&gt;<strong><span
3292 style='font-family:"Courier New"'>StartTrans</span></strong>();<br>
3293 $conn-&gt;Execute($sql);<br>
3294 <span style='mso-spacerun:yes'>  </span>$conn-&gt;<strong><span
3295 style='font-family:"Courier New"'>StartTrans</span></strong>();<span style='mso-spacerun:yes'>    </span><span
3296 style='color:#006600'># ignored</span></pre><pre><span style='mso-spacerun:yes'>  </span>if (!CheckRecords()) $conn-&gt;FailTrans();</pre><pre><span style='mso-spacerun:yes'>  </span>$conn-&gt;<strong><span
3297 style='font-family:"Courier New"'>CompleteTrans</span></strong>(); <span
3298 style='color:#006600'># ignored</span></pre><pre>$conn-&gt;Execute($Sql2);</pre><pre
3299 style='background:#EEEEEE'>$conn-&gt;<strong><span style='font-family:"Courier New"'>CompleteTrans</span></strong>();</pre></div>
3300
3301 <p>Note: Savepoints are currently not supported. </p>
3302
3303 <h2><a name=errorhandling></a>Using Custom Error Handlers and PEAR_Error</h2>
3304
3305 <p>ADOdb supports PHP5 exceptions. Just include <i>adodb-exceptions.inc.php</i>
3306 and you can now catch exceptions on errors as they occur. </p>
3307
3308 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3309 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3310 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span><b>include(&quot;../adodb-exceptions.inc.php&quot;);</b> <br>
3311 <span style='mso-tab-count:1'>         </span>include(&quot;../adodb.inc.php&quot;);<span
3312 style='mso-tab-count:1'>       </span> <br>
3313 <span style='mso-tab-count:1'>         </span>try { <br>
3314 <span style='mso-tab-count:2'>                 </span>$db = NewADOConnection(&quot;oci8://scott:bad-password@mytns/&quot;); <br>
3315 <span style='mso-tab-count:1'>         </span>} catch (exception $e) { <br>
3316 <span style='mso-tab-count:2'>                 </span>var_dump($e); <br>
3317 <span style='mso-tab-count:2'>                 </span>adodb_backtrace($e-&gt;gettrace());<br>
3318 <span style='mso-tab-count:1'>         </span>} </pre></div>
3319
3320 <p>ADOdb also provides two custom handlers which you can modify for your needs.
3321 The first one is in the <b>adodb-errorhandler.inc.php</b> file. This makes use
3322 of the standard PHP functions <a href="http://php.net/error_reporting">error_reporting</a>
3323 to control what error messages types to display, and <a
3324 href="http://php.net/trigger_error">trigger_error</a> which invokes the default
3325 PHP error handler. </p>
3326
3327 <p>Including the above file will cause <i>trigger_error($errorstring,E_USER_ERROR)</i>
3328 to be called when<br>
3329 (a) Connect() or PConnect() fails, or <br>
3330 (b) a function that executes SQL statements such as Execute() or SelectLimit()
3331 has an error.<br>
3332 (c) GenID() appears to go into an infinite loop. </p>
3333
3334 <p>The $errorstring is generated by ADOdb and will contain useful debugging
3335 information similar to the error.log data generated below. This file
3336 adodb-errorhandler.inc.php should be included before you create any
3337 ADOConnection objects. </p>
3338
3339 <p>If you define error_reporting(0), no errors will be passed to the error
3340 handler. If you set error_reporting(E_ALL), all errors will be passed to the
3341 error handler. You still need to use <b>ini_set(&quot;display_errors&quot;,
3342 &quot;0&quot; or &quot;1&quot;)</b> to control the display of errors. </p>
3343
3344 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3345 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?php<br>
3346 <b>error_reporting(E_ALL); # pass any error messages triggered to error handler<br>
3347 include('adodb-errorhandler.inc.php');</b></pre><pre>include('adodb.inc.php');</pre><pre>include('tohtml.inc.php');</pre><pre>$c = NewADOConnection('mysql');</pre><pre>$c-&gt;PConnect('localhost','root','','northwind');</pre><pre>$rs=$c-&gt;Execute('select * from productsz'); #invalid table productsz');</pre><pre>if ($rs) rs2html($rs);</pre><pre>?&gt;</pre></div>
3348
3349 <p>If you want to log the error message, you can do so by defining the
3350 following optional constants ADODB_ERROR_LOG_TYPE and ADODB_ERROR_LOG_DEST.
3351 ADODB_ERROR_LOG_TYPE is the error log message type (see <a
3352 href="http://php.net/error_log">error_log</a> in the PHP manual). In this case
3353 we set it to 3, which means log to the file defined by the constant
3354 ADODB_ERROR_LOG_DEST. </p>
3355
3356 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3357 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?php<br>
3358 <b>error_reporting(E_ALL); # report all errors<br>
3359 ini_set(&quot;display_errors&quot;, &quot;0&quot;); # but do not echo the errors<br>
3360 define('ADODB_ERROR_LOG_TYPE',3);<br>
3361 define('ADODB_ERROR_LOG_DEST','C:/errors.log');<br>
3362 include('adodb-errorhandler.inc.php');</b></pre><pre>include('adodb.inc.php');</pre><pre>include('tohtml.inc.php');</pre><pre><o:p>&nbsp;</o:p></pre><pre>$c = NewADOConnection('mysql');</pre><pre>$c-&gt;PConnect('localhost','root','','northwind');</pre><pre>$rs=$c-&gt;Execute('select * from productsz'); ## invalid table productsz</pre><pre>if ($rs) rs2html($rs);</pre><pre>?&gt;</pre></div>
3363
3364 <p class=MsoNormal>The following message will be logged in the error.log file: </p>
3365
3366 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3367 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3368 style='background:#EEEEEE'>(2001-10-28 14:20:38) mysql error: [1146: Table 'northwind.productsz' doesn't exist] in<br>
3369 <span style='mso-spacerun:yes'> </span>EXECUTE(&quot;select * from productsz&quot;)</pre></div>
3370
3371 <h3>PEAR_ERROR</h3>
3372
3373 <p class=MsoNormal>The second error handler is <b>adodb-errorpear.inc.php</b>.
3374 This will create a PEAR_Error derived object whenever an error occurs. The last
3375 PEAR_Error object created can be retrieved using ADODB_Pear_Error(). </p>
3376
3377 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3378 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>&lt;?php<br>
3379 <b>include('adodb-errorpear.inc.php');</b></pre><pre>include('adodb.inc.php');</pre><pre>include('tohtml.inc.php');</pre><pre>$c = NewADOConnection('mysql');</pre><pre>$c-&gt;PConnect('localhost','root','','northwind');</pre><pre>$rs=$c-&gt;Execute('select * from productsz'); #invalid table productsz');</pre><pre>if ($rs) rs2html($rs);</pre><pre>else {</pre><pre><span
3380 style='mso-tab-count:1'>         </span><b>$e = ADODB_Pear_Error();<br>
3381 <span style='mso-tab-count:1'>         </span>echo '&lt;p&gt;',$e-&gt;message,'&lt;/p&gt;';</b></pre><pre>}</pre><pre>?&gt;</pre></div>
3382
3383 <p>You can use a PEAR_Error derived class by defining the constant
3384 ADODB_PEAR_ERROR_CLASS before the adodb-errorpear.inc.php file is included. For
3385 easy debugging, you can set the default error handler in the beginning of the
3386 PHP script to PEAR_ERROR_DIE, which will cause an error message to be printed,
3387 then halt script execution: </p>
3388
3389 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3390 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3391 style='background:#EEEEEE'>include('PEAR.php');<br>
3392 PEAR::setErrorHandling('PEAR_ERROR_DIE');</pre></div>
3393
3394 <p>Note that we do not explicitly return a PEAR_Error object to you when an
3395 error occurs. We return false instead. You have to call ADODB_Pear_Error() to
3396 get the last error or use the PEAR_ERROR_DIE technique. </p>
3397
3398 <h3>MetaError and MetaErrMsg</h3>
3399
3400 <p>If you need error messages that work across multiple databases, then use <a
3401 href="#metaerror">MetaError()</a>, which returns a virtualized error number,
3402 based on PEAR DB's error number system, and <a href="#metaerrmsg">MetaErrMsg()</a>.
3403 </p>
3404
3405 <h4>Error Messages</h4>
3406
3407 <p>Error messages are outputted using the static method
3408 ADOConnnection::outp($msg,$newline=true). By default, it sends the messages to
3409 the client. You can override this to perform error-logging. </p>
3410
3411 <h2><a name=dsn></a>Data Source Names</h2>
3412
3413 <p>We now support connecting using PEAR style DSN's. A DSN is a connection
3414 string of the form:</p>
3415
3416 <p>$dsn = <i>&quot;$driver://$username:$password@$hostname/$databasename&quot;</i>;</p>
3417
3418 <p>An example:</p>
3419
3420 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3421 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3422 style='background:#EEEEEE'><span style='mso-spacerun:yes'>   </span>$username = 'root';<br>
3423 <span style='mso-spacerun:yes'>   </span>$password = '';<br>
3424 <span style='mso-spacerun:yes'>   </span>$hostname = 'localhost';<br>
3425 <span style='mso-spacerun:yes'>   </span>$databasename = 'xphplens';<br>
3426 <span style='mso-spacerun:yes'>   </span>$driver = 'mysql';<br>
3427 <span style='mso-spacerun:yes'>   </span>$dsn = &quot;$driver://$username:$password@$hostname/$databasename&quot;<br>
3428 <span style='mso-spacerun:yes'>   </span>$db = NewADOConnection(); <br>
3429 <span style='mso-spacerun:yes'>   </span># DB::Connect($dsn) also works if you include 'adodb/adodb-pear.inc.php' at the top<br>
3430 <span style='mso-spacerun:yes'>   </span>$rs = $db-&gt;query('select firstname,lastname from adoxyz');<br>
3431 <span style='mso-spacerun:yes'>   </span>$cnt = 0;<br>
3432 <span style='mso-spacerun:yes'>   </span>while ($arr = $rs-&gt;fetchRow()) {<br>
3433 <span style='mso-tab-count:2'>                 </span>print_r($arr); print &quot;&lt;br&gt;&quot;;<br>
3434 <span style='mso-spacerun:yes'>   </span>}</pre></div>
3435
3436 <p><a href="#dsnsupport">More info and connection examples</a> on the DSN
3437 format. </p>
3438
3439 <h2><a name=pear></a>PEAR Compatibility</h2>
3440
3441 <p class=MsoNormal>We support DSN's (see above), and the following functions: </p>
3442
3443 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3444 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><b><span style='mso-spacerun:yes'> </span>DB_Common</b></pre><pre> <span
3445 style='mso-tab-count:1'>        </span>query - returns PEAR_Error on error</pre><pre><span
3446 style='mso-tab-count:1'>         </span>limitQuery - return PEAR_Error on error</pre><pre><span
3447 style='mso-tab-count:1'>         </span>prepare - does not return PEAR_Error on error</pre><pre><span
3448 style='mso-tab-count:1'>         </span>execute - does not return PEAR_Error on error</pre><pre><span
3449 style='mso-tab-count:1'>         </span>setFetchMode - supports ASSOC and ORDERED</pre><pre><span
3450 style='mso-tab-count:1'>         </span>errorNative</pre><pre><span
3451 style='mso-tab-count:1'>         </span>quote</pre><pre><span style='mso-tab-count:
3452 1'>         </span>nextID</pre><pre><span style='mso-tab-count:1'>         </span>disconnect</pre><pre><span
3453 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
3454 1'>         </span>getOne</pre><pre><span style='mso-tab-count:1'>         </span>getAssoc</pre><pre><span
3455 style='mso-tab-count:1'>         </span>getRow</pre><pre><span
3456 style='mso-tab-count:1'>         </span>getCol</pre><pre><span
3457 style='mso-tab-count:1'>         </span></pre><pre><b> DB_Result</b></pre><pre> <span
3458 style='mso-tab-count:1'>        </span>numRows - returns -1 if not supported</pre><pre><span
3459 style='mso-tab-count:1'>         </span>numCols</pre><pre><span
3460 style='mso-tab-count:1'>         </span>fetchInto - does not support passing of fetchmode</pre><pre><span
3461 style='mso-tab-count:1'>         </span>fetchRows - does not support passing of fetchmode</pre><pre><span
3462 style='mso-tab-count:1'>         </span>free</pre></div>
3463
3464 <h2><a name=caching></a>Caching of Recordsets</h2>
3465
3466 <p>ADOdb now supports caching of recordsets in the file system using the
3467 CacheExecute( ), CachePageExecute( ) and CacheSelectLimit( ) functions. There
3468 are similar to the non-cache functions, except that they take a new first
3469 parameter, $secs2cache. </p>
3470
3471 <p>An example: </p>
3472
3473 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3474 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3475 style='background:#EEEEEE'><b>include</b>('adodb.inc.php'); # load code common to ADOdb<br>
3476 $ADODB_CACHE_DIR = '/usr/ADODB_cache';<br>
3477 $<span style='color:#663300'>conn</span> = &amp;ADONewConnection('mysql');<span style='mso-spacerun:yes'>  </span># create a connection<br>
3478 $<span style='color:#663300'>conn</span>-&gt;PConnect('localhost','userid','','agora');# connect to MySQL, agora db<br>
3479 $<span style='color:#663300'>sql</span> = 'select CustomerName, CustomerID from customers';<br>
3480 $<span style='color:#663300'>rs</span> = $<span style='color:#663300'>conn</span>-&gt;CacheExecute(15,$sql);</pre></div>
3481
3482 <p>The first parameter is the number of seconds to cache the query. Subsequent
3483 calls to that query will used the cached version stored in $ADODB_CACHE_DIR. To
3484 force a query to execute and flush the cache, call CacheExecute() with the
3485 first parameter set to zero. Alternatively, use the CacheFlush($sql) call. </p>
3486
3487 <p>For the sake of security, we recommend you set <i>register_globals=off</i> in
3488 php.ini if you are using $ADODB_CACHE_DIR.</p>
3489
3490 <p>In ADOdb 1.80 onwards, the secs2cache parameter is optional in
3491 CacheSelectLimit() and CacheExecute(). If you leave it out, it will use the
3492 $connection-&gt;cacheSecs parameter, which defaults to 60 minutes. The following
3493 are equivalent: </p>
3494
3495 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3496 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span style='mso-spacerun:yes'>  </span># (1)</pre><pre><span style='mso-spacerun:yes'>  </span>$rs = $db-&gt;SelectLimit(30, 'select * from table', 10);</pre><pre><span style='mso-spacerun:yes'>  </span></pre><pre><span style='mso-spacerun:yes'>  </span># (2)</pre><pre><span style='mso-spacerun:yes'>  </span>$db-&gt;cacheSsecs = 30;</pre><pre><span style='mso-spacerun:yes'>  </span>$rs = $db-&gt;SelectLimit('select * from table', 10);</pre><pre
3497 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span></pre><pre><span
3498 style='mso-tab-count:1'>         </span>$conn-&gt;Connect(...);<br>
3499 <span style='mso-tab-count:1'>         </span>$conn-&gt;cacheSecs = 3600*24; # cache 24 hours<br>
3500 <span style='mso-tab-count:1'>         </span>$rs = $conn-&gt;CacheExecute('select * from table');</pre></div>
3501
3502 <p>Please note that magic_quotes_runtime should be turned off. Do not change
3503 $ADODB_FETCH_MODE (or SetFetchMode) as the cached recordset will use the
3504 $ADODB_FETCH_MODE set when the query was executed. <a name=memcache></a></p>
3505
3506 <h3><span style='mso-bookmark:memcache'>MemCache support</span></h3>
3507
3508 <p><span style='mso-bookmark:memcache'>You can also share cached recordsets on
3509 a memcache server. The memcache API supports one or more pooled hosts. Only if
3510 none of the pooled servers can be contacted will a connect error be generated.
3511 Example below: </span></p>
3512
3513 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3514 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
3515 style='mso-bookmark:memcache'><o:p>&nbsp;</o:p></span></pre><pre><span
3516 style='mso-bookmark:memcache'>$db = NewADOConnection($driver='mysql');</span></pre><pre><span
3517 style='mso-bookmark:memcache'>$db-&gt;memCache = true;</span></pre><pre><span
3518 style='mso-bookmark:memcache'>$db-&gt;memCacheHost = array($ip1, $ip2, $ip3); /// $db-&gt;memCacheHost = $ip1; will work too</span></pre><pre><span
3519 style='mso-bookmark:memcache'>$db-&gt;memCachePort = 11211; /// this is default memCache port</span></pre><pre><span
3520 style='mso-bookmark:memcache'>$db-&gt;memCacheCompress = false; /// Use 'true' to store the item compressed (uses zlib)</span></pre><pre><span
3521 style='mso-bookmark:memcache'><o:p>&nbsp;</o:p></span></pre><pre><span
3522 style='mso-bookmark:memcache'>$db-&gt;Connect(...);</span></pre><pre><span
3523 style='mso-bookmark:memcache'>$db-&gt;CacheExecute($sql);</span></pre></div>
3524
3525 <p><span style='mso-bookmark:memcache'>More info on memcache can be found at </span><a
3526 href="http://www.danga.com/memcached/">http://www.danga.com/memcached/</a>. <a
3527 name=cacheapi></a></p>
3528
3529 <h3><span style='mso-bookmark:cacheapi'>Caching API</span></h3>
3530
3531 <p><span style='mso-bookmark:cacheapi'>There is also a caching API since
3532 4.99/5.05. Two implementations of the API are already available providing file
3533 and memcache support. </span></p>
3534
3535 <p><span style='mso-bookmark:cacheapi'>The new API for creating your custom
3536 caching class uses 2 globals: </span></p>
3537
3538 <ul type=disc>
3539  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
3540      mso-list:l8 level1 lfo8;tab-stops:list 36.0pt'><span style='mso-bookmark:
3541      cacheapi'>$ADODB_CACHE_CLASS: name of caching class </span></li>
3542  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
3543      mso-list:l8 level1 lfo8;tab-stops:list 36.0pt'><span style='mso-bookmark:
3544      cacheapi'>$ADODB_CACHE: instance of $ADODB_CACHE_CLASS </span></li>
3545 </ul>
3546
3547 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3548 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
3549 style='mso-bookmark:cacheapi'><o:p>&nbsp;</o:p></span></pre><pre><span
3550 style='mso-bookmark:cacheapi'>include &quot;/path/to/adodb.inc.php&quot;;</span></pre><pre><span
3551 style='mso-bookmark:cacheapi'>$ADODB_CACHE_CLASS = 'MyCacheClass';</span></pre><pre><span
3552 style='mso-bookmark:cacheapi'><o:p>&nbsp;</o:p></span></pre><pre><span
3553 style='mso-bookmark:cacheapi'>class MyCacheClass extends ADODB_Cache_File</span></pre><pre><span
3554 style='mso-bookmark:cacheapi'>{</span></pre><pre><span style='mso-bookmark:
3555 cacheapi'><span style='mso-tab-count:1'>         </span>var $createdir = false; // do not set this to true unless you use temp directories in cache path</span></pre><pre><span
3556 style='mso-bookmark:cacheapi'><span style='mso-tab-count:1'>         </span>function writecache($filename, $contents,$debug=false){...}</span></pre><pre><span
3557 style='mso-bookmark:cacheapi'><span style='mso-tab-count:1'>         </span>function &amp;readcache($filename, &amp;$err, $secs2cache, $rsClass){ ...}</span></pre><pre><span
3558 style='mso-bookmark:cacheapi'><span style='mso-tab-count:1'>         </span> :</span></pre><pre><span
3559 style='mso-bookmark:cacheapi'>}</span></pre><pre><span style='mso-bookmark:
3560 cacheapi'><o:p>&nbsp;</o:p></span></pre><pre><span style='mso-bookmark:cacheapi'>$DB = NewADOConnection($driver);</span></pre><pre><span
3561 style='mso-bookmark:cacheapi'>$DB-&gt;Connect(...);<span style='mso-spacerun:yes'>  </span>## MyCacheClass created here and stored in $ADODB_CACHE global variable.</span></pre><pre><span
3562 style='mso-bookmark:cacheapi'><o:p>&nbsp;</o:p></span></pre><pre><span
3563 style='mso-bookmark:cacheapi'>$data = $rs-&gt;CacheGetOne($sql); ## MyCacheClass is used here for caching...</span></pre></div>
3564
3565 <span style='mso-bookmark:cacheapi'></span>
3566
3567 <h2><a name=pivot></a>Pivot Tables</h2>
3568
3569 <p>Since ADOdb 2.30, we support the generation of SQL to create pivot tables,
3570 also known as cross-tabulations. For further explanation read this DevShed <a
3571 href="http://www.devshed.com/Server_Side/MySQL/MySQLWiz/">Cross-Tabulation tutorial</a>.
3572 We assume that your database supports the SQL case-when expression. </p>
3573
3574 <p>In this example, we will use the Northwind database from Microsoft. In the
3575 database, we have a products table, and we want to analyze this table by <i>suppliers
3576 versus product categories</i>. We will place the suppliers on each row, and
3577 pivot on categories. So from the table on the left, we generate the pivot-table
3578 on the right:</p>
3579
3580 <div align=center>
3581
3582 <table class=MsoNormalTable border=0 cellpadding=0 style='mso-cellspacing:1.5pt;
3583  mso-padding-alt:1.5pt 1.5pt 1.5pt 1.5pt'>
3584  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes'>
3585   <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3586   <div align=center>
3587   <table class=MsoNormalTable border=1 cellpadding=0 width=142
3588    style='width:106.5pt;mso-cellspacing:1.5pt;mso-padding-alt:1.5pt 1.5pt 1.5pt 1.5pt'>
3589    <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
3590     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3591     <p class=MsoNormal><i>Supplier</i></p>
3592     </td>
3593     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3594     <p class=MsoNormal><i>Category</i></p>
3595     </td>
3596    </tr>
3597    <tr style='mso-yfti-irow:1'>
3598     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3599     <p class=MsoNormal>supplier1</p>
3600     </td>
3601     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3602     <p class=MsoNormal>category1</p>
3603     </td>
3604    </tr>
3605    <tr style='mso-yfti-irow:2'>
3606     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3607     <p class=MsoNormal>supplier2</p>
3608     </td>
3609     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3610     <p class=MsoNormal>category1</p>
3611     </td>
3612    </tr>
3613    <tr style='mso-yfti-irow:3;mso-yfti-lastrow:yes'>
3614     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3615     <p class=MsoNormal>supplier2</p>
3616     </td>
3617     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3618     <p class=MsoNormal>category2</p>
3619     </td>
3620    </tr>
3621   </table>
3622   </div>
3623   <p class=MsoNormal><o:p></o:p></p>
3624   </td>
3625   <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3626   <p class=MsoNormal><span style='font-family:"Courier New"'>--&gt;</span></p>
3627   </td>
3628   <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3629   <div align=center>
3630   <table class=MsoNormalTable border=1 cellpadding=0 style='mso-cellspacing:
3631    1.5pt;mso-padding-alt:1.5pt 1.5pt 1.5pt 1.5pt'>
3632    <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
3633     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3634     <p class=MsoNormal>&nbsp;</p>
3635     </td>
3636     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3637     <p class=MsoNormal><i>category1</i></p>
3638     </td>
3639     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3640     <p class=MsoNormal><i>category2</i></p>
3641     </td>
3642     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3643     <p class=MsoNormal><i>total</i></p>
3644     </td>
3645    </tr>
3646    <tr style='mso-yfti-irow:1'>
3647     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3648     <p class=MsoNormal><i>supplier1</i></p>
3649     </td>
3650     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3651     <p class=MsoNormal align=right style='text-align:right'>1</p>
3652     </td>
3653     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3654     <p class=MsoNormal align=right style='text-align:right'>0</p>
3655     </td>
3656     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3657     <p class=MsoNormal align=right style='text-align:right'>1</p>
3658     </td>
3659    </tr>
3660    <tr style='mso-yfti-irow:2;mso-yfti-lastrow:yes'>
3661     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3662     <p class=MsoNormal><i>supplier2</i></p>
3663     </td>
3664     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3665     <p class=MsoNormal align=right style='text-align:right'>1</p>
3666     </td>
3667     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3668     <p class=MsoNormal align=right style='text-align:right'>1</p>
3669     </td>
3670     <td style='padding:1.5pt 1.5pt 1.5pt 1.5pt'>
3671     <p class=MsoNormal align=right style='text-align:right'>2</p>
3672     </td>
3673    </tr>
3674   </table>
3675   </div>
3676   <p class=MsoNormal><o:p></o:p></p>
3677   </td>
3678  </tr>
3679 </table>
3680
3681 </div>
3682
3683 <p>The following code will generate the SQL for a cross-tabulation: </p>
3684
3685 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3686 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
3687 style='background:#EEEEEE'># Query the main &quot;product&quot; table<br>
3688 # Set the rows to SupplierName<br>
3689 # and the columns to the values of Categories<br>
3690 # and define the joins to link to lookup tables <br>
3691 # &quot;categories&quot; and &quot;suppliers&quot;<br>
3692 #<br>
3693 <span style='mso-spacerun:yes'> </span>include &quot;adodb/pivottable.inc.php&quot;;<br>
3694 <span style='mso-spacerun:yes'> </span>$sql = PivotTableSQL(<br>
3695 <span style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>        </span>$gDB,<span style='mso-spacerun:yes'>                                      </span># adodb connection<br>
3696 <span style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>        </span>'products p ,categories c ,suppliers s',<span style='mso-spacerun:yes'>   </span># tables<br>
3697 <span style='mso-tab-count:1'>         </span>'SupplierName',<span style='mso-spacerun:yes'>                             </span># rows (multiple fields allowed)<br>
3698 <span style='mso-tab-count:1'>         </span>'CategoryName',<span style='mso-spacerun:yes'>                            </span># column to pivot on <br>
3699 <span style='mso-tab-count:1'>         </span>'p.CategoryID = c.CategoryID and s.SupplierID= p.SupplierID' # joins/where<br>
3700 );</pre></div>
3701
3702 <p>This will generate the following SQL:</p>
3703
3704 <p><code><span style='font-size:10.0pt'>SELECT SupplierName, </span></code><span
3705 style='font-size:10.0pt;font-family:"Courier New"'><br>
3706 <code>SUM(CASE WHEN CategoryName='Beverages' THEN 1 ELSE 0 END) AS
3707 &quot;Beverages&quot;, </code><br>
3708 <code>SUM(CASE WHEN CategoryName='Condiments' THEN 1 ELSE 0 END) AS
3709 &quot;Condiments&quot;, </code><br>
3710 <code>SUM(CASE WHEN CategoryName='Confections' THEN 1 ELSE 0 END) AS
3711 &quot;Confections&quot;, </code><br>
3712 <code>SUM(CASE WHEN CategoryName='Dairy Products' THEN 1 ELSE 0 END) AS
3713 &quot;Dairy Products&quot;, </code><br>
3714 <code>SUM(CASE WHEN CategoryName='Grains/Cereals' THEN 1 ELSE 0 END) AS
3715 &quot;Grains/Cereals&quot;, </code><br>
3716 <code>SUM(CASE WHEN CategoryName='Meat/Poultry' THEN 1 ELSE 0 END) AS
3717 &quot;Meat/Poultry&quot;, </code><br>
3718 <code>SUM(CASE WHEN CategoryName='Produce' THEN 1 ELSE 0 END) AS
3719 &quot;Produce&quot;, </code><br>
3720 <code>SUM(CASE WHEN CategoryName='Seafood' THEN 1 ELSE 0 END) AS
3721 &quot;Seafood&quot;, </code><br>
3722 <code>SUM(1) as Total </code><br>
3723 <code>FROM products p ,categories c ,suppliers s WHERE p.CategoryID =
3724 c.CategoryID and s.SupplierID= p.SupplierID </code><br>
3725 <code>GROUP BY SupplierName</code></span></p>
3726
3727 <p>You can also pivot on <i>numerical columns</i> and <i>generate totals</i> by
3728 using ranges. This code was revised in ADODB 2.41 and is not backward
3729 compatible. The second example shows this:</p>
3730
3731 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3732 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span style='mso-spacerun:yes'> </span>$sql = PivotTableSQL(<br>
3733 <span style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>        </span>$gDB,<span style='mso-spacerun:yes'>                                       </span># adodb connection<br>
3734 <span style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>        </span>'products p ,categories c ,suppliers s',<span style='mso-spacerun:yes'>    </span># tables<br>
3735 <span style='mso-tab-count:1'>         </span>'SupplierName',<span style='mso-spacerun:yes'>                              </span># rows (multiple fields allowed)</pre><pre><span style='mso-spacerun:yes'>   </span>array(<span style='mso-spacerun:yes'>                       </span><span style='mso-spacerun:yes'>                </span># column ranges</pre><pre><span
3736 style='mso-tab-count:1'>         </span>' 0 '<span style='mso-spacerun:yes'>      </span>=&gt; 'UnitsInStock &lt;= 0',</pre><pre><span
3737 style='mso-tab-count:1'>         </span>&quot;1 to 5&quot;<span style='mso-spacerun:yes'>   </span>=&gt; '0 &lt; UnitsInStock and UnitsInStock &lt;= 5',</pre><pre><span
3738 style='mso-tab-count:1'>         </span>&quot;6 to 10&quot;<span style='mso-spacerun:yes'>  </span>=&gt; '5 &lt; UnitsInStock and UnitsInStock &lt;= 10',</pre><pre><span
3739 style='mso-tab-count:1'>         </span>&quot;11 to 15&quot; =&gt; '10 &lt; UnitsInStock and UnitsInStock &lt;= 15',</pre><pre><span
3740 style='mso-tab-count:1'>         </span>&quot;16+&quot;<span style='mso-spacerun:yes'>      </span>=&gt; '15 &lt; UnitsInStock'</pre><pre><span
3741 style='mso-tab-count:1'>         </span>),</pre><pre><span style='mso-tab-count:
3742 1'>         </span>' p.CategoryID = c.CategoryID and s.SupplierID= p.SupplierID', # joins/where</pre><pre><span
3743 style='mso-tab-count:1'>         </span>'UnitsInStock',<span style='mso-spacerun:yes'>                             </span># sum this field</pre><pre><span
3744 style='mso-tab-count:1'>         </span>'Sum '<span style='mso-spacerun:yes'>                                      </span># sum label prefix</pre><pre>);</pre></div>
3745
3746 <p>Which generates: </p>
3747
3748 <p><code><span style='font-size:10.0pt'>SELECT SupplierName, </span></code><span
3749 style='font-size:10.0pt;font-family:"Courier New"'><br>
3750 <code>SUM(CASE WHEN UnitsInStock &lt;= 0 THEN UnitsInStock ELSE 0 END) AS
3751 &quot;Sum 0 &quot;, </code><br>
3752 <code>SUM(CASE WHEN 0 &lt; UnitsInStock and UnitsInStock &lt;= 5 THEN
3753 UnitsInStock ELSE 0 END) AS &quot;Sum 1 to 5&quot;,</code><br>
3754 <code>SUM(CASE WHEN 5 &lt; UnitsInStock and UnitsInStock &lt;= 10 THEN UnitsInStock
3755 ELSE 0 END) AS &quot;Sum 6 to 10&quot;,</code><br>
3756 <code>SUM(CASE WHEN 10 &lt; UnitsInStock and UnitsInStock &lt;= 15 THEN
3757 UnitsInStock ELSE 0 END) AS &quot;Sum 11 to 15&quot;, </code><br>
3758 <code>SUM(CASE WHEN 15 &lt; UnitsInStock THEN UnitsInStock ELSE 0 END) AS
3759 &quot;Sum 16+&quot;, </code><br>
3760 <code>SUM(UnitsInStock) AS &quot;Sum UnitsInStock&quot;, </code><br>
3761 <code>SUM(1) as Total,</code><br>
3762 <code>FROM products p ,categories c ,suppliers s WHERE p.CategoryID =
3763 c.CategoryID and s.SupplierID= p.SupplierID </code><br>
3764 <code>GROUP BY SupplierName</code></span></p>
3765
3766 <div class=MsoNormal align=center style='text-align:center'>
3767
3768 <hr size=2 width="100%" align=center>
3769
3770 </div>
3771
3772 <h1>Class Reference<a name=ref></a></h1>
3773
3774 <p>Function parameters with [ ] around them are optional.</p>
3775
3776 <h2>Global Variables</h2>
3777
3778 <h3><a name="adodb_countrecs"></a>$ADODB_COUNTRECS</h3>
3779
3780 <p>If the database driver API does not support counting the number of records
3781 returned in a SELECT statement, the function RecordCount() is emulated when the
3782 global variable $ADODB_COUNTRECS is set to true, which is the default. We
3783 emulate this by buffering the records, which can take up large amounts of
3784 memory for big recordsets. Set this variable to false for the best performance.
3785 This variable is checked every time a query is executed, so you can selectively
3786 choose which recordsets to count.</p>
3787
3788 <h3><a name="adodb_cache_dir"></a>$ADODB_CACHE_DIR</h3>
3789
3790 <p>If you are using recordset caching, this is the directory to save your
3791 recordsets in. Define this before you call any caching functions such as
3792 CacheExecute( ). We recommend setting <i>register_globals=off</i> in php.ini if
3793 you use this feature for security reasons.</p>
3794
3795 <p>If you are using Unix and apache, you might need to set your cache directory
3796 permissions to something similar to the following:</p>
3797
3798 <p>chown -R apache /path/to/adodb/cache<br>
3799 chgrp -R apache /path/to/adodb/cache </p>
3800
3801 <h3><a name="adodb_ansi_padding_off"></a>$ADODB_ANSI_PADDING_OFF</h3>
3802
3803 <p>Determines whether to right trim CHAR fields (and also VARCHAR for
3804 ibase/firebird). Set to true to trim. Default is false. Currently works for
3805 oci8po, ibase and firebird drivers. Added in ADOdb 4.01. </p>
3806
3807 <h3><a name="adodb_lang"></a>$ADODB_LANG</h3>
3808
3809 <p>Determines the language used in MetaErrorMsg(). The default is 'en', for
3810 English. To find out what languages are supported, see the files in
3811 adodb/lang/adodb-$lang.inc.php, where $lang is the supported langauge. </p>
3812
3813 <h3><a name="adodb_fetch_mode"></a>$ADODB_FETCH_MODE</h3>
3814
3815 <p>This is a global variable that determines how arrays are retrieved by recordsets.
3816 The recordset saves this value on creation (eg. in Execute( ) or SelectLimit(
3817 )), and any subsequent changes to $ADODB_FETCH_MODE have no affect on existing
3818 recordsets, only on recordsets created in the future.</p>
3819
3820 <p>The following constants are defined:</p>
3821
3822 <p>define('ADODB_FETCH_DEFAULT',0);<br>
3823 define('ADODB_FETCH_NUM',1);<br>
3824 define('ADODB_FETCH_ASSOC',2);<br>
3825 define('ADODB_FETCH_BOTH',3); </p>
3826
3827 <p>An example: </p>
3828
3829 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3830 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
3831 style='mso-tab-count:1'>         </span>$ADODB_<b>FETCH_MODE</b> = ADODB_FETCH_NUM;<br>
3832 <span style='mso-tab-count:1'>         </span>$rs1 = $db-&gt;Execute('select * from table');<br>
3833 <span style='mso-tab-count:1'>         </span>$ADODB_<b>FETCH_MODE</b> = ADODB_FETCH_ASSOC;<br>
3834 <span style='mso-tab-count:1'>         </span>$rs2 = $db-&gt;Execute('select * from table');<br>
3835 <span style='mso-tab-count:1'>         </span>print_r($rs1-&gt;fields); # shows <i>array([0]=&gt;'v0',[1] =&gt;'v1')</i></pre><pre><span
3836 style='mso-tab-count:1'>         </span>print_r($rs2-&gt;fields); # shows <i>array(['col1']=&gt;'v0',['col2'] =&gt;'v1')</i></pre></div>
3837
3838 <p>As you can see in the above example, both recordsets store and use different
3839 fetch modes based on the $ADODB_FETCH_MODE setting when the recordset was
3840 created by Execute().</p>
3841
3842 <p>If no fetch mode is predefined, the fetch mode defaults to
3843 ADODB_FETCH_DEFAULT. The behaviour of this default mode varies from driver to
3844 driver, so do not rely on ADODB_FETCH_DEFAULT. For portability, we recommend
3845 sticking to ADODB_FETCH_NUM or ADODB_FETCH_ASSOC. Many drivers do not support
3846 ADODB_FETCH_BOTH.</p>
3847
3848 <p><strong>SetFetchMode Function</strong></p>
3849
3850 <p>If you have multiple connection objects, and want to have different fetch
3851 modes for each connection, then use <a href="#setfetchmode">SetFetchMode</a>.
3852 Once this function is called for a connection object, that connection object
3853 will ignore the global variable $ADODB_FETCH_MODE and will use the internal
3854 fetchMode property exclusively.</p>
3855
3856 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
3857 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
3858 style='mso-tab-count:1'>         </span>$db-&gt;SetFetchMode(ADODB_FETCH_NUM);<br>
3859 <span style='mso-tab-count:1'>         </span>$rs1 = $db-&gt;Execute('select * from table');<br>
3860 <span style='mso-tab-count:1'>         </span>$db-&gt;SetFetchMode(ADODB_FETCH_ASSOC);<br>
3861 <span style='mso-tab-count:1'>         </span>$rs2 = $db-&gt;Execute('select * from table');<br>
3862 <span style='mso-tab-count:1'>         </span>print_r($rs1-&gt;fields); # shows <i>array([0]=&gt;'v0',[1] =&gt;'v1')</i></pre><pre
3863 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>print_r($rs2-&gt;fields); # shows <i>array(['col1']=&gt;'v0',['col2'] =&gt;'v1')</i></pre></div>
3864
3865 <p>To retrieve the previous fetch mode, you can use check the $db-&gt;fetchMode
3866 property, or use the return value of SetFetchMode( ). </p>
3867
3868 <p><a name="adodb_assoc_case"></a><strong>ADODB_ASSOC_CASE</strong></p>
3869
3870 <p>You can control the associative fetch case for certain drivers which behave
3871 differently. For the sybase, oci8po, mssql, odbc and ibase drivers and all
3872 drivers derived from them, ADODB_ASSOC_CASE will by default generate recordsets
3873 where the field name keys are lower-cased. Use the constant ADODB_ASSOC_CASE to
3874 change the case of the keys. There are 3 possible values:</p>
3875
3876 <p>0 = assoc lowercase field names. $rs-&gt;fields['orderid']<br>
3877 1 = assoc uppercase field names. $rs-&gt;fields['ORDERID']<br>
3878 2 = use native-case field names. $rs-&gt;fields['OrderID'] -- this is the
3879 default since ADOdb 2.90</p>
3880
3881 <p>To use it, declare it before you incldue adodb.inc.php.</p>
3882
3883 <p>define('ADODB_ASSOC_CASE', 2); # use native-case for ADODB_FETCH_ASSOC<br>
3884 include('adodb.inc.php'); </p>
3885
3886 <h3><a name="force_type"></a>$ADODB_FORCE_TYPE</h3>
3887
3888 <p>See the <a href="#ADODB_FORCE_TYPE">GetUpdateSQL tutorial</a>. </p>
3889
3890 <h3><a name="adodb_auto_quote"></a>$ADODB_QUOTE_FIELDNAMES</h3>
3891
3892 <p>Auto-quotes field names when using AutoExecute() when set to true. </p>
3893 <p>Since 5.13, if $ADODB_QUOTE_FIELDNAMES is set to:
3894 <ul>
3895 <li>'UPPER' or true: uppercase field names. This is the default.
3896 <li>'NATIVE' : use native case.
3897 <li>'LOWER': lowercase field names.
3898 </ul>
3899 <p>&nbsp;</p>
3900
3901 <div class=MsoNormal align=center style='text-align:center'>
3902
3903 <hr size=2 width="100%" align=center>
3904
3905 </div>
3906
3907 <h2>ADOConnection<a name=adoconnection></a></h2>
3908
3909 <p>Object that performs the connection to the database, executes SQL statements
3910 and has a set of utility functions for standardising the format of SQL
3911 statements for issues such as concatenation and date formats.</p>
3912
3913 <h3>ADOConnection Fields</h3>
3914
3915 <p><b>databaseType</b>: Name of the database system we are connecting to. Eg. <b>odbc</b>
3916 or <b>mssql</b> or <b>mysql</b>.</p>
3917
3918 <p><b>dataProvider</b>: The underlying mechanism used to connect to the
3919 database. Normally set to <b>native</b>, unless using <b>odbc</b> or <b>ado</b>.</p>
3920
3921 <p><b>host: </b>Name of server or data source name (DSN) to connect to.</p>
3922
3923 <p><b>database</b>: Name of the database or to connect to. If ado is used, it
3924 will hold the ado data provider.</p>
3925
3926 <p><b>user</b>: Login id to connect to database. Password is not saved for
3927 security reasons.</p>
3928
3929 <p><b>raiseErrorFn</b>: Allows you to define an error handling function. See
3930 adodb-errorhandler.inc.php for an example.</p>
3931
3932 <p><b>debug</b>: Set to <i>true</i> to make debug statements. Set to -99 to only display errors. Set to 99 to display debug statements and add a backtrace.</p>
3933
3934 <p><b>concat_operator</b>: Set to '+' or '||' normally. The operator used to
3935 concatenate strings in SQL. Used by the <b><a href="#concat">Concat</a></b>
3936 function.</p>
3937
3938 <p><b>fmtDate</b>: The format used by the <b><a href="#dbdate">DBDate</a></b>
3939 function to send dates to the database. is '#Y-m-d#' for Microsoft Access, and
3940 ''Y-m-d'' for MySQL.</p>
3941
3942 <p><b>fmtTimeStamp: </b>The format used by the <b><a href="#dbtimestamp">DBTimeStamp</a></b>
3943 function to send timestamps to the database. </p>
3944
3945 <p><b>true</b>: The value used to represent true.Eg. '.T.'. for Foxpro, '1' for
3946 Microsoft SQL.</p>
3947
3948 <p><b>false: </b>The value used to represent false. Eg. '.F.'. for Foxpro, '0'
3949 for Microsoft SQL.</p>
3950
3951 <p><b>replaceQuote</b>: The string used to escape quotes. Eg. double
3952 single-quotes for Microsoft SQL, and backslash-quote for MySQL. Used by <a
3953 href="#qstr">qstr</a>.</p>
3954
3955 <p><b>autoCommit</b>: indicates whether automatic commit is enabled. Default is
3956 true.</p>
3957
3958 <p><b>charSet</b>: set the default charset to use. Currently only
3959 interbase/firebird supports this.</p>
3960
3961 <p><b>dialect</b>: set the default sql dialect to use. Currently only interbase/firebird
3962 supports this.</p>
3963
3964 <p><b>role</b>: set the role. Currently only interbase/firebird supports this.</p>
3965
3966 <p><b>metaTablesSQL</b>: SQL statement to return a list of available tables.
3967 Eg. <i>SHOW TABLES</i> in MySQL.</p>
3968
3969 <p><b>genID</b>: The latest id generated by GenID() if supported by the
3970 database.</p>
3971
3972 <p><b>cacheSecs</b>: The number of seconds to cache recordsets if
3973 CacheExecute() or CacheSelectLimit() omit the $secs2cache parameter. Defaults
3974 to 60 minutes.</p>
3975
3976 <p><b>sysDate</b>: String that holds the name of the database function to call
3977 to get the current date. Useful for inserts and updates.</p>
3978
3979 <p><b>sysTimeStamp</b>: String that holds the name of the database function to
3980 call to get the current timestamp/datetime value.</p>
3981
3982 <p><b>leftOuter</b>: String that holds operator for left outer join, if known.
3983 Otherwise set to false.</p>
3984
3985 <p><b>rightOuter</b>: String that holds operator for left outer join, if known.
3986 Otherwise set to false.</p>
3987
3988 <p><b>ansiOuter</b>: Boolean that if true indicates that ANSI style outer joins
3989 are permitted. Eg. <i>select * from table1 left join table2 on p1=p2.</i></p>
3990
3991 <p><b>connectSID</b>: Boolean that indicates whether to treat the $database
3992 parameter in connects as the SID for the oci8 driver. Defaults to false. Useful
3993 for Oracle 8.0.5 and earlier.</p>
3994
3995 <p><b>autoRollback</b>: Persistent connections are auto-rollbacked in PConnect(
3996 ) if this is set to true. Default is false.</p>
3997
3998 <div class=MsoNormal align=center style='text-align:center'>
3999
4000 <hr size=2 width="100%" align=center>
4001
4002 </div>
4003
4004 <h3>ADOConnection Main Functions</h3>
4005
4006 <p><b>ADOConnection( )</b></p>
4007
4008 <p>Constructor function. Do not call this directly. Use ADONewConnection( )
4009 instead.</p>
4010
4011 <p><b>Connect<a name=connect></a>($host,[$user],[$password],[$database])</b></p>
4012
4013 <p>Non-persistent connect to data source or server $<b>host</b>, using userid $<b>user
4014 </b>and password $<b>password</b>. If the server supports multiple databases,
4015 connect to database $<b>database</b>. </p>
4016
4017 <p>Returns true/false depending on connection success. Since 4.23, null is
4018 returned if the extension is not loaded.</p>
4019
4020 <p><st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City> Note: If
4021 you are using a Microsoft ADO and not OLEDB, you can set the $database
4022 parameter to the OLEDB data provider you are using.</p>
4023
4024 <p>PostgreSQL: An alternative way of connecting to the database is to pass the
4025 standard PostgreSQL connection string in the first parameter $host, and the
4026 other parameters will be ignored.</p>
4027
4028 <p>For Oracle and Oci8, there are two ways to connect. First is to use the TNS
4029 name defined in your local tnsnames.ora (or ONAMES or HOSTNAMES). Place the
4030 name in the $database field, and set the $host field to false. Alternatively,
4031 set $host to the server, and $database to the database SID, this bypassed
4032 tnsnames.ora. </p>
4033
4034 <p>Examples: </p>
4035
4036 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4037 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4038 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span># $oraname in tnsnames.ora/ONAMES/HOSTNAMES<br>
4039 <span style='mso-spacerun:yes'> </span>$conn-&gt;Connect(false, 'scott', 'tiger', $oraname); <br>
4040 <span style='mso-spacerun:yes'> </span>$conn-&gt;Connect('server:1521', 'scott', 'tiger', 'ServiceName'); # bypass tnsnames.ora</pre></div>
4041
4042 <p>There are many examples of connecting to a database. See <a
4043 href="#connect_ex">Connection Examples</a> for many examples. </p>
4044
4045 <p><b>PConnect<a name=pconnect></a>($host,[$user],[$password],[$database])</b></p>
4046
4047 <p>Persistent connect to data source or server $<b>host</b>, using userid $<b>user</b>
4048 and password $<b>password</b>. If the server supports multiple databases,
4049 connect to database $<b>database</b>.</p>
4050
4051 <p>We now perform a rollback on persistent connection for selected databases
4052 since 2.21, as advised in the PHP manual. See change log or source code for
4053 which databases are affected. </p>
4054
4055 <p>Returns true/false depending on connection. Since 4.23, 0 is returned if the
4056 extension is not loaded. See Connect( ) above for more info.</p>
4057
4058 <p>Since ADOdb 2.21, we also support autoRollback. If you set:</p>
4059
4060 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4061 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4062 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>$conn = &amp;NewADOConnection('mysql');<br>
4063 <span style='mso-spacerun:yes'> </span>$conn-&gt;autoRollback = true; # default is false<br>
4064 <span style='mso-spacerun:yes'> </span>$conn-&gt;PConnect(...); # rollback here</pre></div>
4065
4066 <p>Then when doing a persistent connection with PConnect( ), ADOdb will perform
4067 a rollback first. This is because it is documented that PHP is not guaranteed
4068 to rollback existing failed transactions when persistent connections are used.
4069 This is implemented in Oracle, MySQL, PgSQL, MSSQL, ODBC currently. </p>
4070
4071 <p>Since ADOdb 3.11, you can force non-persistent connections even if PConnect
4072 is called by defining the constant ADODB_NEVER_PERSIST before you call
4073 PConnect. </p>
4074
4075 <p>Since 4.23, null is returned if the extension is not loaded. </p>
4076
4077 <p><b>NConnect<a name=nconnect></a>($host,[$user],[$password],[$database])</b></p>
4078
4079 <p>Always force a new connection. In contrast, PHP sometimes reuses connections
4080 when you use Connect() or PConnect(). Currently works only on mysql (PHP 4.3.0
4081 or later), postgresql and oci8-derived drivers. For other drivers, NConnect()
4082 works like Connect().</p>
4083
4084 <p><b>IsConnected( )</b><a name=isconnected></a></p>
4085
4086 <p>Returns true if connected to database. Added in 4.53. </p>
4087
4088 <p><b>Execute<a name=execute></a>($sql,$inputarr=false)</b></p>
4089
4090 <p>Execute SQL statement $<b>sql</b> and return derived class of ADORecordSet
4091 if successful. Note that a record set is always returned on success, even if we
4092 are executing an insert or update statement. You can also pass in $sql a
4093 statement prepared in <a href="#prepare">Prepare()</a>.</p>
4094
4095 <p>Returns derived class of ADORecordSet. Eg. if connecting via mysql, then
4096 ADORecordSet_mysql would be returned. False is returned if there was an error
4097 in executing the sql.</p>
4098
4099 <p>The $inputarr parameter can be used for binding variables to parameters.
4100 Below is an Oracle example:</p>
4101
4102 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4103 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4104 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>$conn-&gt;Execute(&quot;SELECT * FROM TABLE WHERE COND=:val&quot;, array('val'=&gt; $val));<br>
4105 <span style='mso-spacerun:yes'> </span></pre></div>
4106
4107 <p>Another example, using ODBC,which uses the ? convention:</p>
4108
4109 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4110 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4111 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span>$conn-&gt;Execute(&quot;SELECT * FROM TABLE WHERE COND=?&quot;, array($val));</pre></div>
4112
4113 <p class=MsoNormal><a name=binding></a><i>Binding variables</i></p>
4114
4115 <p>Variable binding speeds the compilation and caching of SQL statements,
4116 leading to higher performance. Currently Oracle, Interbase and ODBC supports
4117 variable binding. Interbase/ODBC style ? binding is emulated in databases that
4118 do not support binding. Note that you do not have to quote strings if you use
4119 binding. </p>
4120
4121 <p>Variable binding in the odbc, interbase and oci8po drivers. </p>
4122
4123 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4124 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4125 style='background:#EEEEEE'>$rs = $db-&gt;Execute('select * from table where val=?', array('10'));</pre></div>
4126
4127 <p class=MsoNormal>Variable binding in the oci8 driver: </p>
4128
4129 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4130 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4131 style='background:#EEEEEE'>$rs = $db-&gt;Execute('select name from table where val=:key', <br>
4132 <span style='mso-spacerun:yes'>  </span>array('key' =&gt; 10));</pre></div>
4133
4134 <p class=MsoNormal><a name=bulkbind></a><i>Bulk binding</i> </p>
4135
4136 <p>Since ADOdb 3.80, we support bulk binding in Execute(), in which you pass in
4137 a 2-dimensional array to be bound to an INSERT/UPDATE or DELETE statement. And since ADOdb 5.11 this is
4138 disabled by default due to security issues. To enable, set $conn->bulkBind = true. </p>
4139
4140 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4141 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4142 style='background:#EEEEEE'>$arr = array(<br>
4143 <span style='mso-tab-count:1'>         </span>array('Ahmad',32),<br>
4144 <span style='mso-tab-count:1'>         </span>array('Zulkifli', 24),<br>
4145 <span style='mso-tab-count:1'>         </span>array('Rosnah', 21)<br>
4146 <span style='mso-tab-count:1'>         </span>);<br>
4147 $ok = $db-&gt;Execute('insert into table (name,age) values (?,?)',$arr);</pre></div>
4148
4149 <p>This provides very high performance as the SQL statement is prepared first.
4150 The prepared statement is executed repeatedly for each array row until all rows
4151 are completed, or until the first error. Very useful for importing data. </p>
4152
4153 <p><b>CacheExecute<a name=cacheexecute></a>([$secs2cache,]$sql,$inputarr=false)</b></p>
4154
4155 <p>Similar to Execute, except that the recordset is cached for $secs2cache
4156 seconds in the $ADODB_CACHE_DIR directory, and $inputarr only accepts
4157 1-dimensional arrays. If CacheExecute() is called again with the same $sql,
4158 $inputarr, and also the same database, same userid, and the cached recordset
4159 has not expired, the cached recordset is returned. </p>
4160
4161 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4162 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4163 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span>include('adodb.inc.php'); <br>
4164 <span style='mso-spacerun:yes'>  </span>include('tohtml.inc.php');<br>
4165 <span style='mso-spacerun:yes'>  </span>$ADODB_<b>CACHE_DIR</b> = '/usr/local/ADOdbcache';<br>
4166 <span style='mso-spacerun:yes'>  </span>$conn = &amp;ADONewConnection('mysql'); <br>
4167 <span style='mso-spacerun:yes'>  </span>$conn-&gt;PConnect('localhost','userid','password','database');<br>
4168 <span style='mso-spacerun:yes'>  </span>$rs = $conn-&gt;<b>CacheExecute</b>(15, 'select * from table'); # cache 15 secs<br>
4169 <span style='mso-spacerun:yes'>  </span>rs2html($rs); /* recordset to html table */<span style='mso-spacerun:yes'>  </span></pre></div>
4170
4171 <p>Alternatively, since ADOdb 1.80, the $secs2cache parameter is optional:</p>
4172
4173 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4174 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4175 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect(...);<br>
4176 <span style='mso-spacerun:yes'>   </span><span style='mso-tab-count:1'>      </span>$conn-&gt;cacheSecs = 3600*24; // cache 24 hours<br>
4177 <span style='mso-tab-count:1'>         </span>$rs = $conn-&gt;CacheExecute('select * from table');</pre></div>
4178
4179 <p class=MsoNormal>If $secs2cache is omitted, we use the value in
4180 $connection-&gt;cacheSecs (default is 3600 seconds, or 1 hour). Use
4181 CacheExecute() only with SELECT statements. </p>
4182
4183 <p>Performance note: I have done some benchmarks and found that they vary so
4184 greatly that it's better to talk about when caching is of benefit. When your
4185 database server is <i>much slower </i>than your Web server or the database is <i>very
4186 overloaded </i>then ADOdb's caching is good because it reduces the load on your
4187 database server. If your database server is lightly loaded or much faster than
4188 your Web server, then caching could actually reduce performance. </p>
4189
4190 <p><b>ExecuteCursor<a name=executecursor></a>($sql,$cursorName='rs',$parameters=false)</b></p>
4191
4192 <p>Execute an Oracle stored procedure, and returns an Oracle REF cursor
4193 variable as a regular ADOdb recordset. Does not work with any other database
4194 except oci8. Thanks to Robert Tuttle for the design. </p>
4195
4196 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4197 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4198 style='background:#EEEEEE'><span style='mso-spacerun:yes'>    </span>$db = ADONewConnection(&quot;oci8&quot;); <br>
4199 <span style='mso-spacerun:yes'>    </span>$db-&gt;Connect(&quot;foo.com:1521&quot;, &quot;uid&quot;, &quot;pwd&quot;, &quot;FOO&quot;); <br>
4200 <span style='mso-spacerun:yes'>    </span>$rs = $db-&gt;ExecuteCursor(&quot;begin :cursorvar := getdata(:param1); end;&quot;, <br>
4201 <span style='mso-tab-count:5'>                                            </span>'cursorvar',<br>
4202 <span style='mso-tab-count:5'>                                            </span>array('param1'=&gt;10)); <br>
4203 <span style='mso-spacerun:yes'>    </span># $rs is now just like any other ADOdb recordset object<br>
4204 <span style='mso-spacerun:yes'>    </span>rs2html($rs);</pre></div>
4205
4206 <p>ExecuteCursor() is a helper function that does the following internally: </p>
4207
4208 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4209 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4210 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$stmt = $db-&gt;Prepare(&quot;begin :cursorvar := getdata(:param1); end;&quot;, true); <br>
4211 <span style='mso-tab-count:1'>         </span>$db-&gt;Parameter($stmt, $cur, 'cursorvar', false, -1, OCI_B_CURSOR);<br>
4212 <span style='mso-tab-count:1'>         </span>$rs = $db-&gt;Execute($stmt,$bindarr);</pre></div>
4213
4214 <p>ExecuteCursor only accepts 1 out parameter. So if you have 2 out parameters,
4215 use: </p>
4216
4217 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4218 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4219 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$vv = 'A%';<br>
4220 <span style='mso-tab-count:1'>         </span>$stmt = $db-&gt;PrepareSP(&quot;BEGIN list_tabs(:crsr,:tt); END;&quot;);<br>
4221 <span style='mso-tab-count:1'>         </span>$db-&gt;OutParameter($stmt, $cur, 'crsr', -1, OCI_B_CURSOR);<br>
4222 <span style='mso-tab-count:1'>         </span>$db-&gt;OutParameter($stmt, $vv, 'tt', 32); # return varchar(32)<br>
4223 <span style='mso-tab-count:1'>         </span>$arr = $db-&gt;GetArray($stmt);<br>
4224 <span style='mso-tab-count:1'>         </span>print_r($arr);<br>
4225 <span style='mso-tab-count:1'>         </span>echo &quot; val = $vv&quot;; ## outputs 'TEST'</pre></div>
4226
4227 <p class=MsoNormal>for the following PL/SQL: </p>
4228
4229 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4230 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4231 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>TYPE TabType IS REF CURSOR RETURN TAB%ROWTYPE;<br>
4232 <br>
4233 <span style='mso-tab-count:1'>         </span>PROCEDURE list_tabs(tabcursor IN OUT TabType,tablenames IN OUT VARCHAR) IS<br>
4234 <span style='mso-tab-count:1'>         </span>BEGIN<br>
4235 <span style='mso-tab-count:2'>                 </span>OPEN tabcursor FOR SELECT * FROM TAB WHERE tname LIKE tablenames;<br>
4236 <span style='mso-tab-count:2'>                 </span>tablenames := 'TEST';<br>
4237 <span style='mso-tab-count:1'>         </span>END list_tabs;</pre></div>
4238
4239 <p><b>SelectLimit<a name=selectlimit></a>($sql,$numrows=-1,$offset=-1,$inputarr=false)</b></p>
4240
4241 <p>Returns a recordset if successful. Returns false otherwise. Performs a
4242 select statement, simulating PostgreSQL's SELECT statement, LIMIT $numrows
4243 OFFSET $offset clause.</p>
4244
4245 <p>In PostgreSQL, SELECT * FROM TABLE LIMIT 3 will return the first 3 records
4246 only. The equivalent is <code><span style='font-size:10.0pt'>$connection-&gt;SelectLimit('SELECT
4247 * FROM TABLE',3)</span></code>. This functionality is simulated for databases
4248 that do not possess this feature.</p>
4249
4250 <p>And SELECT * FROM TABLE LIMIT 3 OFFSET 2 will return records 3, 4 and 5 (eg.
4251 after record 2, return 3 rows). The equivalent in ADOdb is <code><span
4252 style='font-size:10.0pt'>$connection-&gt;SelectLimit('SELECT * FROM TABLE',3,2)</span></code>.</p>
4253
4254 <p>Note that this is the <i>opposite</i> of MySQL's LIMIT clause. You can also
4255 set <code><span style='font-size:10.0pt'>$connection-&gt;SelectLimit('SELECT *
4256 FROM TABLE',-1,10)</span></code> to get rows 11 to the last row.</p>
4257
4258 <p>The last parameter $inputarr is for databases that support variable binding
4259 such as Oracle oci8. This substantially reduces SQL compilation overhead. Below
4260 is an Oracle example:</p>
4261
4262 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4263 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4264 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>$conn-&gt;SelectLimit(&quot;SELECT * FROM TABLE WHERE COND=:val&quot;, 100,-1,array('val'=&gt; $val));<br>
4265 <span style='mso-spacerun:yes'> </span></pre></div>
4266
4267 <p>The oci8po driver (oracle portable driver) uses the more standard bind
4268 variable of ?: </p>
4269
4270 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4271 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4272 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>$conn-&gt;SelectLimit(&quot;SELECT * FROM TABLE WHERE COND=?&quot;, 100,-1,array('val'=&gt; $val));</pre></div>
4273
4274 <p>Ron Wilson reports that SelectLimit does not work with UNIONs. </p>
4275
4276 <p><b>CacheSelectLimit<a name=cacheselectlimit></a>([$secs2cache,] $sql,
4277 $numrows=-1,$offset=-1,$inputarr=false)</b></p>
4278
4279 <p>Similar to SelectLimit, except that the recordset returned is cached for
4280 $secs2cache seconds in the $ADODB_CACHE_DIR directory. </p>
4281
4282 <p>Since 1.80, $secs2cache has been optional, and you can define the caching
4283 time in $connection-&gt;cacheSecs.</p>
4284
4285 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4286 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4287 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;Connect(...);<br>
4288 <span style='mso-spacerun:yes'>   </span>$conn-&gt;cacheSecs = 3600*24; // cache 24 hours<br>
4289 <span style='mso-tab-count:1'>         </span>$rs = $conn-&gt;CacheSelectLimit('select * from table',10);</pre></div>
4290
4291 <p><b>CacheFlush<a name=cacheflush></a>($sql=false,$inputarr=false)</b></p>
4292
4293 <p>Flush (delete) any cached recordsets for the SQL statement $sql in
4294 $ADODB_CACHE_DIR. </p>
4295
4296 <p>If no parameter is passed in, then all adodb_*.cache files are deleted. </p>
4297
4298 <p>CacheSelectLimit() rewrites the SQL query, so you won't be able to pass the
4299 SQL to CacheFlush. In this case, to flush the cached SQL recordset returned by
4300 CacheSelectLimit(), set $secs2cache to -1: </p>
4301
4302 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4303 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
4304 style='mso-tab-count:1'>         </span>$db-&gt;CacheSelectLimit(-1, $sql, $nrows);</pre></div>
4305
4306 <p>If you want to flush all cached recordsets manually, execute the following
4307 PHP code (works only under Unix): <br>
4308 <code><span style='font-size:10.0pt'>&nbsp; system(&quot;rm -f `find
4309 &quot;.$ADODB_CACHE_DIR.&quot; -name adodb_*.cache`&quot;);</span></code></p>
4310
4311 <p>For general cleanup of all expired files, you should use <a
4312 href="http://www.superscripts.com/tutorial/crontab.html">crontab</a> on Unix,
4313 or at.exe on Windows, and a shell script similar to the following:<span
4314 style='font-family:"Courier New"'><br>
4315 #------------------------------------------------------ <br>
4316 # This particular example deletes files in the TMPPATH <br>
4317 # directory with the string &quot;.cache&quot; in their name that <br>
4318 # are more than 7 days old. <br>
4319 #------------------------------------------------------ <br>
4320 AGED=7 <br>
4321 find ${TMPPATH} -mtime +$AGED | grep &quot;\.cache&quot; | xargs rm -f </span></p>
4322
4323 <p><b>MetaError<a name=metaerror></a>($errno=false)</b></p>
4324
4325 <p>Returns a virtualized error number, based on PEAR DB's error number system.
4326 You might need to include adodb-error.inc.php before you call this function.
4327 The parameter $errno is the native error number you want to convert. If you do
4328 not pass any parameter, MetaError will call ErrorNo() for you and convert it.
4329 If the error number cannot be virtualized, MetaError will return -1 (DB_ERROR).</p>
4330
4331 <p><b>MetaErrorMsg<a name=metaerrormsg></a>($errno)</b></p>
4332
4333 <p>Pass the error number returned by MetaError() for the equivalent textual
4334 error message.</p>
4335
4336 <p><b>ErrorMsg<a name=errormsg></a>()</b></p>
4337
4338 <p>Returns the last status or error message. The error message is reset after
4339 every call to Execute(). </p>
4340
4341 <p>This can return a string even if no error occurs. In general you do not need
4342 to call this function unless an ADOdb function returns false on an error. </p>
4343
4344 <p>Note: If <b>debug</b> is enabled, the SQL error message is always displayed
4345 when the <b>Execute</b> function is called.</p>
4346
4347 <p><b>ErrorNo<a name=errorno></a>()</b></p>
4348
4349 <p>Returns the last error number. The error number is reset after every call to
4350 Execute(). If 0 is returned, no error occurred. </p>
4351
4352 <p>Note that old versions of PHP (pre 4.0.6) do not support error number for
4353 ODBC. In general you do not need to call this function unless an ADOdb function
4354 returns false on an error.</p>
4355
4356 <p><b>IgnoreErrors<a name=ignoreerrors></a>($saveErrHandlers)</b></p>
4357
4358 <p>Allows you to ignore errors so that StartTrans()/CompleteTrans() is not
4359 affected, nor is the default error handler called if an error occurs. Useful
4360 when you want to check if a field or table exists in a database without
4361 invoking an error if it does not exist. </p>
4362
4363 <p>Usage: </p>
4364
4365 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4366 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$saveErrHandlers = $conn-&gt;IgnoreErrors();</pre><pre>$rs = $conn-&gt;Execute(&quot;select field from some_table_that_might_not_exist&quot;);</pre><pre>$conn-&gt;IgnoreErrors($saveErrHandlers);</pre></div>
4367
4368 <p>Warning: do not call StartTrans()/CompleteTrans() inside a code block that
4369 is using IgnoreErrors(). </p>
4370
4371 <p><b>SetFetchMode<a name=setfetchmode></a>($mode)</b></p>
4372
4373 <p>Sets the current fetch mode for the connection and stores it in
4374 $db-&gt;fetchMode. Legal modes are ADODB_FETCH_ASSOC and ADODB_FETCH_NUM. For
4375 more info, see <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a>.</p>
4376
4377 <p>Returns the previous fetch mode, which could be false if SetFetchMode( ) has
4378 not been called before.</p>
4379
4380 <p><b>CreateSequence<a name=createseq></a>($seqName = 'adodbseq',$startID=1)</b></p>
4381
4382 <p>Create a sequence. The next time GenID( ) is called, the value returned will
4383 be $startID. Added in 2.60. </p>
4384
4385 <p><b>DropSequence<a name=dropseq></a>($seqName = 'adodbseq')</b></p>
4386
4387 <p>Delete a sequence. Added in 2.60. </p>
4388
4389 <p><b>GenID<a name=genid></a>($seqName = 'adodbseq',$startID=1)</b></p>
4390
4391 <p>Generate a sequence number . Works for interbase, mysql, postgresql, oci8,
4392 oci8po, mssql, ODBC based (access,vfp,db2,etc) drivers currently. Uses $seqName
4393 as the name of the sequence. GenID() will automatically create the sequence for
4394 you if it does not exist (provided the userid has permission to do so).
4395 Otherwise you will have to create the sequence yourself. </p>
4396
4397 <p>If your database driver emulates sequences, the name of the table is the
4398 sequence name. The table has one column, &quot;id&quot; which should be of type
4399 integer, or if you need something larger - numeric(16). </p>
4400
4401 <p>For ODBC and databases that do not support sequences natively (eg mssql,
4402 mysql), we create a table for each sequence. If the sequence has not been
4403 defined earlier, it is created with the starting value set in $startID.</p>
4404
4405 <p>Note that the mssql driver's GenID() before 1.90 used to generate 16 byte
4406 GUID's.</p>
4407
4408 <p><b>UpdateBlob<a name=updateblob></a>($table,$column,$val,$where)</b></p>
4409
4410 <p class=MsoNormal>Allows you to store a blob (in $val) into $table into
4411 $column in a row at $where. </p>
4412
4413 <p>Usage: </p>
4414
4415 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4416 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4417 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span># for oracle<br>
4418 <span style='mso-tab-count:1'>         </span>$conn-&gt;Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, empty_blob())');<br>
4419 <span style='mso-tab-count:1'>         </span>$conn-&gt;UpdateBlob('blobtable','blobcol',$blobvalue,'id=1');<br>
4420 <span style='mso-tab-count:1'>         </span><br>
4421 <span style='mso-tab-count:1'>         </span># non oracle databases<br>
4422 <span style='mso-tab-count:1'>         </span>$conn-&gt;Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');<br>
4423 <span style='mso-tab-count:1'>         </span>$conn-&gt;UpdateBlob('blobtable','blobcol',$blobvalue,'id=1');</pre></div>
4424
4425 <p>Returns true if succesful, false otherwise. Supported by MySQL, PostgreSQL,
4426 Oci8, Oci8po and Interbase drivers. Other drivers might work, depending on the
4427 state of development.</p>
4428
4429 <p>Note that when an Interbase blob is retrieved using SELECT, it still needs
4430 to be decoded using $connection-&gt;DecodeBlob($blob); to derive the original
4431 value in versions of PHP before 4.1.0. </p>
4432
4433 <p>For PostgreSQL, you can store your blob using blob oid's or as a bytea field.
4434 You can use bytea fields but not blob oid's currently with UpdateBlob( ).
4435 Conversely UpdateBlobFile( ) supports oid's, but not bytea data.<br>
4436 <br>
4437 If you do not pass in an oid, then UpdateBlob() assumes that you are storing in
4438 bytea fields. </p>
4439
4440 <p>If you do not have any blob fields, you can improve you can improve general
4441 SQL query performance by disabling blob handling with
4442 $connection-&gt;disableBlobs = true. </p>
4443
4444 <p><b>UpdateClob<a name=updateclob></a>($table,$column,$val,$where)</b></p>
4445
4446 <p class=MsoNormal>Allows you to store a clob (in $val) into $table into
4447 $column in a row at $where. Similar to UpdateBlob (see above), but for
4448 Character Large OBjects. </p>
4449
4450 <p>Usage: </p>
4451
4452 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4453 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4454 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span># for oracle<br>
4455 <span style='mso-tab-count:1'>         </span>$conn-&gt;Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, empty_clob())');<br>
4456 <span style='mso-tab-count:1'>         </span>$conn-&gt;UpdateBlob('clobtable','clobcol',$clobvalue,'id=1');<br>
4457 <span style='mso-tab-count:1'>         </span><br>
4458 <span style='mso-tab-count:1'>         </span># non oracle databases<br>
4459 <span style='mso-tab-count:1'>         </span>$conn-&gt;Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, null)');<br>
4460 <span style='mso-tab-count:1'>         </span>$conn-&gt;UpdateBlob('clobtable','clobcol',$clobvalue,'id=1');</pre></div>
4461
4462 <p><b>UpdateBlobFile<a name=updateblobfile></a>($table,$column,$path,$where,$blobtype='BLOB')</b></p>
4463
4464 <p>Similar to UpdateBlob, except that we pass in a file path to where the blob
4465 resides. </p>
4466
4467 <p>For PostgreSQL, if you are using blob oid's, use this interface. This
4468 interface does not support bytea fields. </p>
4469
4470 <p>Returns true if successful, false otherwise. </p>
4471
4472 <p><b>BlobEncode<a name=blobencode id=blobencode></a>($blob)</b> </p>
4473
4474 <p>Some databases require blob's to be encoded manually before upload. Note if
4475 you use UpdateBlob( ) or UpdateBlobFile( ) the conversion is done automatically
4476 for you and you do not have to call this function. For PostgreSQL, currently,
4477 BlobEncode() can only be used for bytea fields. </p>
4478
4479 <p>Returns the encoded blob value. </p>
4480
4481 <p>Note that there is a connection property called <em>blobEncodeType</em>
4482 which has 3 legal values: </p>
4483
4484 <p>false - no need to perform encoding or decoding.<br>
4485 'I' - blob encoding required, and returned encoded blob is a numeric value (no
4486 need to quote).<br>
4487 'C' - blob encoding required, and returned encoded blob is a character value
4488 (requires quoting). </p>
4489
4490 <p>This is purely for documentation purposes, so that programs that accept
4491 multiple database drivers know what is the right thing to do when processing
4492 blobs. </p>
4493
4494 <p><strong>BlobDecode<a name=blobdecode></a>($blob, $maxblobsize = false)</strong>
4495 </p>
4496
4497 <p>Some databases require blob's to be decoded manually after doing a select
4498 statement. If the database does not require decoding, then this function will
4499 return the blob unchanged. Currently BlobDecode is only required for one
4500 database, PostgreSQL, and only if you are using blob oid's (if you are using
4501 bytea fields, we auto-decode for you). The default maxblobsize is set in
4502 $connection-&gt;maxblobsize, which is set to 256K in adodb 4.54. </p>
4503
4504 <p>In ADOdb 4.54 and later, the blob is the return value. In earlier versions,
4505 the blob data is sent to stdout.</p>
4506
4507 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4508 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4509 style='background:#EEEEEE'>$rs = $db-&gt;Execute(&quot;select bloboid from postgres_table where id=$key&quot;);<br>
4510 $blob = $db-&gt;BlobDecode( reset($rs-&gt;fields) );</pre></div>
4511
4512 <p><b>Replace<a name=replace></a>($table, $arrFields,
4513 $keyCols,$autoQuote=false)</b></p>
4514
4515 <p>Try to update a record, and if the record is not found, an insert statement
4516 is generated and executed. Returns 0 on failure, 1 if update statement worked,
4517 2 if no record was found and the insert was executed successfully. This differs
4518 from MySQL's replace which deletes the record and inserts a new record. This
4519 also means you cannot update the primary key. The only exception to this is
4520 Interbase and its derivitives, which uses delete and insert because of some
4521 Interbase API limitations. </p>
4522
4523 <p>The parameters are $table which is the table name, the $arrFields which is
4524 an associative array where the keys are the field names, and $keyCols is the
4525 name of the primary key, or an array of field names if it is a compound key. If
4526 $autoQuote is set to true, then Replace() will quote all values that are
4527 non-numeric; auto-quoting will not quote nulls. Note that auto-quoting will not
4528 work if you use SQL functions or operators. </p>
4529
4530 <p>Examples: </p>
4531
4532 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4533 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4534 style='background:#EEEEEE'># single field primary key<br>
4535 $ret = $db-&gt;Replace('atable', <br>
4536 <span style='mso-tab-count:1'>         </span>array('id'=&gt;1000,'firstname'=&gt;'Harun','lastname'=&gt;'Al-Rashid'),<br>
4537 <span style='mso-tab-count:1'>         </span>'id',$autoquote = true);<span
4538 style='mso-tab-count:1'>  </span><br>
4539 # generates UPDATE atable SET firstname='Harun',lastname='Al-Rashid' WHERE id=1000<br>
4540 # or INSERT INTO atable (id,firstname,lastname) VALUES (1000,'Harun','Al-Rashid')<br>
4541 <br>
4542 # compound key<br>
4543 $ret = $db-&gt;Replace('atable2', <br>
4544 <span style='mso-tab-count:1'>         </span>array('firstname'=&gt;'Harun','lastname'=&gt;'Al-Rashid', 'age' =&gt; 33, 'birthday' =&gt; 'null'),<br>
4545 <span style='mso-tab-count:1'>         </span>array('lastname','firstname'),<br>
4546 <span style='mso-tab-count:1'>         </span>$autoquote = true);<br>
4547 <br>
4548 # no auto-quoting<br>
4549 $ret = $db-&gt;Replace('atable2', <br>
4550 <span style='mso-tab-count:1'>         </span>array('firstname'=&gt;&quot;'Harun'&quot;,'lastname'=&gt;&quot;'Al-Rashid'&quot;, 'age' =&gt; 'null'),<br>
4551 <span style='mso-tab-count:1'>         </span>array('lastname','firstname'));<span
4552 style='mso-tab-count:1'>    </span></pre></div>
4553
4554 <p><b>AutoExecute<a name=autoexecute></a>($table, $arrFields, $mode,
4555 $where=false, $forceUpdate=true,$magicq=false)</b></p>
4556
4557 <p>Since ADOdb 4.56, you can automatically generate and execute INSERTs and
4558 UPDATEs on a given table with this function, which is a wrapper for
4559 GetInsertSQL() and GetUpdateSQL(). </p>
4560
4561 <p>AutoExecute() inserts or updates $table given an array of $arrFields, where
4562 the keys are the field names and the array values are the field values to
4563 store. Note that there is some overhead because the table is first queried to
4564 extract key information before the SQL is generated. We generate an INSERT or
4565 UPDATE based on $mode (see below). </p>
4566
4567 <p>Legal values for $mode are </p>
4568
4569 <ul type=disc>
4570  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4571      mso-list:l5 level1 lfo9;tab-stops:list 36.0pt'>'INSERT' or 1 or DB_AUTOQUERY_INSERT
4572      </li>
4573  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4574      mso-list:l5 level1 lfo9;tab-stops:list 36.0pt'>'UPDATE' or 2 or
4575      DB_AUTOQUERY_UPDATE </li>
4576 </ul>
4577
4578 <p>You have to define the constants DB_AUTOQUERY_UPDATE and DB_AUTOQUERY_INSERT
4579 yourself or include adodb-pear.inc.php. </p>
4580
4581 <p>The $where clause is required if $mode == 'UPDATE'. If $forceUpdate=false
4582 then we will query the database first and check if the field value returned by
4583 the query matches the current field value; only if they differ do we update
4584 that field. </p>
4585
4586 <p>Returns true on success, false on error. </p>
4587
4588 <p>An example of its use is: </p>
4589
4590 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4591 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$record[&quot;firstName&quot;] = &quot;Carol&quot;;</pre><pre>$record[&quot;lasTname&quot;] = &quot;Smith&quot;; </pre><pre>$conn-&gt;AutoExecute($table,$record,'INSERT');</pre><pre># executes <i>&quot;INSERT INTO $table (firstName,lasTname) values ('Carol',Smith')&quot;</i>;</pre><pre><o:p>&nbsp;</o:p></pre><pre>$record[&quot;firstName&quot;] = &quot;Carol&quot;;</pre><pre>$record[&quot;lasTname&quot;] = &quot;Jones&quot;; </pre><pre>$conn-&gt;AutoExecute($table,$record,'UPDATE', &quot;lastname like 'Sm%'&quot;);</pre><pre># executes <i>&quot;UPDATE $table SET firstName='Carol',lasTname='Jones' WHERE lastname like 'Sm%'&quot;</i>;</pre></div>
4592
4593 <p>Note: One of the strengths of ADOdb's AutoExecute() is that only valid field
4594 names for $table are updated. If $arrFields contains keys that are invalid
4595 field names for $table, they are ignored. There is some overhead in doing this
4596 as we have to query the database to get the field names, but given that you are
4597 not directly coding the SQL yourself, you probably aren't interested in speed
4598 at all, but convenience. </p>
4599
4600 <p>Since 4.62, the table name to be used can be overridden by setting
4601 $rs-&gt;tableName before AutoExecute(), GetInsertSQL() or GetUpdateSQL() is
4602 called. </p>
4603
4604 <p>Since 4.94, setting the global variable $ADODB_QUOTE_FIELDNAMES to true will
4605 force field names to be auto-quoted in AutoExecute(), GetInsertSQL() and
4606 GetUpdateSQL(). </p>
4607
4608 <p><b>GetUpdateSQL<a name=getupdatesql></a>(&amp;$rs, $arrFields,
4609 $forceUpdate=false,$magicq=false, $force=null)</b></p>
4610
4611 <p>Generate SQL to update a table given a recordset $rs, and the modified
4612 fields of the array $arrFields (which must be an associative array holding the
4613 column names and the new values) are compared with the current recordset. If
4614 $forceUpdate is true, then we also generate the SQL even if $arrFields is
4615 identical to $rs-&gt;fields. Requires the recordset to be associative. $magicq
4616 is used to indicate whether magic quotes are enabled (see qstr()). The field
4617 names in the array are case-insensitive.</p>
4618
4619 <p>Since 4.52, we allow you to pass the $force type parameter, and this
4620 overrides the <a href="#ADODB_FORCE_TYPE">$ADODB_FORCE_TYPE</a> global
4621 variable. </p>
4622
4623 <p>Since 4.62, the table name to be used can be overridden by setting
4624 $rs-&gt;tableName before AutoExecute(), GetInsertSQL() or GetUpdateSQL() is
4625 called. </p>
4626
4627 <p><b>GetInsertSQL<a name=getinsertsql></a>(&amp;$rs, $arrFields,$magicq=false,$force_type=false)</b></p>
4628
4629 <p>Generate SQL to insert into a table given a recordset $rs. Requires the
4630 query to be associative. $magicq is used to indicate whether magic quotes are
4631 enabled (for qstr()). The field names in the array are case-insensitive.</p>
4632
4633 <p>Since 2.42, you can pass a table name instead of a recordset into
4634 GetInsertSQL (in $rs), and it will generate an insert statement for that table.
4635 </p>
4636
4637 <p>Since 4.52, we allow you to pass the $force_type parameter, and this
4638 overrides the <a href="#ADODB_FORCE_TYPE">$ADODB_FORCE_TYPE</a> global
4639 variable. </p>
4640
4641 <p>Since 4.62, the table name to be used can be overridden by setting
4642 $rs-&gt;tableName before AutoExecute(), GetInsertSQL() or GetUpdateSQL() is
4643 called. </p>
4644
4645 <p><b>PageExecute<a name=pageexecute></a>($sql, $nrows, $page, $inputarr=false)</b>
4646 </p>
4647
4648 <p>Used for pagination of recordset. $page is 1-based. See <a href="#ex8">Example
4649 8</a>.</p>
4650
4651 <p><b>CachePageExecute<a name=cachepageexecute></a>($secs2cache, $sql, $nrows,
4652 $page, $inputarr=false)</b> </p>
4653
4654 <p>Used for pagination of recordset. $page is 1-based. See <a href="#ex8">Example
4655 8</a>. Caching version of PageExecute.</p>
4656
4657 <p><b>Close<a name=close></a>( )</b></p>
4658
4659 <p>Close the database connection. PHP4 proudly states that we no longer have to
4660 clean up at the end of the connection because the reference counting mechanism
4661 of PHP4 will automatically clean up for us.</p>
4662
4663 <p><b>StartTrans<a name=starttrans></a>( )</b></p>
4664
4665 <p>Start a monitored transaction. As SQL statements are executed, ADOdb will
4666 monitor for SQL errors, and if any are detected, when CompleteTrans() is
4667 called, we auto-rollback. </p>
4668
4669 <p>To understand why StartTrans() is superior to BeginTrans(), let us examine a
4670 few ways of using BeginTrans(). The following is the wrong way to use
4671 transactions: </p>
4672
4673 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4674 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4675 style='background:#EEEEEE'>$DB-&gt;BeginTrans();<br>
4676 $DB-&gt;Execute(&quot;update table1 set val=$val1 where id=$id&quot;);<br>
4677 $DB-&gt;Execute(&quot;update table2 set val=$val2 where id=$id&quot;);<br>
4678 $DB-&gt;CommitTrans();</pre></div>
4679
4680 <p>because you perform no error checking. It is possible to update table1 and
4681 for the update on table2 to fail. Here is a better way: </p>
4682
4683 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4684 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4685 style='background:#EEEEEE'>$DB-&gt;BeginTrans();<br>
4686 $ok = $DB-&gt;Execute(&quot;update table1 set val=$val1 where id=$id&quot;);<br>
4687 if ($ok) $ok = $DB-&gt;Execute(&quot;update table2 set val=$val2 where id=$id&quot;);<br>
4688 if ($ok) $DB-&gt;CommitTrans();<br>
4689 else $DB-&gt;RollbackTrans();</pre></div>
4690
4691 <p>Another way is (since ADOdb 2.0): </p>
4692
4693 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4694 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4695 style='background:#EEEEEE'>$DB-&gt;BeginTrans();<br>
4696 $ok = $DB-&gt;Execute(&quot;update table1 set val=$val1 where id=$id&quot;);<br>
4697 if ($ok) $ok = $DB-&gt;Execute(&quot;update table2 set val=$val2 where id=$id&quot;);<br>
4698 $DB-&gt;CommitTrans($ok);</pre></div>
4699
4700 <p>Now it is a headache monitoring $ok all over the place. StartTrans() is an
4701 improvement because it monitors all SQL errors for you. This is particularly
4702 useful if you are calling black-box functions in which SQL queries might be
4703 executed. Also all BeginTrans, CommitTrans and RollbackTrans calls inside a
4704 StartTrans block will be disabled, so even if the black box function does a
4705 commit, it will be ignored. </p>
4706
4707 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4708 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4709 style='background:#EEEEEE'>$DB-&gt;StartTrans();<br>
4710 CallBlackBox();<br>
4711 $DB-&gt;Execute(&quot;update table1 set val=$val1 where id=$id&quot;);<br>
4712 $DB-&gt;Execute(&quot;update table2 set val=$val2 where id=$id&quot;);<br>
4713 $DB-&gt;CompleteTrans();</pre></div>
4714
4715 <p>Note that a StartTrans blocks are nestable, the inner blocks are ignored. </p>
4716
4717 <p><b>CompleteTrans<a name=completetrans></a>($autoComplete=true)</b></p>
4718
4719 <p>Complete a transaction called with StartTrans(). This function monitors for
4720 SQL errors, and will commit if no errors have occured, otherwise it will
4721 rollback. Returns true on commit, false on rollback. If the parameter
4722 $autoComplete is true monitor sql errors and commit and rollback as
4723 appropriate. Set $autoComplete to false to force rollback even if no SQL error
4724 detected. </p>
4725
4726 <p><b>FailTrans<a name=failtrans></a>( )</b></p>
4727
4728 <p>Fail a transaction started with StartTrans(). The rollback will only occur
4729 when CompleteTrans() is called. </p>
4730
4731 <p><b>HasFailedTrans<a name=hasfailedtrans></a>( )</b></p>
4732
4733 <p>Check whether smart transaction has failed, eg. returns true if there was an
4734 error in SQL execution or FailTrans() was called. If not within smart
4735 transaction, returns false. </p>
4736
4737 <p><b>BeginTrans<a name=begintrans></a>( )</b></p>
4738
4739 <p>Begin a transaction. Turns off autoCommit. Returns true if successful. Some
4740 databases will always return false if transaction support is not available. Any
4741 open transactions will be rolled back when the connection is closed. Among the
4742 databases that support transactions are Oracle, PostgreSQL, Interbase, MSSQL,
4743 certain versions of MySQL, DB2, Informix, Sybase, etc.</p>
4744
4745 <p>Note that <a href="#starttrans">StartTrans()</a> and CompleteTrans() is a
4746 superior method of handling transactions, available since ADOdb 3.40. For a
4747 explanation, see the <a href="#starttrans">StartTrans()</a> documentation. </p>
4748
4749 <p>You can also use the ADOdb <a href="#errorhandling">error handler</a> to die
4750 and rollback your transactions for you transparently. Some buggy database
4751 extensions are known to commit all outstanding tranasactions, so you might want
4752 to explicitly do a $DB-&gt;RollbackTrans() in your error handler for safety. </p>
4753
4754 <h4>Detecting Transactions</h4>
4755
4756 <p>Since ADOdb 2.50, you are able to detect when you are inside a transaction.
4757 Check that $connection-&gt;transCnt &gt; 0. This variable is incremented whenever
4758 BeginTrans() is called, and decremented whenever RollbackTrans() or
4759 CommitTrans() is called. </p>
4760
4761 <p><b>CommitTrans<a name=committrans></a>($ok=true)</b></p>
4762
4763 <p>End a transaction successfully. Returns true if successful. If the database
4764 does not support transactions, will return true also as data is always
4765 committed. </p>
4766
4767 <p>If you pass the parameter $ok=false, the data is rolled back. See example in
4768 BeginTrans().</p>
4769
4770 <p><b>RollbackTrans<a name=rollbacktrans></a>( )</b></p>
4771
4772 <p>End a transaction, rollback all changes. Returns true if successful. If the
4773 database does not support transactions, will return false as data is never
4774 rollbacked. </p>
4775
4776 <p><b>SetTransactionMode<a name=SetTransactionMode></a>($mode )</b></p>
4777
4778 <p>SetTransactionMode allows you to pass in the transaction mode to use for all
4779 subsequent transactions. Note: if you have persistent connections and using
4780 mssql or mysql, you might have to explicitly reset your transaction mode at the
4781 beginning of each page request. This is only supported in postgresql, mssql,
4782 mysql with InnoDB and oci8 currently. For example: </p>
4783
4784 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4785 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$db-&gt;SetTransactionMode(&quot;SERIALIZABLE&quot;);</pre><pre>$db-&gt;BeginTrans();</pre><pre>$db-&gt;Execute(...); $db-&gt;Execute(...);</pre><pre>$db-&gt;CommiTrans();</pre><pre><o:p>&nbsp;</o:p></pre><pre>$db-&gt;SetTransactionMode(&quot;&quot;); // restore to default</pre><pre>$db-&gt;StartTrans();</pre><pre>$db-&gt;Execute(...); $db-&gt;Execute(...);</pre><pre>$db-&gt;CompleteTrans();</pre></div>
4786
4787 <p>Supported values to pass in: </p>
4788
4789 <ul type=disc>
4790  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4791      mso-list:l1 level1 lfo10;tab-stops:list 36.0pt'>READ UNCOMMITTED (allows
4792      dirty reads, but fastest) </li>
4793  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4794      mso-list:l1 level1 lfo10;tab-stops:list 36.0pt'>READ COMMITTED (default
4795      postgres, mssql and oci8) </li>
4796  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4797      mso-list:l1 level1 lfo10;tab-stops:list 36.0pt'>REPEATABLE READ (default
4798      mysql) </li>
4799  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
4800      mso-list:l1 level1 lfo10;tab-stops:list 36.0pt'>SERIALIZABLE (slowest and
4801      most restrictive) </li>
4802 </ul>
4803
4804 <p>You can also pass in database specific values such as 'SNAPSHOT' for mssql
4805 or 'READ ONLY' for oci8/postgres. </p>
4806
4807 <p>See transaction levels for <a
4808 href="http://www.postgresql.org/docs/8.1/interactive/sql-set-transaction.html">PostgreSQL</a>,
4809 <a
4810 href="http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_10005.htm">Oracle</a>,
4811 <a href="http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html">MySQL</a>,
4812 and <a href="http://msdn2.microsoft.com/en-US/ms173763.aspx">MS SQL Server</a>.
4813 </p>
4814
4815 <p><b>GetAssoc<a name=getassoc1></a>($sql,$inputarr=false,$force_array=false,$first2cols=false)</b></p>
4816
4817 <p>Returns an associative array for the given query $sql with optional bind
4818 parameters in $inputarr. If the number of columns returned is greater to two, a
4819 2-dimensional array is returned, with the first column of the recordset becomes
4820 the keys to the rest of the rows. If the columns is equal to two, a 1-dimensional
4821 array is created, where the the keys directly map to the values (unless
4822 $force_array is set to true, when an array is created for each value). </p>
4823
4824 <p>Examples:<a name=getassocex></a></p>
4825
4826 <p>We have the following data in a recordset:</p>
4827
4828 <p>row1: Apple, Fruit, Edible<br>
4829 row2: Cactus, Plant, Inedible<br>
4830 row3: Rose, Flower, Edible</p>
4831
4832 <p>GetAssoc will generate the following 2-dimensional associative array:</p>
4833
4834 <p>Apple =&gt; array[Fruit, Edible]<br>
4835 Cactus =&gt; array[Plant, Inedible]<br>
4836 Rose =&gt; array[Flower,Edible]</p>
4837
4838 <p>If the dataset is:</p>
4839
4840 <p>row1: Apple, Fruit<br>
4841 row2: Cactus, Plant<br>
4842 row3: Rose, Flower </p>
4843
4844 <p>GetAssoc will generate the following 1-dimensional associative array (with
4845 $force_array==false):</p>
4846
4847 <p>Apple =&gt; Fruit<br>
4848 Cactus=&gt;Plant<br>
4849 Rose=&gt;Flower </p>
4850
4851 <p>The function returns:</p>
4852
4853 <p>The associative array, or false if an error occurs.</p>
4854
4855 <p><b>CacheGetAssoc<a name=cachegetassoc></a>([$secs2cache,] $sql,$inputarr=false,$force_array=false,$first2cols=false)</b></p>
4856
4857 <p>Caching version of <a href="#getassoc1">GetAssoc</a> function above. </p>
4858
4859 <p><b>GetMedian<a name=getmedian></a>($table, $field, $where='')</b></p>
4860
4861 <p>Returns the median value of $field for $table. The $where clause is
4862 optional. If used, make sure the WHERE is included, as in &quot;WHERE name &gt;
4863 'A'&quot;. If an error occurs, false is returned. Since ADOdb 5.06 and PHP
4864 4.991. </p>
4865
4866 <p><b>GetOne<a name=getone></a>($sql,$inputarr=false)</b></p>
4867
4868 <p>Executes the SQL and returns the first field of the first row. The recordset
4869 and remaining rows are discarded for you automatically. If an error occur,
4870 false is returned; use ErrorNo() or ErrorMsg() to get the error details. Since
4871 4.96/5.00, we return null if no records were found. And since 4.991/5.06, you
4872 can have change the return value if no records are found using the global
4873 variable $ADODB_GETONE_EOF: $ADODB_GETONE_EOF = false;</p>
4874
4875 <p><b>GetRow<a name=getrow></a>($sql,$inputarr=false)</b></p>
4876
4877 <p>Executes the SQL and returns the first row as an array. The recordset and
4878 remaining rows are discarded for you automatically. If no records are returned,
4879 an empty array is returned. If an error occurs, false is returned.</p>
4880
4881 <p><b>GetAll<a name=getall></a>($sql,$inputarr=false)</b></p>
4882
4883 <p>Executes the SQL and returns the all the rows as a 2-dimensional array. The
4884 recordset is discarded for you automatically. If an error occurs, false is
4885 returned. <i>GetArray</i> is a synonym for <i>GetAll</i>.</p>
4886
4887 <p><b>GetCol<a name=getcol></a>($sql,$inputarr=false,$trim=false)</b></p>
4888
4889 <p>Executes the SQL and returns all elements of the first column as a
4890 1-dimensional array. The recordset is discarded for you automatically. If an
4891 error occurs, false is returned.</p>
4892
4893 <p><b>CacheGetOne<a name=cachegetone></a>([$secs2cache,] $sql,$inputarr=false),
4894 CacheGetRow<a name=cachegetrow></a>([$secs2cache,] $sql,$inputarr=false),
4895 CacheGetAll<a name=cachegetall></a>([$secs2cache,] $sql,$inputarr=false),
4896 CacheGetCol<a name=cachegetcol></a>([$secs2cache,]
4897 $sql,$inputarr=false,$trim=false)</b></p>
4898
4899 <p>Similar to above Get* functions, except that the recordset is serialized and
4900 cached in the $ADODB_CACHE_DIR directory for $secs2cache seconds. Good for
4901 speeding up queries on rarely changing data. Note that the $secs2cache
4902 parameter is optional. If omitted, we use the value in
4903 $connection-&gt;cacheSecs (default is 3600 seconds, or 1 hour). </p>
4904
4905 <p><b>Prepare<a name=prepare></a>($sql )</b></p>
4906
4907 <p>Prepares (compiles) an SQL query for repeated execution. Bind parameters are
4908 denoted by ?, except for the oci8 driver, which uses the traditional Oracle
4909 :varname convention. </p>
4910
4911 <p>Returns an array containing the original sql statement in the first array
4912 element; the remaining elements of the array are driver dependent. If there is
4913 an error, or we are emulating Prepare( ), we return the original $sql string.
4914 This is because all error-handling has been centralized in Execute( ).</p>
4915
4916 <p>Prepare( ) cannot be used with functions that use SQL query rewriting
4917 techniques, e.g. PageExecute( ) and SelectLimit( ).</p>
4918
4919 <p>Example:</p>
4920
4921 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4922 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4923 style='background:#EEEEEE'>$stmt = $DB-&gt;Prepare('insert into table (col1,col2) values (?,?)');<br>
4924 for ($i=0; $i &lt; $max; $i++)<br>
4925 <span style='mso-tab-count:1'>         </span>$DB-&gt;Execute($stmt,array((string) rand(), $i));</pre></div>
4926
4927 <p>Also see InParameter(), OutParameter() and PrepareSP() below. Only supported
4928 internally by interbase, oci8 and selected ODBC-based drivers, otherwise it is
4929 emulated. There is no performance advantage to using Prepare() with emulation. </p>
4930
4931 <p>Important: Due to limitations or bugs in PHP, if you are getting errors when
4932 you using prepared queries, try setting $ADODB_COUNTRECS = false before
4933 preparing. This behaviour has been observed with ODBC. </p>
4934
4935 <p><b>IfNull<a name=ifnull></a>($field, $nullReplacementValue)</b></p>
4936
4937 <p>Portable IFNULL function (NVL in Oracle). Returns a string that represents
4938 the function that checks whether a $field is null for the given database, and
4939 if null, change the value returned to $nullReplacementValue. Eg.</p>
4940
4941 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4942 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4943 style='background:#EEEEEE'>$sql = <span style='color:#993300'>'SELECT '</span>.$db-&gt;IfNull('name', <span
4944 style='color:#993300'>&quot;'- unknown -'&quot;</span>).<span style='color:
4945 #993300'> ' FROM table'</span>;</pre></div>
4946
4947 <p><b>length</b><a name=length></a></p>
4948
4949 <p>This is not a function, but a property. Some databases have
4950 &quot;length&quot; and others &quot;len&quot; as the function to measure the
4951 length of a string. To use this property: </p>
4952
4953 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4954 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4955 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span>$sql = <span
4956 style='color:#993300'>&quot;SELECT &quot;</span>.$db-&gt;length.<span
4957 style='color:#993300'>&quot;(field) from table&quot;</span>;<br>
4958 <span style='mso-spacerun:yes'>  </span>$rs = $db-&gt;Execute($sql);</pre></div>
4959
4960 <p><b>random</b><a name=random></a></p>
4961
4962 <p>This is not a function, but a property. This is a string that holds the sql
4963 to generate a random number between 0.0 and 1.0 inclusive. </p>
4964
4965 <p><b>substr</b><a name=substr></a></p>
4966
4967 <p>This is not a function, but a property. Some databases have
4968 &quot;substr&quot; and others &quot;substring&quot; as the function to retrieve
4969 a sub-string. To use this property: </p>
4970
4971 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4972 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4973 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span>$sql = <span
4974 style='color:#993300'>&quot;SELECT &quot;</span>.$db-&gt;substr.<span
4975 style='color:#993300'>&quot;(field, $offset, $length) from table&quot;</span>;<br>
4976 <span style='mso-spacerun:yes'>  </span>$rs = $db-&gt;Execute($sql);</pre></div>
4977
4978 <p>For all databases, the 1st parameter of <i>substr</i> is the field, the 2nd
4979 is the offset (1-based) to the beginning of the sub-string, and the 3rd is the
4980 length of the sub-string. </p>
4981
4982 <p><b>Param<a name=param></a>($name)</b></p>
4983
4984 <p>Generates a bind placeholder portably. For most databases, the bind
4985 placeholder is &quot;?&quot;. However some databases use named bind parameters
4986 such as Oracle, eg &quot;:somevar&quot;. This allows us to portably define an
4987 SQL statement with bind parameters: </p>
4988
4989 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
4990 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
4991 style='background:#EEEEEE'>$sql = <span style='color:#993300'>'insert into table (col1,col2) values ('</span>.$DB-&gt;Param('a').<span
4992 style='color:#993300'>','</span>.$DB-&gt;Param('b').<span style='color:#993300'>')'</span>;<br>
4993 <span style='color:#006600'># generates 'insert into table (col1,col2) values (?,?)'<br>
4994 # or<span style='mso-spacerun:yes'>        </span>'insert into table (col1,col2) values (:a,:b)</span>'<br>
4995 $stmt = $DB-&gt;Prepare($sql);<br>
4996 $stmt = $DB-&gt;Execute($stmt,array('one','two'));</pre></div>
4997
4998 <p><b>PrepareSP<a name=preparesp></a>($sql, $cursor=false )</b></p>
4999
5000 <p>When calling stored procedures in mssql and oci8 (oracle), and you might
5001 want to directly bind to parameters that return values, or for special LOB
5002 handling. PrepareSP() allows you to do so. </p>
5003
5004 <p>Returns the same array or $sql string as Prepare( ) above. If you do not
5005 need to bind to return values, you should use Prepare( ) instead.</p>
5006
5007 <p>The 2nd parameter, $cursor is not used except with oci8. Setting it to true
5008 will force OCINewCursor to be called; this is to support output REF CURSORs. </p>
5009
5010 <p>For examples of usage of PrepareSP( ), see InParameter( ) below. </p>
5011
5012 <p>Note: in the mssql driver, preparing stored procedures requires a special
5013 function call, mssql_init( ), which is called by this function. PrepareSP( ) is
5014 available in all other drivers, and is emulated by calling Prepare( ). </p>
5015
5016 <p><b>InParameter<a name=inparameter></a>($stmt, $var, $name, $maxLen = 4000,
5017 $type = false )</b></p>
5018
5019 <p class=MsoNormal>Binds a PHP variable as input to a stored procedure
5020 variable. The parameter <i>$stmt</i> is the value returned by PrepareSP(), <i>$var</i>
5021 is the PHP variable you want to bind, $name is the name of the stored procedure
5022 variable. Optional is <i>$maxLen</i>, the maximum length of the data to bind,
5023 and $type which is database dependant. Consult <a
5024 href="http://php.net/mssql_bind">mssql_bind</a> and <a
5025 href="http://php.net/ocibindbyname">ocibindbyname</a> docs at php.net for more
5026 info on legal values for $type. </p>
5027
5028 <p>InParameter() is a wrapper function that calls Parameter() with
5029 $isOutput=false. The advantage of this function is that it is self-documenting,
5030 because the $isOutput parameter is no longer needed. Only for mssql and oci8
5031 currently. </p>
5032
5033 <p>Here is an example using oci8: </p>
5034
5035 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5036 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
5037 style='color:green'># For oracle, Prepare and PrepareSP are identical</span></pre><pre>$stmt = $db-&gt;PrepareSP(</pre><pre
5038 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span><span
5039 style='color:#993300'>&quot;declare RETVAL integer; <br>
5040 <span style='mso-tab-count:1'>         </span>begin<br>
5041 <span style='mso-tab-count:1'>         </span>:RETVAL := SP_RUNSOMETHING(:myid,:group);<br>
5042 <span style='mso-tab-count:1'>         </span>end;&quot;</span>);<br>
5043 $db-&gt;InParameter($stmt,$id,'myid');<br>
5044 $db-&gt;InParameter($stmt,$group,'group',64);<br>
5045 $db-&gt;OutParameter($stmt,$ret,'RETVAL');<br>
5046 $db-&gt;Execute($stmt);</pre></div>
5047
5048 <p>The same example using mssql:</p>
5049
5050 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5051 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
5052 style='color:green'># @RETVAL = SP_RUNSOMETHING @myid,@group</span></pre><pre>$stmt = $db-&gt;PrepareSP(<span
5053 style='color:#993333'>'</span><span style='color:#993300'>SP_RUNSOMETHING</span><span
5054 style='color:#993333'>'</span>); <br>
5055 <span style='color:green'># note that the parameter name does not have @ in front!</span></pre><pre>$db-&gt;InParameter($stmt,$id,'myid');</pre><pre>$db-&gt;InParameter($stmt,$group,'group',64);</pre><pre
5056 style='background:#EEEEEE'><span style='color:green'># return value in mssql - RETVAL is hard-coded name</span> <br>
5057 $db-&gt;OutParameter($stmt,$ret,'RETVAL');<br>
5058 $db-&gt;Execute($stmt); </pre></div>
5059
5060 <p>Note that the only difference between the oci8 and mssql implementations is
5061 $sql.</p>
5062
5063 <p>If $type parameter is set to false, in mssql, $type will be dynamicly
5064 determined based on the type of the PHP variable passed <span style='font-family:
5065 "Courier New"'>(string =&gt; SQLCHAR, boolean =&gt;SQLINT1, integer
5066 =&gt;SQLINT4 or float/double=&gt;SQLFLT8)</span>. </p>
5067
5068 <p>In oci8, $type can be set to OCI_B_FILE (Binary-File), OCI_B_CFILE
5069 (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and
5070 OCI_B_ROWID (ROWID). To pass in a null, use<span style='font-family:"Courier New"'>
5071 $db-&gt;Parameter($stmt, $null=null, 'param')</span>. </p>
5072
5073 <p><b>OutParameter<a name=outparameter></a>($stmt, $var, $name, $maxLen = 4000,
5074 $type = false )</b></p>
5075
5076 <p class=MsoNormal>Binds a PHP variable as output from a stored procedure
5077 variable. The parameter <i>$stmt</i> is the value returned by PrepareSP(), <i>$var</i>
5078 is the PHP variable you want to bind, <i>$name</i> is the name of the stored
5079 procedure variable. Optional is <i>$maxLen</i>, the maximum length of the data
5080 to bind, and <i>$type</i> which is database dependant. </p>
5081
5082 <p>OutParameter() is a wrapper function that calls Parameter() with
5083 $isOutput=true. The advantage of this function is that it is self-documenting,
5084 because the $isOutput parameter is no longer needed. Only for mssql and oci8
5085 currently. </p>
5086
5087 <p>For an example, see <a href="#inparameter">InParameter</a>. </p>
5088
5089 <p><b>Parameter<a name=parameter></a>($stmt, $var, $name, $isOutput=false,
5090 $maxLen = 4000, $type = false )</b></p>
5091
5092 <p>Note: This function is deprecated, because of the new InParameter() and
5093 OutParameter() functions. These are superior because they are self-documenting,
5094 unlike Parameter(). </p>
5095
5096 <p>Adds a bind parameter suitable for return values or special data handling
5097 (eg. LOBs) after a statement has been prepared using PrepareSP(). Only for
5098 mssql and oci8 currently. The parameters are:<br>
5099 <br>
5100 $<b><i>stmt</i></b> Statement returned by Prepare() or PrepareSP().<br>
5101 $<b><i>var</i></b> PHP variable to bind to. Make sure you pre-initialize it!<br>
5102 $<b><i>name</i></b> Name of stored procedure variable name to bind to.<br>
5103 [$<b><i>isOutput</i></b>] Indicates direction of parameter 0/false=IN 1=OUT 2=
5104 IN/OUT. This is ignored in oci8 as this driver auto-detects the direction.<br>
5105 [$<b>maxLen</b>] Maximum length of the parameter variable.<br>
5106 [$<b>type</b>] Consult <a href="http://php.net/mssql_bind">mssql_bind</a> and <a
5107 href="http://php.net/ocibindbyname">ocibindbyname</a> docs at php.net for more
5108 info on legal values for type.</p>
5109
5110 <p>Lastly, in oci8, bind parameters can be reused without calling PrepareSP( ) or
5111 Parameters again. This is not possible with mssql. An oci8 example:</p>
5112
5113 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5114 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre>$id = 0; $i = 0;<br>
5115 $stmt = $db-&gt;PrepareSP( <span style='color:#993300'>&quot;update table set val=:i where id=:id&quot;</span>);<br>
5116 $db-&gt;Parameter($stmt,$id,'id');<br>
5117 $db-&gt;Parameter($stmt,$i, 'i');<br>
5118 for ($cnt=0; $cnt &lt; 1000; $cnt++) {<br>
5119 <span style='mso-tab-count:1'>         </span>$id = $cnt; <br>
5120 <span style='mso-tab-count:1'>         </span>$i = $cnt * $cnt; <span
5121 style='color:green'># works with oci8!</span></pre><pre style='background:#EEEEEE'><span
5122 style='mso-tab-count:1'>         </span>$db-&gt;Execute($stmt); <br>
5123 }</pre></div>
5124
5125 <p><b>Bind<a name=bind></a>($stmt, $var, $size=4001, $type=false, $name=false)</b></p>
5126
5127 <p>This is a low-level function supported only by the oci8 driver. <b>Avoid
5128 using</b> unless you only want to support Oracle. The Parameter( ) function is
5129 the recommended way to go with bind variables.</p>
5130
5131 <p>Bind( ) allows you to use bind variables in your sql statement. This binds a
5132 PHP variable to a name defined in an Oracle sql statement that was previously
5133 prepared using Prepare(). Oracle named variables begin with a colon, and ADOdb
5134 requires the named variables be called :0, :1, :2, :3, etc. The first
5135 invocation of Bind() will match :0, the second invocation will match :1, etc.
5136 Binding can provide 100% speedups for insert, select and update statements. </p>
5137
5138 <p>The other variables, $size sets the buffer size for data storage, $type is
5139 the optional descriptor type OCI_B_FILE (Binary-File), OCI_B_CFILE
5140 (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and
5141 OCI_B_ROWID (ROWID). Lastly, instead of using the default :0, :1, etc names,
5142 you can define your own bind-name using $name. </p>
5143
5144 <p>The following example shows 3 bind variables being used: p1, p2 and p3.
5145 These variables are bound to :0, :1 and :2.</p>
5146
5147 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5148 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5149 style='background:#EEEEEE'>$stmt = $DB-&gt;Prepare(&quot;insert into table (col0, col1, col2) values (:0, :1, :2)&quot;);<br>
5150 $DB-&gt;Bind($stmt, $p1);<br>
5151 $DB-&gt;Bind($stmt, $p2);<br>
5152 $DB-&gt;Bind($stmt, $p3);<br>
5153 for ($i = 0; $i &lt; $max; $i++) { <br>
5154 <span style='mso-spacerun:yes'>   </span>$p1 = ?; $p2 = ?; $p3 = ?;<br>
5155 <span style='mso-spacerun:yes'>   </span>$DB-&gt;Execute($stmt);<br>
5156 }</pre></div>
5157
5158 <p>You can also use named variables:</p>
5159
5160 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5161 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5162 style='background:#EEEEEE'>$stmt = $DB-&gt;Prepare(&quot;insert into table (col0, col1, col2) values (:name0, :name1, :name2)&quot;);<br>
5163 $DB-&gt;Bind($stmt, $p1, &quot;name0&quot;);<br>
5164 $DB-&gt;Bind($stmt, $p2, &quot;name1&quot;);<br>
5165 $DB-&gt;Bind($stmt, $p3, &quot;name2&quot;);<br>
5166 for ($i = 0; $i &lt; $max; $i++) { <br>
5167 <span style='mso-spacerun:yes'>   </span>$p1 = ?; $p2 = ?; $p3 = ?;<br>
5168 <span style='mso-spacerun:yes'>   </span>$DB-&gt;Execute($stmt);<br>
5169 }</pre></div>
5170
5171 <p><b>LogSQL($enable=true)</b><a name=logsql></a></p>
5172
5173 <p class=MsoNormal>Call this method to install a SQL logging and timing
5174 function (using fnExecute). Then all SQL statements are logged into an
5175 adodb_logsql table in a database. If the adodb_logsql table does not exist,
5176 ADOdb will create the table if you have the appropriate permissions. Returns
5177 the previous logging value (true for enabled, false for disabled). Here are
5178 samples of the DDL for selected databases: </p>
5179
5180 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5181 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
5182 style='mso-tab-count:2'>                 </span><b>mysql:</b></pre><pre><span
5183 style='mso-tab-count:2'>                 </span>CREATE TABLE adodb_logsql (</pre><pre><span
5184 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>created datetime NOT NULL,</pre><pre><span
5185 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql0 varchar(250) NOT NULL,</pre><pre><span
5186 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql1 text NOT NULL,</pre><pre><span
5187 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>params text NOT NULL,</pre><pre><span
5188 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>tracer text NOT NULL,</pre><pre><span
5189 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>timer decimal(16,6) NOT NULL</pre><pre><span
5190 style='mso-tab-count:2'>                 </span>)</pre><pre><span
5191 style='mso-tab-count:2'>                 </span></pre><pre><span
5192 style='mso-tab-count:2'>                 </span><b>postgres:</b></pre><pre><span
5193 style='mso-tab-count:2'>                 </span>CREATE TABLE adodb_logsql (</pre><pre><span
5194 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>created timestamp NOT NULL,</pre><pre><span
5195 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql0 varchar(250) NOT NULL,</pre><pre><span
5196 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql1 text NOT NULL,</pre><pre><span
5197 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>params text NOT NULL,</pre><pre><span
5198 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>tracer text NOT NULL,</pre><pre><span
5199 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>timer decimal(16,6) NOT NULL</pre><pre><span
5200 style='mso-tab-count:2'>                 </span>)</pre><pre><span
5201 style='mso-tab-count:2'>                 </span></pre><pre><span
5202 style='mso-tab-count:2'>                 </span><b>mssql:</b></pre><pre><span
5203 style='mso-tab-count:2'>                 </span>CREATE TABLE adodb_logsql (</pre><pre><span
5204 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>created datetime NOT NULL,</pre><pre><span
5205 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql0 varchar(250) NOT NULL,</pre><pre><span
5206 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql1 varchar(4000) NOT NULL,</pre><pre><span
5207 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>params varchar(3000) NOT NULL,</pre><pre><span
5208 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>tracer varchar(500) NOT NULL,</pre><pre><span
5209 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>timer decimal(16,6) NOT NULL</pre><pre><span
5210 style='mso-tab-count:2'>                 </span>)</pre><pre><span
5211 style='mso-tab-count:2'>                 </span></pre><pre><span
5212 style='mso-tab-count:2'>                 </span><b>oci8:</b></pre><pre><span
5213 style='mso-tab-count:2'>                 </span>CREATE TABLE adodb_logsql (</pre><pre><span
5214 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>created date NOT NULL,</pre><pre><span
5215 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql0 varchar(250) NOT NULL,</pre><pre><span
5216 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>sql1 varchar(4000) NOT NULL,</pre><pre><span
5217 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>params varchar(4000),</pre><pre><span
5218 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>tracer varchar(4000),</pre><pre><span
5219 style='mso-tab-count:2'>                 </span><span style='mso-spacerun:yes'>  </span>timer decimal(16,6) NOT NULL</pre><pre><span
5220 style='mso-tab-count:2'>                 </span>)</pre></div>
5221
5222 <p class=MsoNormal>Usage: </p>
5223
5224 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5225 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5226 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$conn-&gt;LogSQL(); // turn on logging<br>
5227 <span style='mso-tab-count:1'>         </span><span style='mso-spacerun:yes'>  </span>:<br>
5228 <span style='mso-tab-count:1'>         </span>$conn-&gt;Execute(...);<br>
5229 <span style='mso-tab-count:1'>         </span><span style='mso-spacerun:yes'>  </span>:<br>
5230 <span style='mso-tab-count:1'>         </span>$conn-&gt;LogSQL(false); // turn off logging<br>
5231 <span style='mso-tab-count:1'>         </span><br>
5232 <span style='mso-tab-count:1'>         </span># output summary of SQL logging results<br>
5233 <span style='mso-tab-count:1'>         </span>$perf = NewPerfMonitor($conn);<br>
5234 <span style='mso-tab-count:1'>         </span>echo $perf-&gt;SuspiciousSQL();<br>
5235 <span style='mso-tab-count:1'>         </span>echo $perf-&gt;ExpensiveSQL();</pre></div>
5236
5237 <p>One limitation of logging is that rollback also prevents SQL from being
5238 logged. </p>
5239
5240 <p>If you prefer to use another name for the table used to store the SQL, you
5241 can override it by calling adodb_perf::table($tablename), where $tablename is
5242 the new table name (you will still need to manually create the table yourself).
5243 An example: </p>
5244
5245 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5246 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5247 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>include('adodb.inc.php');<br>
5248 <span style='mso-tab-count:1'>         </span>include('adodb-perf.inc.php');<br>
5249 <span style='mso-tab-count:1'>         </span>adodb_perf::table('my_logsql_table');</pre></div>
5250
5251 <p class=MsoNormal>Also see <a href="docs-perf.htm">Performance Monitor</a>. </p>
5252
5253 <p><b>fnExecute and fnCacheExecute properties</b><a name=fnexecute
5254 id=fnexecute></a></p>
5255
5256 <p>These two properties allow you to define bottleneck functions for all sql
5257 statements processed by ADOdb. This allows you to perform statistical analysis
5258 and query-rewriting of your sql. </p>
5259
5260 <p><b>Examples of fnExecute</b></p>
5261
5262 <p>Here is an example of using fnExecute, to count all cached queries and
5263 non-cached queries, you can do this:</p>
5264
5265 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5266 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span
5267 style='color:#006600'># $db is the connection object</span></pre><pre>function &amp;CountExecs($db, $sql, $inputarray)</pre><pre>{</pre><pre>global $EXECS;</pre><pre><o:p>&nbsp;</o:p></pre><pre><span
5268 style='mso-tab-count:1'>         </span>if (!is_array(inputarray)) $EXECS++;</pre><pre><span
5269 style='mso-tab-count:1'>         </span><span style='color:#006600'># handle 2-dimensional input arrays</span></pre><pre><span
5270 style='mso-tab-count:1'>         </span>else if (is_array(reset($inputarray))) $EXECS += sizeof($inputarray);</pre><pre><span
5271 style='mso-tab-count:1'>         </span>else $EXECS++;</pre><pre><span
5272 style='mso-tab-count:1'>         </span></pre><pre><span style='mso-tab-count:
5273 1'>         </span><span style='color:#006600'># in PHP4.4 and PHP5, we need to return a value by reference</span></pre><pre><span
5274 style='mso-tab-count:1'>         </span>$null = null;</pre><pre><span
5275 style='mso-tab-count:1'>         </span>return $null;</pre><pre>}</pre><pre><o:p>&nbsp;</o:p></pre><pre><span
5276 style='color:#006600'># $db is the connection object</span></pre><pre>function CountCachedExecs($db, $secs2cache, $sql, $inputarray)</pre><pre
5277 style='background:#EEEEEE'>{<br>
5278 global $CACHED; $CACHED++;<br>
5279 }<br>
5280 <br>
5281 $db = NewADOConnection('mysql');<br>
5282 $db-&gt;Connect(...);<br>
5283 $db-&gt;<strong><span style='font-family:"Courier New"'>fnExecute</span></strong> = 'CountExecs';<br>
5284 $db-&gt;<strong><span style='font-family:"Courier New"'>fnCacheExecute</span></strong> = 'CountCachedExecs';<br>
5285 <span style='mso-spacerun:yes'> </span>:<br>
5286 <span style='mso-spacerun:yes'> </span>:<br>
5287 <span style='color:#006600'># After many sql statements:</span>`<br>
5288 printf(&quot;&lt;p&gt;Total queries=%d; total cached=%d&lt;/p&gt;&quot;,$EXECS+$CACHED, $CACHED);</pre></div>
5289
5290 <p>The fnExecute function is called before the sql is parsed and executed, so
5291 you can perform a query rewrite. If you are passing in a prepared statement,
5292 then $sql is an array (see <a href="#prepare">Prepare</a>). The fnCacheExecute
5293 function is only called if the recordset returned was cached. The function
5294 parameters match the Execute and CacheExecute functions respectively, except
5295 that $this (the connection object) is passed as the first parameter.</p>
5296
5297 <p>Since ADOdb 3.91, the behaviour of fnExecute varies depending on whether the
5298 defined function returns a value. If it does not return a value, then the $sql
5299 is executed as before. This is useful for query rewriting or counting sql
5300 queries. </p>
5301
5302 <p>On the other hand, you might want to replace the Execute function with one
5303 of your own design. If this is the case, then have your function return a
5304 value. If a value is returned, that value is returned immediately, without any
5305 further processing. This is used internally by ADOdb to implement LogSQL()
5306 functionality. </p>
5307
5308 <div class=MsoNormal align=center style='text-align:center'>
5309
5310 <hr size=2 width="100%" align=center>
5311
5312 </div>
5313
5314 <h3>ADOConnection Utility Functions</h3>
5315
5316 <p><b>BlankRecordSet<a name=blankrecordset></a>([$queryid])</b></p>
5317
5318 <p>No longer available - removed since 1.99.</p>
5319
5320 <p><b>Concat<a name=concat></a>($s1,$s2,....)</b></p>
5321
5322 <p>Generates the sql string used to concatenate $s1, $s2, etc together. Uses
5323 the string in the concat_operator field to generate the concatenation. Override
5324 this function if a concatenation operator is not used, eg. MySQL.</p>
5325
5326 <p>Returns the concatenated string.</p>
5327
5328 <p><b>DBDate<a name=dbdate></a>($date)</b></p>
5329
5330 <p>Format the $<b>date</b> in the format the database accepts - the return
5331 string is also quoted. This is used when you are sending dates to the database
5332 (eg INSERT, UPDATE or where clause of SELECT statement). The $<b>date</b>
5333 parameter can be a PHP DateTime object (since ADOdb 5.09), a Unix integer timestamp or an ISO format Y-m-d. Uses the
5334 fmtDate field, which holds the format to use. If null or false or '' is passed
5335 in, it will be converted to an SQL null.</p>
5336
5337 <p>Returns the date as a quoted string.</p>
5338
5339 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5340 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
5341 style='mso-tab-count:1'>         </span>$sql = &quot;select * from atable where created &gt; &quot;.$db-&gt;DBDate(&quot;$year-$month-$day&quot;);</pre><pre><span
5342 style='mso-tab-count:1'>         </span>$db-&gt;Execute($sql);</pre></div>
5343
5344 <p>Note to retrieve a date column in a specific format, use <a href="#sqldate">SQLDate</a>.
5345 </p>
5346
5347 <p><b>BindDate<a name=binddate></a>($date)</b></p>
5348
5349 <p>Format the $<b>date</b> in the bind format the database accepts. Normally
5350 this means that the date string is not quoted, unlike DBDate, which quotes the
5351 string. </p>
5352
5353 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5354 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
5355 style='mso-tab-count:1'>         </span>$sql = &quot;select * from atable where created &gt; &quot;.$db-&gt;Param('0');</pre><pre><span
5356 style='mso-tab-count:1'>         </span>// or</pre><pre><span style='mso-tab-count:
5357 1'>         </span>$sql = &quot;select * from atable where created &gt; ?&quot;;</pre><pre><span
5358 style='mso-tab-count:1'>         </span>$db-&gt;Execute($sql,array($db-&gt;BindDate(&quot;$year-$month-$day&quot;));</pre></div>
5359
5360 <p><b>DBTimeStamp<a name=dbtimestamp></a>($ts)</b></p>
5361
5362 <p>Format the timestamp $<b>ts</b> in the format the database accepts; this can
5363 be a PHP DateTime object (since ADOdb 5.09), a Unix integer timestamp or an ISO format Y-m-d H:i:s. Uses the fmtTimeStamp
5364 field, which holds the format to use. If null or false or '' is passed in, it
5365 will be converted to an SQL null.</p>
5366
5367 <p>Returns the timestamp as a quoted string.</p>
5368
5369 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5370 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
5371 style='mso-tab-count:1'>         </span>$sql = &quot;select * from atable where created &gt; &quot;.$db-&gt;DBTimeStamp(&quot;$year-$month-$day $hr:$min:$secs&quot;);</pre><pre><span
5372 style='mso-tab-count:1'>         </span>$db-&gt;Execute($sql);</pre></div>
5373
5374 <p><b>BindTimeStamp<a name=bindtimestamp></a>($ts)</b></p>
5375
5376 <p>Format the timestamp $<b>ts</b> in the bind format the database accepts.
5377 Normally this means that the timestamp string is not quoted, unlike
5378 DBTimeStamp, which quotes the string. </p>
5379
5380 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5381 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span
5382 style='mso-tab-count:1'>         </span>$sql = &quot;select * from atable where created &gt; &quot;.$db-&gt;Param('0');</pre><pre><span
5383 style='mso-tab-count:1'>         </span>// or</pre><pre><span style='mso-tab-count:
5384 1'>         </span>$sql = &quot;select * from atable where created &gt; ?&quot;;</pre><pre><span
5385 style='mso-tab-count:1'>         </span>$db-&gt;Execute($sql,array($db-&gt;BindTimeStamp(&quot;$year-$month-$day $hr:$min:$secs&quot;));</pre></div>
5386
5387 <p><b>qstr<a name=qstr></a>($s,[$magic_quotes_enabled</b>=false]<b>)</b></p>
5388
5389 <p>Quotes a string to be sent to the database. The $<b>magic_quotes_enabled</b>
5390 parameter may look funny, but the idea is if you are quoting a string extracted
5391 from a POST/GET variable, then pass get_magic_quotes_gpc() as the second
5392 parameter. This will ensure that the variable is not quoted twice, once by <i>qstr</i>
5393 and once by the <i>magic_quotes_gpc</i>.</p>
5394
5395 <p>Eg.<span style='font-family:"Courier New"'> $s = $db-&gt;qstr(HTTP_GET_VARS['name'],get_magic_quotes_gpc());</span></p>
5396
5397 <p>Returns the quoted string.</p>
5398
5399 <p><b>Quote<a name=quote></a>($s)</b></p>
5400
5401 <p>Quotes the string $s, escaping the database specific quote character as
5402 appropriate. Formerly checked magic quotes setting, but this was disabled since
5403 3.31 for compatibility with PEAR DB. </p>
5404
5405 <p><b>Affected_Rows<a name="affected_rows"></a>( )</b></p>
5406
5407 <p>Returns the number of rows affected by a update or delete statement. Returns
5408 false if function not supported.</p>
5409
5410 <p>Not supported by interbase/firebird currently. </p>
5411
5412 <p><b>Insert_ID<a name="inserted_id"></a>( )</b></p>
5413
5414 <p>Returns the last autonumbering ID inserted. Returns false if function not
5415 supported. </p>
5416
5417 <p>Only supported by databases that support auto-increment or object id's, such
5418 as PostgreSQL, MySQL and MS SQL Server currently. PostgreSQL returns the OID,
5419 which can change on a database reload.</p>
5420
5421 <p><b>RowLock<a name=rowlock></a>($table,$where)</b></p>
5422
5423 <p>Lock a table row for the duration of a transaction. For example to lock
5424 record $id in table1: </p>
5425
5426 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5427 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5428 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$DB-&gt;StartTrans();<br>
5429 <span style='mso-tab-count:1'>         </span>$DB-&gt;RowLock(&quot;table1&quot;,&quot;rowid=$id&quot;);<br>
5430 <span style='mso-tab-count:1'>         </span>$DB-&gt;Execute($sql1);<br>
5431 <span style='mso-tab-count:1'>         </span>$DB-&gt;Execute($sql2);<br>
5432 <span style='mso-tab-count:1'>         </span>$DB-&gt;CompleteTrans();</pre></div>
5433
5434 <p>Supported in db2, interbase, informix, mssql, oci8, postgres, sybase. </p>
5435
5436 <p><b>MetaDatabases<a name=metadatabases></a>()</b></p>
5437
5438 <p>Returns a list of databases available on the server as an array. You have to
5439 connect to the server first. Only available for ODBC, MySQL and ADO.</p>
5440
5441 <p><b>MetaTables<a name=metatables></a>($ttype = false, $showSchema = false,
5442 $mask=false)</b></p>
5443
5444 <p>Returns an array of tables and views for the current database as an array.
5445 The array should exclude system catalog tables if possible. To only show
5446 tables, use $db-&gt;MetaTables('TABLES'). To show only views, use
5447 $db-&gt;MetaTables('VIEWS'). The $showSchema parameter currently works only for
5448 DB2, and when set to true, will add the schema name to the table, eg.
5449 &quot;SCHEMA.TABLE&quot;. </p>
5450
5451 <p>You can define a mask for matching. For example, setting $mask = 'TMP%' will
5452 match all tables that begin with 'TMP'. Currently only mssql, oci8, odbc_mssql
5453 and postgres* support $mask. </p>
5454
5455 <p><b>MetaColumns<a name=metacolumns></a>($table,$notcasesensitive=true)</b></p>
5456
5457 <p>Returns an array of ADOFieldObject's, one field object for every column of
5458 $table. A field object is a class instance with (name, type, max_length)
5459 defined. Currently Sybase does not recognise date types, and ADO cannot
5460 identify the correct data type (so we default to varchar). </p>
5461
5462 <p>The $notcasesensitive parameter determines whether we uppercase or lowercase
5463 the table name to normalize it (required for some databases). Does not work
5464 with MySQL ISAM tables. </p>
5465
5466 <p>For schema support, pass in the $table parameter,
5467 &quot;$schema.$tablename&quot;. This is only supported for selected databases. </p>
5468
5469 <p><b>MetaColumnNames<a name=metacolumnames></a>($table,$numericIndex=false)</b></p>
5470
5471 <p>Returns an array of column names for $table. Since ADOdb 4.22, this is an
5472 associative array, with the keys in uppercase. Set $numericIndex=true if you
5473 want the old behaviour of numeric indexes (since 4.23). </p>
5474
5475 <p>e.g. array('FIELD1' =&gt; 'Field1', 'FIELD2'=&gt;'Field2') </p>
5476
5477 <p><b>MetaPrimaryKeys<a name=metaprimarykeys></a>($table, $owner=false)</b> </p>
5478
5479 <p>Returns an array containing column names that are the primary keys of
5480 $table. Supported by mysql, odbc (including db2, odbc_mssql, etc), mssql,
5481 postgres, interbase/firebird, oci8 currently. </p>
5482
5483 <p>Views (and some tables) have primary keys, but sometimes this information is
5484 not available from the database. You can define a function
5485 ADODB_View_PrimaryKeys($databaseType, $database, $view, $owner) that should
5486 return an array containing the fields that make up the primary key. If that
5487 function exists, it will be called when MetaPrimaryKeys() cannot find a primary
5488 key for a table or view. </p>
5489
5490 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5491 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5492 style='background:#EEEEEE'>// In this example: dbtype = 'oci8', $db = 'mydb', $view = 'dataView', $owner = false <br>
5493 function ADODB_View_PrimaryKeys($dbtype,$db,$view,$owner)<br>
5494 {<br>
5495 <span style='mso-tab-count:1'>         </span>switch(strtoupper($view)) {<br>
5496 <span style='mso-tab-count:1'>         </span>case 'DATAVIEW': return array('DATAID');<br>
5497 <span style='mso-tab-count:1'>         </span>default: return false;<br>
5498 <span style='mso-tab-count:1'>         </span>}<br>
5499 }<br>
5500 <br>
5501 $db = NewADOConnection('oci8');<br>
5502 $db-&gt;Connect('localhost','root','','mydb'); <br>
5503 $db-&gt;MetaPrimaryKeys('dataView');</pre></div>
5504
5505 <p><b>ServerInfo<a name=serverinfo id=serverinfo></a>()</b> </p>
5506
5507 <p>Returns an array of containing two elements 'description' and 'version'. The
5508 'description' element contains the string description of the database. The
5509 'version' naturally holds the version number (which is also a string).</p>
5510
5511 <p><b>SetCharSet<a name=setcharset id=setcharset></a>($charset)</b> </p>
5512
5513 <p>Set the charset of the connection. The parameter passed in is dependent on the actual database RDBMS. e.g.
5514 <pre>
5515         $DB->SetCharSet('utf8'); // for mysql
5516 </pre>
5517 This is database driver specific and only supported for mysql, mysqlt, mysqli, and also postgres7 and later.</p>
5518
5519 <p><b>MetaForeignKeys<a name=metaforeignkeys></a>($table, $owner=false,
5520 $upper=false)</b> </p>
5521
5522 <p>Returns an associate array of foreign keys, or false if not supported. For
5523 example, if table employee has a foreign key where employee.deptkey points to
5524 dept_table.deptid, and employee.posn=posn_table.postionid and
5525 employee.poscategory=posn_table.category, then
5526 $conn-&gt;MetaForeignKeys('employee') will return </p>
5527
5528 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5529 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5530 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>array(<br>
5531 <span style='mso-tab-count:2'>                 </span>'dept_table' =&gt; array('deptkey=deptid'),<br>
5532 <span style='mso-tab-count:2'>                 </span>'posn_table' =&gt; array('posn=positionid','poscategory=category')<br>
5533 <span style='mso-tab-count:1'>         </span>)</pre></div>
5534
5535 <p>The optional schema or owner can be defined in $owner. If $upper is true,
5536 then the table names (array keys) are upper-cased. </p>
5537
5538 <div class=MsoNormal align=center style='text-align:center'>
5539
5540 <hr size=2 width="100%" align=center>
5541
5542 </div>
5543
5544 <h2>ADORecordSet<a name=adorecordset></a></h2>
5545
5546 <p>When an SQL statement successfully is executed by <span style='font-family:
5547 "Courier New"'>ADOConnection-&gt;Execute($sql),</span>an ADORecordSet object is
5548 returned. This object contains a virtual cursor so we can move from row to row,
5549 functions to obtain information about the columns and column types, and helper
5550 functions to deal with formating the results to show to the user.</p>
5551
5552 <h3>ADORecordSet Fields</h3>
5553
5554 <p><b>fields: </b>Array containing the current row. This is not associative,
5555 but is an indexed array from 0 to columns-1. See also the function <b><a
5556 href="#fields">Fields</a></b>, which behaves like an associative array.</p>
5557
5558 <p><b>dataProvider</b>: The underlying mechanism used to connect to the
5559 database. Normally set to <b>native</b>, unless using <b>odbc</b> or <b>ado</b>.</p>
5560
5561 <p><b>blobSize</b>: Maximum size of a char, string or varchar object before it
5562 is treated as a Blob (Blob's should be shown with textarea's). See the <a
5563 href="#metatype">MetaType</a> function.</p>
5564
5565 <p><b>sql</b>: Holds the sql statement used to generate this record set.</p>
5566
5567 <p><b>canSeek</b>: Set to true if Move( ) function works.</p>
5568
5569 <p><b>EOF</b>: True if we have scrolled the cursor past the last record.</p>
5570
5571 <h3>ADORecordSet Functions</h3>
5572
5573 <p><b>ADORecordSet( )</b></p>
5574
5575 <p>Constructer. Normally you never call this function yourself.</p>
5576
5577 <p><b>GetAssoc<a name=getassoc></a>([$force_array])</b></p>
5578
5579 <p>Generates an associative array from the recordset. Note that is this
5580 function is also <a href="#getassoc1">available</a> in the connection object.
5581 More details can be found there.</p>
5582
5583 <p><b>GetArray<a name=getarray></a>([$number_of_rows])</b></p>
5584
5585 <p>Generate a 2-dimensional array of records from the current cursor position,
5586 indexed from 0 to $number_of_rows - 1. If $number_of_rows is undefined, till
5587 EOF.</p>
5588
5589 <p><b>GetRows<a name=getrows></a>([$number_of_rows])</b></p>
5590
5591 <p class=MsoNormal>Generate a 2-dimensional array of records from the current
5592 cursor position. Synonym for GetArray() for compatibility with Microsoft ADO. </p>
5593
5594 <p><b>GetMenu<a name=getmenu></a>($name, [$default_str=''],
5595 [$blank1stItem=true], [$multiple_select=false], [$size=0], [$moreAttr=''])</b></p>
5596
5597 <p>Generate a HTML menu
5598 (&lt;select&gt;&lt;option&gt;&lt;option&gt;&lt;/select&gt;). The first column
5599 of the recordset (fields[0]) will hold the string to display in the option
5600 tags. If the recordset has more than 1 column, the second column (fields[1]) is
5601 the value to send back to the web server.. The menu will be given the name $<i>name</i>.
5602 </p>
5603
5604 <p>If $<i>default_str</i> is defined, then if $<i>default_str</i> == fields[0],
5605 that field is selected. If $<i>blank1stItem</i> is true, the first option is
5606 empty. You can also set the first option strings by setting $blank1stItem =
5607 &quot;$value:$text&quot;.</p>
5608
5609 <p>$<i>Default_str</i> can be array for a multiple select listbox.</p>
5610
5611 <p>To get a listbox, set the $<i>size</i> to a non-zero value (or pass
5612 $default_str as an array). If $<i>multiple_select</i> is true then a listbox
5613 will be generated with $<i>size</i> items (or if $size==0, then 5 items)
5614 visible, and we will return an array to a server. Lastly use $<i>moreAttr </i>to
5615 add additional attributes such as javascript or styles. </p>
5616
5617 <p>Menu Example 1: <code><span style='font-size:10.0pt'>GetMenu('menu1','A',true)</span></code>
5618 will generate a menu: <SELECT NAME="menu1">
5619 <OPTION>
5620 <OPTION SELECTED VALUE="1">A
5621 <OPTION VALUE="2">B
5622 <OPTION VALUE="3">C
5623 </SELECT>for
5624 the data (A,1), (B,2), (C,3). Also see <a href="#ex5">example 5</a>.</p>
5625
5626 <p>Menu Example 2: For the same data, <code><span style='font-size:10.0pt'>GetMenu('menu1',array('A','B'),false)</span></code>
5627 will generate a menu with both A and B selected: <br>
5628 <SELECT MULTIPLE NAME="menu1" SIZE="3">
5629 <OPTION SELECTED VALUE="1">A
5630 <OPTION SELECTED VALUE="2">B
5631 <OPTION VALUE="3">C
5632 </SELECT></p>
5633
5634 <p><b>GetMenu2<a name=getmenu2></a>($name, [$default_str=''],
5635 [$blank1stItem=true], [$multiple_select=false], [$size=0], [$moreAttr=''])</b></p>
5636
5637 <p>This is nearly identical to GetMenu, except that the $<i>default_str</i> is
5638 matched to fields[1] (the option values).</p>
5639
5640 <p>Menu Example 3: Given the data in menu example 2, <code><span
5641 style='font-size:10.0pt'>GetMenu2('menu1',array('1','2'),false)</span></code>
5642 will generate a menu with both A and B selected in menu example 2, but this
5643 time the selection is based on the 2nd column, which holds the values to return
5644 to the Web server. </p>
5645
5646 <p><b>UserDate<a name=userdate></a>($str, [$fmt])</b></p>
5647
5648 <p>Converts the date string $<i>str</i> to another format. The date format is
5649 Y-m-d, or Unix timestamp format. The default $<i>fmt</i> is Y-m-d.</p>
5650
5651 <p><b>UserTimeStamp<a name=usertimestamp></a>($str, [$fmt])</b></p>
5652
5653 <p>Converts the timestamp string $<b>str</b> to another format. The timestamp
5654 format is Y-m-d H:i:s, as in '2002-02-28 23:00:12', or Unix timestamp format.
5655 UserTimeStamp calls UnixTimeStamp to parse $<i>str</i>, and $<i>fmt</i>
5656 defaults to Y-m-d H:i:s if not defined. </p>
5657
5658 <p><b>UnixDate<a name=unixdate></a>($str)</b></p>
5659
5660 <p>Parses the date string $<b>str</b> and returns it in unix mktime format (eg.
5661 a number indicating the seconds after January 1st, 1970). Expects the date to
5662 be in Y-m-d H:i:s format, except for Sybase and Microsoft SQL Server, where M d
5663 Y is also accepted (the 3 letter month strings are controlled by a global
5664 array, which might need localisation).</p>
5665
5666 <p>This function is available in both ADORecordSet and ADOConnection since
5667 1.91.</p>
5668
5669 <p><b>UnixTimeStamp<a name=unixtimestamp></a>($str)</b></p>
5670
5671 <p>Parses the timestamp string $<b>str</b> and returns it in unix mktime format
5672 (eg. a number indicating the seconds after January 1st, 1970). Expects the date
5673 to be in &quot;Y-m-d, H:i:s&quot; (1970-12-24, 00:00:00) or &quot;Y-m-d
5674 H:i:s&quot; (1970-12-24 00:00:00) or &quot;YmdHis&quot; (19701225000000)
5675 format, except for Sybase and Microsoft SQL Server, where &quot;M d Y
5676 h:i:sA&quot; (Dec 25 1970 00:00:00AM) is also accepted (the 3 letter month
5677 strings are controlled by a global array, which might need localisation).</p>
5678
5679 <p>This function is available in both ADORecordSet and ADOConnection since
5680 1.91. </p>
5681
5682 <p><b>OffsetDate<a name=OffsetDate></a>($dayFraction, $basedate=false)</b></p>
5683
5684 <p>Returns a string with the native SQL functions to calculate future and past
5685 dates based on $basedate in a portable fashion. If $basedate is not defined,
5686 then the current date (at 12 midnight) is used. Returns the SQL string that
5687 performs the calculation when passed to Execute(). </p>
5688
5689 <p>For example, in Oracle, to find the date and time that is 2.5 days from
5690 today, you can use:</p>
5691
5692 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5693 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5694 style='background:#EEEEEE'># get date one week from now<br>
5695 $fld = $conn-&gt;OffsetDate(7); // returns &quot;(trunc(sysdate)+7&quot;)</pre><pre># get date and time that is 60 hours from current date and time<br>
5696 $fld = $conn-&gt;OffsetDate(2.5, $conn-&gt;sysTimeStamp);<span
5697 style='mso-tab-count:1'> </span>// returns &quot;(sysdate+2.5)&quot;<br>
5698 <br>
5699 $conn-&gt;Execute(&quot;UPDATE TABLE SET dodate=$fld WHERE ID=$id&quot;);</pre></div>
5700
5701 <p>This function is available for mysql, mssql, oracle, oci8 and postgresql
5702 drivers since 2.13. It might work with other drivers provided they allow
5703 performing numeric day arithmetic on dates.</p>
5704
5705 <p><b>SQLDate<a name=sqldate></a>($dateFormat, $basedate=false)</b></p>
5706
5707 <p class=MsoNormal>Returns a string which contains the native SQL functions to
5708 format a date or date column $basedate. This is used when retrieving date
5709 columns in SELECT statements. For sending dates to the database (eg. in UPDATE,
5710 INSERT or the where clause of SELECT statements) use <a href="#dbdate">DBDate</a>.
5711 It uses a case-sensitive $dateFormat, which supports: </p>
5712
5713 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5714 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><span style='mso-spacerun:yes'> </span></pre><pre><span style='mso-spacerun:yes'>  </span>Y: 4-digit Year</pre><pre><span style='mso-spacerun:yes'>  </span>Q: Quarter (1-4)</pre><pre><span style='mso-spacerun:yes'>  </span>M: Month (Jan-Dec)</pre><pre><span style='mso-spacerun:yes'>  </span>m: Month (01-12)</pre><pre><span style='mso-spacerun:yes'>  </span>d: Day (01-31)</pre><pre><span style='mso-spacerun:yes'>  </span>H: Hour (00-23)</pre><pre><span style='mso-spacerun:yes'>  </span>h: Hour (1-12)</pre><pre><span style='mso-spacerun:yes'>  </span>i: Minute (00-59)</pre><pre><span style='mso-spacerun:yes'>  </span>s: Second (00-60)</pre><pre><span style='mso-spacerun:yes'>  </span>A: AM/PM indicator</pre><pre><span style='mso-spacerun:yes'>  </span>w: day of week (0-6 or 1-7 depending on DB)</pre><pre><span style='mso-spacerun:yes'>  </span>l: day of week (as string - lowercase L)</pre><pre><span style='mso-spacerun:yes'>  </span>W: week in year (0..53 for MySQL, 1..53 for PostgreSQL and Oracle)</pre><pre
5715 style='background:#EEEEEE'><span style='mso-spacerun:yes'>  </span></pre></div>
5716
5717 <p>All other characters are treated as strings. You can also use \ to escape
5718 characters. Available on selected databases, including mysql, postgresql,
5719 mssql, oci8 and DB2. </p>
5720
5721 <p>This is useful in writing portable sql statements that GROUP BY on dates.
5722 For example to display total cost of goods sold broken by quarter (dates are
5723 stored in a field called postdate): </p>
5724
5725 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5726 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5727 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>$sqlfn = $db-&gt;SQLDate('Y-\QQ','postdate'); # get sql that formats postdate to output 2002-Q1<br>
5728 <span style='mso-spacerun:yes'> </span>$sql = &quot;SELECT $sqlfn,SUM(cogs) FROM table GROUP BY $sqlfn ORDER BY 1 desc&quot;;<br>
5729 <span style='mso-spacerun:yes'> </span></pre></div>
5730
5731 <p><b>MoveNext<a name=movenext></a>( )</b></p>
5732
5733 <p>Move the internal cursor to the next row. The <i>$this-&gt;fields</i> array
5734 is automatically updated. Returns false if unable to do so (normally because
5735 EOF has been reached), otherwise true. </p>
5736
5737 <p>If EOF is reached, then the $this-&gt;fields array is set to false (this was
5738 only implemented consistently in ADOdb 3.30). For the pre-3.30 behaviour of
5739 $this-&gt;fields (at EOF), set the global variable $ADODB_COMPAT_FETCH = true.</p>
5740
5741 <p>Example:</p>
5742
5743 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5744 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5745 style='background:#EEEEEE'>$rs = $db-&gt;Execute($sql);<br>
5746 if ($rs) <br>
5747 <span style='mso-tab-count:1'>         </span>while (!$rs-&gt;EOF) {<br>
5748 <span style='mso-spacerun:yes'> </span><span style='mso-tab-count:2'>                </span>ProcessArray($rs-&gt;fields);<span
5749 style='mso-tab-count:1'>         </span><br>
5750 <span style='mso-tab-count:2'>                 </span>$rs-&gt;MoveNext();<br>
5751 <span style='mso-tab-count:1'>         </span>} </pre></div>
5752
5753 <p><b>Move<a name=move></a>($to)</b></p>
5754
5755 <p>Moves the internal cursor to a specific row $<b>to</b>. Rows are zero-based
5756 eg. 0 is the first row. The <b>fields</b> array is automatically updated. For
5757 databases that do not support scrolling internally, ADOdb will simulate forward
5758 scrolling. Some databases do not support backward scrolling. If the $<b>to</b>
5759 position is after the EOF, $<b>to</b> will move to the end of the RecordSet for
5760 most databases. Some obscure databases using odbc might not behave this way.</p>
5761
5762 <p>Note: This function uses <i>absolute positioning</i>, unlike Microsoft's
5763 ADO.</p>
5764
5765 <p>Returns true or false. If false, the internal cursor is not moved in most
5766 implementations, so AbsolutePosition( ) will return the last cursor position
5767 before the Move( ). </p>
5768
5769 <p><b>MoveFirst<a name=movefirst></a>()</b></p>
5770
5771 <p>Internally calls Move(0). Note that some databases do not support this function.</p>
5772
5773 <p><b>MoveLast<a name=movelast></a>()</b></p>
5774
5775 <p>Internally calls Move(RecordCount()-1). Note that some databases do not
5776 support this function.</p>
5777
5778 <p><b>GetRowAssoc</b><a name=getrowassoc></a>($toUpper=true)</p>
5779
5780 <p>Returns an associative array containing the current row. The keys to the
5781 array are the column names. The column names are upper-cased for easy access.
5782 To get the next row, you will still need to call MoveNext(). </p>
5783
5784 <p>For example:<br>
5785 Array ( [ID] =&gt; 1 [FIRSTNAME] =&gt; Caroline [LASTNAME] =&gt; Miranda
5786 [CREATED] =&gt; 2001-07-05 ) </p>
5787
5788 <p>Note: do not use GetRowAssoc() with $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC.
5789 Because they have the same functionality, they will interfere with each other.</p>
5790
5791 <p><b>AbsolutePage<a name=absolutepage></a>($page=-1) </b></p>
5792
5793 <p>Returns the current page. Requires PageExecute()/CachePageExecute() to be
5794 called. See <a href="#ex8">Example 8</a>.</p>
5795
5796 <p><b>AtFirstPage<a name=atfirstpage>($status='')</a></b><span
5797 style='mso-bookmark:atfirstpage'></span></p>
5798
5799 <p>Returns true if at first page (1-based). Requires
5800 PageExecute()/CachePageExecute() to be called. See <a href="#ex8">Example 8</a>.</p>
5801
5802 <p><b>AtLastPage<a name=atlastpage>($status='')</a></b><span style='mso-bookmark:
5803 atlastpage'></span></p>
5804
5805 <p>Returns true if at last page (1-based). Requires
5806 PageExecute()/CachePageExecute() to be called. See <a href="#ex8">Example 8</a>.</p>
5807
5808 <p><b>Fields</b><a name=fields></a>(<b>$colname</b>)</p>
5809
5810 <p>Returns the value of the associated column $<b>colname</b> for the current
5811 row. The column name is case-insensitive.</p>
5812
5813 <p>This is a convenience function. For higher performance, use <a
5814 href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a>. </p>
5815
5816 <p><b>FetchRow</b><a name=fetchrow></a>()</p>
5817
5818 <p>Returns array containing current row, or false if EOF. FetchRow( )
5819 internally moves to the next record after returning the current row. </p>
5820
5821 <p>Warning: Do not mix using FetchRow() with MoveNext().</p>
5822
5823 <p>Usage:</p>
5824
5825 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5826 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5827 style='background:#EEEEEE'>$rs = $db-&gt;Execute($sql);<br>
5828 if ($rs)<br>
5829 <span style='mso-tab-count:1'>         </span>while ($arr = $rs-&gt;FetchRow()) {<br>
5830 <span style='mso-tab-count:1'>         </span><span style='mso-spacerun:yes'>   </span>&nbsp;&nbsp;# process $arr<span
5831 style='mso-tab-count:1'>       </span><br>
5832 <span style='mso-tab-count:1'>         </span>}</pre></div>
5833
5834 <p><b>FetchInto</b><a name=fetchinto></a>(<b>&amp;$array</b>)</p>
5835
5836 <p>Sets $array to the current row. Returns PEAR_Error object if EOF, 1 if ok
5837 (DB_OK constant). If PEAR is undefined, false is returned when EOF. FetchInto(
5838 ) internally moves to the next record after returning the current row. </p>
5839
5840 <p>FetchRow() is easier to use. See above.</p>
5841
5842 <p><b>FetchField<a name=fetchfield></a>($column_number)</b></p>
5843
5844 <p>Returns an object containing the <b>name</b>, <b>type</b> and <b>max_length</b>
5845 of the associated field. If the max_length cannot be determined reliably, it
5846 will be set to -1. The column numbers are zero-based. See <a href="#ex2">example
5847 2.</a></p>
5848
5849 <p><b>FieldCount<a name=fieldcount></a>( )</b></p>
5850
5851 <p>Returns the number of fields (columns) in the record set.</p>
5852
5853 <p><b>RecordCount<a name=recordcount></a>( )</b></p>
5854
5855 <p>Returns the number of rows in the record set. If the number of records
5856 returned cannot be determined from the database driver API, we will buffer all
5857 rows and return a count of the rows after all the records have been retrieved.
5858 This buffering can be disabled (for performance reasons) by setting the global
5859 variable $ADODB_COUNTRECS = false. When disabled, RecordCount( ) will return -1
5860 for certain databases. See the supported databases list above for more details.
5861 </p>
5862
5863 <p>RowCount is a synonym for RecordCount.</p>
5864
5865 <p><b>PO_RecordCount<a name="po_recordcount"></a>($table, $where)</b></p>
5866
5867 <p>Returns the number of rows in the record set. If the database does not
5868 support this, it will perform a SELECT COUNT(*) on the table $table, with the
5869 given $where condition to return an estimate of the recordset size.</p>
5870
5871 <p>$numrows = $rs-&gt;PO_RecordCount(&quot;articles_table&quot;,
5872 &quot;group=$group&quot;);</p>
5873
5874 <p class=MsoNormal><b>NextRecordSet<a name=nextrecordset id=nextrecordset></a>()</b>
5875 </p>
5876
5877 <p>For databases that allow multiple recordsets to be returned in one query,
5878 this function allows you to switch to the next recordset. Currently only
5879 supported by mssql driver.</p>
5880
5881 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5882 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5883 style='background:#EEEEEE'>$rs = $db-&gt;Execute('execute return_multiple_rs');<br>
5884 $arr1 = $rs-&gt;GetArray();<br>
5885 $rs-&gt;NextRecordSet();<br>
5886 $arr2 = $rs-&gt;GetArray();</pre></div>
5887
5888 <p><b>FetchObject<a name=fetchobject></a>($toupper=true)</b></p>
5889
5890 <p>Returns the current row as an object. If you set $toupper to true, then the
5891 object fields are set to upper-case. Note: The newer FetchNextObject() is the
5892 recommended way of accessing rows as objects. See below.</p>
5893
5894 <p><b>FetchNextObject<a name=fetchnextobject></a>($toupper=true)</b></p>
5895
5896 <p>Gets the current row as an object and moves to the next row automatically.
5897 Returns false if at end-of-file. If you set $toupper to true, then the object
5898 fields are set to upper-case. Note that for some drivers such as mssql, you
5899 need to SetFetchMode(ADODB_FETCH_ASSOC) or SetFetchMode(ADODB_FETCH_BOTH).</p>
5900
5901 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
5902 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
5903 style='background:#EEEEEE'>$rs = $db-&gt;Execute('select firstname,lastname from table');<br>
5904 if ($rs) {<br>
5905 <span style='mso-tab-count:1'>         </span>while ($o = $rs-&gt;FetchNextObject()) {<br>
5906 <span style='mso-tab-count:2'>                 </span>print &quot;$o-&gt;FIRSTNAME, $o-&gt;LASTNAME&lt;BR&gt;&quot;;<br>
5907 <span style='mso-tab-count:1'>         </span>}<br>
5908 }</pre></div>
5909
5910 <p>There is some trade-off in speed in using FetchNextObject(). If performance
5911 is important, you should access rows with the <code><span style='font-size:
5912 10.0pt'>fields[]</span></code> array. <b>FetchObj<a name=fetchobj id=fetchobj></a>()</b>
5913 </p>
5914
5915 <p>Returns the current record as an object. Fields are not upper-cased, unlike
5916 FetchObject. </p>
5917
5918 <p><b>FetchNextObj<a name=fetchnextobj id=fetchnextobj></a>()</b> </p>
5919
5920 <p>Returns the current record as an object and moves to the next record. If
5921 EOF, false is returned. Fields are not upper-cased, unlike FetctNextObject. </p>
5922
5923 <p><b>CurrentRow<a name=currentrow></a>( )</b></p>
5924
5925 <p>Returns the current row of the record set. 0 is the first row.</p>
5926
5927 <p><b>AbsolutePosition<a name=abspos></a>( )</b></p>
5928
5929 <p>Synonym for <b>CurrentRow</b> for compatibility with ADO. Returns the
5930 current row of the record set. 0 is the first row.</p>
5931
5932 <p><b>MetaType<a name=metatype></a>($nativeDBType[,$field_max_length],[$fieldobj])</b></p>
5933
5934 <p>Determine what <i>generic</i> meta type a database field type is given its
5935 native type $<b>nativeDBType</b> as a string and the length of the field $<b>field_max_length</b>.
5936 Note that field_max_length can be -1 if it is not known. The field object
5937 returned by FetchField() can be passed in $<b>fieldobj</b> or as the 1st
5938 parameter <b>$nativeDBType</b>. This is useful for databases such as <i>mysql</i>
5939 which has additional properties in the field object such as <i>primary_key</i>.
5940 </p>
5941
5942 <p>Uses the field <b>blobSize</b> and compares it with $<b>field_max_length</b>
5943 to determine whether the character field is actually a blob.</p>
5944
5945 <p class=MsoNormal>For example, $db-&gt;MetaType('char') will return 'C'. </p>
5946
5947 <p>Returns:</p>
5948
5949 <ul type=disc>
5950  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5951      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>C</b>: Character fields
5952      that should be shown in a &lt;input type=&quot;text&quot;&gt; tag. </li>
5953  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5954      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>X</b>: Clob (character
5955      large objects), or large text fields that should be shown in a
5956      &lt;textarea&gt;</li>
5957  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5958      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>D</b>: Date field</li>
5959  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5960      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>T</b>: Timestamp field</li>
5961  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5962      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>L</b>: Logical field
5963      (boolean or bit-field)</li>
5964  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5965      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>N</b>: Numeric field.
5966      Includes decimal, numeric, floating point, and real. </li>
5967  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5968      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>I</b>:&nbsp; Integer
5969      field. </li>
5970  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5971      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>R</b>: Counter or
5972      Autoincrement field. Must be numeric.</li>
5973  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
5974      mso-list:l7 level1 lfo11;tab-stops:list 36.0pt'><b>B</b>: Blob, or binary
5975      large objects. </li>
5976 </ul>
5977
5978 <p>Since ADOdb 3.0, MetaType accepts $fieldobj as the first parameter, instead
5979 of $nativeDBType. </p>
5980
5981 <p><b>Close( )</b><a name=rsclose></a></p>
5982
5983 <p>Closes the recordset, cleaning all memory and resources associated with the
5984 recordset. </p>
5985
5986 <p>If memory management is not an issue, you do not need to call this function
5987 as recordsets are closed for you by PHP at the end of the script. SQL
5988 statements such as INSERT/UPDATE/DELETE do not really return a recordset, so you
5989 do not have to call Close() for such SQL statements.</p>
5990
5991 <div class=MsoNormal align=center style='text-align:center'>
5992
5993 <hr size=2 width="100%" align=center>
5994
5995 </div>
5996
5997 <h3>function rs2html<a name=rs2html></a>($adorecordset,[$tableheader_attributes],
5998 [$col_titles])</h3>
5999
6000 <p>This is a standalone function (rs2html = recordset to html) that is similar
6001 to PHP's <i>odbc_result_all</i> function, it prints a ADORecordSet, $<b>adorecordset</b>
6002 as a HTML table. $<b>tableheader_attributes</b> allow you to control the table <i>cellpadding</i>,
6003 <i>cellspacing</i> and <i>border</i> attributes. Lastly you can replace the
6004 database column names with your own column titles with the array $<b>col_titles</b>.
6005 This is designed more as a quick debugging mechanism, not a production table
6006 recordset viewer.</p>
6007
6008 <p>You will need to include the file <i>tohtml.inc.php</i>.</p>
6009
6010 <p>Example of rs2html:<a name=exrs2html></a></p>
6011
6012 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6013 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
6014 style='background:#EEEEEE'><b><span style='color:#336600'>&lt;?<br>
6015 include('tohtml.inc.php')</span></b>; # load code common to ADOdb <br>
6016 <b>include</b>('adodb.inc.php'); # load code common to ADOdb <br>
6017 $<span style='color:#663300'>conn</span> = &amp;ADONewConnection('mysql');<span style='mso-spacerun:yes'>   </span># create a connection <br>
6018 $<span style='color:#663300'>conn</span>-&gt;PConnect('localhost','userid','','agora');# connect to MySQL, agora db<br>
6019 $<span style='color:#663300'>sql</span> = 'select CustomerName, CustomerID from customers'; <br>
6020 $<span style='color:#663300'>rs</span><span style='mso-spacerun:yes'>   </span>= $<span
6021 style='color:#663300'>conn</span>-&gt;Execute($sql); <br>
6022 <b><span style='color:#336600'>rs2html</span>($</b><b><span style='color:#663300'>rs</span>,'<i>border=2 cellpadding=3</i>',array('<i>Customer Name','Customer ID</i>'));<br>
6023 ?&gt;</b></pre></div>
6024
6025 <div class=MsoNormal align=center style='text-align:center'>
6026
6027 <hr size=2 width="100%" align=center>
6028
6029 </div>
6030
6031 <h3>Differences between this ADOdb library and Microsoft ADO<a name=adodiff></a></h3>
6032
6033 <ol start=1 type=1>
6034  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6035      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'>ADOdb only supports
6036      recordsets created by a connection object. Recordsets cannot be created
6037      independently.</li>
6038  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6039      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'>ADO properties are implemented
6040      as functions in ADOdb. This makes it easier to implement any enhanced ADO
6041      functionality in the future.</li>
6042  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6043      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'>ADOdb's <span
6044      style='font-family:"Courier New"'>ADORecordSet-&gt;Move()</span> uses
6045      absolute positioning, not relative. Bookmarks are not supported.</li>
6046  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6047      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'><span style='font-family:
6048      "Courier New"'>ADORecordSet-&gt;AbsolutePosition() </span>cannot be used
6049      to move the record cursor.</li>
6050  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6051      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'>ADO Parameter objects are
6052      not supported. Instead we have the ADOConnection::<a href="#parameter">Parameter</a>(
6053      ) function, which provides a simpler interface for calling preparing
6054      parameters and calling stored procedures.</li>
6055  <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
6056      mso-list:l10 level1 lfo12;tab-stops:list 36.0pt'>Recordset properties for
6057      paging records are available, but implemented as in <a href="#ex8">Example
6058      8</a>.</li>
6059 </ol>
6060
6061 <div class=MsoNormal align=center style='text-align:center'>
6062
6063 <hr size=2 width="100%" align=center>
6064
6065 </div>
6066
6067 <h1>Database Driver Guide<a name=driverguide></a></h1>
6068
6069 <p>This describes how to create a class to connect to a new database. To ensure
6070 there is no duplication of work, kindly email me at jlim#natsoft.com if you
6071 decide to create such a class.</p>
6072
6073 <p>First decide on a name in lower case to call the database type. Let's say we
6074 call it xbase. </p>
6075
6076 <p>Then we need to create two classes ADODB_xbase and ADORecordSet_xbase in the
6077 file adodb-xbase.inc.php.</p>
6078
6079 <p>The simplest form of database driver is an adaptation of an existing ODBC
6080 driver. Then we just need to create the class <i>ADODB_xbase extends ADODB_odbc</i>
6081 to support the new <b>date</b> and <b>timestamp</b> formats, the <b>concatenation</b>
6082 operator used, <b>true</b> and <b>false</b>. For the<i> ADORecordSet_xbase
6083 extends ADORecordSet_odbc </i>we need to change the <b>MetaType</b> function.
6084 See<b> adodb-vfp.inc.php</b> as an example.</p>
6085
6086 <p>More complicated is a totally new database driver that connects to a new PHP
6087 extension. Then you will need to implement several functions. Fortunately, you
6088 do not have to modify most of the complex code. You only need to override a few
6089 stub functions. See <b>adodb-mysql.inc.php</b> for example.</p>
6090
6091 <p>The default date format of ADOdb internally is YYYY-MM-DD (Ansi-92). All
6092 dates should be converted to that format when passing to an ADOdb date
6093 function. See Oracle for an example how we use ALTER SESSION to change the
6094 default date format in _pconnect _connect.</p>
6095
6096 <p><b>ADOConnection Functions to Override</b></p>
6097
6098 <p>Defining a constructor for your ADOConnection derived function is optional.
6099 There is no need to call the base class constructor.</p>
6100
6101 <p>_<b>connect</b>: Low level implementation of Connect. Returns true or false.
6102 Should set the _<b>connectionID</b>.</p>
6103
6104 <p>_<b>pconnect:</b> Low level implemention of PConnect. Returns true or false.
6105 Should set the _<b>connectionID</b>.</p>
6106
6107 <p>_<b>query</b>: Execute a query. Returns the queryID, or false.</p>
6108
6109 <p>_<b>close: </b>Close the connection -- PHP should clean up all recordsets. </p>
6110
6111 <p><b>ErrorMsg</b>: Stores the error message in the private variable _errorMsg.
6112 </p>
6113
6114 <p><b>ADOConnection Fields to Set</b></p>
6115
6116 <p>_<b>bindInputArray</b>: Set to true if binding of parameters for SQL inserts
6117 and updates is allowed using ?, eg. as with ODBC.</p>
6118
6119 <p><b>fmtDate</b></p>
6120
6121 <p><b>fmtTimeStamp</b></p>
6122
6123 <p><b>true</b></p>
6124
6125 <p><b>false</b></p>
6126
6127 <p><b>concat_operator</b></p>
6128
6129 <p><b>replaceQuote</b></p>
6130
6131 <p><b>hasLimit</b> support SELECT * FROM TABLE LIMIT 10 of MySQL.</p>
6132
6133 <p><b>hasTop</b> support Microsoft style SELECT TOP 10 * FROM TABLE.</p>
6134
6135 <p><b>ADORecordSet Functions to Override</b></p>
6136
6137 <p>You will need to define a constructor for your ADORecordSet derived class
6138 that calls the parent class constructor.</p>
6139
6140 <p><b>FetchField: </b>as documented above in ADORecordSet</p>
6141
6142 <p>_<b>initrs</b>: low level initialization of the recordset: setup the _<b>numOfRows</b>
6143 and _<b>numOfFields</b> fields -- called by the constructor.</p>
6144
6145 <p>_<b>seek</b>: seek to a particular row. Do not load the data into the fields
6146 array. This is done by _fetch. Returns true or false. Note that some
6147 implementations such as Interbase do not support seek. Set canSeek to false.</p>
6148
6149 <p>_<b>fetch</b>: fetch a row using the database extension function and then
6150 move to the next row. Sets the <b>fields</b> array. If the parameter
6151 $ignore_fields is true then there is no need to populate the <b>fields</b>
6152 array, just move to the next row. then Returns true or false.</p>
6153
6154 <p>_<b>close</b>: close the recordset</p>
6155
6156 <p><b>Fields</b>: If the array row returned by the PHP extension is not an
6157 associative one, you will have to override this. See adodb-odbc.inc.php for an
6158 example. For databases such as MySQL and MSSQL where an associative array is
6159 returned, there is no need to override this function.</p>
6160
6161 <p><b>ADOConnection Fields to Set</b></p>
6162
6163 <p>canSeek: Set to true if the _seek function works.</p>
6164
6165 <h2>Optimizing PHP</h2>
6166
6167 <p class=MsoNormal>For info on tuning PHP, read this article on <a
6168 href="http://phplens.com/lens/php-book/optimizing-debugging-php.php">Optimizing
6169 PHP</a>. </p>
6170
6171 <h2>Change Log<a name=changes></a><a name=changelog></a></h2>
6172 <p><a name=5.18><b>5.18 3 Sep 2012</b>
6173 <p>datadict-postgres: Fixes bug in ALTER COL. See http://phplens.com/lens/lensforum/msgs.php?id=19202. Also fixed bugs in MetaType() checking $fieldobj properties.
6174 <p>GetRowAssoc did not work with null values. Bug in 5.17.
6175 <p>postgres9:  New driver to better support PostgreSQL 9. Thx Glenn Herteg and Cacti team.
6176 <p>sqlite3: Modified to support php 5.4. Thx Günter Weber [built.development#googlemail.com]
6177 <p>adodb: When fetch mode is ADODB_FETCH_ASSOC, and we execute $db->GetAssoc("select 'a','0'"); we get an error. Fixed. See http://phplens.com/lens/lensforum/msgs.php?id=19190
6178 <p>adodb: Caching directory permissions now configurable using global variable
6179 $ADODB_CACHE_PERMS. Default value is 0771.
6180 <p>mysqli: SetCharSet() did not return true (success) or false (fail) correctly. Fixed.
6181 <p>mysqli: changed dataProvider to 'mysql' so that MetaError and other shared functions will work.
6182 <p>mssqlnative: Prepare() did not work previously. Now calling Prepare() will work but the sql is not actually compiled. Unfortunately bind params are passed to sqlsrv_prepare  and not to sqlsrv_execute.
6183 make Prepare() and empty function, and we still execute the unprepared stmt.
6184 <p>mysql: FetchField(-1), turns it is is not possible to retrieve the max_length. Set to -1.
6185 <p>mysql-perf: Fixed "SHOW INNODB STATUS". Change to "SHOW ENGINE INNODB STATUS"
6186 <p><a name=5.17><b>5.17 18 May 2012</b>
6187 <p>Active Record: Removed trailing whitespace from adodb-active-record.inc.php.
6188 <p>odbc: Added support for $database parameter in odbc Connect() function. E.g. $DB->Connect($dsn_without_db, $user, $pwd, $database). 
6189 Previously $database had to be left blank and the $dsn was used to pass in this parameter.
6190 <p>oci8: Added better empty($rs) error handling to metaindexes().
6191 <p>oci8: Changed to use newer oci API to support PHP 5.4.
6192 <p>adodb.inc.php: Changed GetRowAssoc to more generic code that will work in all scenarios.
6193 <p><a name=5.16><b>5.16 26 March 2012</b>
6194 <p>mysqli: extra mysqli_next_result() in close() removed. See http://phplens.com/lens/lensforum/msgs.php?id=19100
6195 <p>datadict-oci8: minor typo in create sequence trigger fixed. See http://phplens.com/lens/lensforum/msgs.php?id=18879.
6196 <p>security: safe date parsing changes. Does not impact security, these are code optimisations. Thx Saithis.
6197 <p>postgres, oci8, oci8po, db2oci: Param() function parameters inconsistent with base class.  $type='C' missing. Fixed.
6198 <p>active-record: locked bug fixed. http://phplens.com/lens/lensforum/msgs.php?phplens_forummsg=new&id=19073
6199 <p>mysql, mysqli and informix: added MetaProcedures. Metaprocedures allows to retrieve an array list of all procedures in database. http://phplens.com/lens/lensforum/msgs.php?id=18414
6200 <p>Postgres7: added support for serial data type in MetaColumns().
6201 <p><a name=5.15><b>5.15 19 Jan 2012</b>
6202 <p>pdo: fix ErrorMsg() to detect errors correctly. Thx Jens.
6203 <p>mssqlnative: added another check for $this->fields array exists.
6204 <p>mssqlnative: bugs in FetchField() fixed. See http://phplens.com/lens/lensforum/msgs.php?id=19024
6205 <p>DBDate and DBTimeStamp had sql injection bug. Fixed. Thx Saithis
6206 <p>mysql and mysqli: MetaTables() now identifies views and tables correctly.
6207 <p>Added function adodb_time() to adodb-time.inc.php. Generates current time in unsigned integer format.
6208 <p><a name=5.14><b>5.14 8 Sep 2011</b>
6209 <p>mysqli: fix php compilation bug. 
6210 <p>postgres: bind variables did not work properly. Fixed.
6211 <p>postgres: blob handling bug in _decode. Fixed.
6212 <p>ActiveRecord: if a null field was never updated, activerecord would still update the record. Fixed.
6213 <p>ActiveRecord: 1 char length string never quoted. Fixed.
6214 <p>LDAP: Connection string ldap:// and ldaps:// did not work. Fixed.
6215 <p><a name=5.13></a><b>5.13 15 Aug 2011</b>
6216 <p>Postgres: Fix in 5.12 was wrong. Uses pg_unescape_bytea() correctly now in _decode.
6217 <p>GetInsertSQL/GetUpdateSQL: Now $ADODB_QUOTE_FIELDNAMES allows you to define 'NATIVE', 'UPPER', 'LOWER'. If set to true, will default to 'UPPER'.
6218 <p>mysqli: added support for persistent connections 'p:'.
6219 <p>mssqlnative: ADODB_FETCH_BOTH did not work properly. Fixed.
6220 <p>mssqlnative: return values for stored procedures where not returned! Fixed. See http://phplens.com/lens/lensforum/msgs.php?id=18919
6221 <p>mssqlnative: timestamp and fetchfield bugs fixed. http ://phplens.com/lens/lensforum/msgs.php?id=18453
6222 <p><a name=5.12></a><b>5.12 30 June 2011</b> </p>
6223 <p>Postgres: Added information_schema support for postgresql.
6224 <p>Postgres: Use pg_unescape_bytea() in _decode.
6225 <p>Fix bulk binding with oci8. http://phplens.com/lens/lensforum/msgs.php?id=18786
6226 <p>oci8 perf: added wait evt monitoring. Also db cache advice now handles multiple buffer pools properly.
6227 <p>sessions2: Fixed setFetchMode problem.
6228 <p>sqlite: Some DSN connection settings were not parsed correctly.
6229 <p>mysqli: now GetOne obeys $ADODB_GETONE_EOF;
6230 <p>memcache: compress option did not work. Fixed. See http://phplens.com/lens/lensforum/msgs.php?id=18899
6231 <p><a name=5.11></a><b>5.11 5 May 2010</b> </p>
6232 <p>mysql: Fixed GetOne() to return null if no records returned.
6233 <p>oci8 perf: added stats on sga, rman, memory usage, and flash in performance tab.
6234 <p>odbtp: Now you can define password in $password field of Connect()/PConnect(), and it will add it to DSN.
6235 <p>Datadict: altering columns did not consider the scale of the column. Now it does.
6236 <p>mssql: Fixed problem with ADODB_CASE_ASSOC causing multiple versions of column name appearing in recordset fields.
6237 <p>oci8: Added missing & to refLob.
6238 <p>oci8: Added obj->scale to FetchField().
6239 <p>oci8: Now you can get column info of a table in a different schema, e.g. MetaColumns("schema.table") is supported.
6240 <p>odbc_mssql: Fixed missing $metaDatabasesSQL.
6241 <p>xmlschema: Changed declaration of create() to create($xmls) to fix compat problems. Also changed constructor adoSchema() to pass in variable instead of variable reference.
6242 <p>ado5: Fixed ado5 exceptions to only display errors when $this->debug=true;
6243 <p>Added DSN support to sessions2.inc.php.
6244 <p>adodb-lib.inc.php. Fixed issue with _adodb_getcount() not using $secs2cache parameter.
6245 <p>adodb active record. Fixed caching bug. See http://phplens.com/lens/lensforum/msgs.php?id=18288.
6246 <p>db2: fixed ServerInfo().
6247 <p>adodb_date: Added support for format 'e' for TZ as in adodb_date('e')
6248 <p>Active Record: If you have a field which is a string field (with numbers in) and you add preceding 0's to it the adodb library does not pick up the fact that the field has changed because of the way php's == works (dodgily). The end result is that it never gets updated into the database - fix by  Matthew Forrester (MediaEquals). [matthew.forrester#mediaequals.com]
6249
6250 <p>Fixes RowLock() and MetaIndexes() inconsistencies. See http://phplens.com/lens/lensforum/msgs.php?id=18236
6251 <p>Active record support for postgrseql boolean. See http://phplens.com/lens/lensforum/msgs.php?id=18246
6252 <p>By default, Execute 2D array is disabled for security reasons. Set $conn->bulkBind = true to enable. See http://phplens.com/lens/lensforum/msgs.php?id=18270. Note this breaks backward compat.
6253 <P>MSSQL: fixes for 5.2 compat. http://phplens.com/lens/lensforum/msgs.php?id=18325
6254 <p>Changed Version() to return a string instead of a float so it correctly returns 5.10 instead of 5.1.
6255
6256 <p><a name=5.10></a><b>5.10 10 Nov 2009</b> </p>
6257 <p>Fixed memcache to properly support $rs->timeCreated.
6258 <p>adodb-ado.inc.php: Added BigInt support for PHP5. Will return float instead to support large numbers. Thx nasb#mail.goo.ne.jp.
6259 <p>adodb-mysqli.inc.php: mysqli_multi_query is now turned off by default. To turn it on, use $conn->multiQuery = true; This is because of the risks of sql injection. See http://phplens.com/lens/lensforum/msgs.php?id=18144
6260 <p>New db2oci driver for db2 9.7 when using PL/SQL mode. Allows oracle style :0, :1, :2 bind parameters which are remapped to ? ? ?.
6261 <p>adodb-db2.inc.php: fixed bugs in MetaTables. SYS owner field not checked properly. Also in $conn->Connect($dsn, null, null, $schema) and PConnect($dsn, null, null, $schema), we do a SET SCHEMA=$schema if successful connection.
6262 <p>adodb-mysqli.inc.php: Now $rs->Close() closes all pending next resultsets. Thx Clifton mesmackgod#gmail.com
6263 <p>Moved _CreateCache() from PConnect()/Connect() to CacheExecute(). Suggested by Dumka.
6264 <p>Many bug fixes to adodb-pdo_sqlite.inc.php and new datadict-sqlite.inc.php. Thx Andrei B. [andreutz#mymail.ro]
6265 <p>Removed usage of split (deprecated in php 5.3). Thx david#horizon-nigh.org.
6266 <p>Fixed RowLock() parameters to comply with PHP5 strict mode in multiple drivers.
6267
6268 <p><a name=5.09></a><b>5.09 25 June 2009</b> </p>
6269 <p>Active Record: You can force column names to be quoted in INSERT and UPDATE statements, typically because you are using reserved words as column names by setting
6270 ADODB_Active_Record::$_quoteNames = true;
6271 <p>Added memcache and cachesecs to DSN. e.g.
6272 <pre>
6273         # we have a memcache servers mem1,mem2 on port 8888, compression=off and cachesecs=120
6274         $dsn = 'mysql://user:pwd@localhost/mydb?memcache=mem1,mem2:8888:0&cachesecs=120';
6275 </pre>
6276 <p>Fixed up MetaColumns and MetaPrimaryIndexes() for php 5.3 compat. Thx http://adodb.pastebin.com/m52082b16
6277 <p>The postgresql driver's OffsetDate() apparently does not work with postgres 8.3. Fixed.
6278 <p>Added support for magic_quotes_sybase in qstr() and addq(). Thanks Eloy and Sam Moffat.
6279 <p>The oci8 driver did not handle LOBs properly when binding. Fixed. See http://phplens.com/lens/lensforum/msgs.php?id=17991.
6280 <p>Datadict: In order to support TIMESTAMP with subsecond accuracy, added to datadict the new TS type. Supported by mssql, postgresql and oci8 (oracle).
6281 Also changed oci8 $conn->sysTimeStamp to use 'SYSTIMESTAMP' instead of 'SYSDATE'. Should be backwards compat.
6282 <p>Added support for PHP 5.1+ DateTime objects in DBDate and DBTimeStamp. This means that dates and timestamps will be managed by DateTime objects if you are running PHP 5.1+.
6283 <p>Added new property to postgres64 driver to support returning I if type is unique int called $db->uniqueIisR, defaulting to true. See http://phplens.com/lens/lensforum/msgs.php?id=17963
6284 <p>Added support for bindarray in adodb_GetActiveRecordsClass with SelectLimit in adodb-active-record.inc.php.
6285 <p>Transactions now allowed in ado_access driver. Thx to  petar.petrov.georgiev#gmail.com.
6286 <p>Sessions2 garbage collection is now much more robust. We perform ORDER BY to prevent deadlock in adodb-sessions2.inc.php.
6287 <p>Fixed typo in pdo_sqlite driver.
6288
6289 <p><a name=5.08a></a><b>5.08a 17 Apr 2009</b> </p>
6290 <p>Fixes wrong version number string.
6291 <p>Incorrect + in adodb-datadict.inc.php removed.
6292 <p>Fixes missing OffsetDate() function in pdo. Thx paul#mantisforge.org. 
6293
6294 <p><a name=5.08></a><b>5.08 17 Apr 2009</b> </p>
6295 <p>adodb-sybase.inc.php driver. Added $conn->charSet support. Thx Luis Henrique Mulinari (luis.mulinari#gmail.com)
6296 <p>adodb-ado5.inc.php. Fixed some bind param issues. Thx Jirka Novak. 
6297 <p>adodb-ado5.inc.php. Now has improved error handling.
6298 <p>Fixed typo in adodb-xmlschema03.inc.php. See XMLS_EXISTING_DATA, line 1501. Thx james johnson.
6299 <p>Made $inputarr optional for _query() in all drivers.
6300 <p>Fixed spelling mistake in flushall() in adodb.inc.ophp.
6301 <p>Fixed handling of quotes in adodb_active_record::doquote. Thx Jonathan Hohle (jhohle#godaddy.com).
6302 <p>Added new index parameter to adodb_active_record::setdatabaseadaptor. Thx Jonathan Hohle
6303 <p>Fixed & readcache() reference compat problem with php 5.3 in adodb.Thx Jonathan Hohle.
6304 <p>Some minor $ADODB_CACHE_CLASS definition issues in adodb.inc.php.
6305 <p>Added Reset() function to adodb_active_record. Thx marcus.
6306 <p>Minor dsn fix for pdo_sqlite in adodb.inc.php. Thx Sergey Chvalyuk.
6307 <p>Fixed adodb-datadict _CreateSuffix() inconsistencies. Thx Chris Miller.
6308 <p>Option to delete old fields $dropOldFlds in datadict ChangeTableSQL($table, $flds, $tableOptions, $dropOldFlds=false) added. Thx  Philipp Niethammer.
6309 <p>Memcache caching did not expire properly. Fixed.
6310 <p>MetaForeignKeys for postgres7 driver changed from adodb_movenext to $rs->MoveNext (also in 4.99)
6311 <p>Added support for ldap and ldaps url format in ldap driver. E.g. ldap://host:port/dn?attributes?scope?filter?extensions
6312 <p><a name=5.07></a><b>5.07 26 Dec 2008</b> </p>
6313
6314 <p>BeginTrans/CommitTrans/RollbackTrans return true/false correctly on
6315 success/failure now for mssql, odbc, oci8, mysqlt, mysqli, postgres, pdo. </p>
6316
6317 <p>Replace() now quotes all non-null values including numeric ones. </p>
6318
6319 <p>Postgresql qstr() now returns booleans as <b>true</b> and <b>false</b>
6320 without quotes. </p>
6321
6322 <p>MetaForeignKeys in mysql and mysqli drivers had this problem: A table can
6323 have two foreign keys pointing to the same column in the same table. The
6324 original code will incorrectly report only the last column. Fixed.
6325 https://sourceforge.net/tracker/index.php?func=detail&amp;aid=2287278&amp;group_id=42718&amp;atid=433976
6326 </p>
6327
6328 <p>Passing in full ado connection string in $argHostname with ado drivers was
6329 failing in adodb5 due to bug. Fixed. </p>
6330
6331 <p>Fixed memcachelib flushcache and flushall bugs. Also fixed possible
6332 timeCreated = 0 problem in readcache. (Also in adodb 4.992). Thanks AlexB_UK
6333 (alexbarnes#hotmail.com). </p>
6334
6335 <p>Fixed a notice in adodb-sessions2.inc.php, in _conn(). Thx bober
6336 m.derlukiewicz#rocktech.remove_me.pl; </p>
6337
6338 <p>ADOdb Active Record: Fixed some issues with incompatible fetch modes
6339 (ADODB_FETCH_ASSOC) causing problems in UpdateActiveTable(). </p>
6340
6341 <p>ADOdb Active Record: Added support for functions that support predefining
6342 one-to-many relationships:<br>
6343 &nbsp; <i>ClassHasMany ClassBelongsTo TableHasMany TableBelongsTo
6344 TableKeyHasMany TableKeyBelongsTo</i>. <br>
6345 You can also define your child/parent class in these functions, instead of the
6346 default ADODB_Active_Record. Thx Arialdo Martini &amp; Chris R for idea. </p>
6347
6348 <p>ADOdb Active Record: HasMany hardcoded primary key to &quot;id&quot;. Fixed.
6349 </p>
6350
6351 <p>Many pdo and pdo-sqlite fixes from Sid Dunayer [sdunayer#interserv.com]. </p>
6352
6353 <p>CacheSelectLimit not working for mssql. Fixed. Thx AlexB. </p>
6354
6355 <p>The rs2html function did not display hours in timestamps correctly. Now 24hr
6356 clock used.</p>
6357
6358 <p>Changed ereg* functions to use preg* functions as ereg* is deprecated in PHP 5.3. Modified sybase and postgresql drivers.</p>
6359
6360 <p><a name=5.06></a><b>5.06 16 Oct 2008</b> </p>
6361
6362 <p>Added driver adodb-pdo_sqlite.inc.php. Thanks Diogo Toscano
6363 (diogo#scriptcase.net) for the code. </p>
6364
6365 <p>Added support for <a href="docs-active-record.htm#onetomany">one-to-many relationships</a>
6366 with BelongsTo() and HasMany() in adodb_active_record. </p>
6367
6368 <p>Added BINARY type to mysql.inc.php (also in 4.991). </p>
6369
6370 <p>Added support for SelectLimit($sql,-1,100) in oci8. (also in 4.991). </p>
6371
6372 <p>New $conn-&gt;GetMedian($table, $field, $where='') to get median account no.
6373 (also in 4.991) </p>
6374
6375 <p>The rs2html() function in tohtml.inc.php did not handle dates with ':' in it
6376 properly. Fixed. (also in 4.991) </p>
6377
6378 <p>Added support for connecting to oci8 using $DB-&gt;Connect($ip, $user, $pwd,
6379 &quot;SID=$sid&quot;); (also in 4.991) </p>
6380
6381 <p>Added mysql type 'VAR_STRING' to MetaType(). (also in 4.991) </p>
6382
6383 <p>The session and session2 code supports setfetchmode assoc properly now (also
6384 in 4.991). </p>
6385
6386 <p>Added concat support to pdo. Thx Andrea Baron. </p>
6387
6388 <p>Changed db2 driver to use format &quot;Y-m-d H-i-s&quot; for datetime
6389 instead of &quot;Y-m-d-H-i-s&quot; which was legacy from odbc_db2 conversion. </p>
6390
6391 <p>Removed vestigal break on adodb_tz_offset in adodb-time.inc.php. </p>
6392
6393 <p>MetaForeignKeys did not work for views in MySQL 5. Fixed. </p>
6394
6395 <p>Changed error handling in GetActiveRecordsClass. </p>
6396
6397 <p>Added better support for using existing driver when $ADODB_NEWCONNECTION
6398 function returns false. </p>
6399
6400 <p>In _CreateSuffix in adodb-datadict.inc.php, adding unsigned variable for
6401 mysql. </p>
6402
6403 <p>In adodb-xmlschema03.inc.php, changed addTableOpt to include db name. </p>
6404
6405 <p>If bytea blob in postgresql is null, empty string was formerly returned. Now
6406 null is returned. </p>
6407
6408 <p>Changed db2 driver CreateSequence to support $start parameter. </p>
6409
6410 <p>rs2html() now does not add nbsp to end if length of string &gt; 0 </p>
6411
6412 <p>The oci8po FetchField() now only lowercases field names if ADODB_ASSOC_CASE
6413 is set to 0. </p>
6414
6415 <p>New mssqlnative drivers for php. TQ Garrett Serack of M'soft. <a
6416 href="http://www.microsoft.com/downloads/details.aspx?FamilyId=61BF87E0-D031-466B-B09A-6597C21A2E2A&amp;displaylang=en">Download</a>
6417 mssqlnative extension. Note that this is still in beta. </p>
6418
6419 <p>Fixed bugs in memcache support. </p>
6420
6421 <p>You can now change the return value of GetOne if no records are found using
6422 the global variable $ADODB_GETONE_EOF. The default is null. To change it back
6423 to the pre-4.99/5.00 behaviour of false, set $ADODB_GETONE_EOF = false; </p>
6424
6425 <p>In Postgresql 8.2/8.3 MetaForeignkeys did not work. Fixed William Kolodny
6426 William.Kolodny#gt-t.net </p>
6427
6428 <p><a name=5.05></a><b>4.990/5.05 11 Jul 2008</b> </p>
6429
6430 <p>Added support for multiple recordsets in mysqli &quot;Geisel Sierote&quot;
6431 geisel#4up.com.br. See http://phplens.com/lens/lensforum/msgs.php?id=15917 </p>
6432
6433 <p>Malcolm Cook added new Reload() function to Active Record. See
6434 http://phplens.com/lens/lensforum/msgs.php?id=17474 </p>
6435
6436 <p>Thanks Zoltan Monori [monzol#fotoprizma.hu] for bug fixes in iterator,
6437 SelectLimit, GetRandRow, etc. </p>
6438
6439 <p>Under heavy loads, the performance monitor for oci8 disables Ixora views. </p>
6440
6441 <p>Fixed sybase driver SQLDate to use str_replace(). Also for adodb5, changed
6442 sybase driver UnixDate and UnixTimeStamp calls to static. </p>
6443
6444 <p>Changed oci8 lob handler to use &amp; reference
6445 $this-&gt;_refLOBs[$numlob]['VAR'] = &amp;$var. </p>
6446
6447 <p>We now strtolower the get_class() function in PEAR::isError() for php5
6448 compat. </p>
6449
6450 <p>CacheExecute did not retrieve cache recordsets properly for 5.04 (worked in
6451 4.98). Fixed. </p>
6452
6453 <p>New ADODB_Cache_File class for file caching defined in adodb.inc.php. </p>
6454
6455 <p>Farsi language file contribution by Peyman Hooshmandi Raad
6456 (phooshmand#gmail.com) </p>
6457
6458 <p>New API for creating your custom caching class which is stored in
6459 $ADODB_CACHE: </p>
6460
6461 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6462 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>include &quot;/path/to/adodb.inc.php&quot;;</pre><pre>$ADODB_CACHE_CLASS = 'MyCacheClass';</pre><pre><o:p>&nbsp;</o:p></pre><pre>class MyCacheClass extends ADODB_Cache_File</pre><pre>{</pre><pre><span
6463 style='mso-tab-count:1'>         </span>function writecache($filename, $contents,$debug=false){...}</pre><pre><span
6464 style='mso-tab-count:1'>         </span>function &amp;readcache($filename, &amp;$err, $secs2cache, $rsClass){ ...}</pre><pre><span
6465 style='mso-tab-count:1'>         </span> :</pre><pre>}</pre><pre><o:p>&nbsp;</o:p></pre><pre>$DB = NewADOConnection($driver);</pre><pre>$DB-&gt;Connect(...);<span style='mso-spacerun:yes'>  </span>## MyCacheClass created here and stored in $ADODB_CACHE global variable.</pre><pre><o:p>&nbsp;</o:p></pre><pre>$data = $rs-&gt;CacheGetOne($sql); ## MyCacheClass is used here for caching...</pre></div>
6466
6467 <p>Memcache supports multiple pooled hosts now. Only if none of the pooled
6468 servers can be contacted will a connect error be generated. Usage example
6469 below: </p>
6470
6471 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6472 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$db = NewADOConnection($driver);</pre><pre>$db-&gt;memCache = true; /// should we use memCache instead of caching in files</pre><pre>$db-&gt;memCacheHost = array($ip1, $ip2, $ip3); /// $db-&gt;memCacheHost = $ip1; still works</pre><pre>$db-&gt;memCachePort = 11211; /// this is default memCache port</pre><pre>$db-&gt;memCacheCompress = false; /// Use 'true' to store the item compressed (uses zlib)</pre><pre><o:p>&nbsp;</o:p></pre><pre>$db-&gt;Connect(...);</pre><pre>$db-&gt;CacheExecute($sql);</pre></div>
6473
6474 <p><a name=4.98></a><b>4.98/5.04 13 Feb 2008</b> </p>
6475
6476 <p>Fixed adodb_mktime problem which causes a performance bottleneck in $hrs. </p>
6477
6478 <p>Added mysqli support to adodb_getcount(). </p>
6479
6480 <p>Removed MYSQLI_TYPE_CHAR from MetaType(). </p>
6481
6482 <p><a name=4.97></a><b>4.97/5.03 22 Jan 2008</b> </p>
6483
6484 <p>Active Record: $ADODB_ASSOC_CASE=1 did not work properly. Fixed. </p>
6485
6486 <p>Modified Fields() in recordset class to support display null fields in
6487 FetchNextObject(). </p>
6488
6489 <p>In ADOdb5, active record implementation, we now support column names with
6490 spaces in them - we autoconvert the spaces to _ using __set(). Thx Daniel Cook.
6491 http://phplens.com/lens/lensforum/msgs.php?id=17200 </p>
6492
6493 <p>Removed $arg3 from mysqli SelectLimit. See
6494 http://phplens.com/lens/lensforum/msgs.php?id=16243. Thx Zsolt Szeberenyi. </p>
6495
6496 <p>Changed oci8 FetchField, which returns the max_length of BLOB/CLOB/NCLOB as
6497 4000 (incorrectly) to -1. </p>
6498
6499 <p>CacheExecute would sometimes return an error on Windows if it was unable to
6500 lock the cache file. This is harmless and has been changed to a warning that
6501 can be ignored. Also adodb_write_file() code revised. </p>
6502
6503 <p>ADOdb perf code changed to only log sql if execution time &gt;= 0.05
6504 seconds. New $ADODB_PERF_MIN variable holds min sql timing. Any SQL with timing
6505 value below this and is not causing an error is not logged. </p>
6506
6507 <p>Also adodb_backtrace() now traces 1 level deeper as sometimes actual culprit
6508 function is not displayed. </p>
6509
6510 <p>Fixed a group by problem with adodb_getcount() for db's which are not
6511 postgres/oci8 based. </p>
6512
6513 <p>Changed mssql driver Parameter() from SQLCHAR to SQLVARCHAR: case 'string':
6514 $type = SQLVARCHAR; break. </p>
6515
6516 <p>Problem with mssql driver in php5 (for adodb 5.03) because some functions
6517 are not static. Fixed. </p>
6518
6519 <p><a name=4.96></a><b>4.96/5.02 24 Sept 2007</b> </p>
6520
6521 <p>ADOdb perf for oci8 now has non-table-locking code when clearing the sql.
6522 Slower but better transparency. Added in 4.96a and 5.02a. </p>
6523
6524 <p>Fix adodb count optimisation. Preg_match did not work properly. Also rewrote
6525 the ORDER BY stripping code in _adodb_getcount(), adodb-lib.inc.php. </p>
6526
6527 <p>SelectLimit for oci8 not optimal for large recordsets when offset=0. Changed
6528 $nrows check. </p>
6529
6530 <p>Active record optimizations. Added support for assoc arrays in Set(). </p>
6531
6532 <p>Now GetOne returns null if EOF (no records found), and false if error
6533 occurs. Use ErrorMsg()/ErrorNo() to get the error. </p>
6534
6535 <p>Also CacheGetRow and CacheGetCol will return false if error occurs, or empty
6536 array() if EOF, just like GetRow and GetCol. </p>
6537
6538 <p>Datadict now allows changing of types which are not resizable, eg. VARCHAR
6539 to TEXT in ChangeTableSQL. -- Mateo Tibaquirá </p>
6540
6541 <p>Added BIT data type support to adodb-ado.inc.php and adodb-ado5.inc.php. </p>
6542
6543 <p>Ldap driver did not return actual ldap error messages. Fixed. </p>
6544
6545 <p>Implemented GetRandRow($sql, $inputarr). Optimized for Oci8. </p>
6546
6547 <p>Changed adodb5 active record to use static SetDatabaseAdapter() and removed
6548 php4 constructor. Bas van Beek bas.vanbeek#gmail.com. </p>
6549
6550 <p>Also in adodb5, changed adodb-session2 to use static function declarations
6551 in class. Thx Daniel <st1:State w:st="on"><st1:place w:st="on">Berlin</st1:place></st1:State>.
6552 </p>
6553
6554 <p>Added &quot;Clear SQL Log&quot; to bottom of Performance screen. </p>
6555
6556 <p>Sessions2 code echo'ed directly to the screen in debug mode. Now uses
6557 ADOConnection::outp(). </p>
6558
6559 <p>In mysql/mysqli, qstr(null) will return the string &quot;null&quot; instead
6560 of empty quoted string &quot;''&quot;. </p>
6561
6562 <p>postgresql optimizeTable in perf-postgres.inc.php added by Daniel Berlin
6563 (mail#daniel-berlin.de) </p>
6564
6565 <p>Added 5.2.1 compat code for oci8. </p>
6566
6567 <p>Changed @@identity to SCOPE_IDENTITY() for multiple mssql drivers. Thx
6568 Stefano Nari. </p>
6569
6570 <p>Code sanitization introduced in 4.95 caused problems in European locales (as
6571 float 3.2 was typecast to 3,2). Now we only sanitize if is_numeric fails. </p>
6572
6573 <p>Added support for customizing ADORecordset_empty using
6574 $this-&gt;rsPrefix.'empty'. By Josh Truwin. </p>
6575
6576 <p>Added proper support for ALterColumnSQL for Postgresql in datadict code.
6577 Thx. Josh Truwin. </p>
6578
6579 <p>Added better support for MetaType() in mysqli when using an array recordset.
6580 </p>
6581
6582 <p>Changed parser for pgsql error messages in adodb-error.inc.php to
6583 case-insensitive regex. </p>
6584
6585 <p><a name=4.95></a><b>4.95/5.01 17 May 2007</b> </p>
6586
6587 <p>CacheFlush debug outp() passed in invalid parameters. Fixed. </p>
6588
6589 <p>Added Thai language file for adodb. Thx Trirat Petchsingh rosskouk#gmail.com
6590 and Marcos Pont</p>
6591
6592 <p>Added zerofill checking support to MetaColumns for mysql and mysqli. </p>
6593
6594 <p>CacheFlush no longer deletes all files/directories. Only *.cache files
6595 deleted.</p>
6596
6597 <p>DB2 timestamp format changed to var $fmtTimeStamp =
6598 &quot;'Y-m-d-H:i:s'&quot;;</p>
6599
6600 <p>Added some code sanitization to AutoExecute in adodb-lib.inc.php.</p>
6601
6602 <p>Due to typo, all connections in adodb-oracle.inc.php would become
6603 persistent, even non-persistent ones. Fixed.</p>
6604
6605 <p>Oci8 DBTimeStamp uses 24 hour time for input now, so you can perform string
6606 comparisons between 2 DBTimeStamp values.</p>
6607
6608 <p>Some PHP4.4 compat issues fixed in adodb-session2.inc.php</p>
6609
6610 <p>For ADOdb 5.01, fixed some adodb-datadict.inc.php MetaType compat issues
6611 with PHP5. </p>
6612
6613 <p>The $argHostname was wiped out in adodb-ado5.inc.php. Fixed. </p>
6614
6615 <p>Adodb5 version, added iterator support for adodb_recordset_empty. </p>
6616
6617 <p>Adodb5 version,more error checking code now will use exceptions if
6618 available. </p>
6619
6620 <p><a name=4.94></a><b>4.94 23 Jan 2007</b> </p>
6621
6622 <p>Active Record: $ADODB_ASSOC_CASE=2 did not work properly. Fixed. Thx
6623 gmane#auxbuss.com. </p>
6624
6625 <p>mysqli had bugs in BeginTrans() and EndTrans(). Fixed.</p>
6626
6627 <p>Improved error handling when no database is connected for oci8. Thx Andy
6628 Hassall.</p>
6629
6630 <p>Names longer than 30 chars in oci8 datadict will be changed to random name.
6631 Thx Eugenio. http://phplens.com/lens/lensforum/msgs.php?id=16182 </p>
6632
6633 <p>Added var $upperCase = 'ucase' to access and ado_access drivers. Thx Renato
6634 De Giovanni renato#cria.org.br</p>
6635
6636 <p>Postgres64 driver, if preparing plan failed in _query, did not handle error
6637 properly. Fixed. See http://phplens.com/lens/lensforum/msgs.php?id=16131. </p>
6638
6639 <p>Fixed GetActiveRecordsClass() reference bug. See
6640 http://phplens.com/lens/lensforum/msgs.php?id=16120 </p>
6641
6642 <p>Added handling of nulls in adodb-ado_mssql.inc.php for qstr(). Thx to Felix
6643 Rabinovich. </p>
6644
6645 <p>Adodb-dict contributions by Gaetano: <br>
6646 + Support for INDEX in data-dict. Example: idx_ev1. The ability to define
6647 indexes using the INDEX keyword was added in ADOdb 4.94. The following example
6648 features mutiple indexes, including a compound index idx_ev1. </p>
6649
6650 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6651 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre><span style='mso-spacerun:yes'>  </span>event_id I(11) NOTNULL AUTOINCREMENT PRIMARY,</pre><pre><span style='mso-spacerun:yes'>  </span>event_type I(4) NOTNULL<span style='mso-spacerun:yes'>  </span><b>INDEX idx_evt</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_start_date T DEFAULT NULL <b>INDEX id_esd</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_end_date T DEFAULT '0000-00-00 00:00:00' <b>INDEX id_eted</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_parent I(11) UNSIGNED NOTNULL DEFAULT 0 <b>INDEX id_evp</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_owner I(11) DEFAULT 0 <b>INDEX idx_ev1</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_project I(11) DEFAULT 0 <b>INDEX idx_ev1</b>,</pre><pre><span style='mso-spacerun:yes'>  </span>event_times_recuring I(11) UNSIGNED NOTNULL DEFAULT 0,</pre><pre><span style='mso-spacerun:yes'>  </span>event_icon C(20) DEFAULT 'obj/event',</pre><pre><span style='mso-spacerun:yes'>  </span>event_description X</pre></div>
6652
6653 <p class=MsoNormal><br>
6654 + Prevents the generated SQL from including double drop-sequence statements for
6655 REPLACE case of tables with autoincrement columns (on those dbs that emulate it
6656 via sequences) <br>
6657 + makes any date defined as DEFAULT value for D and T columns work
6658 cross-database, not just the &quot;sysdate&quot; value (as long as it is
6659 specified using adodb standard format). See above example. </p>
6660
6661 <p>Fixed pdo's GetInsertID() support. Thx Ricky Su. </p>
6662
6663 <p>oci8 Prepare() now sets error messages if an error occurs. </p>
6664
6665 <p>Added 'PT_BR' to SetDateLocale() -- brazilian portugese. </p>
6666
6667 <p>charset in oci8 was not set correctly on *Connect() </p>
6668
6669 <p>ADOConnection::Transpose() now appends as first column the field names. </p>
6670
6671 <p>Added $ADODB_QUOTE_FIELDNAMES. If set to true, will autoquote field names in
6672 AutoExecute(),GetInsertSQL(), GetUpdateSQL(). </p>
6673
6674 <p>Transpose now adds the field names as the first column after transposition. </p>
6675
6676 <p>Added === check in ADODB_SetDatabaseAdapter for $db,
6677 adodb-active-record.inc.php. Thx Christian Affolter. </p>
6678
6679 <p>Added ErrorNo() to adodb-active-record.inc.php. Thx ante#novisplet.com. </p>
6680
6681 <p><a name=4.93></a><b>4.93 10 Oct 2006</b> </p>
6682
6683 <p>Added support for multiple database connections in performance monitoring
6684 code (adodb-perf.inc.php). Now all sql in multiple database connections can be
6685 saved into one database ($ADODB_LOG_CONN). </p>
6686
6687 <p>Added MetaIndexes() to odbc_mssql. </p>
6688
6689 <p>Added connection property $db-&gt;null2null = 'null'. In
6690 autoexecute/getinsertsql/getupdatesql, this value will be converted to a null.
6691 Set this to a funny invalid value if you do not want null conversion. See
6692 http://phplens.com/lens/lensforum/msgs.php?id=15902. </p>
6693
6694 <p>Path disclosure problem in mysqli fixed. Thx Andy. </p>
6695
6696 <p>Fixed typo in session_schema2.xml. </p>
6697
6698 <p>Changed INT in oci8 to return correct precision in $fld-&gt;max_length,
6699 MetaColumns(). <st1:place w:st="on"><st1:PlaceName w:st="on">Thx</st1:PlaceName>
6700  <st1:PlaceName w:st="on">Eloy</st1:PlaceName> <st1:PlaceName w:st="on">Lafuente</st1:PlaceName>
6701  <st1:PlaceType w:st="on">Plaza</st1:PlaceType></st1:place>. </p>
6702
6703 <p>Patched postgres64 _connect to handle serverinfo(). see http://phplens.com/lens/lensforum/msgs.php?id=15887.
6704 </p>
6705
6706 <p>Added pdo fix for null columns. See
6707 http://phplens.com/lens/lensforum/msgs.php?id=15889 </p>
6708
6709 <p>For stored procedures, missing connection id now passed into mssql_query().
6710 Thx Ecsy (ecsy#freemail.hu). </p>
6711
6712 <p><a name=4.92a></a><b>4.92a 30 Aug 2006</b> </p>
6713
6714 <p>Syntax error in postgres7 driver. <st1:place w:st="on"><st1:PlaceName w:st="on">Thx</st1:PlaceName>
6715  <st1:PlaceName w:st="on">Eloy</st1:PlaceName> <st1:PlaceName w:st="on">Lafuente</st1:PlaceName>
6716  <st1:PlaceType w:st="on">Plaza</st1:PlaceType></st1:place>. </p>
6717
6718 <p>Minor bug fixes - adodb informix 10 types added to adodb.inc.php. Thx
6719 Fernando Ortiz. </p>
6720
6721 <p><a name=4.92></a><b>4.92 29 Aug 2006</b> </p>
6722
6723 <p>Better odbtp date support. </p>
6724
6725 <p>Added IgnoreErrors() to bypass default error handling. </p>
6726
6727 <p>The _adodb_getcount() function in adodb-lib.inc.php, some ORDER BY bug
6728 fixes. </p>
6729
6730 <p>For ibase and firebird, set $sysTimeStamp = &quot;CURRENT_TIMESTAMP&quot;. </p>
6731
6732 <p>Fixed postgres connection bug:
6733 http://phplens.com/lens/lensforum/msgs.php?id=11057. </p>
6734
6735 <p>Changed CacheSelectLimit() to flush cache when $secs2cache==-1 due to
6736 complaints from other users. </p>
6737
6738 <p>Added support for using memcached with CacheExecute/CacheSelectLimit.
6739 Requires memcache module PECL extension. Usage: </p>
6740
6741 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6742 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$db = NewADOConnection($driver);</pre><pre>$db-&gt;memCache = true; /// should we use memCache instead of caching in files</pre><pre>$db-&gt;memCacheHost = &quot;126.0.1.1&quot;; /// memCache host</pre><pre>$db-&gt;memCachePort = 11211; /// this is default memCache port</pre><pre>$db-&gt;memCacheCompress = false; /// Use 'true' to store the item compressed (uses zlib)</pre><pre><o:p>&nbsp;</o:p></pre><pre>$db-&gt;Connect(...);</pre><pre>$db-&gt;CacheExecute($sql);</pre></div>
6743
6744 <p>Implemented Transpose() for recordsets. Recordset must be retrieved using
6745 ADODB_FETCH_NUM. First column becomes the column name. </p>
6746
6747 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
6748 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>$DB = NewADOConnection('mysql');</pre><pre>$DB-&gt;Connect(...);</pre><pre>$DB-&gt;SetFetchMode(ADODB_FETCH_NUM);</pre><pre>$rs = $DB-&gt;Execute('select productname,productid,unitprice from products limit 10');</pre><pre>$rs2 = $DB-&gt;Transpose($rs);</pre><pre>rs2html($rs2);</pre></div>
6749
6750 <p><a name=4.91></a><b>4.91 2 Aug 2006</b> </p>
6751
6752 <p>Major session code rewrite .... See session docs. </p>
6753
6754 <p>PDO bindinputarray was not set properly for MySQL (changed from true to
6755 false). </p>
6756
6757 <p>Changed CacheSelectLimit() to re-cache when $secs2cache==0. This is one way
6758 to flush the cache when SelectLimit is called. </p>
6759
6760 <p>Added to quotes to mysql and mysqli: &quot;SHOW COLUMNS FROM `%s`&quot;; </p>
6761
6762 <p>Removed accidental optgroup handling in GetMenu(). Fixed ibase _BlobDecode
6763 for php5 compat, and also mem alloc issues for small blobs, thx
6764 salvatori#interia.pl </p>
6765
6766 <p>Mysql driver OffsetDate() speedup, useful for adodb-sessions. </p>
6767
6768 <p>Fix for GetAssoc() PHP5 compat. See
6769 http://phplens.com/lens/lensforum/msgs.php?id=15425 </p>
6770
6771 <p>Active Record - If inserting a record and the value of a primary key field
6772 is null, then we do not insert that field in as we assume it is an
6773 auto-increment field. Needed by mssql. </p>
6774
6775 <p>Changed postgres7 MetaForeignKeys() see http://phplens.com/lens/lensforum/msgs.php?id=15531
6776 </p>
6777
6778 <p>DB2 will now return db2_conn_errormsg() when it is a connection error. </p>
6779
6780 <p><a name=4.90></a><b>4.90 8 June 2006</b> </p>
6781
6782 <p>Changed adodb_countrec() in adodb-lib.inc.php to allow LIMIT to be used as a
6783 speedup to reduce no of records counted. </p>
6784
6785 <p>Added support for transaction modes for postgres and oci8 with
6786 SetTransactionMode(). These transaction modes affect all subsequent
6787 transactions of that connection. </p>
6788
6789 <p>Thanks to Halmai Csongor for suggestion. </p>
6790
6791 <p>Removed $off = $fieldOffset - 1 line in db2 driver, FetchField(). Tx Larry
6792 Menard. </p>
6793
6794 <p>Added support for PHP5 objects as Execute() bind parameters using __toString
6795 (eg. Simple-XML). Thx Carl-Christian Salvesen. </p>
6796
6797 <p>Rounding in tohtml.inc.php did not work properly. Fixed. </p>
6798
6799 <p>MetaIndexes in postgres fails when fields are deleted then added in again
6800 because the attnum has gaps in it. See
6801 http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1451245&amp;group_id=42718&amp;atid=433976.
6802 Fixed. </p>
6803
6804 <p>MetaForeignkeys in mysql and mysqli did not work when
6805 fetchMode==ADODB_FETCH_ASSOC used. Fixed. </p>
6806
6807 <p>Reference error in AutoExecute() fixed. </p>
6808
6809 <p>Added macaddr postgres type to MetaType. Maps to 'C'. </p>
6810
6811 <p>Added to _connect() in adodb-ado5.inc.php support for $database and
6812 $dataProvider parameters. Thx Larry Menard. </p>
6813
6814 <p>Added support for sequences in adodb-ado_mssql.inc.php. Thx Larry Menard. </p>
6815
6816 <p>Added ADODB_SESSION_READONLY. </p>
6817
6818 <p>Added session expiryref support to crc32 mode, and in LOB code. </p>
6819
6820 <p>Clear _errorMsg in postgres7 driver, so that ErrorMsg() displays properly
6821 when no error occurs. </p>
6822
6823 <p>Added BindDate and BindTimeStamp </p>
6824
6825 <p><a name=4.81></a><b>4.81 3 May 2006</b> </p>
6826
6827 <p>Fixed variable ref errors in adodb-ado5.inc.php in _query(). </p>
6828
6829 <p>Mysqli setcharset fix using method_exists(). </p>
6830
6831 <p>The adodb-perf.inc.php CreateLogTable() code now works for user-defined
6832 table names. </p>
6833
6834 <p>Error in ibase_blob_open() fixed. See
6835 http://phplens.com/lens/lensforum/msgs.php?id=14997 </p>
6836
6837 <p><a name=4.80></a><b>4.80 8 Mar 2006</b> </p>
6838
6839 <p>Added activerecord support. </p>
6840
6841 <p>Added mysql $conn-&gt;compat323 = true if you want MySQL 3.23 compat
6842 enabled. Fixes GetOne() Select-Limit problems. </p>
6843
6844 <p>Added adodb-xmlschema03.inc.php to support XML Schema version 3 and updated
6845 adodb-datadict.htm docs. </p>
6846
6847 <p>Better memory management in Execute. Thx Mike Fedyk. </p>
6848
6849 <p><a name=4.72></a><b>4.72 21 Feb 2006</b> </p>
6850
6851 <p>Added 'new' DSN parameter for NConnect(). </p>
6852
6853 <p>Pager now sanitizes $PHP_SELF to protect against XSS. Thx to James Bercegay
6854 and others. </p>
6855
6856 <p>ADOConnection::MetaType changed to setup $rs-&gt;connection correctly. </p>
6857
6858 <p>New native DB2 driver contributed by Larry Menard, Dan Scott, Andy
6859 Staudacher, Bharat Mediratta. </p>
6860
6861 <p>The mssql CreateSequence() did not BEGIN TRANSACTION correctly. Fixed. Thx
6862 Sean Lee. </p>
6863
6864 <p>The _adodb_countrecs() function in adodb-lib.inc.php has been revised to
6865 handle more ORDER BY variations. </p>
6866
6867 <p><a name=4.71></a><b>4.71 24 Jan 2006</b> </p>
6868
6869 <p>Fixes postgresql security issue related to binary strings. Thx to Andy
6870 Staudacher. </p>
6871
6872 <p>Several DSN bugs found: </p>
6873
6874 <p>1. Fix bugs in DSN connections introduced in 4.70 when underscores are found
6875 in the DSN. </p>
6876
6877 <p>2. DSN with _ did not work properly in PHP5 (fine in PHP4). Fixed. </p>
6878
6879 <p>3. Added support for PDO DSN connections in NewADOConnection(), and database
6880 parameter in PDO::Connect(). </p>
6881
6882 <p>The oci8 datetime flag not correctly implemented in ADORecordSet_array.
6883 Fixed. </p>
6884
6885 <p>Added BlobDelete() to postgres, as a counterpoint to UpdateBlobFile(). </p>
6886
6887 <p>Fixed GetInsertSQL() to support oci8po. </p>
6888
6889 <p>Fixed qstr() issue with postgresql with \0 in strings. </p>
6890
6891 <p>Fixed some datadict driver loading issues in _adodb_getdriver(). </p>
6892
6893 <p>Added register shutdown function session_write_close in
6894 adodb-session.inc.php for PHP 5 compat. See
6895 http://phplens.com/lens/lensforum/msgs.php?id=14200. </p>
6896
6897 <p><a name=4.70></a><b>4.70 6 Jan 2006</b> </p>
6898
6899 <p>Many fixes from Danila Ulyanov to ibase, oci8, postgres, mssql, odbc_oracle,
6900 odbtp, etc drivers. </p>
6901
6902 <p>Changed usage of binary hint in adodb-session.inc.php for mysql. See
6903 http://phplens.com/lens/lensforum/msgs.php?id=14160 </p>
6904
6905 <p>Fixed invalid variable reference problem in undomq(), adodb-perf.inc.php. </p>
6906
6907 <p>Fixed http://phplens.com/lens/lensforum/msgs.php?id=14254 in
6908 adodb-perf.inc.php, _DBParameter() settings of fetchmode was wrong. </p>
6909
6910 <p>Fixed security issues in server.php and tmssql.php discussed by Andreas
6911 Sandblad in a Secunia security advisory. Added $ACCEPTIP = 127.0.0.1 and
6912 changed suggested root password to something more secure. </p>
6913
6914 <p>Changed pager to close recordset after RenderLayout(). </p>
6915
6916 <p><a name=4.68></a><b>4.68 25 Nov 2005</b> </p>
6917
6918 <p>PHP 5 compat for mysqli. MetaForeignKeys repeated twice and
6919 MYSQLI_BINARY_FLAG missing. </p>
6920
6921 <p>PHP 5.1 support for postgresql bind parameters using ? did not work if &gt;=
6922 10 parameters. Fixed. Thx to Stanislav Shramko. </p>
6923
6924 <p>Lots of PDO improvements. </p>
6925
6926 <p>Spelling error fixed in mysql MetaForeignKeys, $associative parameter. </p>
6927
6928 <p><a name=4.67></a><b>4.67 16 Nov 2005</b> </p>
6929
6930 <p>Postgresql not_null flag not set to false correctly. Thx Cristian MARIN. </p>
6931
6932 <p>We now check in Replace() if key is in fieldArray. Thx Sébastien Vanvelthem.
6933 </p>
6934
6935 <p>_file_get_contents() function was missing in xmlschema. fixed. </p>
6936
6937 <p>Added week in year support to SQLDate(), using 'W' flag. Thx Spider. </p>
6938
6939 <p>In sqlite metacolumns was repeated twice, causing PHP 5 problems. Fixed. </p>
6940
6941 <p>Made debug output XHTML compliant. </p>
6942
6943 <p><a name=4.66></a><b>4.66 28 Sept 2005</b> </p>
6944
6945 <p>ExecuteCursor() in oci8 did not clean up properly on failure. Fixed. </p>
6946
6947 <p>Updated xmlschema.dtd, by &quot;Alec Smecher&quot; asmecher#smecher.bc.ca </p>
6948
6949 <p>Hardened SelectLimit, typecasting nrows and offset to integer. </p>
6950
6951 <p>Fixed misc bugs in AutoExecute() and GetInsertSQL(). </p>
6952
6953 <p>Added $conn-&gt;database as the property holding the database name. The
6954 older $conn-&gt;databaseName is retained for backward compat. </p>
6955
6956 <p>Changed _adodb_backtrace() compat check to use function_exists(). </p>
6957
6958 <p>Bug in postgresql MetaIndexes fixed. Thx Kevin Jamieson. </p>
6959
6960 <p>Improved OffsetDate for MySQL, reducing rounding error. </p>
6961
6962 <p>Metacolumns added to sqlite. Thx Mark Newnham. </p>
6963
6964 <p>PHP 4.4 compat fixes for GetAssoc(). </p>
6965
6966 <p>Added postgresql bind support for php 5.1. Thx Cristiano da Cunha Duarte </p>
6967
6968 <p>OffsetDate() fixes for postgresql, typecasting strings to date or timestamp.
6969 </p>
6970
6971 <p>DBTimeStamp formats for mssql, odbc_mssql and postgresql made to conform
6972 with other db's. </p>
6973
6974 <p>Changed PDO constants from PDO_ to PDO:: to support latest spec. </p>
6975
6976 <p><a name=4.65></a><b>4.65 22 July 2005</b> </p>
6977
6978 <p>Reverted 'X' in mssql datadict to 'TEXT' to be compat with mssql driver.
6979 However now you can set $datadict-&gt;typeX = 'varchar(4000)' or 'TEXT' or
6980 'CLOB' for mssql and oci8 drivers. </p>
6981
6982 <p>Added charset support when using DSN for Oracle. </p>
6983
6984 <p>_adodb_getmenu did not use fieldcount() to get number of fields. Fixed. </p>
6985
6986 <p>MetaForeignKeys() for mysql/mysqli contributed by Juan Carlos Gonzalez. </p>
6987
6988 <p>MetaDatabases() now correctly returns an array for mysqli driver. Thx
6989 Cristian MARIN. </p>
6990
6991 <p>CompleteTrans(false) did not return false. Fixed. Thx to JMF. </p>
6992
6993 <p>AutoExecute() did not work with Oracle. Fixed. Thx José Moreira. </p>
6994
6995 <p>MetaType() added to connection object. </p>
6996
6997 <p>More PHP 4.4 reference return fixes. Thx Ryan C Bonham and others. </p>
6998
6999 <p><a name=4.64></a><b>4.64 20 June 2005</b> </p>
7000
7001 <p>In datadict, if the default field value is set to '', then it is not applied
7002 when the field is created. Fixed by Eugenio. </p>
7003
7004 <p>MetaPrimaryKeys for postgres did not work because of true/false change in
7005 4.63. Fixed. </p>
7006
7007 <p>Tested ocifetchstatement in oci8. Rejected at the end. </p>
7008
7009 <p>Added port to dsn handling. Supported in postgres, mysql, mysqli,ldap. </p>
7010
7011 <p>Added 'w' and 'l' to mysqli SQLDate(). </p>
7012
7013 <p>Fixed error handling in ldap _connect() to be more consistent. Also added
7014 ErrorMsg() handling to ldap. </p>
7015
7016 <p>Added support for union in _adodb_getcount, adodb-lib.inc.php for postgres
7017 and oci8. </p>
7018
7019 <p>rs2html() did not work with null dates properly. </p>
7020
7021 <p>PHP 4.4 reference return fixes. </p>
7022
7023 <p><a name=4.63></a><b>4.63 18 May 2005</b> </p>
7024
7025 <p>Added $nrows<0 check to mysqli's SelectLimit().
7026 <p>Added OptimizeTable() and OptimizeTables() in adodb-perf.inc.php. By Markus Staab.
7027 <p>PostgreSQL inconsistencies fixed. true and false set to TRUE and FALSE, and boolean type in datadict-postgres.inc.php set
7028 to 'L' => 'BOOLEAN'. Thx Kevin Jamieson.
7029 <p>New adodb_session_create_table() function in adodb-session.inc.php. By Markus Staab.
7030 <p>Added null check to UserTimeStamp().
7031 <p>Fixed typo in mysqlt driver in adorecordset. Thx to Andy Staudacher.
7032 <p>GenID() had a bug in the raiseErrorFn handling. Fixed. Thx Marcos Pont.
7033 <p>Datadict name quoting now handles ( ) in index fields correctly - they aren't part of the index field. ></p>
7034
7035 <p>Performance monitoring: (1) oci8 Ixora checks moved down; (2) expensive sql
7036 changed so that only those sql with count(*)&gt;1 are shown; (3) changed sql1
7037 field to a length+crc32 checksum - this breaks backward compat. </p>
7038
7039 <p>We remap firebird15 to firebird in data dictionary. </p>
7040
7041 <p><a name=4.62></a><b>4.62 2 Apr 2005</b> </p>
7042
7043 <p>Added 'w' (dow as 0-6 or 1-7) and 'l' (dow as string) for SQLDate for oci8,
7044 postgres and mysql. </p>
7045
7046 <p>Rolled back MetaType() changes for mysqli done in prev version. </p>
7047
7048 <p>Datadict change by chris, cblin#tennaxia.com data mappings from: </p>
7049
7050 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7051 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>oci8:<span style='mso-spacerun:yes'>  </span>X-&gt;varchar(4000) XL-&gt;CLOB</pre><pre>mssql: X-&gt;XL-&gt;TEXT</pre><pre>mysql: X-&gt;XL-&gt;LONGTEXT</pre><pre>fbird: X-&gt;XL-&gt;varchar(4000)</pre></div>
7052
7053 <p>to: </p>
7054
7055 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7056 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre><o:p>&nbsp;</o:p></pre><pre>oci8:<span style='mso-spacerun:yes'>  </span>X-&gt;varchar(4000) XL-&gt;CLOB</pre><pre>mssql: X-&gt;VARCHAR(4000) XL-&gt;TEXT</pre><pre>mysql: X-&gt;TEXT<span style='mso-spacerun:yes'>          </span>XL-&gt;LONGTEXT</pre><pre>fbird: X-&gt;VARCHAR(4000) XL-&gt;VARCHAR(32000)</pre></div>
7057
7058 <p>Added $connection-&gt;disableBlobs to postgresql to improve performance when
7059 no bytea is used (2-5% improvement). </p>
7060
7061 <p>Removed all HTTP_* vars. </p>
7062
7063 <p>Added $rs-&gt;tableName to be set before calling AutoExecute(). </p>
7064
7065 <p>Alex Rootoff rootoff#pisem.net contributed ukrainian language file. </p>
7066
7067 <p>Added new mysql_option() support using $conn-&gt;optionFlags array. </p>
7068
7069 <p>Added support for ldap_set_option() using the $LDAP_CONNECT_OPTIONS global
7070 variable. Contributed by Josh Eldridge. </p>
7071
7072 <p>Added LDAP_* constant definitions to ldap. </p>
7073
7074 <p>Added support for boolean bind variables. We use $conn-&gt;false and
7075 $conn-&gt;true to hold values to set false/true to. </p>
7076
7077 <p>We now do not close the session connection in adodb-session.inc.php as other
7078 objects could be using this connection. </p>
7079
7080 <p>We now strip off \0 at end of Ixora SQL strings in $perf-&gt;tohtml() for
7081 oci8. </p>
7082
7083 <p><a name=4.61></a><b>4.61 23 Feb 2005</b> </p>
7084
7085 <p>MySQLi added support for mysqli_connect_errno() and mysqli_connect_error(). </p>
7086
7087 <p>Massive improvements to alpha PDO driver. </p>
7088
7089 <p>Quote string bind parameters logged by performance monitor for easy type
7090 checking. Thx Jason Judge. </p>
7091
7092 <p>Added support for $role when connecting with Interbase/firebird. </p>
7093
7094 <p>Added support for enum recognition in MetaColumns() mysql and mysqli. Thx
7095 Amedeo Petrella. </p>
7096
7097 <p>The sybase_ase driver contributed by Interakt Online. Thx Cristian Marin
7098 cristic#interaktonline.com. </p>
7099
7100 <p>Removed not_null, has_default, and default_value from ADOFieldObject. </p>
7101
7102 <p>Sessions code, fixed quoting of keys when handling LOBs in session write()
7103 function. </p>
7104
7105 <p>Sessions code, added adodb_session_regenerate_id(), to reduce risk of
7106 session hijacking by changing session cookie dynamically. Thx Joe Li. </p>
7107
7108 <p>Perf monitor, polling for CPU did not work for PHP 4.3.10 and 5.0.0-5.0.3
7109 due to PHP bugs, so we special case these versions. </p>
7110
7111 <p>Postgresql, UpdateBlob() added code to handle type==CLOB. </p>
7112
7113 <p><a name=4.60></a><b>4.60 24 Jan 2005</b> </p>
7114
7115 <p>Implemented PEAR DB's autoExecute(). Simplified design because I don't like
7116 using constants when strings work fine. </p>
7117
7118 <p>_rs2serialize will now update $rs-&gt;sql and $rs-&gt;oldProvider. </p>
7119
7120 <p>Added autoExecute(). </p>
7121
7122 <p>Added support for postgres8 driver. Currently just remapped to postgres7
7123 driver. </p>
7124
7125 <p>Changed oci8 _query(), so that OCIBindByName() sets the length to -1 if
7126 element size is &gt; 4000. This provides better support for LONGs. </p>
7127
7128 <p>Added SetDateLocale() support for <st1:country-region w:st="on"><st1:place
7129  w:st="on">netherlands</st1:place></st1:country-region> (Nl). </p>
7130
7131 <p>Spelling error in pivot code ($iff should be $iif). </p>
7132
7133 <p>mysql insert_id() did not work with mysql 3.x. Fixed. </p>
7134
7135 <p>&quot;\r\n&quot; not converted to spaces correctly in exporting data. Fixed.
7136 </p>
7137
7138 <p>_nconnect() in mysqli did not return value correctly. Fixed. </p>
7139
7140 <p>Arne Eckmann contributed danish language file. </p>
7141
7142 <p>Added clone() support to FetchObject() for PHP5.</p>
7143
7144 <p>Removed SQL_CUR_USE_ODBC from odbc_mssql.</p>
7145
7146 <p><a name=4.55></a><b>4.55 5 Jan 2005</b> </p>
7147
7148 <p>Found bug in Execute() with bind params for db's that do not support binding
7149 natively. </p>
7150
7151 <p>DropSequence() now correctly uses default parameter. </p>
7152
7153 <p>Now Execute() ignores locale for floats, so 1.23 is NEVER converted to 1,23.
7154 </p>
7155
7156 <p>SetFetchMode() not properly saved in adodb-perf, suspicious sql and
7157 expensive sql. Fixed. </p>
7158
7159 <p>Added INET to postgresql metatypes. Thx motzel. </p>
7160
7161 <p>Allow oracle hints to work when counting with _adodb_getcount in
7162 adodb-lib.inc.php. Thx Chris Wrye. </p>
7163
7164 <p>Changed mysql insert_id() to use SELECT LAST_INSERT_ID(). </p>
7165
7166 <p>If alter col in datadict does not modify col type/size of actual col, then
7167 it is removed from alter col code. By Mark Newham. Not perfect as MetaType()
7168 !== ActualType(). </p>
7169
7170 <p>Added handling of view fields in metacolumns() for postgresql. Thx Renato De
7171 Giovanni. </p>
7172
7173 <p>Added to informix MetaPrimaryKeys and MetaColumns fixes for null bit. Thx to
7174 Cecilio Albero. </p>
7175
7176 <p>Removed obsolete connection_timeout() from perf code. </p>
7177
7178 <p>Added support for arrayClass in adodb-csv.inc.php. </p>
7179
7180 <p>RSFilter now accepts methods of the form $array($obj, 'methodname'). Thx to
7181 blake#near-time.com. </p>
7182
7183 <p>Changed CacheFlush to $cmd = 'rm -rf
7184 '.$ADODB_CACHE_DIR.'/[0-9a-f][0-9a-f]/'; </p>
7185
7186 <p>For better cursor concurrency, added code to free ref cursors in oci8 when
7187 $rs-&gt;Close() is called. Note that CLose() is called internally by the Get*
7188 functions too. </p>
7189
7190 <p>Added IIF support for access when pivoting. Thx Volodia Krupach. </p>
7191
7192 <p>Added mssql datadict support for timestamp. Thx Alexios. </p>
7193
7194 <p>Informix pager fix. By Mario Ramirez. </p>
7195
7196 <p>ADODB_TABLE_REGEX now includes ':'. By Mario Ramirez. </p>
7197
7198 <p>Mark Newnham contributed MetaIndexes for oci8 and db2. </p>
7199
7200 <p><a name=4.54></a><b>4.54 5 Nov 2004</b> </p>
7201
7202 <p>Now you can set $db-&gt;charSet = ?? before doing a Connect() in oci8. </p>
7203
7204 <p>Added adodbFetchMode to sqlite. </p>
7205
7206 <p>Perf code, added a string typecast to substr in adodb_log_sql(). </p>
7207
7208 <p>Postgres: Changed BlobDecode() to use po_loread, added new $maxblobsize
7209 parameter, and now it returns the blob instead of sending it to stdout - make
7210 sure to mention that as a compat warning. Also added $db-&gt;IsOID($oid)
7211 function; uses a heuristic, not guaranteed to work 100%. </p>
7212
7213 <p>Contributed arabic language file by &quot;El-Shamaa, Khaled&quot;
7214 k.el-shamaa#cgiar.org </p>
7215
7216 <p>PHP5 exceptions did not handle @ protocol properly. Fixed. </p>
7217
7218 <p>Added ifnull handling for postgresql (using coalesce). </p>
7219
7220 <p>Added metatables() support for Postgresql 8.0 (no longer uses pg_%
7221 dictionary tables). </p>
7222
7223 <p>Improved Sybase ErrorMsg() function. By Gaetano Giunta. </p>
7224
7225 <p>Improved oci8 SelectLimit() to use Prepare(). By Cristiano Duarte. </p>
7226
7227 <p>Type-cast $row parameter in ifx_fetch_row() to int. Thx stefan bodgan. </p>
7228
7229 <p>Ralf becker contributed improvements in postgresql, sapdb, mysql data
7230 dictionary handling:<br>
7231 - MySql and Postgres MetaType was reporting every int column which was part of
7232 a primary key and unique as serial<br>
7233 - Postgres was not reporting the scale of decimal types<br>
7234 - MaxDB was padding the defaults of none-string types with spaces<br>
7235 - MySql now correctly converts enum columns to varchar </p>
7236
7237 <p>Ralf also changed Postgresql datadict:<br>
7238 - you cant add NOT NULL columns in postgres in one go, they need to be added as
7239 NULL and then altered to NOT NULL<br>
7240 - AlterColumnSQL could not change a varchar column with numbers into an integer
7241 column, postgres need an explicit conversation<br>
7242 - a re-created sequence was not set to the correct value, if the name was the
7243 old name (no implicit sequence), now always the new name of the implicit
7244 sequence is used</p>
7245
7246 <p>Sergio Strampelli added extra $intoken check to Lens_ParseArgs() in datadict
7247 code. </p>
7248
7249 <p><a name=4.53></a><b>4.53 28 Sept 2004</b> </p>
7250
7251 <p>FetchMode cached in recordset is sometimes mapped to native db fetchMode.
7252 Normally this does not matter, but when using cached recordsets, we need to
7253 switch back to using adodb fetchmode. So we cache this in
7254 $rs-&gt;adodbFetchMode if it differs from the db's fetchMode. </p>
7255
7256 <p>For informix we now set canSeek = false driver because stefan bodgan tells
7257 me that seeking doesn't work. </p>
7258
7259 <p>SetDateLocale() never worked till now ;-) Thx david#tomato.it </p>
7260
7261 <p>Set $_bindInputArray = true in sapdb driver. Required for clob support. </p>
7262
7263 <p>Fixed some PEAR::DB emulation issues with isError() and isWarning. Thx to
7264 Gert-Rainer Bitterlich. </p>
7265
7266 <p>Empty() used in getupdatesql without strlen() check. Fixed.</p>
7267
7268 <p>Added unsigned detection to mysql and mysqli drivers. Thx to dan cech. </p>
7269
7270 <p>Added hungarian language file. Thx to Halászvári Gábor. </p>
7271
7272 <p>Improved fieldname-type formatting of datadict SQL generated (adding
7273 $widespacing parameter to _GenField). </p>
7274
7275 <p>Datadict oci8 DROP CONSTRAINTS misspelt. Fixed. Thx Mark Newnham. </p>
7276
7277 <p>Changed odbtp to dynamically change databaseType based on connection, eg.
7278 from 'odbtp' to 'odbtp_mssql' when connecting to mssql database. </p>
7279
7280 <p>In datadict, MySQL I4 was wrongly mapped to MEDIUMINT, which is actually I3.
7281 Fixed. </p>
7282
7283 <p>Fixed mysqli MetaType() recognition. Mysqli returns numeric types unlike
7284 mysql extension. Thx Francesco Riosa. </p>
7285
7286 <p>VFP odbc driver curmode set wrongly, causing problems with memo fields.
7287 Fixed. </p>
7288
7289 <p>Odbc driver did not recognize odbc version 2 driver date types properly.
7290 Fixed. Thx Bostjan. </p>
7291
7292 <p>ChangeTableSQL() fixes to datadict-db2.inc.php by Mark Newnham. </p>
7293
7294 <p>Perf monitoring with odbc improved. Now we try in perf code to manually set
7295 the sysTimeStamp using date() if sysTimeStamp is empty. </p>
7296
7297 <p>All <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>
7298 errors are thrown as exceptions in PHP5. So we added exception handling to ado
7299 in PHP5 by creating new adodb-ado5.inc.php driver. </p>
7300
7301 <p>Added IsConnected(). Returns true if connection object connected. By
7302 Luca.Gioppo. </p>
7303
7304 <p>&quot;Ralf Becker&quot; RalfBecker#digitalROCK.de contributed new sapdb
7305 data-dictionary driver and a large patch that implements field and table
7306 renaming for oracle, mssql, postgresql, mysql and sapdb. See the new RenameTableSQL()
7307 and RenameColumnSQL() functions. </p>
7308
7309 <p>We now check ExecuteCursor to see if PrepareSP was initially called. </p>
7310
7311 <p>Changed oci8 datadict to use MODIFY for $dd-&gt;alterCol. Thx Mark Newnham. </p>
7312
7313 <p><a name=4.52></a><b>4.52 10 Aug 2004</b> </p>
7314
7315 <p>Bug found in Replace() when performance logging enabled, introduced in ADOdb
7316 4.50. Fixed. </p>
7317
7318 <p>Replace() checks update stmt. If update stmt fails, we now return
7319 immediately. Thx to alex. </p>
7320
7321 <p>Added support for $ADODB_FORCE_TYPE in GetUpdateSQL/GetInsertSQL. Thx to
7322 niko. </p>
7323
7324 <p>Added ADODB_ASSOC_CASE support to postgres/postgres7 driver. </p>
7325
7326 <p>Support for DECLARE stmt in oci8. Thx Lochbrunner. </p>
7327
7328 <p><a name=4.51></a><b>4.51 29 July 2004</b> </p>
7329
7330 <p>Added adodb-xmlschema 1.0.2. Thx dan and richard. </p>
7331
7332 <p>Added new adorecordset_ext_* classes. If ADOdb extension installed for
7333 mysql, mysqlt and oci8 (but not oci8po), we use the superfast ADOdb extension
7334 code for movenext. </p>
7335
7336 <p>Added schema support to mssql and odbc_mssql MetaPrimaryKeys(). </p>
7337
7338 <p>Patched MSSQL driver to support PHP NULL and Boolean values while binding
7339 the input array parameters in the _query() function. By Stephen Farmer. </p>
7340
7341 <p>Added support for clob's for mssql, UpdateBlob(). Thx to
7342 gfran#directa.com.br </p>
7343
7344 <p>Added normalize support for postgresql (true=lowercase table name, or
7345 false=case-sensitive table names) to MetaColumns($table, $normalize=true). </p>
7346
7347 <p>PHP5 variant dates in <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>
7348 not working. Fixed in adodb-ado.inc.php. </p>
7349
7350 <p>Constant ADODB_FORCE_NULLS was not working properly for many releases (for
7351 GetUpdateSQL). Fixed. Also GetUpdateSQL strips off ORDER BY now - thx Elieser
7352 Leão. </p>
7353
7354 <p>Perf Monitor for oci8 now dynamically highlights optimizer_* params if too
7355 high/low. </p>
7356
7357 <p>Added dsn support to NewADOConnection/ADONewConnection. </p>
7358
7359 <p>Fixed out of page bounds bug in _adodb_pageexecute_all_rows() Thx to
7360 &quot;Sergio Strampelli&quot; sergio#rir.it </p>
7361
7362 <p>Speedup of movenext for mysql and oci8 drivers. </p>
7363
7364 <p>Moved debugging code _adodb_debug_execute() to adodb-lib.inc.php. </p>
7365
7366 <p>Fixed postgresql bytea detection bug. See
7367 http://phplens.com/lens/lensforum/msgs.php?id=9849. </p>
7368
7369 <p>Fixed ibase datetimestamp typo in PHP5. Thx stefan. </p>
7370
7371 <p>Removed whitespace at end of odbtp drivers. </p>
7372
7373 <p>Added db2 metaprimarykeys fix. </p>
7374
7375 <p>Optimizations to MoveNext() for mysql and oci8. Misc speedups to Get*
7376 functions. </p>
7377
7378 <p><a name=4.50></a><b>4.50 6 July 2004</b> </p>
7379
7380 <p>Bumped it to 4.50 to avoid confusion with PHP 4.3.x series. </p>
7381
7382 <p>Added db2 metatables and metacolumns extensions. </p>
7383
7384 <p>Added alpha PDO driver. Very buggy, only works with odbc. </p>
7385
7386 <p>Tested mysqli. Set poorAffectedRows = true. Cleaned up movenext() and
7387 _fetch(). </p>
7388
7389 <p>PageExecute does not work properly with php5 (return val not a variable).
7390 Reported Dmytro Sychevsky sych#php.com.ua. Fixed. </p>
7391
7392 <p>MetaTables() for mysql, $showschema parameter was not backward compatible
7393 with older versions of adodb. Fixed. </p>
7394
7395 <p>Changed mysql GetOne() to work with mysql 3.23 when using with non-select
7396 stmts (e.g. SHOW TABLES). </p>
7397
7398 <p>Changed TRIG_ prefix to a variable in datadict-oci8.inc.php. Thx to
7399 Luca.Gioppo#csi.it. </p>
7400
7401 <p>New to adodb-time code. We allow you to define your own daylights savings
7402 function, adodb_daylight_sv for pre-1970 dates. If the function is defined
7403 (somewhere in an include), then you can correct for daylights savings. See
7404 http://phplens.com/phpeverywhere/node/view/16#daylightsavings for more info. </p>
7405
7406 <p>New sqlitepo driver. This is because assoc mode does not work like other
7407 drivers in sqlite. Namely, when selecting (joining) multiple tables, in assoc
7408 mode the table names are included in the assoc keys in the &quot;sqlite&quot;
7409 driver. In &quot;sqlitepo&quot; driver, the table names are stripped from the
7410 returned column names. When this results in a conflict, the first field get
7411 preference. Contributed by Herman Kuiper herman#ozuzo.net </p>
7412
7413 <p>Added $forcenull parameter to GetInsertSQL/GetUpdateSQL. Idea by Marco
7414 Aurelio Silva. </p>
7415
7416 <p>More XHTML changes for GetMenu. By Jeremy Evans. </p>
7417
7418 <p>Fixes some ibase date issues. Thx to stefan bogdan. </p>
7419
7420 <p>Improvements to mysqli driver to support $ADODB_COUNTRECS. </p>
7421
7422 <p>Fixed adodb-csvlib.inc.php problem when reading stream from socket. We need
7423 to poll stream continiously. </p>
7424
7425 <p><a name=4.23></a><b>4.23 16 June 2004</b> </p>
7426
7427 <p>New interbase/firebird fixes thx to Lester Caine. Driver fixes a problem
7428 with getting field names in the result array, and corrects a couple of data
7429 conversions. Also we default to dialect3 for firebird. Also ibase sysDate
7430 property was wrong. Changed to cast as timestamp. </p>
7431
7432 <p>The datadict driver is set up to give quoted tables and fields as this was
7433 the only way round reserved words being used as field names in TikiWiki.
7434 TikiPro is tidying that up, and I hope to be able to produce a build of THAT
7435 which uses what I consider proper UPPERCASE field and table names. The
7436 conversion of TikiWiki to ADOdb helped in that, but until the database is
7437 completely tidied up in TikiPro ... </p>
7438
7439 <p>Modified _gencachename() to include fetchmode in name hash. This means you
7440 should clear your cache directory after installing this release as the cache
7441 name algorithm has changed. </p>
7442
7443 <p>Now Cache* functions work in safe mode, because we do not create
7444 sub-directories in the $ADODB_CACHE_DIR in safe mode. In non-safe mode we still
7445 create sub-directories. Done by modifying _gencachename(). </p>
7446
7447 <p>Added $gmt parameter (true/false) to UserDate and UserTimeStamp in
7448 connection class, to force conversion of input (in local time) to be converted
7449 to UTC/GMT. </p>
7450
7451 <p>Mssql datadict did not support INT types properly (no size param allowed).
7452 Added _GetSize() to datadict-mssql.inc.php. </p>
7453
7454 <p>For borland_ibase, BeginTrans(), changed:</p>
7455
7456 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7457 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
7458 style='background:#EEEEEE'><span style='mso-spacerun:yes'>   </span>$this-&gt;_transactionID = $this-&gt;_connectionID;</pre></div>
7459
7460 <p class=MsoNormal>to</p>
7461
7462 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7463 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
7464 style='background:#EEEEEE'><span style='mso-spacerun:yes'>   </span>$this-&gt;_transactionID = ibase_trans($this-&gt;ibasetrans, $this-&gt;_connectionID);</pre></div>
7465
7466 <p>Fixed typo in mysqi_field_seek(). Thx to Sh4dow (sh4dow#php.pl). </p>
7467
7468 <p>LogSQL did not work with Firebird/Interbase. Fixed. </p>
7469
7470 <p>Postgres: made errorno() handling more consistent. Thx to Michael Jahn,
7471 Michael.Jahn#mailbox.tu-dresden.de. </p>
7472
7473 <p>Added informix patch to better support metatables, metacolumns by
7474 &quot;Cecilio Albero&quot; c-albero#eos-i.com </p>
7475
7476 <p>Cyril Malevanov contributed patch to oci8 to support passing of LOB
7477 parameters: </p>
7478
7479 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7480 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
7481 style='background:#EEEEEE'><span style='mso-tab-count:1'>         </span>$text = 'test test test';<br>
7482 <span style='mso-tab-count:1'>         </span>$sql = &quot;declare rs clob; begin :rs := lobinout(:sa0); end;&quot;;<br>
7483 <span style='mso-tab-count:1'>         </span>$stmt = $conn -&gt; PrepareSP($sql);<br>
7484 <span style='mso-tab-count:1'>         </span>$conn -&gt; InParameter($stmt,$text,'sa0', -1, OCI_B_CLOB);<br>
7485 <span style='mso-tab-count:1'>         </span>$rs = '';<br>
7486 <span style='mso-tab-count:1'>         </span>$conn -&gt; OutParameter($stmt,$rs,'rs', -1, OCI_B_CLOB);<br>
7487 <span style='mso-tab-count:1'>         </span>$conn -&gt; Execute($stmt);<br>
7488 <span style='mso-tab-count:1'>         </span>echo &quot;return = &quot;.$rs.&quot;&lt;br&gt;&quot;;</pre></div>
7489
7490 <p class=MsoNormal>As he says, the LOBs limitations are: </p>
7491
7492 <div style='mso-element:para-border-div;border:solid #DDDDDD 1.0pt;mso-border-alt:
7493 solid #DDDDDD .75pt;padding:9.0pt 18.0pt 9.0pt 18.0pt;background:#EEEEEE'><pre
7494 style='background:#EEEEEE'><span style='mso-spacerun:yes'> </span>- use OCINewDescriptor before binding<br>
7495 <span style='mso-spacerun:yes'> </span>- if Param is IN, uses save() before each execute. This is done automatically for you.<br>
7496 <span style='mso-spacerun:yes'> </span>- if Param is OUT, uses load() after each execute. This is done automatically for you.<br>
7497 <span style='mso-spacerun:yes'> </span>- when we bind $var as LOB, we create new descriptor and return it as a<br>
7498 <span style='mso-spacerun:yes'>  </span><span style='mso-spacerun:yes'> </span>Bind Result, so if we want to use OUT parameters, we have to store<br>
7499 <span style='mso-spacerun:yes'>   </span>somewhere &amp;$var to load() data from LOB to it.<br>
7500 <span style='mso-spacerun:yes'> </span>- IN OUT params are not working now (should not be a big problem to fix it)<br>
7501 <span style='mso-spacerun:yes'> </span>- now mass binding not working too (I've wrote about it before)</pre></div>
7502
7503 <p>Simplified Connect() and PConnect() error handling. </p>
7504
7505 <p>When extension not loaded, Connect() and PConnect() will return null. On
7506 connect error, the fns will return false. </p>
7507
7508 <p>CacheGetArray() added to code. </p>
7509
7510 <p>Added Init() to adorecordset_empty(). </p>
7511
7512 <p>Changed postgres64 driver, MetaColumns() to not strip off quotes in default
7513 value if :: detected (type-casting of default). </p>
7514
7515 <p>Added test: if (!defined('ADODB_DIR')) die(). Useful to prevent hackers from
7516 detecting file paths. </p>
7517
7518 <p>Changed metaTablesSQL to ignore Postgres 7.4 information schemas (sql_*). </p>
7519
7520 <p>New polish language file by Grzegorz Pacan </p>
7521
7522 <p>Added support for <st1:place w:st="on">UNION</st1:place> in
7523 _adodb_getcount(). </p>
7524
7525 <p>Added security check for ADODB_DIR to limit path disclosure issues.
7526 Requested by postnuke team. </p>
7527
7528 <p>Added better error message support to oracle driver. Thx to Gaetano Giunta. </p>
7529
7530 <p>Added showSchema support to mysql. </p>
7531
7532 <p>Bind in oci8 did not handle $name=false properly. Fixed. </p>
7533
7534 <p>If extension not loaded, Connect(), PConnect(), NConnect() will return null.
7535 </p>
7536
7537 <p><b>4.22 15 Apr 2004</b> </p>
7538
7539 <p>Moved docs to own adodb/docs folder. </p>
7540
7541 <p>Fixed session bug when quoting compressed/encrypted data in Replace(). </p>
7542
7543 <p>Netezza Driver and LDAP drivers contributed by Josh Eldridge. </p>
7544
7545 <p>GetMenu now uses rtrim() on values instead of trim(). </p>
7546
7547 <p>Changed MetaColumnNames to return an associative array, keys being the field
7548 names in uppercase. </p>
7549
7550 <p>Suggested fix to adodb-ado.inc.php affected_rows to support PHP5 variants.
7551 Thx to Alexios Fakos. </p>
7552
7553 <p>Contributed bulgarian language file by Valentin Sheiretsky
7554 valio#valio.eu.org. </p>
7555
7556 <p>Contributed romanian language file by stefan bogdan. </p>
7557
7558 <p>GetInsertSQL now checks for table name (string) in $rs, and will create a
7559 recordset for that table automatically. Contributed by Walt Boring. Also added
7560 OCI_B_BLOB in bind on Walt's request - hope it doesn't break anything :-) </p>
7561
7562 <p>Some minor postgres speedups in _initrs(). </p>
7563
7564 <p>ChangeTableSQL checks now if MetaColumns returns empty. Thx Jason Judge. </p>
7565
7566 <p>Added ADOConnection::Time(), returns current database time in unix timestamp
7567 format, or false. </p>
7568
7569 <p><b>4.21 20 Mar 2004</b> </p>
7570
7571 <p>We no longer in SelectLimit for VFP driver add SELECT TOP X unless an ORDER
7572 BY exists. </p>
7573
7574 <p>Pim Koeman contributed dutch language file adodb-nl.inc.php. </p>
7575
7576 <p>Rick Hickerson added CLOB support to db2 datadict. </p>
7577
7578 <p>Added odbtp driver. Thx to &quot;stefan bogdan&quot; sbogdan#rsb.ro. </p>
7579
7580 <p>Changed PrepareSP() 2nd parameter, $cursor, to default to true (formerly
7581 false). Fixes oci8 backward compat problems with OUT params. </p>
7582
7583 <p>Fixed month calculation error in adodb-time.inc.php. 2102-June-01 appeared
7584 as 2102-May-32. </p>
7585
7586 <p>Updated PHP5 RC1 iterator support. API changed, hasMore() renamed to
7587 valid(). </p>
7588
7589 <p>Changed internal format of serialized cache recordsets. As we store a
7590 version number, this should be backward compatible. </p>
7591
7592 <p>Error handling when driver file not found was flawed in ADOLoadCode().
7593 Fixed. </p>
7594
7595 <p><b>4.20 27 Feb 2004</b> </p>
7596
7597 <p>Updated to AXMLS 1.01. </p>
7598
7599 <p>MetaForeignKeys for postgres7 modified by Edward Jaramilla, works on pg 7.4.
7600 </p>
7601
7602 <p>Now numbers accepts function calls or sequences for
7603 GetInsertSQL/GetUpdateSQL numeric fields. </p>
7604
7605 <p>Changed quotes of 'delete from $perf_table' to &quot;&quot;. Thx Kehui
7606 (webmaster#kehui.net) </p>
7607
7608 <p>Added ServerInfo() for ifx, and putenv trim fix. Thx Fernando Ortiz. </p>
7609
7610 <p>Added addq(), which is analogous to addslashes(). </p>
7611
7612 <p>Tested with php5b4. Fix some php5 compat problems with exceptions and
7613 sybase. </p>
7614
7615 <p>Carl-Christian Salvesen added patch to mssql _query to support binds greater
7616 than 4000 chars. </p>
7617
7618 <p>Mike suggested patch to PHP5 exception handler. $errno must be numeric. </p>
7619
7620 <p>Added double quotes (&quot;) to ADODB_TABLE_REGEX. </p>
7621
7622 <p>For oci8, Prepare(...,$cursor), $cursor's meaning was accidentally inverted
7623 in 4.11. This causes problems with ExecuteCursor() too, which calls Prepare()
7624 internally. Thx to William Lovaton. </p>
7625
7626 <p>Now dateHasTime property in connection object renamed to datetime for
7627 consistency. This could break bc. </p>
7628
7629 <p>Csongor Halmai reports that db2 SelectLimit with input array is not working.
7630 Fixed.. </p>
7631
7632 <p><b>4.11 27 Jan 2004</b> </p>
7633
7634 <p>Csongor Halmai reports db2 binding not working. Reverted back to emulated
7635 binding. </p>
7636
7637 <p>Dan Cech modifies datadict code. Adds support for DropIndex. Minor cleanups.
7638 </p>
7639
7640 <p>Table misspelt in perf-oci8.inc.php. Changed v$conn_cache_advice to
7641 v$db_cache_advice. Reported by Steve W. </p>
7642
7643 <p>UserTimeStamp and DBTimeStamp did not handle YYYYMMDDHHMMSS format properly.
7644 Reported by Mike Muir. Fixed. </p>
7645
7646 <p>Changed oci8 Prepare(). Does not auto-allocate OCINewCursor automatically,
7647 unless 2nd param is set to true. This will break backward compat, if
7648 Prepare/Execute is used instead of ExecuteCursor. Reported by Chris Jones. </p>
7649
7650 <p>Added InParameter() and OutParameter(). Wrapper functions to Parameter(),
7651 but nicer because they are self-documenting. </p>
7652
7653 <p>Added 'R' handling in ActualType() to datadict-mysql.inc.php </p>
7654
7655 <p>Added ADOConnection::SerializableRS($rs). Returns a recordset that can be
7656 serialized in a session. </p>
7657
7658 <p>Added &quot;Run SQL&quot; to performance UI(). </p>
7659
7660 <p>Misc spelling corrections in adodb-mysqli.inc.php, adodb-oci8.inc.php and
7661 datadict-oci8.inc.php, from Heinz Hombergs. </p>
7662
7663 <p>MetaIndexes() for ibase contributed by Heinz Hombergs. </p>
7664
7665 <p><b>4.10 12 Jan 2004</b> </p>
7666
7667 <p>Dan Cech contributed extensive changes to data dictionary to support name
7668 quoting (with `), and drop table/index. </p>
7669
7670 <p>Informix added cursorType property. Default remains IFX_SCROLL, but you can
7671 change to 0 (non-scrollable cursor) for performance. </p>
7672
7673 <p>Added ADODB_View_PrimaryKeys() for returning view primary keys to
7674 MetaPrimaryKeys(). </p>
7675
7676 <p>Simplified chinese file, adodb-cn.inc.php from cysoft. </p>
7677
7678 <p>Added check for ctype_alnum in adodb-datadict.inc.php. Thx to Jason Judge. </p>
7679
7680 <p>Added connection parameter to ibase Prepare(). Fix by Daniel Hassan. </p>
7681
7682 <p>Added nameQuote for quoting identifiers and names to connection obj.
7683 Requested by Jason Judge. Also the data dictionary parser now detects `field
7684 name` and generates column names with spaces correctly. </p>
7685
7686 <p>BOOL type not recognised correctly as L. Fixed. </p>
7687
7688 <p>Fixed paths in ADODB_DIR for session files, and back-ported it to 4.05 (15
7689 Dec 2003) </p>
7690
7691 <p>Added Schema to postgresql MetaTables. Thx to col#gear.hu </p>
7692
7693 <p>Empty postgresql recordsets that had blob fields did not set EOF properly.
7694 Fixed. </p>
7695
7696 <p>CacheSelectLimit internal parameters to SelectLimit were wrong. Thx to Nio. </p>
7697
7698 <p>Modified adodb_pr() and adodb_backtrace() to support command-line usage (eg.
7699 no html). </p>
7700
7701 <p>Fixed some fr and it lang errors. Thx to Gaetano G. </p>
7702
7703 <p>Added contrib directory, with adodb rs to xmlrpc convertor by Gaetano G. </p>
7704
7705 <p>Fixed array recordset bugs when _skiprow1 is true. Thx to Gaetano G. </p>
7706
7707 <p>Fixed pivot table code when count is false. </p>
7708
7709 <p><b>4.05 13 Dec 2003 </b></p>
7710
7711 <p>Added MetaIndexes to data-dict code - thx to Dan Cech. </p>
7712
7713 <p>Rewritten session code by Ross Smith. Moved code to adodb/session directory.
7714 </p>
7715
7716 <p>Added function exists check on connecting to most drivers, so we don't crash
7717 with the unknown function error. </p>
7718
7719 <p>Smart Transactions failed with GenID() when it no seq table has been created
7720 because the sql statement fails. Fix by Mark Newnham. </p>
7721
7722 <p>Added $db-&gt;length, which holds name of function that returns strlen. </p>
7723
7724 <p>Fixed error handling for bad driver in ADONewConnection - passed too few
7725 params to error-handler. </p>
7726
7727 <p>Datadict did not handle types like 16.0 properly in _GetSize. Fixed. </p>
7728
7729 <p>Oci8 driver SelectLimit() bug &amp;= instead of =&amp; used. Thx to Swen
7730 Thümmler. </p>
7731
7732 <p>Jesse Mullan suggested not flushing outp when output buffering enabled. Due
7733 to Apache 2.0 bug. Added. </p>
7734
7735 <p>MetaTables/MetaColumns return ref bug with PHP5 fixed in
7736 adodb-datadict.inc.php. </p>
7737
7738 <p>New mysqli driver contributed by Arjen de Rijke. Based on adodb 3.40 driver.
7739 Then jlim added BeginTrans, CommitTrans, RollbackTrans, IfNull, SQLDate. Also
7740 fixed return ref bug. </p>
7741
7742 <p>$ADODB_FLUSH added, if true then force flush in debugging outp. Default is
7743 false. In earlier versions, outp defaulted to flush, which is not compat with
7744 apache 2.0. </p>
7745
7746 <p>Mysql driver's GenID() function did not work when when sql logging is on.
7747 Fixed. </p>
7748
7749 <p>$ADODB_SESSION_TBL not declared as global var. Not available if
7750 adodb-session.inc.php included in function. Fixed. </p>
7751
7752 <p>The input array not passed to Execute() in _adodb_getcount(). Fixed. </p>
7753
7754 <p><b>4.04 13 Nov 2003 </b></p>
7755
7756 <p>Switched back to foreach - faster than list-each. </p>
7757
7758 <p>Fixed bug in ado driver - wiping out $this-&gt;fields with date fields. </p>
7759
7760 <p>Performance Monitor, View SQL, Explain Plan did not work if
7761 strlen($SQL)&gt;max($_GET length). Fixed. </p>
7762
7763 <p>Performance monitor, oci8 driver added memory sort ratio. </p>
7764
7765 <p>Added random property, returns SQL to generate a floating point number
7766 between 0 and 1; </p>
7767
7768 <p><b>4.03 6 Nov 2003 </b></p>
7769
7770 <p>The path to adodb-php4.inc.php and adodb-iterators.inc.php was not setup
7771 properly. </p>
7772
7773 <p>Patched SQLDate in interbase to support hours/mins/secs. Thx to ari
7774 kuorikoski. </p>
7775
7776 <p>Force autorollback for pgsql persistent connections - apparently pgsql did
7777 not autorollback properly before 4.3.4. See http://bugs.php.net/bug.php?id=25404
7778 </p>
7779
7780 <p><b>4.02 5 Nov 2003 </b></p>
7781
7782 <p>Some errors in adodb_error_pg() fixed. Thx to Styve. </p>
7783
7784 <p>Spurious Insert_ID() error was generated by LogSQL(). Fixed. </p>
7785
7786 <p>Insert_ID was interfering with Affected_Rows() and Replace() when LogSQL()
7787 enabled. Fixed. </p>
7788
7789 <p>More foreach loops optimized with list/each. </p>
7790
7791 <p>Null dates not handled properly in <st1:City w:st="on"><st1:place w:st="on">ADO</st1:place></st1:City>
7792 driver (it becomes 31 Dec 1969!). </p>
7793
7794 <p>Heinz Hombergs contributed patches for mysql MetaColumns - adding scale,
7795 made interbase MetaColumns work with firebird/interbase, and added
7796 lang/adodb-de.inc.php. </p>
7797
7798 <p>Added INFORMIXSERVER environment variable. </p>
7799
7800 <p>Added $ADODB_ANSI_PADDING_OFF for interbase/firebird. </p>
7801
7802 <p>PHP 5 beta 2 compat check. Foreach (Iterator) support. Exceptions support. </p>
7803
7804 <p><b>4.01 23 Oct 2003 </b></p>
7805
7806 <p>Fixed bug in rs2html(), tohtml.inc.php, that generated blank table cells. </p>
7807
7808 <p>Fixed insert_id() incorrectly generated when logsql() enabled. </p>
7809
7810 <p>Modified PostgreSQL _fixblobs to use list/each instead of foreach. </p>
7811
7812 <p>Informix ErrorNo() implemented correctly. </p>
7813
7814 <p>Modified several places to use list/each, including GetRowAssoc(). </p>
7815
7816 <p>Added UserTimeStamp() to connection class. </p>
7817
7818 <p>Added $ADODB_ANSI_PADDING_OFF for oci8po. </p>
7819
7820 <p><b>4.00 20 Oct 2003 </b></p>
7821
7822 <p>Upgraded adodb-xmlschema to 1 Oct 2003 snapshot. </p>
7823
7824 <p>Fix to rs2html warning message. Thx to Filo. </p>
7825
7826 <p>Fix for odbc_mssql/mssql SQLDate(), hours was wrong. </p>
7827
7828 <p>Added MetaColumns and MetaPrimaryKeys for sybase. Thx to Chris Phillipson. </p>
7829
7830 <p>Added autoquoting to datadict for MySQL and PostgreSQL. Suggestion by
7831 Karsten Dambekalns </p>
7832
7833 <p><b>3.94 11 Oct 2003 </b></p>
7834
7835 <p>Create trigger in datadict-oci8.inc.php did not work, because all cr/lf's
7836 must be removed. </p>
7837
7838 <p>ErrorMsg()/ErrorNo() did not work for many databases when logging enabled.
7839 Fixed. </p>
7840
7841 <p>Removed global variable $ADODB_LOGSQL as it does not work properly with
7842 multiple connections. </p>
7843
7844 <p>Added SQLDate support for sybase. Thx to Chris Phillipson </p>
7845
7846 <p>Postgresql checking of pgsql resultset resource was incorrect. Fix by Bharat
7847 Mediratta bharat#menalto.com. Same patch applied to _insertid and _affectedrows
7848 for adodb-postgres64.inc.php. </p>
7849
7850 <p>Added support for NConnect for postgresql. </p>
7851
7852 <p>Added Sybase data dict support. Thx to Chris Phillipson </p>
7853
7854 <p>Extensive improvements in $perf-&gt;UI(), eg. Explain now opens in new
7855 window, we show scripts which call sql, etc. </p>
7856
7857 <p>Perf Monitor UI works with magic quotes enabled. </p>
7858
7859 <p>rsPrefix was declared twice. Removed. </p>
7860
7861 <p>Oci8 stored procedure support, eg. &quot;begin func(); end;&quot; was
7862 incorrect in _query. Fixed. </p>
7863
7864 <p>Tiraboschi Massimiliano contributed italian language file. </p>
7865
7866 <p>Fernando Ortiz, fortiz#lacorona.com.mx, contributed informix performance
7867 monitor. </p>
7868
7869 <p>Added _varchar (varchar arrays) support for postgresql. Reported by PREVOT
7870 Stéphane.</p>
7871
7872 <div class=MsoNormal align=center style='text-align:center'>
7873
7874 <hr size=2 width="100%" align=center>
7875
7876 </div>
7877
7878 <p><strong>0.10 Sept 9 2000</strong> First release </p>
7879
7880 <h3><strong>Old change log history moved to <a href="old-changelog.htm">old-changelog.htm</a>.
7881 </strong></h3>
7882
7883 <p>&nbsp;</p>
7884
7885 </div>
7886
7887 </body>
7888
7889 </html>