From 47bedef42fc896ad8f3dd9736993b4975890b440 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 6 Jul 2009 23:45:03 +0000 Subject: - Update the import/export progress sheet title to reflect the current activity - Fix mutliple-table CSV and XML export when a view is selected - data for the view is now correctly exported --- Source/TableDump.h | 1 + Source/TableDump.m | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/TableDump.h b/Source/TableDump.h index 3419465c..d43912c3 100644 --- a/Source/TableDump.h +++ b/Source/TableDump.h @@ -83,6 +83,7 @@ IBOutlet id errorsView; IBOutlet id singleProgressSheet; IBOutlet id singleProgressBar; + IBOutlet id singleProgressTitle; IBOutlet id singleProgressText; IBOutlet id fieldMappingSheet; diff --git a/Source/TableDump.m b/Source/TableDump.m index 32e40700..cf90eb1a 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -442,6 +442,8 @@ // reset interface [errorsView setString:@""]; [errorsView displayIfNeeded]; + [singleProgressTitle setStringValue:NSLocalizedString(@"Starting import...", @"text showing that the application has started importing")]; + [singleProgressTitle displayIfNeeded]; [singleProgressText setStringValue:NSLocalizedString(@"Reading...", @"text showing that app is reading dump")]; [singleProgressText displayIfNeeded]; [singleProgressBar setDoubleValue:0]; @@ -473,6 +475,7 @@ [singleProgressBar stopAnimation:self]; [singleProgressBar setUsesThreadedAnimation:NO]; [singleProgressBar setIndeterminate:NO]; + [singleProgressTitle setStringValue:NSLocalizedString(@"Importing SQL", @"text showing that the application is importing SQL")]; [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Executing %d statements...", @"text showing that app is executing x statements"), queryCount]]; NSCharacterSet *whitespaceAndNewline = [NSCharacterSet whitespaceAndNewlineCharacterSet]; @@ -545,6 +548,7 @@ didEndSelector:nil contextInfo:nil]; + [singleProgressTitle setStringValue:NSLocalizedString(@"Importing CSV", @"text showing that the application is importing CSV")]; [singleProgressSheet makeKeyWindow]; [singleProgressBar setIndeterminate:YES]; [singleProgressBar setUsesThreadedAnimation:YES]; @@ -652,6 +656,8 @@ contextInfo:nil]; [singleProgressSheet makeKeyWindow]; + [singleProgressText setStringValue:NSLocalizedString(@"Creating rows...", @"text showing that app is importing rows from CSV")]; + [singleProgressText displayIfNeeded]; // get fields to be imported for (i = 0; i < [fieldMappingArray count] ; i++ ) { @@ -849,9 +855,10 @@ // Reset the interface [errorsView setString:@""]; [errorsView displayIfNeeded]; + [singleProgressTitle setStringValue:NSLocalizedString(@"Exporting SQL", @"text showing that the application is exporting SQL")]; + [singleProgressTitle displayIfNeeded]; [singleProgressText setStringValue:NSLocalizedString(@"Dumping...", @"text showing that app is writing dump")]; [singleProgressText displayIfNeeded]; - //progressBarWidth = (int)[singleProgressBar bounds].size.width; [singleProgressBar setDoubleValue:0]; [singleProgressBar displayIfNeeded]; @@ -1151,6 +1158,8 @@ NSString *previousConnectionEncoding; BOOL previousConnectionEncodingViaLatin1; + [singleProgressTitle setStringValue:NSLocalizedString(@"Exporting Dot file", @"text showing that the application is exporting a Dot file")]; + [singleProgressTitle displayIfNeeded]; [singleProgressText setStringValue:NSLocalizedString(@"Dumping...", @"text showing that app is writing dump")]; [singleProgressText displayIfNeeded]; progressBarWidth = (int)[singleProgressBar bounds].size.width; @@ -1344,6 +1353,7 @@ if ( !silently ) { // Set the progress text + [singleProgressTitle setStringValue:NSLocalizedString(@"Exporting CSV", @"text showing that the application is exporting a CSV")]; [singleProgressText setStringValue:NSLocalizedString(@"Exporting...", @"text showing that app is exporting to text file")]; // [singleProgressText displayIfNeeded]; @@ -1681,6 +1691,8 @@ if ( !silently ) { // Set the progress text + [singleProgressTitle setStringValue:NSLocalizedString(@"Exporting XML", @"text showing that the application is exporting XML")]; + [singleProgressTitle displayIfNeeded]; [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")]; [singleProgressText displayIfNeeded]; @@ -1815,6 +1827,7 @@ // Reset the interface [errorsView setString:@""]; [errorsView displayIfNeeded]; + [singleProgressTitle setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Exporting %@", @"text showing that the application is importing a supplied format"), [type uppercaseString]]]; [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")]; [singleProgressText displayIfNeeded]; [singleProgressBar setDoubleValue:0]; @@ -1875,8 +1888,18 @@ [fileHandle writeData:[[NSString stringWithFormat:@"Table %@%@%@", tableName, csvLineEnd, csvLineEnd] dataUsingEncoding:connectionEncoding]]; } + // Determine whether this table is a table or a view via the create table command, and get the table details + queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE %@", [tableName backtickQuotedString]]]; + if ( [queryResult numOfRows] ) { + tableDetails = [NSDictionary dictionaryWithDictionary:[queryResult fetchRowAsDictionary]]; + if ([tableDetails objectForKey:@"Create View"]) { + tableDetails = [NSDictionary dictionaryWithDictionary:[tableDataInstance informationForView:tableName]]; + } else { + tableDetails = [NSDictionary dictionaryWithDictionary:[tableDataInstance informationForTable:tableName]]; + } + } + // Retrieve the table details via the data class, and use it to build an array containing column numeric status - tableDetails = [NSDictionary dictionaryWithDictionary:[tableDataInstance informationForTable:tableName]]; tableColumnNumericStatus = [NSMutableArray array]; for ( j = 0; j < [[tableDetails objectForKey:@"columns"] count] ; j++ ) { tableColumnTypeGrouping = [[[tableDetails objectForKey:@"columns"] objectAtIndex:j] objectForKey:@"typegrouping"]; -- cgit v1.2.3