[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?

BTW, I have Oracle 10g Express Edition and CodeIgniter Version 1.0. Thanks for any help.
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:
<?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();
}
}
?>
Regards