Просмотр исходного кода

Removed FMDatabaseSplitter, since it's no longer needed and cleaned up some code.

August Mueller 11 лет назад
Родитель
Сommit
598cbf67cc

+ 1 - 1
Tests/FMDatabaseTests.m

@@ -832,7 +832,7 @@ - (void)testApplicationID
 }
 #endif
 
-- (void)testBulkSQL
+- (void)testExecuteStatements
 {
     BOOL success;
 

+ 0 - 29
fmdb.xcodeproj/project.pbxproj

@@ -31,9 +31,6 @@
 		CC47A011148581E9002CCDAB /* FMDatabaseQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = CC47A00E148581E9002CCDAB /* FMDatabaseQueue.m */; };
 		CC50F2CD0DF9183600E4AAAE /* FMDatabaseAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CC50F2CB0DF9183600E4AAAE /* FMDatabaseAdditions.m */; };
 		CC7CE42818F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7CE42718F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.m */; };
-		CC7CE43118F5C05800938264 /* FMSQLStatementSplitter.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7CE42B18F5C05800938264 /* FMSQLStatementSplitter.m */; };
-		CC7CE43218F5C05800938264 /* FMStatementKeywordRecogniser.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7CE42D18F5C05800938264 /* FMStatementKeywordRecogniser.m */; };
-		CC7CE43318F5C05800938264 /* FMStatementQuotedRecogniser.m in Sources */ = {isa = PBXBuildFile; fileRef = CC7CE42F18F5C05800938264 /* FMStatementQuotedRecogniser.m */; };
 		CC9E4EB913B31188005F9210 /* FMDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = CC9E4EB813B31188005F9210 /* FMDatabasePool.m */; };
 		CC9E4EBA13B31188005F9210 /* FMDatabasePool.h in Headers */ = {isa = PBXBuildFile; fileRef = CC9E4EB713B31188005F9210 /* FMDatabasePool.h */; };
 		CC9E4EBB13B31188005F9210 /* FMDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = CC9E4EB813B31188005F9210 /* FMDatabasePool.m */; };
@@ -110,13 +107,6 @@
 		CC50F2CC0DF9183600E4AAAE /* FMDatabaseAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMDatabaseAdditions.h; path = src/fmdb/FMDatabaseAdditions.h; sourceTree = SOURCE_ROOT; };
 		CC7CE42618F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "FMDatabase+InMemoryOnDiskIO.h"; path = "src/extra/FMDatabase+InMemoryOnDiskIO.h"; sourceTree = "<group>"; };
 		CC7CE42718F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "FMDatabase+InMemoryOnDiskIO.m"; path = "src/extra/FMDatabase+InMemoryOnDiskIO.m"; sourceTree = "<group>"; };
-		CC7CE42A18F5C05800938264 /* FMSQLStatementSplitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMSQLStatementSplitter.h; sourceTree = "<group>"; };
-		CC7CE42B18F5C05800938264 /* FMSQLStatementSplitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMSQLStatementSplitter.m; sourceTree = "<group>"; };
-		CC7CE42C18F5C05800938264 /* FMStatementKeywordRecogniser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMStatementKeywordRecogniser.h; sourceTree = "<group>"; };
-		CC7CE42D18F5C05800938264 /* FMStatementKeywordRecogniser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMStatementKeywordRecogniser.m; sourceTree = "<group>"; };
-		CC7CE42E18F5C05800938264 /* FMStatementQuotedRecogniser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMStatementQuotedRecogniser.h; sourceTree = "<group>"; };
-		CC7CE42F18F5C05800938264 /* FMStatementQuotedRecogniser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMStatementQuotedRecogniser.m; sourceTree = "<group>"; };
-		CC7CE43018F5C05800938264 /* FMStatementTokenRecogniser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMStatementTokenRecogniser.h; sourceTree = "<group>"; };
 		CC8C138A0E3135C400FBE1E7 /* CHANGES_AND_TODO_LIST.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGES_AND_TODO_LIST.txt; sourceTree = "<group>"; };
 		CC8C138B0E3135C400FBE1E7 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
 		CC8C138C0E3135C400FBE1E7 /* CONTRIBUTORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CONTRIBUTORS.txt; sourceTree = "<group>"; };
@@ -294,28 +284,12 @@
 		CC7CE42518F5C02E00938264 /* optional extras */ = {
 			isa = PBXGroup;
 			children = (
-				CC7CE42918F5C05800938264 /* FMStatementSplitter */,
 				CC7CE42618F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.h */,
 				CC7CE42718F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.m */,
 			);
 			name = "optional extras";
 			sourceTree = "<group>";
 		};
