From 230f6295f5c6a80201410bc0347e83920df08bfe Mon Sep 17 00:00:00 2001 From: drx777 Date: Thu, 29 Apr 2010 18:31:39 +0000 Subject: Cleanup/simplification: using messageWindow property directly instead of the getTableWindow method; removed the latter --- Source/SPDatabaseCopy.m | 8 ++------ Source/SPDatabaseInfo.m | 6 +----- Source/SPDatabaseRename.m | 12 ++++-------- Source/SPTableCopy.m | 8 ++------ 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m index 6fc52ae8..5f0c8fe8 100644 --- a/Source/SPDatabaseCopy.m +++ b/Source/SPDatabaseCopy.m @@ -41,10 +41,6 @@ return dbInfo; } -- (NSObject *)getTableWindow { - return messageWindow; -} - - (BOOL)copyDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName withContent:(BOOL)copyWithContent { SPDatabaseInfo *databaseInfo = [self getDBInfoObject]; @@ -58,7 +54,7 @@ tables = [connection listTablesFromDB:sourceDatabaseName]; } else { SPBeginAlertSheet(NSLocalizedString(@"Cannot create existing database", @"create database exists error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nDatabase %@ already exists.", @"create database error informative message"), targetDatabaseName]); @@ -87,7 +83,7 @@ if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to create database", @"create database error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nMySQL said: %@", @"create database error informative message"), [connection getLastErrorMessage]]); diff --git a/Source/SPDatabaseInfo.m b/Source/SPDatabaseInfo.m index 6c5b3f66..883ebef2 100644 --- a/Source/SPDatabaseInfo.m +++ b/Source/SPDatabaseInfo.m @@ -27,10 +27,6 @@ @implementation SPDatabaseInfo -- (NSObject *)getTableWindow { - return messageWindow; -} - -(BOOL)databaseExists:(NSString *)databaseName { NSArray *names = [self listDBs]; return [names containsObject:databaseName]; @@ -54,7 +50,7 @@ if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to retrieve databases list", @"database list error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to retrieve a list of databases.\n\nMySQL said: %@", @"database list error informative message"), [connection getLastErrorMessage]]); diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m index aa3a401a..448b2690 100644 --- a/Source/SPDatabaseRename.m +++ b/Source/SPDatabaseRename.m @@ -42,10 +42,6 @@ return dbInfo; } -- (NSObject *)getTableWindow { - return messageWindow; -} - - (BOOL)renameDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName { SPDatabaseInfo *databaseInfo = [self getDBInfoObject]; @@ -59,7 +55,7 @@ tables = [connection listTablesFromDB:sourceDatabaseName]; } else { SPBeginAlertSheet(NSLocalizedString(@"Cannot create existing database", @"create database exists error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nDatabase %@ already exists.", @"create database error informative message"), targetDatabaseName]); @@ -82,7 +78,7 @@ [self dropDatabase:sourceDatabaseName]; } else { SPBeginAlertSheet(NSLocalizedString(@"Failed to delete database", @"delete database error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Database %@ not empty, skipping drop database.", @"delete database not empty error informative message"), sourceDatabaseName]); @@ -95,7 +91,7 @@ [connection queryString:createStatement]; if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to create database", @"create database error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create a database.\n\nMySQL said: %@", @"create database error informative message"), [connection getLastErrorMessage]]); @@ -111,7 +107,7 @@ [connection queryString:dropStatement]; if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to drop database", @"drop database error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to drop a database.\n\nMySQL said: %@", @"drop database error informative message"), [connection getLastErrorMessage]]); diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m index 19bff7c2..ab485b60 100644 --- a/Source/SPTableCopy.m +++ b/Source/SPTableCopy.m @@ -27,10 +27,6 @@ @implementation SPTableCopy -- (NSObject *)getTableWindow { - return messageWindow; -} - - (NSString *)getCreateTableStatementFor: (NSString *)tableName inDB: (NSString *)sourceDB { NSString *showCreateTableStatment = [NSString stringWithFormat:@"SHOW CREATE TABLE %@.%@", [sourceDB backtickQuotedString], @@ -40,7 +36,7 @@ if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to show create table statement", @"show create table error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to retrieve the create table statement for a table.\n\nMySQL said: %@", @"show create table error informative message"), [connection getLastErrorMessage]]); @@ -78,7 +74,7 @@ if ([connection queryErrored]) { SPBeginAlertSheet(NSLocalizedString(@"Failed to copy table", @"copy table error message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, [self getTableWindow], self, nil, nil, nil, + NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to copy a table.\n\nMySQL said: %@", @"copy table error informative message"), [connection getLastErrorMessage]]); -- cgit v1.2.3