aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-02-28 02:23:17 +0000
committerrowanbeentje <rowan@beent.je>2009-02-28 02:23:17 +0000
commit497aa0b00521383ca497db4c1c42b63b3fb32f9d (patch)
treeae88ca94937e8c2453379bc256dfae30d0d42345 /Source/TableDump.m
parent52784a1b02f5ff32bc8d9661d948d2ebee93f610 (diff)
downloadsequelpro-497aa0b00521383ca497db4c1c42b63b3fb32f9d.tar.gz
sequelpro-497aa0b00521383ca497db4c1c42b63b3fb32f9d.tar.bz2
sequelpro-497aa0b00521383ca497db4c1c42b63b3fb32f9d.zip
- Improve handling of disconnections made while selecting a database, fixing a crasher when suffering from network issues
- When prompting for an export filename, only select the filename for editing and not the extension - Remove timing debug from CSV export
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m31
1 files changed, 21 insertions, 10 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 6bb61975..5236c07d 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -102,6 +102,8 @@
NSString *file;
NSString *contextInfo;
NSSavePanel *savePanel = [NSSavePanel savePanel];
+ [savePanel setAllowsOtherFileTypes:YES];
+ [savePanel setExtensionHidden:NO];
NSString *currentDate = [[NSDate date] descriptionWithCalendarFormat:@"%d.%m.%Y" timeZone:nil locale:nil];
switch ( tag ) {
@@ -109,53 +111,61 @@
// export dump
[self reloadTables:self];
file = [NSString stringWithFormat:@"%@_dump %@.sql", [tableDocumentInstance database], currentDate];
+ [savePanel setRequiredFileType:@"sql"];
[savePanel setAccessoryView:exportDumpView];
contextInfo = @"exportDump";
break;
// Export the full resultset for the currently selected table to a file in CSV format
case 6:
- file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance table]];
+ file = [NSString stringWithString:(NSString *)[tableDocumentInstance table]];
+ [savePanel setRequiredFileType:@"csv"];
[savePanel setAccessoryView:exportCSVView];
contextInfo = @"exportTableContentAsCSV";
break;
// Export the full resultset for the currently selected table to a file in XML format
case 7:
- file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance table]];
+ file = [NSString stringWithString:(NSString *)[tableDocumentInstance table]];
+ [savePanel setRequiredFileType:@"xml"];
contextInfo = @"exportTableContentAsXML";
break;
// Export the current "browse" view to a file in CSV format
case 8:
- file = [NSString stringWithFormat:@"%@ view.csv", [tableDocumentInstance table]];
+ file = [NSString stringWithFormat:@"%@ view", [tableDocumentInstance table]];
+ [savePanel setRequiredFileType:@"csv"];
[savePanel setAccessoryView:exportCSVView];
contextInfo = @"exportBrowseViewAsCSV";
break;
// Export the current "browse" view to a file in XML format
case 9:
- file = [NSString stringWithFormat:@"%@ view.xml", [tableDocumentInstance table]];
+ file = [NSString stringWithFormat:@"%@ view", [tableDocumentInstance table]];
+ [savePanel setRequiredFileType:@"xml"];
contextInfo = @"exportBrowseViewAsXML";
break;
// Export the current custom query result set to a file in CSV format
case 10:
- file = @"customresult.csv";
+ file = @"customresult";
+ [savePanel setRequiredFileType:@"csv"];
[savePanel setAccessoryView:exportCSVView];
contextInfo = @"exportCustomResultAsCSV";
break;
// Export the current custom query result set to a file in XML format
case 11:
- file = @"customresult.xml";
+ file = @"customresult";
+ [savePanel setRequiredFileType:@"xml"];
contextInfo = @"exportCustomResultAsXML";
break;
// Export multiple tables to a file in CSV format
case 12:
[self reloadTables:self];
- file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance database]];
+ file = [NSString stringWithString:[tableDocumentInstance database]];
+ [savePanel setRequiredFileType:@"csv"];
[savePanel setAccessoryView:exportMultipleCSVView];
contextInfo = @"exportMultipleTablesAsCSV";
break;
@@ -163,7 +173,8 @@
// Export multiple tables to a file in XML format
case 13:
[self reloadTables:self];
- file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance database]];
+ file = [NSString stringWithString:[tableDocumentInstance database]];
+ [savePanel setRequiredFileType:@"xml"];
[savePanel setAccessoryView:exportMultipleXMLView];
contextInfo = @"exportMultipleTablesAsXML";
break;
@@ -1551,7 +1562,7 @@
if ( [type isEqualToString:@"csv"] && [selectedTables count] > 1) {
[fileHandle writeData:[[NSString stringWithFormat:@"Table %@%@%@", tableName, csvLineEnd, csvLineEnd] dataUsingEncoding:connectionEncoding]];
}
-NSDate *startDate = [NSDate date];
+
// 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];
@@ -1593,7 +1604,7 @@ NSDate *startDate = [NSDate date];
lineEnds:[exportMultipleLinesTerminatedField stringValue]
withNumericColumns:tableColumnNumericStatus
silently:YES];
- NSLog(@"CSV export took %f s", [[NSDate date] timeIntervalSinceDate:startDate]);
+
// Add a spacer to the file
[fileHandle writeData:[[NSString stringWithFormat:@"%@%@%@", csvLineEnd, csvLineEnd, csvLineEnd] dataUsingEncoding:connectionEncoding]];
} else if ( [type isEqualToString:@"xml"] ) {