From 9ea6eae511d5f5bccb36ae5c31e961635ce2cc33 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sun, 10 Oct 2010 08:48:54 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20issue=20of=20unnecessary=20string?= =?UTF-8?q?=20escaping=20for=20importing=20spatial=20data=20via=20GeomFrom?= =?UTF-8?q?Text()=20=E2=80=A2=20minor=20code=20cosmetics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCustomQuery.m | 2 +- Source/SPDataImport.m | 2 +- Source/SPStringAdditions.h | 2 +- Source/SPStringAdditions.m | 2 +- Source/SPTableContent.m | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 3938a72f..5fdfd026 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1907,7 +1907,7 @@ } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) { newObject = @"NULL"; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) { - newObject = [(NSString*)anObject getGeomFromTextFromString]; + newObject = [(NSString*)anObject getGeomFromTextString]; } 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"] diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 98cbb697..32d00382 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -1358,7 +1358,7 @@ } else { // Apply GeomFromText() for each geometry field if([geometryFields count] && [geometryFieldsMapIndex containsIndex:i]) { - [valueString appendString:[mySQLConnection prepareString:[(NSString*)cellData getGeomFromTextFromString]]]; + [valueString appendString:[(NSString*)cellData getGeomFromTextString]]; } else { [valueString appendFormat:@"'%@'", [mySQLConnection prepareString:cellData]]; } diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h index 260f44d9..fd30a50b 100644 --- a/Source/SPStringAdditions.h +++ b/Source/SPStringAdditions.h @@ -67,7 +67,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS - (NSArray *)lineRangesForRange:(NSRange)aRange; - (NSString *)createViewSyntaxPrettifier; -- (NSString*)getGeomFromTextFromString; +- (NSString*)getGeomFromTextString; - (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)charSet options:(NSUInteger)mask; - (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)charSet; diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index a8695dbb..ea603cbc 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -377,7 +377,7 @@ /** * Create the GeomFromText() string according to a possible SRID value */ -- (NSString*)getGeomFromTextFromString +- (NSString*)getGeomFromTextString { NSString *geomStr = [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 027f86a3..f6174366 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2393,7 +2393,7 @@ [rowValue setString:@"CURRENT_TIMESTAMP"]; } else if ( [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"typegrouping"] isEqualToString:@"geometry"] ) { - [rowValue setString:([rowObject isKindOfClass:[MCPGeometryData class]]) ? [[rowObject wktString] getGeomFromTextFromString] : [(NSString*)rowObject getGeomFromTextFromString]]; + [rowValue setString:([rowObject isKindOfClass:[MCPGeometryData class]]) ? [[rowObject wktString] getGeomFromTextString] : [(NSString*)rowObject getGeomFromTextString]]; // 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:@""]) ) { @@ -3566,7 +3566,7 @@ } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) { newObject = @"NULL"; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) { - newObject = [(NSString*)anObject getGeomFromTextFromString]; + newObject = [(NSString*)anObject getGeomFromTextString]; } 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