Duplicate Columns in "2 Day Plus PHP Developer Guide"

A post on the OTN forum reminded me of a documentation problem in the comprehensively titled Oracle Database Express Edition 2 Day Plus PHP Developer Guide 10g Release 2 (10.2) Part Number B25317-01

In chapter three "Connecting to the Database" at step 5 of you will get duplicate columns returned if you use the latest version of PHP.

The solution is to change the fetch line, adding "OCI_ASSOC+", to read:

       while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {

The change isn't necessary in older versions of PHP.

I have to admit I was involved in both ends of the problem: I wrote the PHP code for the manual and then I logged PHP bug 37487 which changed the default behavior of oci_fetch_array().

At the moment I'm having a similar discussion with Tony Dovgal, the lead maintainer of the oci8 extension, about PHP bug 39988.  We both believe the fix will have little or no impact but there is always doubt.  I'm in favor of making the change since there are some code examples that are harder to manage unless you can specify the return type of the data.

Comments:

Post a Comment:
Comments are closed for this entry.
About

Tourists looking out over an Opal mine
I'm a Product Manager in Server Technologies, working on scripting languages and developer-access.
Email: christopher.jones@oracle.com
Twitter: http://twitter.com/ghrd
Book: Free PHP Oracle book
Download: PHP Linux RPMs with the OCI8 extension
Links: OTN PHP Developer Center

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today