spadefoot / kohana-orm-leap

An ORM module for the Kohana PHP framework that is designed to work with all major databases.
http://spadefoot.github.io/kohana-orm-leap/
100 stars 25 forks source link

Column and table name wrapping for Oracle #88

Closed mazu0 closed 11 years ago

mazu0 commented 11 years ago

Hi,

When trying to use DB_ORM::select for oracle (config: 'type' => 'SQL', 'dialect' => 'Oracle', 'driver' => 'Standard') the builder wraps all the column names and the table name in quotes which leads to unsuccessful execution. The wrapping is done in file leap\classes\Base\DB\Oracle\Precompiler.php , function prepare_identifier line 97.

If i comment the lines from 95 to 99 the queries are built and executed normally.

BTW: you rock and rule my good sir :)

Thanks for the good work and have a good day, MzZz

bluesnowman commented 11 years ago

See section 8 on this page (http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements008.htm) regarding quoting identifiers in Oracle. Essentially, Oracle treats non-quoted identifiers as being uppercase. So the following will be true:

roles
ROLES
"ROLES"

These are therefore all the same. Since leap quotes its identifiers, I would bet that if you wrote the table or column name in all uppercase letters your queries would work.

mazu0 commented 11 years ago

@bluesnowman: it worked, thank you very much for your help