Greetings,

I built php 4.2.1 and am having database access troubles.  The problem
shows up with either the php module for apache/stronghold or the
command line/standalone version of php, so I've been using the stand alone
version.

I believe that my syntax and test program is correct, because a slightly
different sql statement works while others fail.

Here is the version information:
php: 4.2.1
 gcc -v
Reading specs from
/opt/tools/gcc-2.95.1/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1/specs
gcc version 2.95.1 19990816 (release)
Oracle 7.0.15 statically linked in

Below is my test program.  The output is within the test program itself.

Thanks in advance for any help.

Chip

<?php


     Putenv("ORACLE_HOME=/opt/tools/oracle/home/oracle/product/7.0.15");


     $connection = Ora_Logon ("batch","gpz058");

     if ($connection == false){
       echo Ora_ErrorCode($connection).":1 ".Ora_Error($connection)."<BR>\n";
       exit;
     }

     $cursor = Ora_Open ($connection);
     if ($cursor == false){
       echo Ora_ErrorCode($connection).":2 ".Ora_Error($connection)."<BR>\n";
       exit;
     }

     /* WORKS and gives
     $query = "SELECT * FROM ALL_TABLES";

    Numcols: 20
    Column:       Type:        Size:     Result:
    --------------------------------------------
    0            VARCHAR2           30        SYS
    1            VARCHAR2           30        CDEF$
    2            VARCHAR2           30        SYSTEM
    3            VARCHAR2           30        C_COBJ#
    4            NUMBER           22        0


     */

     /* HOSED and gives
     $query = 'SELECT TABLE_NAME, OWNER FROM ALL_TABLES';
     PHP Warning:  Ora_GetColumn found invalid type (0) in 
/export/home/sun/chip/build/php-4.2.1/index4.php on line 75
     /export/home/sun/chip/build/php-4.2.1/index4.php(75) : Warning - Ora_GetColumn 
found invalid type (0)
     Numcols: 2
     Column:       Type:        Size:     Result:
     --------------------------------------------
     0            VARCHAR2           30
     1            UNKNOWN(0)           0
     2
     3
     4
     */
     $query = 'SELECT TABLE_NAME, OWNER FROM ALL_TABLES'; /* HOSED */
     $result = Ora_Parse ($cursor, $query);

     $result = Ora_Exec ($cursor);
     if ($result == false){
       echo Ora_ErrorCode($cursor).":4 ".Ora_Error($cursor)."<BR>\n";
       exit;
     }

     $numcols = ora_numcols ($cursor);
     echo "Numcols: $numcols\n";
     echo "Column:       Type:        Size:     Result:\n";
     echo "--------------------------------------------\n";
     /* Just look at 5 for debugging purposes.
      */
     if ($numcols > 5)
     {
       $cols_to_print = 5;
     }
     else
     {
       $cols_to_print = $numcols;
     }
     for ($i = 0; $i < $cols_to_print; $i++)
     {
       $t = ora_columntype ($cursor, $i);
       $s = ora_columnsize ($cursor, $i);
       $result = ora_getcolumn ($cursor, $i);
       echo "$i            $t           $s        $result\n";
     }

     Ora_Close ($cursor);
     Ora_Logoff ($connection);

?>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to