Configuration issues: Codeigniter and Firebird

509 views Asked by At

I was integrating Codeigniter and Firebird ... I created a simple database with two tables: CITIES and STATES.

When I run the application, the connection goes OK, but as I try to get all STATES using:

$qry = $this->db->get("states");

I get the following error message:

Error Number: -204 Dynamic SQL Error SQL error code = -204 Table unknown states At line 2, column 1 SELECT * FROM "states" Filename: C:/xampp/htdocs/ci_test/application/controllers/Home.php Line Number: 11

I realized that the cause of the problem is the double-quotes at the SQL query. Cause the query:

SELECT * FROM states;

runs ok.

Has anyone experienced this problem and/or knows how to solve it?

3

There are 3 answers

1
NeoCodeIgniter On
function get_states_data() {
    $this->db->select ( '*' );
    $this->db->from ( 'states' );
    $query = $this->db->get ();
    return $query->result ();
}

check this code :)

3
Mark Rotteveel On

It looks like codeigniter quotes object names. In Firebird unquoted names are case insensitive: they are handled as if they are uppercase. Quoted names are case sensitive: they are handled as-is. This means that the table STATES can be referenced as states, STATES, "STATES", but not as "states".

I don't know codeigniter, but you could apply the following solutions:

  1. Find a way so codeigniter doesn't quote the object name,
  2. Use uppercase in your code $this->db->get("STATES"),
  3. Change the table so its name is in lowercase.
1
Abdulla Nilam On

Just use this instead of your existing code

$query = $this->db->query("SELECT * FROM states");
$result = $query->result_array();
return $result;