aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-01 12:20:30 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-01 12:20:30 +0000
commit294af53678cda18e5f6e5f2007daa0893c1250d0 (patch)
tree1ba6643637001b2d4852094551e7deb2f22c929b /Source/SPTableData.m
parentd7efae3ff6e5cf9407af16dbba09a55be092ce45 (diff)
downloadsequelpro-294af53678cda18e5f6e5f2007daa0893c1250d0.tar.gz
sequelpro-294af53678cda18e5f6e5f2007daa0893c1250d0.tar.bz2
sequelpro-294af53678cda18e5f6e5f2007daa0893c1250d0.zip
• added basic support for spatial data
- while querying and writing back make usage of AsText() and GeomFromText() to allow to edit each GEOMETRY field as text simple string - works only in Content Tab so far - the spatial data are not yet editable inside views
Diffstat (limited to 'Source/SPTableData.m')
-rw-r--r--Source/SPTableData.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index edff16b6..fc410044 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -258,6 +258,30 @@
return (BOOL) ([[[self columnWithName:colName] objectForKey:@"typegrouping"] isEqualToString:@"textdata" ] || [[[self columnWithName:colName] objectForKey:@"typegrouping"] isEqualToString:@"blobdata"]);
}
+/**
+ * Checks if this column is type geometry.
+ * Used to determine if we have to use AsText() in SELECT.
+ *
+ * @param colName The column name which should be checked.
+ */
+
+- (BOOL) columnIsGeometry:(NSString *)colName
+{
+
+ // Return if CREATE SYNTAX is being parsed
+ if(isWorking) return YES; // to be at the safe side
+
+ if ([columns count] == 0) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
+ [self updateInformationForCurrentView];
+ } else {
+ [self updateInformationForCurrentTable];
+ }
+ }
+
+ return (BOOL) ([[[self columnWithName:colName] objectForKey:@"typegrouping"] isEqualToString:@"geometry"]);
+}
+
/**
* Retrieve the table status value for a supplied key, using or refreshing the cache as appropriate.
@@ -1147,6 +1171,11 @@
} else if ([detailString isEqualToString:@"TINYTEXT"] || [detailString isEqualToString:@"TEXT"]
|| [detailString isEqualToString:@"MEDIUMTEXT"] || [detailString isEqualToString:@"LONGTEXT"]) {
[fieldDetails setObject:@"textdata" forKey:@"typegrouping"];
+ } else if ([detailString isEqualToString:@"POINT"] || [detailString isEqualToString:@"GEOMETRY"]
+ || [detailString isEqualToString:@"LINESTRING"] || [detailString isEqualToString:@"POLYGON"]
+ || [detailString isEqualToString:@"MULTIPOLYGON"] || [detailString isEqualToString:@"GEOMETRYCOLLECTION"]
+ || [detailString isEqualToString:@"MULTIPOINT"] || [detailString isEqualToString:@"MULTILINESTRING"]) {
+ [fieldDetails setObject:@"geometry" forKey:@"typegrouping"];
// Default to "blobdata". This means that future and currently unsupported types - including spatial extensions -
// will be preserved unmangled.