khhaaannnnn khhaaannnnn - 2 months ago 24
SQL Question

Codeigniter 3 Oracle Set Query Builder Case Insensitivity

Using Codeigniter 3 at work with Oracle 12c and sporadic uses of the Query Builder class.

Query Builder is selecting from Oracle with escaped table names. I would like to configure the class to not do this. I'd like this call:

$query = $this->db->get('customers');


to go from

select * from 'customers';


to

select * from customers;


in generated SQL.

Is there a config item I don't know about or am I going to have to fix one of my coworker's queries every three weeks until the end of time?

Answer

You have to use next syntax

$this->db->select('SELECT * FROM customers', false)->get();

since second parameter in select($tablename, $escape=NULL) method will prevent table name or field names escaping when set to NULL.