diff --git a/Resources/Localization/en.lproj/Localizable.strings b/Resources/Localization/en.lproj/Localizable.strings index b5e5a2df2..1770c5d3d 100644 --- a/Resources/Localization/en.lproj/Localizable.strings +++ b/Resources/Localization/en.lproj/Localizable.strings @@ -3288,6 +3288,9 @@ /* Menu item title for checking for updates */ "Check for updates" = "Check for updates"; +/* Warning message during connection in case the variable skip-show-database is set to ON */ +"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges." = "The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges."; + /* Error alert title when the request to GitHub fails */ "GitHub Request Failed" = "GitHub Request Failed"; diff --git a/Resources/Localization/es-ES.lproj/Localizable.strings b/Resources/Localization/es-ES.lproj/Localizable.strings index 562b1143c..b661f380b 100644 --- a/Resources/Localization/es-ES.lproj/Localizable.strings +++ b/Resources/Localization/es-ES.lproj/Localizable.strings @@ -3233,3 +3233,6 @@ /* New Connection Error informative message */ "Failed to create new database connection window. Please restart Sequel Ace and try again." = "Failed to create new database connection window. Please restart Sequel Ace and try again."; + +/* Warning message during connection in case the variable skip-show-database is set to ON */ +"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges." = "The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges."; diff --git a/Resources/Localization/es.lproj/Localizable.strings b/Resources/Localization/es.lproj/Localizable.strings index 562b1143c..b661f380b 100644 --- a/Resources/Localization/es.lproj/Localizable.strings +++ b/Resources/Localization/es.lproj/Localizable.strings @@ -3233,3 +3233,6 @@ /* New Connection Error informative message */ "Failed to create new database connection window. Please restart Sequel Ace and try again." = "Failed to create new database connection window. Please restart Sequel Ace and try again."; + +/* Warning message during connection in case the variable skip-show-database is set to ON */ +"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges." = "The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges."; diff --git a/Resources/Localization/zh-Hans.lproj/Localizable.strings b/Resources/Localization/zh-Hans.lproj/Localizable.strings index 6db46b924..77c9ce367 100644 --- a/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -3233,3 +3233,6 @@ /* New Connection Error informative message */ "Failed to create new database connection window. Please restart Sequel Ace and try again." = "Failed to create new database connection window. Please restart Sequel Ace and try again."; + +/* Warning message during connection in case the variable skip-show-database is set to ON */ +"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges." = "The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges."; diff --git a/Resources/Localization/zh-Hant.lproj/Localizable.strings b/Resources/Localization/zh-Hant.lproj/Localizable.strings index c74fbc880..29d778664 100644 --- a/Resources/Localization/zh-Hant.lproj/Localizable.strings +++ b/Resources/Localization/zh-Hant.lproj/Localizable.strings @@ -3233,3 +3233,6 @@ /* New Connection Error informative message */ "Failed to create new database connection window. Please restart Sequel Ace and try again." = "Failed to create new database connection window. Please restart Sequel Ace and try again."; + +/* Warning message during connection in case the variable skip-show-database is set to ON */ +"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges." = "The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges."; diff --git a/Source/Controllers/MainViewControllers/SPDatabaseDocument.m b/Source/Controllers/MainViewControllers/SPDatabaseDocument.m index ff9bfda71..203a600c0 100644 --- a/Source/Controllers/MainViewControllers/SPDatabaseDocument.m +++ b/Source/Controllers/MainViewControllers/SPDatabaseDocument.m @@ -413,6 +413,16 @@ - (void)setConnection:(SPMySQLConnection *)theConnection // Ensure the connection encoding is set to utf8 for database/table name retrieval [mySQLConnection setEncoding:@"utf8mb4"]; + // Check if skip-show-database is set to ON + SPMySQLResult *result = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'skip_show_database'"]; + [result setReturnDataAsStrings:YES]; + if(![mySQLConnection queryErrored] && [result numberOfRows] == 1) { + NSString *skip_show_database = [[result getRowAsDictionary] objectForKey:@"Value"]; + if ([skip_show_database.lowercaseString isEqualToString:@"on"]) { + [NSAlert createWarningAlertWithTitle:NSLocalizedString(@"Warning",@"warning") message:NSLocalizedString(@"The skip-show-database variable of the database server is set to ON. Thus, you won't be able to list databases unless you have the SHOW DATABASES privilege.\n\nHowever, the databases are still accessible directly through SQL queries depending on your privileges.", @"Warning message during connection in case the variable skip-show-database is set to ON") callback:nil]; + } + } + // Update the database list [self setDatabases:self]; diff --git a/Source/Controllers/MainViewControllers/TableRelations/SPTableRelations.m b/Source/Controllers/MainViewControllers/TableRelations/SPTableRelations.m index c9fad1f83..079b5dd45 100644 --- a/Source/Controllers/MainViewControllers/TableRelations/SPTableRelations.m +++ b/Source/Controllers/MainViewControllers/TableRelations/SPTableRelations.m @@ -141,9 +141,12 @@ - (IBAction)confirmAddRelation:(id)sender NSString *thisTable = [tablesListInstance tableName]; NSString *thisColumn = [columnPopUpButton titleOfSelectedItem]; NSString *thatDatabase = [refDatabasePopUpButton titleOfSelectedItem]; - NSString *thatTable = [refTablePopUpButton titleOfSelectedItem]; - NSString *thatColumn = [refColumnPopUpButton titleOfSelectedItem]; - + if (!thatDatabase) { + thatDatabase = [tableDocumentInstance database]; + } + NSString *thatTable = [refTablePopUpButton titleOfSelectedItem]; + NSString *thatColumn = [refColumnPopUpButton titleOfSelectedItem]; + NSString *query = [NSString stringWithFormat:@"ALTER TABLE %@ ADD ",[thisTable backtickQuotedString]]; // Set constraint name? @@ -587,6 +590,9 @@ - (void)_updateAvailableTables { // Get selected database NSString *database = [refDatabasePopUpButton titleOfSelectedItem]; + if (!database) { + database = [tableDocumentInstance database]; + } [refTablePopUpButton setEnabled:NO]; [refColumnPopUpButton setEnabled:NO];