Welcome Guest, Not a member yet? Register   Sign In
CI+oci8+stored procedure=Anonymous error.
#1

[eluser]Unknown[/eluser]
Hello. I'm trying to use oci8 driver for calling stored procedure, but getting database error message without number or description, just with SQL code.
I have changed code in oci8_driver.php twice:

1)changed:
Code:
function db_connect()

    {

        return @ocilogon($this->username, $this->password, $this->hostname);

    }
to:
Code:
function db_connect()

    {

        return @ocilogon($this->username, $this->password, $this->hostname, $this->char_set);

    }
for proper display of cyrillic symbols,

2)changed

Code:
function _bind_params($params)

    {

        if ( ! is_array($params) OR ! is_resource($this->stmt_id))

        {

            return;

        }

        

        foreach ($params as $param)

        {

             foreach (array('name', 'value', 'type', 'length') as $val)

            {

                if ( ! isset($param[$val]))

                {

                    $param[$val] = '';

                }

            }



            ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);

        }

    }
to
Code:
function _bind_params($params)

    {

        if ( ! is_array($params) OR ! is_resource($this->stmt_id))

        {

            return;

        }

        

        foreach ($params as $param)

        {

             foreach (array('name', 'value', 'type', 'length') as $val)

            {

                if ( ! isset($param[$val]))

                {

                    $param[$val] = FALSE;

                }

            }



            ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);

        }

    }

Because of getting warnings about type mismatch.

controllers code:
Code:
<?php

class Test extends Controller{

    function index(){

        $user=array('login'=>'someuser',
                    'password'=>'somepass',
        );        

        $transaction=array('result'=>'-1');

        $params=array(

            array('name'=>':p_login' , 'value'=>$user['login'] , 'length'=>'255'),
            array('name'=>':p_passwd' , 'value'=>$user['password'] , 'length'=>'255'),
            array('name'=>':p_result', 'value'=>$transaction['result'], 'length'=>'255')

        );

        $this->db->stored_procedure('test_package', 'test_procedure', $params);


        echo $transaction['result'];
    }

}

?>
Exactly same SQL code worked fine in clear PHP.
How to handle error?


Messages In This Thread
CI+oci8+stored procedure=Anonymous error. - by El Forum - 02-26-2008, 11:41 AM
CI+oci8+stored procedure=Anonymous error. - by El Forum - 01-02-2010, 12:44 PM
CI+oci8+stored procedure=Anonymous error. - by El Forum - 01-05-2010, 07:00 AM
CI+oci8+stored procedure=Anonymous error. - by El Forum - 01-05-2010, 10:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB