diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-10-07 14:15:07 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-10-07 14:15:07 +0000 |
commit | 95d2e4acc393e91aa70ed4c71daa1f776454a936 (patch) | |
tree | c0462090392ae1e252d6ddff5af5887f84dc3ce1 /Source/SPTableContent.m | |
parent | b763c421f6fc2fc693ccbf89ffe38c64cd977ab8 (diff) | |
download | sequelpro-95d2e4acc393e91aa70ed4c71daa1f776454a936.tar.gz sequelpro-95d2e4acc393e91aa70ed4c71daa1f776454a936.tar.bz2 sequelpro-95d2e4acc393e91aa70ed4c71daa1f776454a936.zip |
• removed approach to query spatial data by using AsText() since it breaks some column definition approaches
- instead introduced a new MCPKit class MCPGeometryData
- up to now the spatial data will be displayed as hex bytes - work on it will come soon
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index b620cf0b..cc5eb6bd 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2716,43 +2716,27 @@ */ - (NSString *)fieldListForQuery { - NSInteger i; - NSMutableArray *fields = [NSMutableArray array]; - NSArray *columnNames = [tableDataInstance columnNames]; - BOOL hasGeometryFields = NO; + if (([prefs boolForKey:SPLoadBlobsAsNeeded]) && [dataColumns count]) { - if (([prefs boolForKey:SPLoadBlobsAsNeeded]) && ([dataColumns count] > 0)) { + NSMutableArray *fields = [NSMutableArray arrayWithCapacity:[dataColumns count]]; + BOOL tableHasBlobs = NO; + NSString *fieldName; - for (i = 0 ; i < [columnNames count]; i++) - { - if (![tableDataInstance columnIsBlobOrText:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"]] ) { - if([tableDataInstance columnIsGeometry:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"]]) - [fields addObject:[NSString stringWithFormat:@"AsText(%@)", [NSArrayObjectAtIndex(columnNames, i) backtickQuotedString]]]; - else - [fields addObject:[NSArrayObjectAtIndex(columnNames, i) backtickQuotedString]]; - } + for (NSDictionary* field in dataColumns) + if (![tableDataInstance columnIsBlobOrText:fieldName = [field objectForKey:@"name"]] ) + [fields addObject:[fieldName backtickQuotedString]]; else { // For blob/text fields, select a null placeholder so the column count is still correct [fields addObject:@"NULL"]; + tableHasBlobs = YES; } - } - return [fields componentsJoinedByString:@","]; - } else { + return (tableHasBlobs) ? [fields componentsJoinedByString:@", "] : @"*"; - for (i = 0 ; i < [columnNames count]; i++) - { - if([tableDataInstance columnIsGeometry:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"]]) { - [fields addObject:[NSString stringWithFormat:@"AsText(%@)", [NSArrayObjectAtIndex(columnNames, i) backtickQuotedString]]]; - hasGeometryFields = YES; - } - else - [fields addObject:[NSArrayObjectAtIndex(columnNames, i) backtickQuotedString]]; - } - if(hasGeometryFields) - return [fields componentsJoinedByString:@","]; - else - return @"*"; + } + else { + + return @"*"; } } @@ -3416,6 +3400,9 @@ theValue = SPDataStorageObjectAtRowAndColumn(tableValues, rowIndex, columnIndex); } + if([theValue isKindOfClass:[MCPGeometryData class]]) + return [theValue description]; + if ([theValue isNSNull]) return [prefs objectForKey:SPNullValue]; |