-		CC7CE42918F5C05800938264 /* FMStatementSplitter */ = {
-			isa = PBXGroup;
-			children = (
-				CC7CE42A18F5C05800938264 /* FMSQLStatementSplitter.h */,
-				CC7CE42B18F5C05800938264 /* FMSQLStatementSplitter.m */,
-				CC7CE42C18F5C05800938264 /* FMStatementKeywordRecogniser.h */,
-				CC7CE42D18F5C05800938264 /* FMStatementKeywordRecogniser.m */,
-				CC7CE42E18F5C05800938264 /* FMStatementQuotedRecogniser.h */,
-				CC7CE42F18F5C05800938264 /* FMStatementQuotedRecogniser.m */,
-				CC7CE43018F5C05800938264 /* FMStatementTokenRecogniser.h */,
-			);
-			name = FMStatementSplitter;
-			path = src/extra/FMStatementSplitter;
-			sourceTree = "<group>";
-		};
 /* End PBXGroup section */
 
 /* Begin PBXHeadersBuildPhase section */
@@ -470,11 +444,8 @@
 			buildActionMask = 2147483647;
 			files = (
 				CCC24EC20A13E34D00A6D3E3 /* FMDatabase.m in Sources */,
-				CC7CE43218F5C05800938264 /* FMStatementKeywordRecogniser.m in Sources */,
 				CCC24EC50A13E34D00A6D3E3 /* main.m in Sources */,
-				CC7CE43118F5C05800938264 /* FMSQLStatementSplitter.m in Sources */,
 				CCC24EC70A13E34D00A6D3E3 /* FMResultSet.m in Sources */,
-				CC7CE43318F5C05800938264 /* FMStatementQuotedRecogniser.m in Sources */,
 				CC7CE42818F5C04600938264 /* FMDatabase+InMemoryOnDiskIO.m in Sources */,
 				CC50F2CD0DF9183600E4AAAE /* FMDatabaseAdditions.m in Sources */,
 				CC9E4EB913B31188005F9210 /* FMDatabasePool.m in Sources */,

+ 0 - 40
src/extra/FMStatementSplitter/FMSQLStatementSplitter.h

@@ -1,40 +0,0 @@
-//
-//  FMSQLStatementSplitter.h
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-/**
- * The FMSplittedStatement class contains a separated statement.
- */
-@interface FMSplittedStatement : NSObject
-
-/**
- * Separated statement string.
- */
-@property (nonatomic, retain) NSString *statementString;//statement string
-@end
-
-@interface FMSQLStatementSplitter : NSObject
-
-/**
- * Get singleton instance.
- */
-+ (instancetype)sharedInstance;
-
-/**
- * Split batch sql statement into separated statements.
- *
- * @param batchStatement The batch statement string to split.
- *
- * @return Returns the array of splitted statements. Each member of return value is an `FMSplittedStatement`.
- *
- * @see FMSplittedStatement
- */
-- (NSArray *)statementsFromBatchSqlStatement:(NSString *)batchStatement;
-
-@end

+ 0 - 186
src/extra/FMStatementSplitter/FMSQLStatementSplitter.m

@@ -1,186 +0,0 @@
-//
-//  FMSQLStatementSplitter.m
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import "FMSQLStatementSplitter.h"
-#import "FMStatementKeywordRecogniser.h"
-#import "FMStatementQuotedRecogniser.h"
-#import "FMDatabase.h"
-
-@implementation FMSplittedStatement
-
-- (NSString *)description
-{
-    NSString *description = [super description];
-    description = [description stringByAppendingFormat:@" %@", self.statementString];
-    return description;
-}
-
-@end
-
-@implementation FMSQLStatementSplitter
-{
-    NSMutableArray *_tokenRecognisers;
-}
-
-- (id)init
-{
-    self = [super init];
-    if (self)
-    {
-        _tokenRecognisers = [NSMutableArray array];
-        FMDBRetain(_tokenRecognisers);
-        
-        //' quote
-        FMStatementQuotedRecogniser *singleQuoteRecogniser = nil;
-        singleQuoteRecogniser = [FMStatementQuotedRecogniser quotedRecogniserWithStartQuote:@"'"
-                                                                         endQuote:@"'"
-                                                                   escapeSequence:@"\\"
-                                                                             name:@"SingleQuote"];
-        singleQuoteRecogniser.shouldQuoteEscapeSequence = YES;
-        [_tokenRecognisers addObject:singleQuoteRecogniser];
-        
-        //" quote
-        FMStatementQuotedRecogniser *doubleQuoteRecogniser = nil;
-        doubleQuoteRecogniser = [FMStatementQuotedRecogniser quotedRecogniserWithStartQuote:@"\""
-                                                                     endQuote:@"\""
-                                                               escapeSequence:@"\\"
-                                                                         name:@"DoubleQuote"];
-        
-        doubleQuoteRecogniser.shouldQuoteEscapeSequence = NO;
-        [_tokenRecognisers addObject:doubleQuoteRecogniser];
-        
-        //` quote
-        FMStatementQuotedRecogniser *sqlashQuoteRecogniser = nil;
-        sqlashQuoteRecogniser = [FMStatementQuotedRecogniser quotedRecogniserWithStartQuote:@"`"
-                                                                          endQuote:@"`"
-                                                                    escapeSequence:@"\\"
-                                                                              name:@"SqlashQuote"];
-        sqlashQuoteRecogniser.shouldQuoteEscapeSequence = NO;
-        [_tokenRecognisers addObject:sqlashQuoteRecogniser];
-        
-        //; recognizer
-        NSArray *operatorKeywords = @[@";"];
-        [_tokenRecognisers addObject:[FMStatementKeywordRecogniser recogniserForKeywords:operatorKeywords]];
-    }
-    return self;
-}
-
-- (void)dealloc
-{
-    FMDBRelease(_tokenRecognisers);
-#if ! __has_feature(objc_arc)
-    [super dealloc];
-#endif
-}
-
-+ (instancetype)sharedInstance
-{
-    static id instance;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        instance = [[self alloc] init];
-    });
-    return instance;
-}
-
-
-- (NSArray *)statementsFromBatchSqlStatement:(NSString *)input;
-{
-    NSUInteger currentTokenOffset = 0;
-    NSUInteger inputLength = [input length];
-    NSArray *recs = _tokenRecognisers;
-    NSScanner *scanner = [NSScanner scannerWithString:input];
-
-    NSMutableArray *resultArray = [NSMutableArray array];
-    NSUInteger lastSplitterLocation = 0;
-
-    while (currentTokenOffset < inputLength)
-    {
-        @autoreleasepool
-        {
-            BOOL recognised = NO;
-            for (NSUInteger i = 0; i < recs.count; i++)
-            {
-                id<FMStatementTokenRecogniser> recogniser = recs[i];
-                NSRange range = [recogniser recogniseRangeWithScanner:scanner currentTokenPosition:&currentTokenOffset];
-                if (NSNotFound != range.location)
-                {
-                    if (i == 3)//Recognised ; keyword
-                    {
-                        FMSplittedStatement *statement = [[FMSplittedStatement alloc] init];
-                        statement.statementString = [input substringWithRange:NSMakeRange(lastSplitterLocation, currentTokenOffset - lastSplitterLocation)];
-                        lastSplitterLocation = currentTokenOffset;
-                        [resultArray addObject:statement];
-                        FMDBRelease(statement);
-                   }
-                    recognised = YES;
-                    break;
-                }
-            }
-            
-            if (!recognised)
-            {
-                currentTokenOffset ++;
-            }
-            
-            if (currentTokenOffset == inputLength && lastSplitterLocation != inputLength)
-                //input comes to end, put all string remaining to the last statement
-            {
-                FMSplittedStatement *statement = [[FMSplittedStatement alloc] init];
-                statement.statementString = [input substringWithRange:NSMakeRange(lastSplitterLocation, currentTokenOffset - lastSplitterLocation)];
-                lastSplitterLocation = currentTokenOffset;
-                [resultArray addObject:statement];
-                FMDBRelease(statement);
-            }
-        }
-    }
-    
-    return [NSArray arrayWithArray:resultArray];
-}
-
-+ (void)test
-{
-    NSArray *statementStringArray = @[
-    @"SELECT TABLE IF EXISTS ';' `web_offline_track`;",
-    @"select TABLE IF NOT EXISTS \";\" `web_offline_track` (`id` VARCHAR(40) NOT NULL, `type` INT NULL, `type_extra` BIGINT NULL, `track_id` BIGINT NULL, `detail` TEXT NULL, `size` INT NULL, `dfsid` BIGINT NULL, `bitrate` INT NULL, `state` INT NULL, `download_time` INT NULL, `complete_time` INT NULL, `sou;rce_href` TEXT NULL, `source_text` TEXT NULL, `source_extra` TEXT NULL, `album_id` VARCHAR(40) NULL, `relative_path` TEXT NULL, `track_name` TEXT NULL, `artist_name` TEXT NULL, `album_name` TEXT NULL, PRIMARY KEY (`id`));",
-    @"create TABLE select IF EXISTS `web_playl;ist_order`;",
-    @"select TABLE IF NOT EXISTS `web_playlist_order` (`playlist_id` BIGINT NOT NULL, `field` VARCHAR(40) NULL, `order` VARCHAR(40) NULL, PRIMARY KEY select (`playlist_SELECTid`));",
-    @"'\\\\';",
-    @"'blah blah"];
-    
-    NSMutableString *batchStatement = [NSMutableString string];
-    for (NSString *str in statementStringArray)
-    {
-        [batchStatement appendString:str];
-    }
-    
-    //Result
-    NSArray *statements = [[FMSQLStatementSplitter sharedInstance] statementsFromBatchSqlStatement:batchStatement];
-    NSLog(@"%@ test with parsed result: %@",[super description], statements);
-    
-    //counts
-    NSLog(@"statement count :%lu expected %lu.",
-          (unsigned long)statements.count,
-          (unsigned long)statementStringArray.count);
-    
-    //single statement
-    for (NSUInteger i = 0; i<statementStringArray.count && i<statements.count; i++)
-    {
-        NSString *originalString = statementStringArray[i];
-        FMSplittedStatement *statement = statements[i];
-        NSLog(@"statement check successed : %d", [originalString isEqualToString:statement.statementString]);
-    }
-}
-
-//+ (void)load
-//{
-//    [super load];
-//    [self test];
-//}
-
-@end

