aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDataImport.m17
-rw-r--r--Source/SPSQLExporter.m5
2 files changed, 17 insertions, 5 deletions
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m
index 8a8f9d64..dc22cb0f 100644
--- a/Source/SPDataImport.m
+++ b/Source/SPDataImport.m
@@ -384,15 +384,19 @@
fileTotalLength = [[[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] objectForKey:NSFileSize] longLongValue];
if (!fileTotalLength) fileTotalLength = 1;
+ // If importing a bzipped file, use indeterminate progress bars as no progress is available
+ BOOL useIndeterminate = NO;
+ if ([sqlFileHandle compressionFormat] == SPBzip2Compression) useIndeterminate = YES;
+
// Reset progress interface
[errorsView setString:@""];
[[singleProgressTitle onMainThread] setStringValue:NSLocalizedString(@"Importing SQL", @"text showing that the application is importing SQL")];
[[singleProgressText onMainThread] setStringValue:NSLocalizedString(@"Reading...", @"text showing that app is reading dump")];
- [[singleProgressBar onMainThread] setIndeterminate:NO];
+ [[singleProgressBar onMainThread] setIndeterminate:useIndeterminate];
[[singleProgressBar onMainThread] setMaxValue:fileTotalLength];
[[singleProgressBar onMainThread] setUsesThreadedAnimation:YES];
[[singleProgressBar onMainThread] startAnimation:self];
-
+
// Open the progress sheet
[[NSApp onMainThread] beginSheet:singleProgressSheet modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:nil contextInfo:nil];
[[singleProgressSheet onMainThread] makeKeyWindow];
@@ -1467,10 +1471,17 @@
if ([pathExtension isEqualToString:@"SQL"]) {
[importFormatPopup selectItemWithTitle:@"SQL"];
[self changeFormat:self];
- } else if ([pathExtension isEqualToString:@"CSV"]) {
+ } else if ([pathExtension isEqualToString:@"CSV"] || [pathExtension isEqualToString:@"TSV"]) {
[importFormatPopup selectItemWithTitle:@"CSV"];
[self changeFormat:self];
+ // Set the cell delineator based on extension
+ if ([pathExtension isEqualToString:@"CSV"]) {
+ [importFieldsTerminatedField setStringValue:@","];
+ } else if ([pathExtension isEqualToString:@"TSV"]) {
+ [importFieldsTerminatedField setStringValue:@"\\t"];
+ }
+
// Try to detect the line endings using "file"
NSTask *fileTask = [[NSTask alloc] init];
NSPipe *filePipe = [[NSPipe alloc] init];
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m
index 1374ccda..d999cc2b 100644
--- a/Source/SPSQLExporter.m
+++ b/Source/SPSQLExporter.m
@@ -396,10 +396,11 @@
[sqlString appendString:data];
[data release];
+
+ [sqlString appendString:@"'"];
}
-
- [sqlString appendString:@"'"];
}
+
// GEOMETRY data types directly as hex data
else if ([object isKindOfClass:[MCPGeometryData class]]) {
[sqlString appendFormat:@"X'%@'", [connection prepareBinaryData:[object data]]];