Welcome Guest, Not a member yet? Register   Sign In
Scaffolding and Oracle 9i
#1

[eluser]Unknown[/eluser]
I am trying to use the scaffolding feature in CI but am having issues. I get the error message of:

A Database Error Occurred

Error Number:

SELECT COUNT(1) AS "numrows" FROM "ci_entries"

One of the problems is that the query string that is automatically built and formatted is incorrect. The table name should not be in quotes. In a query editor connected directly to the DB it errors, but when the quotes are removed from the table name it runs. How should I or how can I correct this?
#2

[eluser]Unknown[/eluser]
Also of note, this happens on any and all automatically generates quieries, even the simplest $this->db->get->
#3

[eluser]lomapa[/eluser]
The table name should not be in quotes. In a query editor connected directly.
#4

[eluser]jedd[/eluser]
[quote author="tooltf" date="1235785135"]
SELECT COUNT(1) AS "numrows" FROM "ci_entries"

... The table name should not be in quotes. In a query editor connected directly to the DB it errors, but when the quotes are removed from the table name it runs. How should I or how can I correct this?[/quote]

To paraphrase that Bard of American Cinema .. Show Us The Code! ;-)
#5

[eluser]Unknown[/eluser]
hi guys! this is my first post!

i am new with CI and i am having the same problem above, except it is with the oracle-10g.

does anyone know a fix or workaround?

thanks!


Daniel Previatti
#6

[eluser]Civet[/eluser]
Hi,

I'm new on CI and have the same problem.

Quote:A Database Error Occurred

Error Number:

SELECT COUNT(1) AS "numrows" FROM "table_name"

I think the query is wrong and doesn't work because of the "" around the tablename.

Any solution?

Thanx :coolsmile:
#7

[eluser]Civet[/eluser]
I set the protected_identifiers attribute to FALSE and now I've got the next problem:
the result_array contains a stdClass Object what get's me this error message:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$numrows

Filename: oci8/oci8_driver.php

Line Number: 477

The Object

Quote:CI_DB_oci8_result Object
(
[stmt_id] => Resource id #54
[curs_id] =>
[limit_used] =>
[conn_id] => Resource id #45
[result_id] => 1
[result_array] => Array
(
[0] => Array
(
[NUMROWS] => 7
)

)

[result_object] => Array
(
[0] => stdClass Object
(
[NUMROWS] => 7
)

)

[current_row] => 0
[num_rows] => 1
[row_data] =>
)
#8

[eluser]Ben Galaviz[/eluser]
I had this problem also. This is how I fixed it.

1.) Find the following function in the /system/database/drivers/oci8/oci8_driver.php
Code:
function _escape_identifiers($item)

2.) Change the last line in that function from
Code:
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);

to
Code:
return $item;
        //return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);

Don't know if this is the correct way to do it, but it has worked for me.
#9

[eluser]Civet[/eluser]
Thanks for your help.

But this is only another way to stop the double quoted table name problem.

It doesn't fix the
Quote:Message: Undefined property: stdClass::$numrows
problem.
#10

[eluser]Ben Galaviz[/eluser]
Can you post the code you are using to run the query?




Theme © iAndrew 2016 - Forum software by © MyBB