+ 0 - 97
src/extra/FMStatementSplitter/FMStatementKeywordRecogniser.h

@@ -1,97 +0,0 @@
-//
-//  FMStatementKeywordRecogniser.h
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#import "FMStatementTokenRecogniser.h"
-
-/**
- * The FMStatementKeywordRecogniser class attempts to recognise a specific keyword in a token stream.
- * 
- * A keyword recogniser attempts to recognise a specific word or set of symbols.
- * Keyword recognisers can also check that the keyword is not followed by specific characters in order to stop it recognising the beginnings of words.
- */
-@interface FMStatementKeywordRecogniser : NSObject <FMStatementTokenRecogniser>
-
-///---------------------------------------------------------------------------------------
-/// @name Creating and Initialising a Keyword Recogniser
-///---------------------------------------------------------------------------------------
-
-/**
- * Creates a Keyword Recogniser for a specific keyword.
- * 
- * @param keyword The keyword to recognise.
- *
- * @return Returns a keyword recogniser for the passed keyword.
- *
- * @see initWithKeyword:
- * @see recogniserForKeyword:invalidFollowingCharacters:
- */
-+ (id)recogniserForKeyword:(NSString *)keyword;
-
-+ (id)recogniserForKeywords:(NSArray *)keywords;
-
-/**
- * Creates a Keyword Recogniser for a specific keyword.
- * 
- * @param keyword The keyword to recognise.
- * @param invalidFollowingCharacters A set of characters that may not follow the keyword in the string being tokenised.
- *
- * @return Returns a keyword recogniser for the passed keyword.
- *
- * @see recogniserForKeyword:
- * @see initWithKeyword:invalidFollowingCharacters:
- */
-+ (id)recogniserForKeyword:(NSString *)keyword invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters;
-
-+ (id)recogniserForKeywords:(NSArray *)keywords invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters;
-
-/**
- * Initialises a Keyword Recogniser to recognise a specific keyword.
- * 
- * @param keyword The keyword to recognise.
- *
- * @return Returns the keyword recogniser initialised to recognise the passed keyword.
- *
- * @see recogniserForKeyword:
- * @see initWithKeyword:invalidFollowingCharacters:
- */
-- (id)initWithKeyword:(NSString *)keyword;
-
-- (id)initWithKeywords:(NSArray *)keywords;
-
-/**
- * Initialises a Keyword Recogniser to recognise a specific keyword.
- * 
- * @param keyword The keyword to recognise.
- * @param invalidFollowingCharacters A set of characters that may not follow the keyword in the string being tokenised.
- *
- * @return Returns the keyword recogniser initialised to recognise the passed keyword.
- *
- * @see initWithKeyword:
- * @see recogniserForKeyword:invalidFollowingCharacters:
- */
-- (id)initWithKeyword:(NSString *)keyword invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters;
-
-- (id)initWithKeywords:(NSArray *)keywords invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters;
-
-///---------------------------------------------------------------------------------------
-/// @name Configuring a Keyword Recogniser
-///---------------------------------------------------------------------------------------
-
-/**
- * The keyword that the recogniser should attempt to recognise.
- */
-@property (readwrite,retain,nonatomic) NSArray *keywords;
-
-/**
- * A set of characters that may not follow the keyword.
- */
-@property (readwrite,retain,nonatomic) NSCharacterSet *invalidFollowingCharacters;
-
-@end

