enterprise-support team mailing list archive
-
enterprise-support team
-
Mailing list archive
-
Message #05650
[Bug 1611268] [NEW] myloader can`t create database from *-schema-create.sql
Public bug reported:
void create_database(MYSQL *conn, gchar *database){
gchar* query = NULL;
if((db == NULL && source_db == NULL)
|| (db != NULL && source_db != NULL && !g_ascii_strcasecmp(db, source_db))){
const gchar* filename1= g_strdup_printf("%s-schema-create.sql", db ? db : database);
const gchar* filenamegz1= g_strdup_printf("%s-schema-create.sql.gz", db ? db : database);
if (g_file_test (filename, G_FILE_TEST_EXISTS)){
restore_data(conn, database, NULL, filename1, TRUE, FALSE);
}else if (g_file_test (filenamegz, G_FILE_TEST_EXISTS)){
restore_data(conn, database, NULL, filenamegz1, TRUE, FALSE);
}else{
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
mysql_query(conn, query);
}
}else{
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
mysql_query(conn, query);
}
g_free(query);
return;
}
////////////////////////////////////
g_file_test function should take a full path filename, so in create_database function, two g_file_test will return false and then use :
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
mysql_query(conn, query);
to create a database. so the charset may be wrong
should be modified like:
////////////////////////////////////
void create_database(MYSQL *conn, gchar *database){
gchar* query = NULL;
if((db == NULL && source_db == NULL)
|| (db != NULL && source_db != NULL && !g_ascii_strcasecmp(db, source_db))){
const gchar* filename= g_strdup_printf("%s/%s-schema-create.sql", directory, db ? db : database);
const gchar* filenamegz= g_strdup_printf("%s/%s-schema-create.sql.gz", directory, db ? db : database);
const gchar* filename1= g_strdup_printf("%s-schema-create.sql", db ? db : database);
const gchar* filenamegz1= g_strdup_printf("%s-schema-create.sql.gz", db ? db : database);
if (g_file_test (filename, G_FILE_TEST_EXISTS)){
restore_data(conn, database, NULL, filename1, TRUE, FALSE);
}else if (g_file_test (filenamegz, G_FILE_TEST_EXISTS)){
restore_data(conn, database, NULL, filenamegz1, TRUE, FALSE);
}else{
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
mysql_query(conn, query);
}
}else{
query= g_strdup_printf("CREATE DATABASE `%s`", db ? db : database);
mysql_query(conn, query);
}
g_free(query);
return;
}
** Affects: mydumper
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to MySQL.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1611268
Title:
myloader can`t create database from *-schema-create.sql
To manage notifications about this bug go to:
https://bugs.launchpad.net/mydumper/+bug/1611268/+subscriptions