***************
*** 67,109 ****
  static void decrease_user_connections(USER_CONN *uc);
  #endif /* NO_EMBEDDED_ACCESS_CHECKS */
  static bool check_multi_update_lock(THD *thd);
- static void remove_escape(char *name);
  static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
  
  const char *any_db="*any*";	// Special symbol for check_access
  
! LEX_STRING command_name[]={
!   (char *)STRING_WITH_LEN("Sleep"),
!   (char *)STRING_WITH_LEN("Quit"),
!   (char *)STRING_WITH_LEN("Init DB"),
!   (char *)STRING_WITH_LEN("Query"),
!   (char *)STRING_WITH_LEN("Field List"),
!   (char *)STRING_WITH_LEN("Create DB"),
!   (char *)STRING_WITH_LEN("Drop DB"),
!   (char *)STRING_WITH_LEN("Refresh"),
!   (char *)STRING_WITH_LEN("Shutdown"),
!   (char *)STRING_WITH_LEN("Statistics"),
!   (char *)STRING_WITH_LEN("Processlist"),
!   (char *)STRING_WITH_LEN("Connect"),
!   (char *)STRING_WITH_LEN("Kill"),
!   (char *)STRING_WITH_LEN("Debug"),
!   (char *)STRING_WITH_LEN("Ping"),
!   (char *)STRING_WITH_LEN("Time"),
!   (char *)STRING_WITH_LEN("Delayed insert"),
!   (char *)STRING_WITH_LEN("Change user"),
!   (char *)STRING_WITH_LEN("Binlog Dump"),
!   (char *)STRING_WITH_LEN("Table Dump"),
!   (char *)STRING_WITH_LEN("Connect Out"),
!   (char *)STRING_WITH_LEN("Register Slave"),
!   (char *)STRING_WITH_LEN("Prepare"),
!   (char *)STRING_WITH_LEN("Execute"),
!   (char *)STRING_WITH_LEN("Long Data"),
!   (char *)STRING_WITH_LEN("Close stmt"),
!   (char *)STRING_WITH_LEN("Reset stmt"),
!   (char *)STRING_WITH_LEN("Set option"),
!   (char *)STRING_WITH_LEN("Fetch"),
!   (char *)STRING_WITH_LEN("Daemon"),
!   (char *)STRING_WITH_LEN("Error")  // Last command number
  };
  
  const char *xa_state_names[]={
--- 67,108 ----
  static void decrease_user_connections(USER_CONN *uc);
  #endif /* NO_EMBEDDED_ACCESS_CHECKS */
  static bool check_multi_update_lock(THD *thd);
  static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
  
  const char *any_db="*any*";	// Special symbol for check_access
  
! const LEX_STRING command_name[]={
!   C_STRING_WITH_LEN("Sleep"),
!   C_STRING_WITH_LEN("Quit"),
!   C_STRING_WITH_LEN("Init DB"),
!   C_STRING_WITH_LEN("Query"),
!   C_STRING_WITH_LEN("Field List"),
!   C_STRING_WITH_LEN("Create DB"),
!   C_STRING_WITH_LEN("Drop DB"),
!   C_STRING_WITH_LEN("Refresh"),
!   C_STRING_WITH_LEN("Shutdown"),
!   C_STRING_WITH_LEN("Statistics"),
!   C_STRING_WITH_LEN("Processlist"),
!   C_STRING_WITH_LEN("Connect"),
!   C_STRING_WITH_LEN("Kill"),
!   C_STRING_WITH_LEN("Debug"),
!   C_STRING_WITH_LEN("Ping"),
!   C_STRING_WITH_LEN("Time"),
!   C_STRING_WITH_LEN("Delayed insert"),
!   C_STRING_WITH_LEN("Change user"),
!   C_STRING_WITH_LEN("Binlog Dump"),
!   C_STRING_WITH_LEN("Table Dump"),
!   C_STRING_WITH_LEN("Connect Out"),
!   C_STRING_WITH_LEN("Register Slave"),
!   C_STRING_WITH_LEN("Prepare"),
!   C_STRING_WITH_LEN("Execute"),
!   C_STRING_WITH_LEN("Long Data"),
!   C_STRING_WITH_LEN("Close stmt"),
!   C_STRING_WITH_LEN("Reset stmt"),
!   C_STRING_WITH_LEN("Set option"),
!   C_STRING_WITH_LEN("Fetch"),
!   C_STRING_WITH_LEN("Daemon"),
!   C_STRING_WITH_LEN("Error")  // Last command number
  };
  
  const char *xa_state_names[]={
***************
*** 1738,1744 ****
        password.  New clients send the size (1 byte) + string (not null
        terminated, so also '\0' for empty string).
      */
!     char db_buff[NAME_LEN+1];                 // buffer to store db in utf8
      char *db= passwd;
      uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
        *passwd++ : strlen(passwd);
--- 1736,1742 ----
        password.  New clients send the size (1 byte) + string (not null
        terminated, so also '\0' for empty string).
      */
!     char db_buff[NAME_LEN+1];               // buffer to store db in utf8
      char *db= passwd;
      uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
        *passwd++ : strlen(passwd);
***************
*** 2315,2321 ****
          DBUG_RETURN(1);
        }
        db= lex->select_lex.db;
-       remove_escape(db);				// Fix escaped '_'
        if (check_db_name(db))
        {
          my_error(ER_WRONG_DB_NAME, MYF(0), db);
--- 2312,2317 ----
          DBUG_RETURN(1);
        }
        db= lex->select_lex.db;
        if (check_db_name(db))
        {
          my_error(ER_WRONG_DB_NAME, MYF(0), db);
***************
*** 6310,6345 ****
  }
  
  
- /* Fix escaping of _, % and \ in database and table names (for ODBC) */
- 
- static void remove_escape(char *name)
- {
-   if (!*name)					// For empty DB names
-     return;
-   char *to;
- #ifdef USE_MB
-   char *strend=name+(uint) strlen(name);
- #endif
-   for (to=name; *name ; name++)
-   {
- #ifdef USE_MB
-     int l;
-     if (use_mb(system_charset_info) &&
-         (l = my_ismbchar(system_charset_info, name, strend)))
-     {
- 	while (l--)
- 	    *to++ = *name++;
- 	name--;
- 	continue;
-     }
- #endif
-     if (*name == '\\' && name[1])
-       name++;					// Skip '\\'
-     *to++= *name;
-   }
-   *to=0;
- }
- 
  /****************************************************************************
  ** save order by and tables in own lists
  ****************************************************************************/
--- 6296,6301 ----
  }
  
  
  /****************************************************************************
  ** save order by and tables in own lists
  ****************************************************************************/