Welcome Guest, Not a member yet? Register   Sign In
Database Error w/o error number in the DB_driver.php
#2

[eluser]Unknown[/eluser]
[quote author="ndsadona" date="1323218468"]I'm new to Oracle and I'm using Wamp.
I already have an existing connection between CI using Wamp and MySql, and now I'm required to connect it to Oracle.

I'm getting this error and I can't find any solutions yet (I've searched on some posts already).

Quote:A Database Error Occurred
Error Number:

SELECT * FROM "project_users" WHERE "userid" = 'user1' AND "password" = 'iamuser1'

Filename: C:\wamp\www\project\system\database\DB_driver.php

Line Number: 330

Can someone help me on this? Sad BTW, I have Oracle 10g Express Edition and CodeIgniter Version 1.0. Thanks for any help. Wink

This is the code in line 330:

Code:
if (FALSE === ($this->result_id = $this->simple_query($sql)))
  {
   if ($this->save_queries == TRUE)
   {
    $this->query_times[] = 0;
   }

   $this->_trans_status = FALSE;

   if ($this->db_debug)
   {
    $error_no = $this->_error_number();
    $error_msg = $this->_error_message();

    $this->trans_complete();

    log_message('error', 'Query error: '.$error_msg);

    return $this->display_error(

          array(
            'Error Number: '.$error_no,
            $error_msg,
            $sql
           )
          );  //   <------this line is 330
   }
   return FALSE;
  }
[/quote]

Hi!
I know that this problem its old, but I just want to explain a little bit the real problem here.

Please, look at the SQL query generated by CI:
Code:
SELECT * FROM "project_users" WHERE "userid" = 'user1' AND "password" = 'iamuser1'

Note that the table names and table fields has double quotes, and that the reason of the issue: in a oracle SQL query, you DONT escape the name of the identifiers.

Looking in the source of CI, de base class CI_DB has a flag indicating that identifiers MUST be escaped. This is not necessary in Oracle, so i just add this attribute in system/database/drivers/oci8_diver.php...

Code:
var $_protect_identifiers = FALSE;

(If someone else want to test it, I put the line above before the method db_connect() on the OCI 8 Driver).


After that, I can use the models and querys exactly the same as the tutorial shows:
Code:
&lt;?php
class Personal_model extends CI_Model {
public function __construct(){
  $this->load->database();
}

public function get_personal(){
  $consulta = $this->db->get('personal');
  return $consulta->result();
}
}
?&gt;


Regards


Messages In This Thread
Database Error w/o error number in the DB_driver.php - by El Forum - 12-06-2011, 05:41 PM
Database Error w/o error number in the DB_driver.php - by El Forum - 07-19-2012, 08:55 AM
Database Error w/o error number in the DB_driver.php - by El Forum - 09-16-2012, 12:01 AM
Database Error w/o error number in the DB_driver.php - by El Forum - 10-17-2013, 10:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB