aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPCopyTable.m6
-rw-r--r--Source/SPCustomQuery.m3
-rw-r--r--Source/SPTableContent.m45
3 files changed, 24 insertions, 30 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index e53e714a..9d014839 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -669,8 +669,12 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003;
// Retrieve the cell's content
contentString = [tableStorage cellDataAtRow:i column:columnIndex];
+ // TODO it's temporarily
+ if ([contentString isKindOfClass:[MCPGeometryData class]])
+ contentString = [contentString description];
+
// Replace NULLs with their placeholder string
- if ([contentString isNSNull]) {
+ else if ([contentString isNSNull]) {
contentString = [prefs objectForKey:SPNullValue];
// Same for cells for which loading has been deferred - likely blobs
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 5f658a1d..44ba5987 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1847,6 +1847,9 @@
if ([theValue isNSNull])
return [prefs objectForKey:SPNullValue];
+ if ([theValue isKindOfClass:[MCPGeometryData class]])
+ return [theValue description];
+
return theValue;
}
else {
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];