mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Some small portability fixes.
Added support for lower_case_table_names=2, which is to be used on case insensitive file systems. This tells MySQL to preserve the used case of filenames and database names to make it esier to move files between cases sensitive can case insensitive file systems (like Windows and Linux) client/mysqltest.c: Indentation cleanup include/myisam.h: Made some pointers 'const' mysql-test/mysql-test-run.sh: Portability fix for OSX sql/filesort.cc: Safety fix (not needed for current code but needed for 5.0) sql/ha_berkeley.cc: More debugging Changed 'create' to return error number sql/ha_berkeley.h: Added HA_FILE_BASED sql/ha_innodb.cc: Added missing DBUG_RETURN sql/ha_isam.cc: Changed create to return error number sql/ha_isam.h: Added HA_FILE_BASED sql/ha_isammrg.h: Added HA_FILE_BASED sql/ha_myisam.cc: Changed create to return error number sql/ha_myisam.h: Added HA_FILE_BASED sql/ha_myisammrg.cc: Changed create to return error number sql/ha_myisammrg.h: Added HA_FILE_BASED sql/handler.cc: Ensure that table engines gets table names in lower case even if we are using lower_case_table_names Removed test for DB_TYPE_INNODB by ensuring that create method returns error number. sql/handler.h: Added HA_FILE_BASED Made some struct entries 'const' Added 'alias' for create to be able to create tables in mixed case on case insensitive file systems sql/mysql_priv.h: Support for lower_case_table_names=2 sql/mysqld.cc: Support for lower_case_table_names=2 Moved test of case insenstive file system after all mutex are created sql/set_var.cc: Support for lower_case_table_names=2 sql/sql_class.h: Indentation change sql/sql_db.cc: Support for lower_case_table_names=2 sql/sql_insert.cc: Indentation change sql/sql_parse.cc: Support for lower_case_table_names=2 sql/sql_rename.cc: Support for lower_case_table_names=2 Added missing 'unpack_filename' to RENAME which may fix a bug in RENAME TABLE on windows sql/sql_show.cc: If lower_case_table_name=2 is given, show original case in SHOW CREATE TABLE sql/sql_table.cc: Support for lower_case_table_names=2 for DROP TABLE, RENAME TABLE, ALTER TABLE and CREATE TABLE
This commit is contained in:
@ -59,8 +59,8 @@ static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables);
|
||||
static void mysql_init_query(THD *thd);
|
||||
static void remove_escape(char *name);
|
||||
static void refresh_status(void);
|
||||
static bool append_file_to_dir(THD *thd, char **filename_ptr,
|
||||
char *table_name);
|
||||
static bool append_file_to_dir(THD *thd, const char **filename_ptr,
|
||||
const char *table_name);
|
||||
static bool create_total_list(THD *thd, LEX *lex,
|
||||
TABLE_LIST **result, bool skip_first);
|
||||
|
||||
@ -1121,10 +1121,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
||||
case COM_CREATE_DB: // QQ: To be removed
|
||||
{
|
||||
char *db=thd->strdup(packet), *alias;
|
||||
|
||||
statistic_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_status);
|
||||
char *db=thd->strdup(packet);
|
||||
// null test to handle EOM
|
||||
if (!db || !strip_sp(db) || check_db_name(db))
|
||||
if (!db || !strip_sp(db) || !(alias= thd->strdup(db)) ||
|
||||
check_db_name(db))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||
break;
|
||||
@ -1132,15 +1134,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
if (check_access(thd,CREATE_ACL,db,0,1))
|
||||
break;
|
||||
mysql_log.write(thd,command,packet);
|
||||
mysql_create_db(thd,db,0,0);
|
||||
mysql_create_db(thd,(lower_case_table_names == 2 ? alias : db),0,0);
|
||||
break;
|
||||
}
|
||||
case COM_DROP_DB: // QQ: To be removed
|
||||
{
|
||||
statistic_increment(com_stat[SQLCOM_DROP_DB],&LOCK_status);
|
||||
char *db=thd->strdup(packet);
|
||||
char *db=thd->strdup(packet), *alias;
|
||||
// null test to handle EOM
|
||||
if (!db || !strip_sp(db) || check_db_name(db))
|
||||
if (!db || !strip_sp(db) || !(alias= thd->strdup(db)) ||
|
||||
check_db_name(db))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
|
||||
break;
|
||||
@ -1153,7 +1156,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
break;
|
||||
}
|
||||
mysql_log.write(thd,command,db);
|
||||
mysql_rm_db(thd,db,0,0);
|
||||
mysql_rm_db(thd,alias,0,0);
|
||||
break;
|
||||
}
|
||||
case COM_BINLOG_DUMP:
|
||||
@ -1599,6 +1602,7 @@ mysql_execute_command(void)
|
||||
CREATE_TMP_ACL : CREATE_ACL);
|
||||
if (!tables->db)
|
||||
tables->db=thd->db;
|
||||
lex->create_info.alias= tables->alias;
|
||||
if (check_access(thd,want_priv,tables->db,&tables->grant.privilege) ||
|
||||
check_merge_table_access(thd, tables->db,
|
||||
(TABLE_LIST *)
|
||||
@ -1664,7 +1668,8 @@ mysql_execute_command(void)
|
||||
if (!(res=open_and_lock_tables(thd,tables->next)))
|
||||
{
|
||||
if ((result=new select_create(tables->db ? tables->db : thd->db,
|
||||
tables->real_name, &lex->create_info,
|
||||
tables->real_name,
|
||||
&lex->create_info,
|
||||
lex->create_list,
|
||||
lex->key_list,
|
||||
select_lex->item_list,lex->duplicates)))
|
||||
@ -1676,7 +1681,8 @@ mysql_execute_command(void)
|
||||
else // regular create
|
||||
{
|
||||
res = mysql_create_table(thd,tables->db ? tables->db : thd->db,
|
||||
tables->real_name, &lex->create_info,
|
||||
tables->real_name,
|
||||
&lex->create_info,
|
||||
lex->create_list,
|
||||
lex->key_list,0, 0); // do logging
|
||||
if (!res)
|
||||
@ -2341,7 +2347,9 @@ mysql_execute_command(void)
|
||||
break;
|
||||
case SQLCOM_CREATE_DB:
|
||||
{
|
||||
if (!strip_sp(lex->name) || check_db_name(lex->name))
|
||||
char *alias;
|
||||
if (!strip_sp(lex->name) || !(alias=thd->strdup(lex->name)) ||
|
||||
check_db_name(lex->name))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||
break;
|
||||
@ -2363,12 +2371,15 @@ mysql_execute_command(void)
|
||||
|
||||
if (check_access(thd,CREATE_ACL,lex->name,0,1))
|
||||
break;
|
||||
res=mysql_create_db(thd,lex->name,lex->create_info.options,0);
|
||||
res=mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name),
|
||||
lex->create_info.options,0);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DROP_DB:
|
||||
{
|
||||
if (!strip_sp(lex->name) || check_db_name(lex->name))
|
||||
char *alias;
|
||||
if (!strip_sp(lex->name) || !(alias=thd->strdup(lex->name)) ||
|
||||
check_db_name(lex->name))
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||
break;
|
||||
@ -2394,7 +2405,7 @@ mysql_execute_command(void)
|
||||
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
|
||||
goto error;
|
||||
}
|
||||
res=mysql_rm_db(thd,lex->name,lex->drop_if_exists,0);
|
||||
res=mysql_rm_db(thd,alias,lex->drop_if_exists,0);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_CREATE_FUNCTION:
|
||||
@ -3779,7 +3790,8 @@ static void refresh_status(void)
|
||||
|
||||
/* If pointer is not a null pointer, append filename to it */
|
||||
|
||||
static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
|
||||
static bool append_file_to_dir(THD *thd, const char **filename_ptr,
|
||||
const char *table_name)
|
||||
{
|
||||
char buff[FN_REFLEN],*ptr, *end;
|
||||
if (!*filename_ptr)
|
||||
|
Reference in New Issue
Block a user