+ 0 - 118
src/extra/FMStatementSplitter/FMStatementKeywordRecogniser.m

@@ -1,118 +0,0 @@
-//
-//  FMStatementKeywordRecogniser.m
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import "FMStatementKeywordRecogniser.h"
-#import "FMDatabase.h"
-
-@implementation FMStatementKeywordRecogniser
-
-@synthesize keywords = _keywords;
-@synthesize invalidFollowingCharacters = _invalidFollowingCharacters;
-
-+ (id)recogniserForKeyword:(NSString *)keyword
-{
-    return [self recogniserForKeywords:@[keyword]];
-}
-
-+ (id)recogniserForKeywords:(NSArray *)keywords
-{
-    return FMDBReturnAutoreleased([[self alloc] initWithKeywords:keywords]);
-}
-
-- (id)initWithKeyword:(NSString *)keyword
-{
-    return [self initWithKeywords:@[keyword]];
-}
-
-- (id)initWithKeywords:(NSArray *)keywords
-{
-    return [self initWithKeywords:keywords invalidFollowingCharacters:nil];
-}
-
-+ (id)recogniserForKeyword:(NSString *)keyword invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters
-{
-    return [self recogniserForKeywords:@[keyword]
-            invalidFollowingCharacters:invalidFollowingCharacters];
-}
-
-+ (id)recogniserForKeywords:(NSArray *)keywords invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters
-{
-    return FMDBReturnAutoreleased([[self alloc] initWithKeywords:keywords invalidFollowingCharacters:invalidFollowingCharacters]);
-}
-
-- (id)initWithKeyword:(NSString *)keyword invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters
-{
-    return [self initWithKeywords:@[keyword] invalidFollowingCharacters:invalidFollowingCharacters];
-}
-
-- (id)initWithKeywords:(NSArray *)keywords invalidFollowingCharacters:(NSCharacterSet *)invalidFollowingCharacters
-{
-    self = [super init];
-    
-    if (nil != self)
-    {
-        self.keywords = keywords;
-        [self setInvalidFollowingCharacters:invalidFollowingCharacters];
-    }
-    
-    return self;
-}
-
-- (id)init
-{
-    return [self initWithKeyword:@" "];
-}
-
-#define CPKeywordRecogniserKeywordKey @"K.k"
-#define CPKeywordRecogniserInvalidFollowingCharactersKey @"K.f"
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super init];
-    
-    if (nil != self)
-    {
-        [self setKeywords:[aDecoder decodeObjectForKey:CPKeywordRecogniserKeywordKey]];
-        [self setInvalidFollowingCharacters:[aDecoder decodeObjectForKey:CPKeywordRecogniserInvalidFollowingCharactersKey]];
-    }
-    
-    return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)aCoder
-{
-    [aCoder encodeObject:[self keywords] forKey:CPKeywordRecogniserKeywordKey];
-    [aCoder encodeObject:[self invalidFollowingCharacters] forKey:CPKeywordRecogniserInvalidFollowingCharactersKey];
-}
-
-- (NSRange)recogniseRangeWithScanner:(NSScanner *)scanner currentTokenPosition:(NSUInteger *)tokenPosition
-{
-    for (NSString *keyword in self.keywords)
-    {
-        NSUInteger kwLength = [keyword length];
-        NSUInteger remainingChars = [[scanner string] length] - *tokenPosition;
-        if (remainingChars >= kwLength)
-        {
-            if (CFStringFindWithOptions((CFStringRef)[scanner string], (CFStringRef)keyword, CFRangeMake((CFIndex)*tokenPosition, (CFIndex)kwLength), kCFCompareAnchored | kCFCompareCaseInsensitive, NULL))
-            {
-                if (remainingChars == kwLength ||
-                    nil == self.invalidFollowingCharacters ||
-                    !CFStringFindCharacterFromSet((CFStringRef)[scanner string], (CFCharacterSetRef)self.invalidFollowingCharacters, CFRangeMake((CFIndex)(*tokenPosition + kwLength), 1), kCFCompareAnchored, NULL))
-                {
-                    NSRange result = NSMakeRange(*tokenPosition, kwLength);
-                    *tokenPosition = *tokenPosition + kwLength;
-                    return result;
-                }
-            }
-        }
-    }
-    
-    return NSMakeRange(NSNotFound, 0);
-}
-
-@end

