aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 12ab01de..a035c750 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -40,6 +40,7 @@
#import "SPAlertSheets.h"
#import "SPFieldMapperController.h"
#import "SPMainThreadTrampoline.h"
+#import "SPNotLoaded.h"
@implementation TableDump
@@ -1342,6 +1343,10 @@
else
cellData = NSArrayObjectAtIndex(csvRowArray, mapColumn);
+ // If import column isn't specified import the table column default value
+ if ([cellData isSPNotLoaded])
+ cellData = NSArrayObjectAtIndex(fieldMappingTableDefaultValues, i);
+
if (cellData == [NSNull null]) {
[setString appendString:@"NULL"];
} else {
@@ -1362,6 +1367,10 @@
else
cellData = NSArrayObjectAtIndex(csvRowArray, mapColumn);
+ // If import column isn't specified import the table column default value
+ if ([cellData isSPNotLoaded])
+ cellData = NSArrayObjectAtIndex(fieldMappingTableDefaultValues, i);
+
if (cellData == [NSNull null]) {
[whereString appendString:@" IS NULL"];
} else {
@@ -1403,6 +1412,10 @@
else
cellData = NSArrayObjectAtIndex(csvRowArray, mapColumn);
+ // If import column isn't specified import the table column default value
+ if ([cellData isSPNotLoaded])
+ cellData = NSArrayObjectAtIndex(fieldMappingTableDefaultValues, i);
+
if (cellData == [NSNull null]) {
[valueString appendString:@"NULL"];
} else {
@@ -2783,12 +2796,12 @@
if ([column objectForKey:@"default"]) {
// Some MySQL server versions show a default of NULL for NOT NULL columns - don't export those.
- if ([[column objectForKey:@"default"] isEqualToString:@"NULL"]) {
+ if ([column objectForKey:@"default"] == [NSNull null]) {
if ([[column objectForKey:@"null"] integerValue])
[fieldString appendString:@" DEFAULT NULL"];
} else if ([[column objectForKey:@"type"] isEqualToString:@"TIMESTAMP"]
- && [[[column objectForKey:@"default"] uppercaseString] isEqualToString:@"CURRENT_TIMESTAMP"]) {
+ && [column objectForKey:@"default"] != [NSNull null] && [[[column objectForKey:@"default"] uppercaseString] isEqualToString:@"CURRENT_TIMESTAMP"]) {
[fieldString appendString:@" DEFAULT CURRENT_TIMESTAMP"];
} else {
[fieldString appendFormat:@" DEFAULT '%@'", [mySQLConnection prepareString:[column objectForKey:@"default"]]];