CodeIgniter Forums
OCI8_driver Question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: OCI8_driver Question (/showthread.php?tid=52353)



OCI8_driver Question - El Forum - 06-07-2012

[eluser]Unknown[/eluser]
Hello all,

I am in charge of getting a COTS product (that was procured by someone in another department) working for my company that was written using CI and MySQL. The caveat is that we have a requirement to use Oracle 11G R2 for security reasons and I am curious why the CI OCI8 driver was written using the double quote (") as an escape character. The problem with this, is that it puts the quotes around table and field names when querying the DB and in Oracle this means that the table and field names become case sensitive. Therefore, if we have an active record statement such as this:

$this->db->where("columnName", $this->session->userdata("something"));
$query = $this->db->get("tableName");

Our query ends up looking like: select * from "tablename" where "columnname" = something

If I remove the escape character, then everything that the vendor coded is lowercase, which is fine except Oracle defaults to uppercase, so when the datarow is returned from Oracle it is in uppercase. All the code was written such as below:

$row = $query->row();

$password_chk = $row->password;
$fullname = $row->lastname.", ".$row->firstname;
$pw_expire = $row->new_password;

Since the row is returned by Oracle as Uppercase, all of this code is now broken beacause the application is looking for $row->lastname and what's being returned is $row->LASTNAME. The current solution has been to lowercase the entire DB, table and column names however this, imo, seems to be a very hackish workaround.

Does anyone have any thoughts or suggestions on this topic, or am I missing something? Anything at all would be appreciated. Thanks!

/*---------------------------------------
line 47 of system/database/drivers/oci8_driver.php
// The character used for excaping
var $_escape_char = '"';