diff options
author | avenjamin <avenjamin@gmail.com> | 2009-04-22 04:25:43 +0000 |
---|---|---|
committer | avenjamin <avenjamin@gmail.com> | 2009-04-22 04:25:43 +0000 |
commit | 3271be602a018a9c7872429c395139b9546d0ef2 (patch) | |
tree | c0005d8dbc6d0274571ffc3ab49bca23079e2cd7 | |
parent | aa60169e5a05bc91f2cf4f4f2377ca894755ef9e (diff) | |
download | sequelpro-3271be602a018a9c7872429c395139b9546d0ef2.tar.gz sequelpro-3271be602a018a9c7872429c395139b9546d0ef2.tar.bz2 sequelpro-3271be602a018a9c7872429c395139b9546d0ef2.zip |
- 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.
-rw-r--r-- | Source/TableDump.m | 8 | ||||
-rw-r--r-- | 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 <Cocoa/Cocoa.h> #endif + +#ifdef DEBUG + #define DLog(...) NSLog(__VA_ARGS__) +#else + #define DLog(...) /* */ +#endif + +#define ALog(...) NSLog(__VA_ARGS__)
\ No newline at end of file |