+ 0 - 130
src/extra/FMStatementSplitter/FMStatementQuotedRecogniser.h

@@ -1,130 +0,0 @@
-//
-//  FMStatementQuotedRecogniser.h
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#import "FMStatementTokenRecogniser.h"
-
-/**
- * The FMStatementQuotedRecogniser class is used to recognise quoted literals in the input string.  This can be used for quoted strings, characters, comments and many other things.
- * 
- * Quoted tokens are recognised via a start string and end string.  You may optionally add an escape sequence string that stops the end quote being recognised at that point in the input.
- * You may optionally provide a block used to replace escape sequences with their actual meaning.  If you don't provide an escape replcement block it is assumed that the character
- * following the escape sequence replaces the whole sequence.
- *
- * Finally, you may also provide a maximum length for the quoted sequence to recognise.  If you want to recognise strings of any length, pass NSNotFound.
- */
-@interface FMStatementQuotedRecogniser : NSObject <FMStatementTokenRecogniser>
-
-///---------------------------------------------------------------------------------------
-/// @name Creating and Initialising a Quoted Recogniser
-///---------------------------------------------------------------------------------------
-
-/**
- * Creates a quoted recogniser that recognises quoted litterals starting with startQuote and ending with endQuote.
- *
- * @param startQuote A string that indicates the beginning of a quoted literal.
- * @param endQuote   A string that indicates the end of the quoted literal.
- * @param name       The name to attach to recognised tokens.
- * @return Returns a FMStatementQuotedRecogniser that recognises C like identifiers.
- *
- * @see quotedRecogniserWithStartQuote:endQuote:escapeSequence:name:
- * @see quotedRecogniserWithStartQuote:endQuote:escapeSequence:maximumLength:name:
- */
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote name:(NSString *)name;
-
-/**
- * Creates a quoted recogniser that recognises quoted litterals starting with startQuote and ending with endQuote.  Escaped sequences are recognised by the escapeSequence string.
- *
- * @param startQuote     A string that indicates the beginning of a quoted literal.
- * @param endQuote       A string that indicates the end of the quoted literal.
- * @param escapeSequence A string that indicates an escaped character.
- * @param name           The name to attach to recognised tokens.
- * @return Returns a FMStatementQuotedRecogniser that recognises C like identifiers.
- *
- * @see quotedRecogniserWithStartQuote:endQuote:name:
- * @see quotedRecogniserWithStartQuote:endQuote:escapeSequence:maximumLength:name:
- */
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote escapeSequence:(NSString *)escapeSequence name:(NSString *)name;
-
-/**
- * Creates a quoted recogniser that recognises quoted litterals starting with startQuote and ending with endQuote.  Escaped sequences are recognised by the escapeSequence string.  Quoted strings have a maximum length.
- *
- * @param startQuote     A string that indicates the beginning of a quoted literal.
- * @param endQuote       A string that indicates the end of the quoted literal.
- * @param escapeSequence A string that indicates an escaped character.
- * @param maximumLength  The maximum length of the resulting string.
- * @param name           The name to attach to recognised tokens.
- * @return Returns a FMStatementQuotedRecogniser that recognises C like identifiers.
- *
- * @see quotedRecogniserWithStartQuote:endQuote:name:
- * @see quotedRecogniserWithStartQuote:endQuote:escapeSequence:name:
- * @see initWithStartQuote:endQuote:escapeSequence:maximumLength:name:
- */
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote escapeSequence:(NSString *)escapeSequence maximumLength:(NSUInteger)maximumLength name:(NSString *)name;
-
-/**
- * Initialises a quoted recogniser that recognises quoted litterals starting with startQuote and ending with endQuote.  Escaped sequences are recognised by the escapeSequence string.  Quoted strings have a maximum length.
- *
- * @param startQuote     A string that indicates the beginning of a quoted literal.
- * @param endQuote       A string that indicates the end of the quoted literal.
- * @param escapeSequence A string that indicates an escaped character.
- * @param maximumLength  The maximum length of the resulting string.
- * @param name           The name to attach to recognised tokens.
- * @return Returns a FMStatementQuotedRecogniser that recognises C like identifiers.
- *
- * @see quotedRecogniserWithStartQuote:endQuote:escapeSequence:maximumLength:name:
- */
-- (id)initWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote escapeSequence:(NSString *)escapeSequence maximumLength:(NSUInteger)maximumLength name:(NSString *)name;
-
-///---------------------------------------------------------------------------------------
-/// @name Configuring a Quoted Recogniser
-///---------------------------------------------------------------------------------------
-
-/**
- * Determines the string used to indicate the start of the quoted literal.
- *
- * @see endQuote
- */
-@property (readwrite,nonatomic,copy) NSString *startQuote;
-
-/**
- * Determines the string used to indicate the end of the quoted literal.
- *
- * @see startQuote
- */
-@property (readwrite,nonatomic,copy) NSString *endQuote;
-
-/**
- * Determines the string used to indicate an escaped character in the quoted literal.
- */
-@property (readwrite,nonatomic,copy) NSString *escapeSequence;
-
-/**
- * If `YES`, quoted string will contains `escapeSequence`.
- * If `NO`, quoted string will not contains `escapeSequence`.
- * Default is `NO`.
- */
-@property (nonatomic,assign) BOOL shouldQuoteEscapeSequence;
-
-/**
- * Determines how much of the input string to consume when an escaped literal is found, and what to replace it with.
- */
-@property (readwrite,nonatomic,copy) NSString *(^escapeReplacer)(NSString *tokenStream, NSUInteger *quotePosition);
-
-/**
- * Determines the maximum length of the quoted literal not including quotes.  To indicate the literal can be any length specify NSNotFound.
- */
-@property (readwrite,nonatomic,assign) NSUInteger maximumLength;
-
-/**
- * Determines the name of the token produced.
- */
-@property (readwrite,nonatomic,copy) NSString *name;
-
-@end

