aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-07 22:23:29 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-07 22:23:29 +0000
commit933bb6c9254ba4761eb960c1b3893a9e57c39fb6 (patch)
treebf50da8ca46d1c60b6de5e23e9881b806c75de51 /Source/SPCustomQuery.m
parent600314d27c03b299e3a9d0f986698a8c2baca9bc (diff)
downloadsequelpro-933bb6c9254ba4761eb960c1b3893a9e57c39fb6.tar.gz
sequelpro-933bb6c9254ba4761eb960c1b3893a9e57c39fb6.tar.bz2
sequelpro-933bb6c9254ba4761eb960c1b3893a9e57c39fb6.zip
• enhanced spatial support
- implemented native routine to immediate AsText() [MULTIPOLYGON and GEOMETRYCOLLECTION are not yet ready] - enabled editing of spatial data in Content View for tables and views and in Custom Query via wkt strings which will be saved automatically as wkb by using GeomFromText()
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 44ba5987..a945a53d 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1752,6 +1752,9 @@
else if ([[field objectForKey:@"typegrouping"] isEqualToString:@"integer"]) {
[fieldIDQueryStr appendFormat:@"%@=%@ AND ", [[field objectForKey:@"org_name"] backtickQuotedString], [aValue description]];
}
+ else if ([[field objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) {
+ [fieldIDQueryStr appendFormat:@"%@=X'%@' AND ", [[field objectForKey:@"org_name"] backtickQuotedString], [mySQLConnection prepareBinaryData:[aValue data]]];
+ }
else {
[fieldIDQueryStr appendFormat:@"%@='%@' AND ", [[field objectForKey:@"org_name"] backtickQuotedString], [mySQLConnection prepareString:aValue]];
}
@@ -1848,7 +1851,7 @@
return [prefs objectForKey:SPNullValue];
if ([theValue isKindOfClass:[MCPGeometryData class]])
- return [theValue description];
+ return [theValue wktString];
return theValue;
}
@@ -1902,6 +1905,8 @@
newObject = @"CURRENT_TIMESTAMP";
} else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) {
newObject = @"NULL";
+ } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) {
+ newObject = [NSString stringWithFormat:@"GeomFromText('%@')", anObject];
} 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"]