diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-10-10 08:48:54 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-10-10 08:48:54 +0000 |
commit | 9ea6eae511d5f5bccb36ae5c31e961635ce2cc33 (patch) | |
tree | 41c1c4c8f63cc584bc0cf44a1a3215d062447d74 | |
parent | 31a31c1fb9d46e9c6db1c836e03314b0b534194c (diff) | |
download | sequelpro-9ea6eae511d5f5bccb36ae5c31e961635ce2cc33.tar.gz sequelpro-9ea6eae511d5f5bccb36ae5c31e961635ce2cc33.tar.bz2 sequelpro-9ea6eae511d5f5bccb36ae5c31e961635ce2cc33.zip |
• fixed issue of unnecessary string escaping for importing spatial data via GeomFromText()
• minor code cosmetics
-rw-r--r-- | Source/SPCustomQuery.m | 2 | ||||
-rw-r--r-- | Source/SPDataImport.m | 2 | ||||
-rw-r--r-- | Source/SPStringAdditions.h | 2 | ||||
-rw-r--r-- | Source/SPStringAdditions.m | 2 | ||||
-rw-r--r-- | Source/SPTableContent.m | 4 |
5 files changed, 6 insertions, 6 deletions
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"] |