+ 0 - 137
src/extra/FMStatementSplitter/FMStatementQuotedRecogniser.m

@@ -1,137 +0,0 @@
-//
-//  FMStatementQuotedRecogniser.m
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import "FMStatementQuotedRecogniser.h"
-#import "FMDatabase.h"
-
-@implementation FMStatementQuotedRecogniser
-
-@synthesize startQuote = _startQuote;
-@synthesize endQuote = _endQuote;
-@synthesize escapeSequence = _escapeSequence;
-@synthesize escapeReplacer = _escapeReplacer;
-@synthesize maximumLength = _maximumLength;
-@synthesize name = _name;
-
-+ (NSUInteger)minWithLeftParam:(NSUInteger)left rightParam:(NSUInteger)right
-{
-    return (left < right ? left : right);
-}
-
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote name:(NSString *)name
-{
-    return [FMStatementQuotedRecogniser quotedRecogniserWithStartQuote:startQuote endQuote:endQuote escapeSequence:nil name:name];
-}
-
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote escapeSequence:(NSString *)escapeSequence name:(NSString *)name
-{
-    return [FMStatementQuotedRecogniser quotedRecogniserWithStartQuote:startQuote endQuote:endQuote escapeSequence:escapeSequence maximumLength:NSNotFound name:name];
-}
-
-+ (id)quotedRecogniserWithStartQuote:(NSString *)startQuote endQuote:(NSString *)endQuote escapeSequence:(NSString *)escapeSequence maximumLength:(NSUInteger)maximumLength name:(NSString *)name
-{
-    return FMDBReturnAutoreleased([[FMStatementQuotedRecogniser alloc] initWithStartQuote:startQuote endQuote:endQuote escapeSequence:escapeSequence maximumLength:maximumLength name:name]);
-}
-
-- (id)initWithStartQuote:(NSString *)initStartQuote endQuote:(NSString *)initEndQuote escapeSequence:(NSString *)initEscapeSequence maximumLength:(NSUInteger)initMaximumLength name:(NSString *)initName
-{
-    self = [super init];
-    
-    if (nil != self)
-    {
-        [self setStartQuote:initStartQuote];
-        [self setEndQuote:initEndQuote];
-        [self setEscapeSequence:initEscapeSequence];
-        [self setMaximumLength:initMaximumLength];
-        [self setName:initName];
-    }
-    
-    return self;
-}
-
-- (NSRange)recogniseRangeWithScanner:(NSScanner *)scanner currentTokenPosition:(NSUInteger *)tokenPosition
-{
-    NSString *(^er)(NSString *tokenStream, NSUInteger *quotePosition) = [self escapeReplacer];
-    NSUInteger startQuoteLength = [self.startQuote length];
-    NSUInteger endQuoteLength = [self.endQuote length];
-    NSString *tokenString = [scanner string];
-
-    NSUInteger inputLength = [tokenString length];
-    NSUInteger rangeLength = [FMStatementQuotedRecogniser minWithLeftParam:inputLength - *tokenPosition
-                                                                rightParam:startQuoteLength + endQuoteLength + self.maximumLength];
-    CFRange searchRange = CFRangeMake((CFIndex)*tokenPosition, (CFIndex)rangeLength);
-    CFRange range;
-    Boolean matched = CFStringFindWithOptions((CFStringRef)tokenString, (CFStringRef)self.startQuote, searchRange, kCFCompareAnchored, &range);
-    
-    CFMutableStringRef outputString = CFStringCreateMutable(kCFAllocatorDefault, 0);
-    
-    if (matched)
-    {
-        searchRange.location = searchRange.location + range.length;
-        searchRange.length   = searchRange.length   - range.length;
-        
-        CFRange endRange;
-        CFRange escapeRange;
-        Boolean matchedEndSequence = CFStringFindWithOptions((CFStringRef)tokenString, (CFStringRef)self.endQuote, searchRange, 0L, &endRange);
-        Boolean matchedEscapeSequence = nil == self.escapeSequence ? NO : CFStringFindWithOptions((CFStringRef)tokenString, (CFStringRef)self.escapeSequence, searchRange, 0L, &escapeRange);
-        
-        while (matchedEndSequence && (NSUInteger)searchRange.location < inputLength)
-        {
-            if (!matchedEscapeSequence || endRange.location < escapeRange.location)//End quote is not escaped by escape sequence.
-            {
-                NSUInteger resultRangeBegin = *tokenPosition;
-                *tokenPosition = (NSUInteger)(endRange.location + endRange.length);
-                NSUInteger resultRangeLength = *tokenPosition - resultRangeBegin;
-                CFRelease(outputString);
-                return NSMakeRange(resultRangeBegin, resultRangeLength);
-            }
-            else//End quote is escaped by escape sequence
-            {
-                NSUInteger quotedPosition = (NSUInteger)(escapeRange.location + escapeRange.length);
-                CFRange subStrRange = CFRangeMake(searchRange.location,
-                                                  escapeRange.location + (self.shouldQuoteEscapeSequence ? escapeRange.length : 0) - searchRange.location);
-                CFStringRef substr = CFStringCreateWithSubstring(kCFAllocatorDefault, (CFStringRef)tokenString, subStrRange);
-                CFStringAppend(outputString, substr);
-                CFRelease(substr);
-                BOOL appended = NO;
-                if (nil != er)
-                {
-                    NSString *s = er(tokenString, &quotedPosition);
-                    if (nil != s)
-                    {
-                        appended = YES;
-                        CFStringAppend(outputString, (CFStringRef)s);
-                    }
-                }
-                if (!appended)
-                {
-                    substr = CFStringCreateWithSubstring(kCFAllocatorDefault, (CFStringRef)tokenString, CFRangeMake(escapeRange.location + escapeRange.length, 1));
-                    CFStringAppend(outputString, substr);
-                    CFRelease(substr);
-                    quotedPosition += 1;
-                }
-                searchRange.length   = searchRange.location + searchRange.length - (CFIndex)quotedPosition;
-                searchRange.location = (CFIndex)quotedPosition;
-                
-                if (endRange.location < searchRange.location)
-                {
-                    matchedEndSequence = CFStringFindWithOptions((CFStringRef)tokenString, (CFStringRef)self.endQuote, searchRange, 0L, &endRange);
-                }
-                if (escapeRange.location < searchRange.location)
-                {
-                    matchedEscapeSequence = CFStringFindWithOptions((CFStringRef)tokenString, (CFStringRef)self.escapeSequence, searchRange, 0L, &escapeRange);
-                }
-            }
-        }
-    }
-    
-    CFRelease(outputString);
-    return NSMakeRange(NSNotFound, 0);
-}
-
-@end

