From 3271be602a018a9c7872429c395139b9546d0ef2 Mon Sep 17 00:00:00 2001 From: avenjamin Date: Wed, 22 Apr 2009 04:25:43 +0000 Subject: - Fixed an issue causing a crash with large SQL imports. NSLog was dumping the sql file and was crashing due to the size of the file. Line is commented out in non-Debug builds. --- Source/TableDump.m | 8 ++++++-- Source/sequel-pro_Prefix.pch | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/TableDump.m b/Source/TableDump.m index ff79129d..03e98bd6 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -391,11 +391,14 @@ // Load file into string. For SQL imports, try UTF8 file encoding before the current encoding. if ([fileType isEqualToString:@"SQL"]) { - NSLog(@"Reading as utf8"); + NSLog(@"Attempting to read as utf8"); dumpFile = [SPSQLParser stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&errorStr]; - NSLog(dumpFile); + + // This will crash if dumpFile is big. + DLog(dumpFile); + if (errorStr) { importSQLAsUTF8 = NO; errorStr = nil; @@ -404,6 +407,7 @@ // If the SQL-as-UTF8 read failed, and for CSVs, use the current connection encoding. if (!importSQLAsUTF8 || [fileType isEqualToString:@"CSV"]) { + NSLog(@"Reading using connection encoding"); dumpFile = [SPSQLParser stringWithContentsOfFile:filename encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]] error:&errorStr]; diff --git a/Source/sequel-pro_Prefix.pch b/Source/sequel-pro_Prefix.pch index 8df1011d..0fa8023c 100644 --- a/Source/sequel-pro_Prefix.pch +++ b/Source/sequel-pro_Prefix.pch @@ -5,3 +5,11 @@ #ifdef __OBJC__ #import #endif + +#ifdef DEBUG + #define DLog(...) NSLog(__VA_ARGS__) +#else + #define DLog(...) /* */ +#endif + +#define ALog(...) NSLog(__VA_ARGS__) \ No newline at end of file -- cgit v1.2.3