diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-10-09 23:16:37 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-10-09 23:16:37 +0000 |
commit | 31a31c1fb9d46e9c6db1c836e03314b0b534194c (patch) | |
tree | 044edba373b899fc2dda03eb58aa6e1b6c966d79 /Source/SPTableContent.m | |
parent | a4ae7f6898d3b978938869382667a83535c1a805 (diff) | |
download | sequelpro-31a31c1fb9d46e9c6db1c836e03314b0b534194c.tar.gz sequelpro-31a31c1fb9d46e9c6db1c836e03314b0b534194c.tar.bz2 sequelpro-31a31c1fb9d46e9c6db1c836e03314b0b534194c.zip |
• enabled SRID editing of spatial fields via WKT string
- the SRID value will be appended at the WKT string like POINT(1 1),101 which will be transformed to GeomFromText('POINT(1 1)',101) on the fly
- otherwise the SRID information will be deleted after editing a geometry field
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 5 |
1 files changed, 3 insertions, 2 deletions
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"] |