From f8ffeabf18d766c4072a9ddc672b24b631db96b8 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 27 Sep 2010 13:17:00 +0000 Subject: When checking for DB changes during an export, don't refresh the table list, which results in wiping the user's selection. Fix for issue #832. --- Source/SPExportController.m | 110 ++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 59 deletions(-) (limited to 'Source/SPExportController.m') diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 1ae22ed9..55a5bbc8 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -41,7 +41,6 @@ - (void)_switchTab; - (void)_checkForDatabaseChanges; -- (NSUInteger)_refreshDatabaseTableList; - (void)_toggleExportButton:(id)uiStateDict; - (void)_toggleExportButtonOnBackgroundThread; @@ -376,7 +375,51 @@ */ - (IBAction)refreshTableList:(id)sender { - [self _refreshDatabaseTableList]; + [tables removeAllObjects]; + + // For all modes, retrieve table and view names + NSArray *tablesAndViews = [tablesListInstance allTableAndViewNames]; + + for (id itemName in tablesAndViews) { + [tables addObject:[NSMutableArray arrayWithObjects: + itemName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeTable], + nil]]; + } + + // For SQL only, add procedures and functions + if (exportType == SPSQLExport) { + NSArray *procedures = [tablesListInstance allProcedureNames]; + + for (id procName in procedures) + { + [tables addObject:[NSMutableArray arrayWithObjects: + procName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeProc], + nil]]; + } + + NSArray *functions = [tablesListInstance allFunctionNames]; + + for (id funcName in functions) + { + [tables addObject:[NSMutableArray arrayWithObjects: + funcName, + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithBool:YES], + [NSNumber numberWithInt:SPTableTypeFunc], + nil]]; + } + } + + [exportTableList reloadData]; } /** @@ -711,8 +754,13 @@ [tablesListInstance updateTables:self]; - NSUInteger j = [self _refreshDatabaseTableList]; + NSUInteger j = [[tablesListInstance allTableAndViewNames] count]; + // If this is an SQL export, include procs and functions + if (exportType == SPSQLExport) { + j += ([[tablesListInstance allProcedureNames] count] + [[tablesListInstance allFunctionNames] count]); + } + if (j > i) { NSUInteger diff = (j - i); @@ -727,62 +775,6 @@ } } -/** - * Refreshes the database table list. - * - * @return An unsigned integer indicating the number of items within the list. - */ -- (NSUInteger)_refreshDatabaseTableList -{ - [tables removeAllObjects]; - - // For all modes, retrieve table and view names - NSArray *tablesAndViews = [tablesListInstance allTableAndViewNames]; - - for (id itemName in tablesAndViews) { - [tables addObject:[NSMutableArray arrayWithObjects: - itemName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeTable], - nil]]; - } - - // For SQL only, add procedures and functions - if (exportType == SPSQLExport) { - NSArray *procedures = [tablesListInstance allProcedureNames]; - - for (id procName in procedures) - { - [tables addObject:[NSMutableArray arrayWithObjects: - procName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeProc], - nil]]; - } - - NSArray *functions = [tablesListInstance allFunctionNames]; - - for (id funcName in functions) - { - [tables addObject:[NSMutableArray arrayWithObjects: - funcName, - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithBool:YES], - [NSNumber numberWithInt:SPTableTypeFunc], - nil]]; - } - } - - [exportTableList reloadData]; - - return [tables count]; -} - /** * Enables or disables the export button based on the state of various interface controls. * -- cgit v1.2.3