Welcome Guest, Not a member yet? Register   Sign In
Important: CI can't handel sql statment to select from Oracle view
#2

[eluser]kgill[/eluser]
First step is to figure out what's going wrong... If you're not opposed to modifying the driver a little you can make your life much easier by adding some error logging.
Code:
//oci8_driver.php around line 145 you'll see this:

    function _execute($sql)
    {
        // oracle must parse the query before it is run. All of the actions with
        // the query are based on the statement id returned by ociparse
        $this->stmt_id = FALSE;
        $this->_set_stmt_id($sql);
        ocisetprefetch($this->stmt_id, 1000);
        return @ociexecute($this->stmt_id, $this->_commit);
    }    

/*
the ociexecute is returning the true/false directly and not doing any error checking, we want to know what's going on so we need to modify this a bit so change the function like so:
*/

    function _execute($sql)
    {
        // oracle must parse the query before it is run. All of the actions with
        // the query are based on the statement id returned by ociparse
        $this->stmt_id = FALSE;
        $this->_set_stmt_id($sql);
        ocisetprefetch($this->stmt_id, 1000);
        $exec_worked = ociexecute($this->stmt_id, $this->_commit);
        if ($exec_worked === FALSE) { // if ociexecute failed, grab the oracle error message and log it
            $e = oci_error($this->stmt_id);
            log_message('error', $e['message']);
        }
        return $exec_worked;
    }

Now you'll have the actual oracle error messages showing up in your log file when you enable error logging, once you've got those you should be able to figure out what's going on by googling the ORA- number.


Messages In This Thread
Important: CI can't handel sql statment to select from Oracle view - by El Forum - 07-13-2009, 01:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB