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

Error doing a select with Oracle 11g #11

Closed ekarlso closed 12 years ago

ekarlso commented 12 years ago

$b = DB_SQL::select('tech')->from('ENVIRONMENTS'); $this->content = $b->query();

ErrorException [ Warning ]: oci_execute() [function.oci-execute]: ORA-00911: invalid character MODPATH\leap\classes\base\db\oracle\connection\standard.php [ 125 ] 120 if ( ! is_null($result_set)) { 121 $this->sql = $sql; 122 return $result_set; 123 } 124 $resource_id = @oci_parse($this->link_id, $sql); 125 if (($resource_id === FALSE) || !oci_execute($resource_id, $this->execution_mode)) { 126 $oci_error = oci_error($resource_id); 127 $this->error = 'Message: Failed to query SQL statement. Reason: ' . $oci_error['message']; 128 throw new Kohana_SQL_Exception($this->error, array(':sql' => $sql, ':type' => $type)); 129 } 130 $records = array();

spadefoot commented 12 years ago

Thank you for the feedback! I will be happy to look into this issue. Would you mind posting the generated SQL statement that the query builder is creating for this table? This can be done using: echo $b->statement(); According to what I found online about this error (see http://www.dba-oracle.com/sf_ora_00911_invalid_character.htm), I am wondering if the query builder is not producing the correct SQL statement.

spadefoot commented 12 years ago

If possible, let's try to eliminate what might be causing the problem. Can you get the following lines of code to work?

$connection = DB_Connection_Pool::instance()->get_connection('tech'); $results = $connection->query('SELECT * FROM "ENVIRONMENTS";');

ekarlso commented 12 years ago

Im not currently at the office On Jan 14, 2012 12:10 AM, "spadefoot" < reply@reply.github.com> wrote:

If possible, let's try to eliminate what might be causing the problem. Can you get the following lines of code to work?

$connection = DB_Connection_Pool::instance()->get_connection('tech'); $results = $connection->query('SELECT * FROM "ENVIRONMENTS";');


Reply to this email directly or view it on GitHub: https://github.com/spadefoot/kohana-orm-leap/issues/11#issuecomment-3488057

ekarlso commented 12 years ago

$conn = DB_Connection_Pool::instance()->get_connection("tech");

This works: $results = $conn->query('SELECT * FROM "ENVIRONMENTS"');

This does not: $results = $conn->query('SELECT * FROM "ENVIRONMENTS";');

Can we get a fix for this ASAP? The whole ORM is useless with this error.

spadefoot commented 12 years ago

Yes, I will post a fix within the next few minutes. It looks like the semicolon just needs to be removed. I will add some code to trim semicolons from the end of Oracle SQL statements.

I really appreciate your input. Thank you so much for helping us debug this Oracle plugin for Leap. If you find other bugs, please let us know and we will try to address them asap.