+ 0 - 26
src/extra/FMStatementSplitter/FMStatementTokenRecogniser.h

@@ -1,26 +0,0 @@
-//
-//  FMStatementTokenRecogniser.h
-//  FMDB
-//
-//  Created by openthread on 3/5/14.
-//  Copyright (c) 2014 openthread. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-/**
- * The FMStatementTokenRecogniser protocol.
- */
-@protocol FMStatementTokenRecogniser <NSObject>
-
-@required
-/**
- * Recognise token with a scanner.
- * @param scanner The recognising scanner.
- * @param tokenPosition Begining token position to recognise of scanner.
- *
- * @return Returns the recognised token range of scanner. If not recognised, the location of return value is `NSNotFound`.
- */
-- (NSRange)recogniseRangeWithScanner:(NSScanner *)scanner currentTokenPosition:(NSUInteger *)tokenPosition;
-
-@end

+ 1 - 1
src/fmdb/FMDatabaseQueue.m

@@ -17,7 +17,7 @@
  
  */
 
-/**
+/*
  * A key used to associate the FMDatabaseQueue object with the dispatch_queue_t it uses.
  * This in turn is used for deadlock detection by seeing if inDatabase: is called on
  * the queue's dispatch queue, which should not happen and causes a deadlock.

+ 0 - 36
src/sample/main.m

@@ -5,7 +5,6 @@
 
 #import <Foundation/Foundation.h>
 #import "FMDB.h"
-#import "FMSQLStatementSplitter.h"
 
 #define FMDBQuickCheck(SomeBool) { if (!(SomeBool)) { NSLog(@"Failure on line %d", __LINE__); abort(); } }
 
@@ -1078,41 +1077,6 @@ int main (int argc, const char * argv[]) {
         
     }];
     
-    //Example for splitting batch statement
-    {
-        NSArray *batchStringArray = @[@"insert into ftest values ('hello;');",
-                                      @"insert into ftest values ('hi;');",
-                                      @"insert into ftest values ('not h!\\\\');",
-                                      @"insert into ftest values ('definitely not h!')"];
-        NSMutableString *batchStatement = [NSMutableString string];
-        for (NSString *str in batchStringArray)
-        {
-            [batchStatement appendString:str];
-        }
-        NSArray *statements = [[FMSQLStatementSplitter sharedInstance] statementsFromBatchSqlStatement:batchStatement];
-        NSLog(@"Number of sqlitted statements is %lu (should be %lu)", (unsigned long)statements.count, (unsigned long)batchStringArray.count);
-        
-        if (statements.count == batchStringArray.count)
-        {
-            for (NSUInteger splittedIndex = 0; splittedIndex < statements.count; splittedIndex++)
-            {
-                NSString *originalStatement = batchStringArray[splittedIndex];
-                NSString *splittedStatement = ((FMSplittedStatement *)statements[splittedIndex]).statementString;
-                if (![originalStatement isEqualToString:splittedStatement])
-                {
-                    NSLog(@"Splitter failed! Original batch string is %@", batchStatement);
-                }
-            }
-        }
-        
-        [queue inDatabase:^(FMDatabase *adb) {
-            for (FMSplittedStatement *sqlittedStatement in statements)
-            {
-                [adb executeUpdate:sqlittedStatement.statementString];
-            }
-        }];
-    }
-    
     NSLog(@"That was version %@ of sqlite", [FMDatabase sqliteLibVersion]);