aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-08 10:32:32 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-08 10:32:32 +0000
commit73dca377472fe466ac5b2b2d0ba13ae109863f59 (patch)
treef23e8d2497cfc16b7fabf69703849e3e1dcff7c5
parente4f629711ee44c5c05bcdcd5062036d82bb73596 (diff)
downloadsequelpro-73dca377472fe466ac5b2b2d0ba13ae109863f59.tar.gz
sequelpro-73dca377472fe466ac5b2b2d0ba13ae109863f59.tar.bz2
sequelpro-73dca377472fe466ac5b2b2d0ba13ae109863f59.zip
• added spatial field types to field list suggestions
• adjusted gui validation for geometry field types
-rw-r--r--Source/SPTableStructure.m29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index f0556ba8..51f2e458 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -43,6 +43,7 @@
- (BOOL)_isFieldTypeNumeric:(NSString*)aType;
- (BOOL)_isFieldTypeDate:(NSString*)aType;
- (BOOL)_isFieldTypeString:(NSString*)aType;
+- (BOOL)_isFieldTypeGeometry:(NSString*)aType;
- (BOOL)_isFieldTypeAllowBinary:(NSString*)aType;
@end
@@ -123,6 +124,15 @@
@"TIMESTAMP",
@"TIME",
@"YEAR",
+ @"--------",
+ @"GEOMETRY",
+ @"POINT",
+ @"LINESTRING",
+ @"POLYGON",
+ @"MULTIPOINT",
+ @"MULTILINESTRING",
+ @"MULTIPOLYGON",
+ @"GEOMETRYCOLLECTION",
nil] retain];
// Hint: _isFieldTypeDate and _isFieldTypeNumeric must be changed if typeSuggestions was changed!
@@ -1822,9 +1832,9 @@ would result in a position change.
else if([[aTableColumn identifier] isEqualToString:@"null"]) {
[aCell setEnabled:([[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] || [[[theRow objectForKey:@"Extra"] uppercaseString] isEqualToString:@"AUTO_INCREMENT"]) ? NO : YES];
}
- // TEXT or BLOB fields don't allow a length
+ // TEXT, BLOB, date, and GEOMETRY fields don't allow a length
else if([[aTableColumn identifier] isEqualToString:@"length"]) {
- [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [self _isFieldTypeDate:theRowType]) ? NO : YES];
+ [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [self _isFieldTypeDate:theRowType] || [self _isFieldTypeGeometry:theRowType]) ? NO : YES];
}
else {
[aCell setEnabled:YES];
@@ -1929,7 +1939,20 @@ would result in a position change.
if(![typeSuggestions containsObject:type]) return YES; // for safety reasons
- return ([typeSuggestions indexOfObject:type] > 32);
+ return ([typeSuggestions indexOfObject:type] > 32 && [typeSuggestions indexOfObject:type] < 38);
+}
+
+/**
+ * Return if aType is a geometry to typeSuggestions's position
+ * Hint: This must be changed if typeSuggestions was changed!
+ */
+- (BOOL)_isFieldTypeGeometry:(NSString*)aType
+{
+ NSString *type = [[aType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
+
+ if(![typeSuggestions containsObject:type]) return YES; // for safety reasons
+
+ return ([typeSuggestions indexOfObject:type] > 38);
}
/**