Skip to content
Browse files

Safety measure for prepareStringForQuery

  • Loading branch information...
1 parent e9b875d commit 09ff2b9727fa9feb3af39ce4bdc1c35555807c3f @barijaona barijaona committed Dec 8, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 3rdparty/SQLiteLib/SQLDatabase.m
View
8 3rdparty/SQLiteLib/SQLDatabase.m
@@ -122,6 +122,14 @@ + (NSString*)prepareStringForQuery:(NSString*)inString
NSRange range = NSMakeRange( 0, [inString length]);
NSRange subRange;
+ if([inString respondsToSelector:@selector(stringValue)]) {
+ inString = [(id)inString stringValue];
+ }
+ if((NSNull*)inString == [NSNull null]) {
+ inString = nil;
+ }
+ if(inString == nil) return nil; // just don't try.
+
subRange = [inString rangeOfString:@"'" options:NSLiteralSearch range:range];
if( subRange.location == NSNotFound )
return inString;

0 comments on commit 09ff2b9

Please sign in to comment.
Something went wrong with that request. Please try again.