Error with database name prefix in queries... Error with database name prefix in queries...
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Error with database name prefix in queries...

Started by bmd_online, July 31, 2005, 12:24:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bmd_online

When connecting to my gallery, I have this error :

While executing query "delete from `bmd.online`.cpg_sessions where time<1122742088 and remember=0;" on Resource id #5

mySQL error: Incorrect table name 'cpg_sessions'


(I have replaced my database name (from my provider) with "bmd.online". My real database name was "firstname.lastname").

In the file bridge/coppermine.inc.php, I have changed (lines 68-70)

                $this->usertable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['users'];
                $this->groupstable =  '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['groups'];
                $this->sessionstable =  '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['sessions'];


like this (removed database name).

                $this->usertable = $this->db['prefix'] . $this->table['users'];
                $this->groupstable =  $this->db['prefix'] . $this->table['groups'];
                $this->sessionstable =  $this->db['prefix'] . $this->table['sessions'];


Now, it works correctly.
Maybe it's due to "dot" in my database name  ???


I'm using latest devel from CVS.

Joachim Müller

yes: database names mustn't contain dots! Not a coppermine issue, marking as "invalid"

bmd_online

It was due to my provider, it's not my fault !
Version 1.3 working correctly. With this change, 1.4.x works too.

In this topic, I read the same problem in another file :
Quote from: donnoman on April 21, 2005, 03:34:37 AM
If you replace that code with :


        // Derived full table names
        if (strpos($db_prefix, '.') === false) {
            $this->usertable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['users'];
            $this->groupstable =  '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['groups'];
        } else {
            $this->usertable = $this->db['prefix'] . $this->table['users'];
            $this->groupstable = $this->db['prefix'] . $this->table['groups'];
        }


It will work for both 1.0.3 and 1.1 beta 1.

Should I commit this to devel?

Nibbler


bmd_online