diff options
author | rowanbeentje <rowan@beent.je> | 2009-07-06 23:45:03 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-07-06 23:45:03 +0000 |
commit | 47bedef42fc896ad8f3dd9736993b4975890b440 (patch) | |
tree | 2308e3c5d17f6ae037bfbbe6ed022e2b9d99552d /Source/TableDump.m | |
parent | b3065d6e706a5ddc7b0345c833ad125883cded82 (diff) | |
download | sequelpro-47bedef42fc896ad8f3dd9736993b4975890b440.tar.gz sequelpro-47bedef42fc896ad8f3dd9736993b4975890b440.tar.bz2 sequelpro-47bedef42fc896ad8f3dd9736993b4975890b440.zip |
- 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
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r-- | Source/TableDump.m | 27 |
1 files changed, 25 insertions, 2 deletions
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"]; |