Menu

#13 Hyphen in database names causes error

open
None
3
2008-12-29
2008-04-29
No

I'm forwarding this from the forums as reported by one of our users:

Chat does not work with datbases that uses a "-" in it. You'd get the following error:

Query: SELECT userID, userName, userRole, channel, UNIX_TIMESTAMP(dateTime) AS timeStamp, ip FROM web163-db.ajax_chat_online ORDER BY userName; Error-Report: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-db.ajax_chat_online ORDER BY userName' at line 9 Error-Code: 1064

in the Lib\class\AJAXChatDataBase.php
Find // Method to retrieve the current DataBase name:
function getName() {
return $this->_dbName;
}
and replace it with

// Method to retrieve the current DataBase name:
function getName() {
return '`'.$this->_db->getName().'`';
}

This should fix the problem

Fixed By AdamWeb

Discussion

  • Eric Martindale

    Eric Martindale - 2008-05-21

    Logged In: YES
    user_id=1473741
    Originator: NO

    This should be fixed in the latest trunk version.

     
  • Philip Nicolcev

    Philip Nicolcev - 2008-12-29
    • priority: 6 --> 3
    • assigned_to: nobody --> frug
     
  • Philip Nicolcev

    Philip Nicolcev - 2008-12-29

    The current workaround appears to conflict with the phpbb3 integration, causing it to be unable to locate the database. It does appear to work fine in the standalone version, however.

    The fix will now be included for standalone but excluded from integration versions.