aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-04-06 15:20:11 +0000
committerBibiko <bibiko@eva.mpg.de>2010-04-06 15:20:11 +0000
commit139c7223197461493c89021c2cbaa840053f0511 (patch)
tree1388864a5b0851cb8b434db653fe87f2ccc4712d /Source/TableDump.m
parent4ba28f6e7c3bb8cacaff226d011ff1da18a4714b (diff)
downloadsequelpro-139c7223197461493c89021c2cbaa840053f0511.tar.gz
sequelpro-139c7223197461493c89021c2cbaa840053f0511.tar.bz2
sequelpro-139c7223197461493c89021c2cbaa840053f0511.zip
• CSV Import
- ensure that if the connection is lost while importing all relevant allocated objects are released including the import pool - any error which cancels the import process will also release all retained global variables coming from the field mapper
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m53
1 files changed, 45 insertions, 8 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index a905d7be..a7a1f31d 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -867,6 +867,13 @@
[csvDataBuffer release];
[parsedRows release];
[parsePositions release];
+ if(csvImportTailString) [csvImportTailString release], csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release], csvImportHeaderString = nil;
+ if(fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
+ if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release], fieldMappingGlobalValueArray = nil;
+ if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release], fieldMappingTableColumnNames = nil;
+ if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release], fieldMappingTableDefaultValues = nil;
+ if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
return;
@@ -907,6 +914,13 @@
[csvDataBuffer release];
[parsedRows release];
[parsePositions release];
+ if(csvImportTailString) [csvImportTailString release], csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release], csvImportHeaderString = nil;
+ if(fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
+ if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release], fieldMappingGlobalValueArray = nil;
+ if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release], fieldMappingTableColumnNames = nil;
+ if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release], fieldMappingTableDefaultValues = nil;
+ if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
return;
@@ -951,6 +965,13 @@
[csvDataBuffer release];
[parsedRows release];
[parsePositions release];
+ if(csvImportTailString) [csvImportTailString release], csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release], csvImportHeaderString = nil;
+ if(fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
+ if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release], fieldMappingGlobalValueArray = nil;
+ if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release], fieldMappingTableColumnNames = nil;
+ if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release], fieldMappingTableDefaultValues = nil;
+ if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
return;
@@ -988,7 +1009,23 @@
if (!fieldMappingArray) continue;
// Before entering the following loop, check that we actually have a connection. If not, bail.
- if (![mySQLConnection isConnected]) return;
+ if (![mySQLConnection isConnected]) {
+ [self closeAndStopProgressSheet];
+ [csvParser release];
+ [csvDataBuffer release];
+ [parsedRows release];
+ [parsePositions release];
+ if(csvImportTailString) [csvImportTailString release], csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release], csvImportHeaderString = nil;
+ if(fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
+ if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release], fieldMappingGlobalValueArray = nil;
+ if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release], fieldMappingTableColumnNames = nil;
+ if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release], fieldMappingTableDefaultValues = nil;
+ if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
+ [importPool drain];
+ [tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+ return;
+ }
// If we have more than the csvRowsPerQuery amount, or if we're at the end of the
// available data, construct and run a query.
@@ -1123,13 +1160,13 @@
[csvDataBuffer release];
[parsedRows release];
[parsePositions release];
- if(csvImportTailString) [csvImportTailString release]; csvImportTailString = nil;
- if(csvImportHeaderString) [csvImportHeaderString release]; csvImportHeaderString = nil;
- if(fieldMappingArray) [fieldMappingArray release]; fieldMappingArray = nil;
- if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release]; fieldMappingGlobalValueArray = nil;
- if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release]; fieldMappingTableColumnNames = nil;
- if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release]; fieldMappingTableDefaultValues = nil;
- if(fieldMapperOperator) [fieldMapperOperator release]; fieldMapperOperator = nil;
+ if(csvImportTailString) [csvImportTailString release], csvImportTailString = nil;
+ if(csvImportHeaderString) [csvImportHeaderString release], csvImportHeaderString = nil;
+ if(fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
+ if(fieldMappingGlobalValueArray) [fieldMappingGlobalValueArray release], fieldMappingGlobalValueArray = nil;
+ if(fieldMappingTableColumnNames) [fieldMappingTableColumnNames release], fieldMappingTableColumnNames = nil;
+ if(fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release], fieldMappingTableDefaultValues = nil;
+ if(fieldMapperOperator) [fieldMapperOperator release], fieldMapperOperator = nil;
[importPool drain];
[tableDocumentInstance setQueryMode:SPInterfaceQueryMode];