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 --- Interfaces/English.lproj/DBView.xib | 67 +++++++++++++++++++++++++------------ Source/TableDump.h | 1 + Source/TableDump.m | 27 +++++++++++++-- 3 files changed, 72 insertions(+), 23 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 0d7a4ae2..94d37f02 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,6 +8,7 @@ 353.00 YES + @@ -6768,6 +6769,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 17}, {418, 140}} + 4 @@ -6801,6 +6803,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 0}, {418, 17}} + 4 @@ -6809,6 +6812,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{-1, 22}, {420, 158}} + 514 @@ -6949,7 +6953,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{18, 56}, {343, 20}} - 16394 1.000000e+02 @@ -6958,7 +6961,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{59, 84}, {300, 17}} - YES 67239488 @@ -6981,7 +6983,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{279, 12}, {83, 32}} - YES 67239424 @@ -7007,7 +7008,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{59, 104}, {300, 17}} - YES 67239488 @@ -7040,7 +7040,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 87}, {32, 32}} - YES 130560 @@ -7059,7 +7058,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {379, 139} - {{0, 0}, {1920, 1178}} {213, 72} @@ -7450,6 +7448,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {667, 370} + @@ -7479,6 +7478,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 39}, {667, 370}} + 528 @@ -7592,6 +7592,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {667, 370} + @@ -7621,6 +7622,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 39}, {667, 370}} + 528 @@ -7746,7 +7748,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {370, 204}} - @@ -7776,7 +7777,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{-1, 35}, {383, 206}} - 18 @@ -7930,6 +7930,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 17}, {399, 251}} + 4 @@ -7963,6 +7964,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 0}, {399, 17}} + 4 @@ -7971,6 +7973,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{-1, 39}, {412, 269}} + 18 @@ -8054,7 +8057,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {120, 100} - + 256 YES @@ -8063,7 +8066,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 {{180, -1}, {81, 27}} - YES 67239424 @@ -8094,7 +8096,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6418 {266, 144} - @@ -8340,7 +8341,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {266, 121} - @@ -8352,7 +8352,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{266, 0}, {12, 121}} - YES 2 @@ -8364,7 +8363,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{-100, -100}, {574, 15}} - 1 _doScroller: @@ -8374,7 +8372,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 34}, {278, 121}} - 592 @@ -8383,8 +8380,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {280, 162} - - {{0, 0}, {1440, 878}} {120, 119} @@ -8487,6 +8482,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {352, 178}} + @@ -8516,6 +8512,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 45}, {365, 180}} + 18 @@ -8967,7 +8964,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {350, 250} - + 256 YES @@ -8986,6 +8983,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{128, 16}, {100, 26}} + YES -2076049856 @@ -9018,6 +9016,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{17, 22}, {109, 17}} + YES 68288064 @@ -9032,10 +9031,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {465, 60}} + {{-1, 233}, {467, 62}} + {0, 0} 67239424 @@ -9073,12 +9074,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {423, 141} + YES 256 {423, 17} + @@ -9086,6 +9089,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 -2147483392 {{-22, 0}, {12, 17}} + YES @@ -9161,6 +9165,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 17}, {423, 141}} + @@ -9171,6 +9176,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 -2147483392 {{413, 18}, {11, 140}} + 256 _doScroller: @@ -9181,6 +9187,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{-100, -100}, {227, 11}} + 257 _doScroller: @@ -9195,6 +9202,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 0}, {423, 17}} + @@ -9204,6 +9212,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 45}, {425, 159}} + 530 @@ -9218,6 +9227,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{17, 211}, {151, 13}} + YES 67239424 @@ -9234,6 +9244,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 {{286, 6}, {82, 32}} + YES 67239424 @@ -9259,6 +9270,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 {{368, 6}, {83, 32}} + 1 YES @@ -9282,6 +9294,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{20, 11}, {32, 24}} + YES 604110336 @@ -9306,6 +9319,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{51, 11}, {32, 24}} + 1 YES @@ -9332,6 +9346,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{88, 16}, {98, 14}} + YES 68288064 @@ -9345,6 +9360,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {465, 294} + + {{0, 0}, {1920, 1178}} {350, 272} @@ -15124,6 +15141,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6237 + + + singleProgressTitle + + + + 6238 + @@ -24664,7 +24689,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 6237 + 6238 @@ -25462,7 +25487,6 @@ Y2hhbmdlIHRoZSBvcmRlcg YES addDatabaseButton chooseDatabaseButton - connectionController contentViewSplitter createTableSyntaxWindow customQueryInstance @@ -25499,7 +25523,6 @@ Y2hhbmdlIHRoZSBvcmRlcg YES id id - id NSSplitView NSWindow id @@ -25627,6 +25650,7 @@ Y2hhbmdlIHRoZSBvcmRlcg singleProgressBar singleProgressSheet singleProgressText + singleProgressTitle tableContentInstance tableDataInstance tableDocumentInstance @@ -25689,6 +25713,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id 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