Skip to content

Commit 5d99aca

Browse files
committed
Add sys database to the list of system databases.
1 parent 6639af7 commit 5d99aca

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

Source/SPConstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ extern NSString *SPDefaultMonospacedFontName;
255255
extern NSString *SPMySQLDatabase;
256256
extern NSString *SPMySQLInformationSchemaDatabase;
257257
extern NSString *SPMySQLPerformanceSchemaDatabase;
258+
extern NSString *SPMySQLSysDatabase;
258259

259260
// Table view drag types
260261
extern NSString *SPDefaultPasteboardDragType;

Source/SPConstants.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
NSString *SPMySQLDatabase = @"mysql";
4141
NSString *SPMySQLInformationSchemaDatabase = @"information_schema";
4242
NSString *SPMySQLPerformanceSchemaDatabase = @"performance_schema";
43+
NSString *SPMySQLSysDatabase = @"sys";
4344

4445
// Table view drag types
4546
NSString *SPDefaultPasteboardDragType = @"SequelProPasteboard";

Source/SPDatabaseDocument.m

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,6 @@ - (SPMySQLConnection *)getConnection
624624
*/
625625
- (IBAction)setDatabases:(id)sender;
626626
{
627-
#ifndef SP_CODA /* ui manipulation */
628-
629627
if (!chooseDatabaseButton) return;
630628

631629
[chooseDatabaseButton removeAllItems];
@@ -635,7 +633,6 @@ - (IBAction)setDatabases:(id)sender;
635633
[[chooseDatabaseButton menu] addItemWithTitle:NSLocalizedString(@"Add Database...", @"menu item to add db") action:@selector(addDatabase:) keyEquivalent:@""];
636634
[[chooseDatabaseButton menu] addItemWithTitle:NSLocalizedString(@"Refresh Databases", @"menu item to refresh databases") action:@selector(setDatabases:) keyEquivalent:@""];
637635
[[chooseDatabaseButton menu] addItem:[NSMenuItem separatorItem]];
638-
#endif
639636

640637
if (allDatabases) SPClear(allDatabases);
641638
if (allSystemDatabases) SPClear(allSystemDatabases);
@@ -645,25 +642,25 @@ - (IBAction)setDatabases:(id)sender;
645642
allDatabases = [[NSMutableArray alloc] initWithCapacity:[theDatabaseList count]];
646643
allSystemDatabases = [[NSMutableArray alloc] initWithCapacity:2];
647644

648-
for (NSString *databaseName in theDatabaseList) {
649-
645+
for (NSString *databaseName in theDatabaseList)
646+
{
650647
// If the database is either information_schema or mysql then it is classed as a
651-
// system table; similarly, for 5.5.3+, performance_schema
648+
// system database; similarly, performance_schema in 5.5.3+ and sys in 5.7.7+
652649
if ([databaseName isEqualToString:SPMySQLDatabase] ||
653650
[databaseName isEqualToString:SPMySQLInformationSchemaDatabase] ||
654-
[databaseName isEqualToString:SPMySQLPerformanceSchemaDatabase]) {
651+
[databaseName isEqualToString:SPMySQLPerformanceSchemaDatabase] ||
652+
[databaseName isEqualToString:SPMySQLSysDatabase]) {
655653
[allSystemDatabases addObject:databaseName];
656654
}
657655
else {
658656
[allDatabases addObject:databaseName];
659657
}
660658
}
661659

662-
#ifndef SP_CODA /* ui manipulation */
663660
// Add system databases
664-
for (NSString *db in allSystemDatabases)
661+
for (NSString *database in allSystemDatabases)
665662
{
666-
[chooseDatabaseButton addItemWithTitle:db];
663+
[chooseDatabaseButton addItemWithTitle:database];
667664
}
668665

669666
// Add a separator between the system and user databases
@@ -672,13 +669,12 @@ - (IBAction)setDatabases:(id)sender;
672669
}
673670

674671
// Add user databases
675-
for (NSString *db in allDatabases)
672+
for (NSString *database in allDatabases)
676673
{
677-
[chooseDatabaseButton addItemWithTitle:db];
674+
[chooseDatabaseButton addItemWithTitle:database];
678675
}
679676

680677
(![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]];
681-
#endif
682678
}
683679

684680
#ifndef SP_CODA /* chooseDatabase: */

0 commit comments

Comments
 (0)