Welcome Guest, Not a member yet? Register   Sign In
MySQL table names forced to lower-case, and table_exists function case-sensitive ?
#1

[eluser]aidehua[/eluser]
I create a database table like this:

Code:
$sql = "CREATE TABLE IF NOT EXISTS tbUsers (
                    id INT AUTO_INCREMENT PRIMARY KEY,
                    email VARCHAR(255),
                    unique_salt VARCHAR(255),
                    password_hash VARCHAR(255),
                    role TINYINT,
                    created_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    created_IP VARCHAR(50),
                    last_login_date TIMESTAMP,
                    last_login_IP VARCHAR(50)
                    COLLATE utf8_unicode_ci
                    )";
        $query = $this->db->query($sql);

And the table is created correctly, except that it is given the name "tbusers" (all lower-case), and not "tbUsers" (CamelCase, as in my SQL).

Having created the table as above:

$this->db->table_exists('tbusers') returns TRUE, but
$this->db->table_exists('tbUsers') returns FALSE.

I'm curious as to why CI (or MySQL) is over-riding my case preference.

And I wonder why the CI table_exists function appears to be case sensitive.

Pleas forgive my ignorance - can anyone shed light on this, and tell me whether it is a CodeIgniter thing or a MySQL thing? And what you would suggest if I am determined to persist with CamelCased table names (old habit, dies hard...). Thanks.


Messages In This Thread
MySQL table names forced to lower-case, and table_exists function case-sensitive ? - by El Forum - 01-06-2010, 01:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB