From 31a31c1fb9d46e9c6db1c836e03314b0b534194c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 9 Oct 2010 23:16:37 +0000 Subject: =?UTF-8?q?=E2=80=A2=20enabled=20SRID=20editing=20of=20spatial=20f?= =?UTF-8?q?ields=20via=20WKT=20string=20-=20the=20SRID=20value=20will=20be?= =?UTF-8?q?=20appended=20at=20the=20WKT=20string=20like=20POINT(1=201),101?= =?UTF-8?q?=20which=20will=20be=20transformed=20to=20GeomFromText('POINT(1?= =?UTF-8?q?=201)',101)=20on=20the=20fly=20-=20otherwise=20the=20SRID=20inf?= =?UTF-8?q?ormation=20will=20be=20deleted=20after=20editing=20a=20geometry?= =?UTF-8?q?=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableContent.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/SPTableContent.m') diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index ab0a15c3..027f86a3 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2340,6 +2340,7 @@ contextInfo:nil]; } + /** * Tries to write a new row to the database. * Returns YES if row is written to database, otherwise NO; also returns YES if no row @@ -2392,7 +2393,7 @@ [rowValue setString:@"CURRENT_TIMESTAMP"]; } else if ( [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"typegrouping"] isEqualToString:@"geometry"] ) { - [rowValue setString:[NSString stringWithFormat:@"GeomFromText('%@')", ([rowObject isKindOfClass:[MCPGeometryData class]]) ? [rowObject wktString] : rowObject]]; + [rowValue setString:([rowObject isKindOfClass:[MCPGeometryData class]]) ? [[rowObject wktString] getGeomFromTextFromString] : [(NSString*)rowObject getGeomFromTextFromString]]; // 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:@""]) ) { @@ -3565,7 +3566,7 @@ } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) { newObject = @"NULL"; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) { - newObject = [NSString stringWithFormat:@"GeomFromText('%@')", anObject]; + newObject = [(NSString*)anObject getGeomFromTextFromString]; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"bit"]) { newObject = [NSString stringWithFormat:@"b'%@'", ((![[anObject description] length] || [[anObject description] isEqualToString:@"0"]) ? @"0" : [anObject description])]; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"date"] -- cgit v1.2.3