aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPStringAdditions.m2
-rw-r--r--Source/SPTableContent.m6
-rw-r--r--Source/SPTableStructure.m6
3 files changed, 7 insertions, 7 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index ea603cbc..847b4dbc 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -382,7 +382,7 @@
NSString *geomStr = [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- if(![self rangeOfString:@")"].length || [self length] < 5) return @"";
+ if(![self rangeOfString:@")"].length || [self length] < 5) return @"NULL";
// No SRID
if([geomStr hasSuffix:@")"])
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index fe586e8a..c1c28c61 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2389,9 +2389,6 @@
{
[rowValue setString:@"CURRENT_TIMESTAMP"];
- } else if ( [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"typegrouping"] isEqualToString:@"geometry"] ) {
- [rowValue setString:([rowObject isKindOfClass:[MCPGeometryData class]]) ? [[rowObject wktString] getGeomFromTextString] : [(NSString*)rowObject getGeomFromTextString]];
- // Convert the object to a string (here we can add special treatment for date-, number- and data-fields)
} else if ( [rowObject isNSNull]
|| ([rowObject isMemberOfClass:[NSString class]] && [[rowObject description] isEqualToString:@""]) ) {
@@ -2399,6 +2396,9 @@
// problem: when a number isn't set, sequel-pro enters 0
// -> second if argument isn't necessary!
[rowValue setString:@"NULL"];
+ } else if ( [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"typegrouping"] isEqualToString:@"geometry"] ) {
+ [rowValue setString:([rowObject isKindOfClass:[MCPGeometryData class]]) ? [[rowObject wktString] getGeomFromTextString] : [(NSString*)rowObject getGeomFromTextString]];
+ // Convert the object to a string (here we can add special treatment for date-, number- and data-fields)
} else {
// I don't believe any of these class matches are ever met at present.
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index e6afab2d..5c5a400a 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -1546,7 +1546,7 @@ returns a dictionary containing enum/set field names as key and possible values
if(anObject && [(NSString*)anObject length] && ![(NSString*)anObject hasPrefix:@"--"]) {
[currentRow setObject:[(NSString*)anObject uppercaseString] forKey:@"type"];
// If type is BLOB or TEXT reset DEFAULT since these field types don't allow a default
- if([[currentRow objectForKey:@"type"] hasSuffix:@"TEXT"] || [[currentRow objectForKey:@"type"] hasSuffix:@"BLOB"]) {
+ if([[currentRow objectForKey:@"type"] hasSuffix:@"TEXT"] || [[currentRow objectForKey:@"type"] hasSuffix:@"BLOB"] || [self _isFieldTypeGeometry:[currentRow objectForKey:@"type"]]) {
[currentRow setObject:@"" forKey:@"default"];
[currentRow setObject:@"" forKey:@"length"];
}
@@ -1897,9 +1897,9 @@ would result in a position change.
else if([[aTableColumn identifier] isEqualToString:@"binary"]) {
[aCell setEnabled:([self _isFieldTypeAllowBinary:theRowType])];
}
- // TEXT or BLOB fields don't allow a DEFAULT
+ // TEXT, BLOB, and GEOMETRY fields don't allow a DEFAULT
else if([[aTableColumn identifier] isEqualToString:@"default"]) {
- [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"]) ? NO : YES];
+ [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [self _isFieldTypeGeometry:theRowType]) ? NO : YES];
}
// Check allow NULL
else if([[aTableColumn identifier] isEqualToString:@"null"]) {