PHP5RC2 and PEAR DB Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek Battams

    PHP5RC2 and PEAR DB Problem

    With PHP5RC2, DB::connect() is not returning the correct type of object.

    #!/usr/local/bin/php
    <?php
    require_once("D B.php");

    $dsn = "odbc://db2inst1:badpas swd@testdb";
    $db = DB::connect($ds n);
    echo $db->getMessage() ;
    if(DB::isError( $db))
    echo "Connect failed!";
    else
    {
    $res = $db->query("SELEC T * FROM test_tbl");
    while($row = $res->fetchRow())
    echo $row[0] . "\n";
    $db->disconnect() ;
    }
    ?>

    The password in the DSN is wrong and DB2 reports the error, however
    DB::connect() still returns an object of type DB_odbc. I've traced
    connect() in DB/odbc.php and confirmed that it recognized that
    odbc_connect() failed and goes into that code path and creates a DB_error
    object and I've even printed out the type of the object inside the function
    before it returns it, but in the caller (my test script above), the reported
    type is DB_odbc and so the if statement is false and then it tried to run
    the query, but then I get a series of odbc_*() errors because there's no
    valid resource for those functions to operate on. Has anyone been able to
    use PEAR DB, specifically the ODBC driver, with PHP5RC2? The code above
    works on another system, as expected, with PHP 4.3.6.

    Thanks,

    Derek


Working...