From 294af53678cda18e5f6e5f2007daa0893c1250d0 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 1 Oct 2010 12:20:30 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20basic=20support=20for=20spatial=20d?= =?UTF-8?q?ata=20-=20while=20querying=20and=20writing=20back=20make=20usag?= =?UTF-8?q?e=20of=20AsText()=20and=20GeomFromText()=20to=20allow=20to=20ed?= =?UTF-8?q?it=20each=20GEOMETRY=20field=20as=20text=20simple=20string=20-?= =?UTF-8?q?=20works=20only=20in=20Content=20Tab=20so=20far=20-=20the=20spa?= =?UTF-8?q?tial=20data=20are=20not=20yet=20editable=20inside=20views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableData.m | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Source/SPTableData.m') 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. -- cgit v1.2.3