├── FMDBMigrationManager ├── FMDBMigrationManager.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── alan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── alan.xcuserdatad │ │ └── xcschemes │ │ └── FMDBMigrationManager.xcscheme ├── FMDBMigrationManager.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── alan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── FMDBMigrationManager │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── Migration.h │ ├── Migration.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── FMDBMigrationManagerTests │ ├── FMDBMigrationManagerTests.m │ └── Info.plist ├── FMDBMigrationManagerUITests │ ├── FMDBMigrationManagerUITests.m │ └── Info.plist ├── Podfile ├── Podfile.lock └── Pods │ ├── FMDB │ ├── LICENSE.txt │ ├── README.markdown │ └── src │ │ └── fmdb │ │ ├── FMDB.h │ │ ├── FMDatabase.h │ │ ├── FMDatabase.m │ │ ├── FMDatabaseAdditions.h │ │ ├── FMDatabaseAdditions.m │ │ ├── FMDatabasePool.h │ │ ├── FMDatabasePool.m │ │ ├── FMDatabaseQueue.h │ │ ├── FMDatabaseQueue.m │ │ ├── FMResultSet.h │ │ └── FMResultSet.m │ ├── FMDBMigrationManager │ ├── Code │ │ ├── FMDBMigrationManager.h │ │ └── FMDBMigrationManager.m │ ├── LICENSE │ └── README.md │ ├── Headers │ ├── Private │ │ ├── FMDB │ │ │ ├── FMDB.h │ │ │ ├── FMDatabase.h │ │ │ ├── FMDatabaseAdditions.h │ │ │ ├── FMDatabasePool.h │ │ │ ├── FMDatabaseQueue.h │ │ │ └── FMResultSet.h │ │ └── FMDBMigrationManager │ │ │ └── FMDBMigrationManager.h │ └── Public │ │ ├── FMDB │ │ ├── FMDB.h │ │ ├── FMDatabase.h │ │ ├── FMDatabaseAdditions.h │ │ ├── FMDatabasePool.h │ │ ├── FMDatabaseQueue.h │ │ └── FMResultSet.h │ │ └── FMDBMigrationManager │ │ └── FMDBMigrationManager.h │ ├── Manifest.lock │ ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── alan.xcuserdatad │ │ └── xcschemes │ │ ├── FMDB.xcscheme │ │ ├── FMDBMigrationManager.xcscheme │ │ ├── Pods-FMDBMigrationManager.xcscheme │ │ ├── Pods-FMDBMigrationManagerTests.xcscheme │ │ └── Pods-FMDBMigrationManagerUITests.xcscheme │ └── Target Support Files │ ├── FMDB │ ├── FMDB-dummy.m │ ├── FMDB-prefix.pch │ └── FMDB.xcconfig │ ├── FMDBMigrationManager │ ├── FMDBMigrationManager-dummy.m │ ├── FMDBMigrationManager-prefix.pch │ └── FMDBMigrationManager.xcconfig │ ├── Pods-FMDBMigrationManager │ ├── Pods-FMDBMigrationManager-acknowledgements.markdown │ ├── Pods-FMDBMigrationManager-acknowledgements.plist │ ├── Pods-FMDBMigrationManager-dummy.m │ ├── Pods-FMDBMigrationManager-frameworks.sh │ ├── Pods-FMDBMigrationManager-resources.sh │ ├── Pods-FMDBMigrationManager.debug.xcconfig │ └── Pods-FMDBMigrationManager.release.xcconfig │ ├── Pods-FMDBMigrationManagerTests │ ├── Pods-FMDBMigrationManagerTests-acknowledgements.markdown │ ├── Pods-FMDBMigrationManagerTests-acknowledgements.plist │ ├── Pods-FMDBMigrationManagerTests-dummy.m │ ├── Pods-FMDBMigrationManagerTests-frameworks.sh │ ├── Pods-FMDBMigrationManagerTests-resources.sh │ ├── Pods-FMDBMigrationManagerTests.debug.xcconfig │ └── Pods-FMDBMigrationManagerTests.release.xcconfig │ └── Pods-FMDBMigrationManagerUITests │ ├── Pods-FMDBMigrationManagerUITests-acknowledgements.markdown │ ├── Pods-FMDBMigrationManagerUITests-acknowledgements.plist │ ├── Pods-FMDBMigrationManagerUITests-dummy.m │ ├── Pods-FMDBMigrationManagerUITests-frameworks.sh │ ├── Pods-FMDBMigrationManagerUITests-resources.sh │ ├── Pods-FMDBMigrationManagerUITests.debug.xcconfig │ └── Pods-FMDBMigrationManagerUITests.release.xcconfig ├── README.md └── readme /FMDBMigrationManager/FMDBMigrationManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager.xcodeproj/project.xcworkspace/xcuserdata/alan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FaceWaller/How-To-Use-FMDBMigrationManager/3a7b09d7b9c4cdf4902ef7b91f7e2c28fc22b90a/FMDBMigrationManager/FMDBMigrationManager.xcodeproj/project.xcworkspace/xcuserdata/alan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/FMDBMigrationManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager.xcworkspace/xcuserdata/alan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FaceWaller/How-To-Use-FMDBMigrationManager/3a7b09d7b9c4cdf4902ef7b91f7e2c28fc22b90a/FMDBMigrationManager/FMDBMigrationManager.xcworkspace/xcuserdata/alan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Migration.h: -------------------------------------------------------------------------------- 1 | // 2 | // Migration.h 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FMDBMigrationManager.h" 11 | @interface Migration : NSObject 12 | - (instancetype)initWithName:(NSString *)name andVersion:(uint64_t)version andExecuteUpdateArray:(NSArray *)updateArray;//自定义方法 13 | 14 | @property (nonatomic, readonly) NSString *name; 15 | @property (nonatomic, readonly) uint64_t version; 16 | - (BOOL)migrateDatabase:(FMDatabase *)database error:(out NSError *__autoreleasing *)error; 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/Migration.m: -------------------------------------------------------------------------------- 1 | // 2 | // Migration.m 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import "Migration.h" 10 | 11 | @interface Migration() 12 | 13 | @property(nonatomic,copy)NSString * myName; 14 | @property(nonatomic,assign)uint64_t myVersion; 15 | @property(nonatomic,strong)NSArray * updateArray; 16 | @end 17 | 18 | @implementation Migration 19 | - (instancetype)initWithName:(NSString *)name andVersion:(uint64_t)version andExecuteUpdateArray:(NSArray *)updateArray 20 | { 21 | if (self=[super init]) { 22 | _myName=name; 23 | _myVersion=version; 24 | _updateArray=updateArray; 25 | } 26 | return self; 27 | } 28 | 29 | - (NSString *)name 30 | { 31 | return _myName; 32 | } 33 | 34 | - (uint64_t)version 35 | { 36 | return _myVersion; 37 | } 38 | 39 | - (BOOL)migrateDatabase:(FMDatabase *)database error:(out NSError *__autoreleasing *)error 40 | { 41 | for(NSString * updateStr in _updateArray) 42 | { 43 | [database executeUpdate:updateStr]; 44 | } 45 | return YES; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Fmdb.h" 11 | #import "FMDBMigrationManager.h" 12 | #import "Migration.h" 13 | @interface ViewController () 14 | @property(nonatomic,copy)NSString * path; 15 | @property(nonatomic,strong)FMDatabase * db; 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | //定义一个地址存放数据库 为了查看方便我直接放在桌面 24 | NSString * path=@"/Users/alan/Desktop/fmdbMigration.db"; 25 | _path=path; 26 | 27 | //生成数据库 28 | [self creatSqlite]; 29 | 30 | //检查并升级数据库 31 | [self updatePrivateMsg]; 32 | 33 | } 34 | 35 | - (void)creatSqlite{ 36 | FMDatabase * db=[FMDatabase databaseWithPath:_path]; 37 | _db=db; 38 | 39 | if ([_db open]) { 40 | //创建一个名为Student的表 包含一个字段name 41 | BOOL result=[_db executeUpdate:@"CREATE TABLE IF NOT EXISTS Student (id integer PRIMARY KEY AUTOINCREMENT, name text NOT NULL);"]; 42 | if (result) { 43 | NSLog(@"创表成功"); 44 | }else{ 45 | NSLog(@"创表失败"); 46 | } 47 | 48 | //存入十个小明 49 | for (int i=0; i<10; i++) { 50 | 51 | [_db executeUpdate:@"INSERT INTO Student (name) VALUES (?)",@"小明"]; 52 | } 53 | } 54 | 55 | 56 | [_db close]; 57 | } 58 | 59 | 60 | - (void)updatePrivateMsg{ 61 | 62 | FMDBMigrationManager * manager=[FMDBMigrationManager managerWithDatabaseAtPath:_path migrationsBundle:[NSBundle mainBundle]]; 63 | 64 | Migration * migration_1=[[Migration alloc]initWithName:@"新增USer表" andVersion:1 andExecuteUpdateArray:@[@"create table User(name text,age integer)"]];//从版本生升级到版本1创建一个User表 带有 name,age 字段 65 | 66 | 67 | Migration * migration_2=[[Migration alloc]initWithName:@"USer表新增字段email" andVersion:2 andExecuteUpdateArray:@[@"alter table User add email text"]];//给User表添加email字段 68 | 69 | 70 | 71 | [manager addMigration:migration_1]; 72 | [manager addMigration:migration_2]; 73 | 74 | BOOL resultState=NO; 75 | NSError * error=nil; 76 | if (!manager.hasMigrationsTable) { 77 | resultState=[manager createMigrationsTable:&error]; 78 | } 79 | resultState=[manager migrateDatabaseToVersion:UINT64_MAX progress:nil error:&error]; 80 | 81 | } 82 | 83 | 84 | 85 | - (void)didReceiveMemoryWarning { 86 | [super didReceiveMemoryWarning]; 87 | // Dispose of any resources that can be recreated. 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManager/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FMDBMigrationManager 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManagerTests/FMDBMigrationManagerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDBMigrationManagerTests.m 3 | // FMDBMigrationManagerTests 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FMDBMigrationManagerTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FMDBMigrationManagerTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManagerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManagerUITests/FMDBMigrationManagerUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDBMigrationManagerUITests.m 3 | // FMDBMigrationManagerUITests 4 | // 5 | // Created by Alan on 2017/2/8. 6 | // Copyright © 2017年 Alan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FMDBMigrationManagerUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FMDBMigrationManagerUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FMDBMigrationManager/FMDBMigrationManagerUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | pod 'FMDB','~> 2.6.2' 5 | 6 | pod 'FMDBMigrationManager', '~> 1.4.1' 7 | target 'FMDBMigrationManager' do 8 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 9 | # use_frameworks! 10 | 11 | # Pods for FMDBMigrationManager 12 | 13 | target 'FMDBMigrationManagerTests' do 14 | inherit! :search_paths 15 | # Pods for testing 16 | end 17 | 18 | target 'FMDBMigrationManagerUITests' do 19 | inherit! :search_paths 20 | # Pods for testing 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FMDB (2.6.2): 3 | - FMDB/standard (= 2.6.2) 4 | - FMDB/standard (2.6.2) 5 | - FMDBMigrationManager (1.4.1): 6 | - FMDBMigrationManager/System (= 1.4.1) 7 | - FMDBMigrationManager/System (1.4.1): 8 | - FMDB/standard (>= 2.3) 9 | 10 | DEPENDENCIES: 11 | - FMDB (~> 2.6.2) 12 | - FMDBMigrationManager (~> 1.4.1) 13 | 14 | SPEC CHECKSUMS: 15 | FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a 16 | FMDBMigrationManager: d52007f328ea0665e8985ca8a33500707aef084f 17 | 18 | PODFILE CHECKSUM: 6925e85e19fee5f7f41b9efe1edd39accccc07a4 19 | 20 | COCOAPODS: 1.2.0 21 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/LICENSE.txt: -------------------------------------------------------------------------------- 1 | If you are using FMDB in your project, I'd love to hear about it. Let Gus know 2 | by sending an email to gus@flyingmeat.com. 3 | 4 | And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you 5 | might consider purchasing a drink of their choosing if FMDB has been useful to 6 | you. 7 | 8 | Finally, and shortly, this is the MIT License. 9 | 10 | Copyright (c) 2008-2014 Flying Meat Inc. 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in 20 | all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | THE SOFTWARE. -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDB.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | FOUNDATION_EXPORT double FMDBVersionNumber; 4 | FOUNDATION_EXPORT const unsigned char FMDBVersionString[]; 5 | 6 | #import "FMDatabase.h" 7 | #import "FMResultSet.h" 8 | #import "FMDatabaseAdditions.h" 9 | #import "FMDatabaseQueue.h" 10 | #import "FMDatabasePool.h" 11 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseAdditions.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 10/30/05. 6 | // Copyright 2005 Flying Meat Inc.. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FMDatabase.h" 11 | 12 | 13 | /** Category of additions for `` class. 14 | 15 | ### See also 16 | 17 | - `` 18 | */ 19 | 20 | @interface FMDatabase (FMDatabaseAdditions) 21 | 22 | ///---------------------------------------- 23 | /// @name Return results of SQL to variable 24 | ///---------------------------------------- 25 | 26 | /** Return `int` value for query 27 | 28 | @param query The SQL query to be performed. 29 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 30 | 31 | @return `int` value. 32 | 33 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 34 | */ 35 | 36 | - (int)intForQuery:(NSString*)query, ...; 37 | 38 | /** Return `long` value for query 39 | 40 | @param query The SQL query to be performed. 41 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 42 | 43 | @return `long` value. 44 | 45 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 46 | */ 47 | 48 | - (long)longForQuery:(NSString*)query, ...; 49 | 50 | /** Return `BOOL` value for query 51 | 52 | @param query The SQL query to be performed. 53 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 54 | 55 | @return `BOOL` value. 56 | 57 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 58 | */ 59 | 60 | - (BOOL)boolForQuery:(NSString*)query, ...; 61 | 62 | /** Return `double` value for query 63 | 64 | @param query The SQL query to be performed. 65 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 66 | 67 | @return `double` value. 68 | 69 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 70 | */ 71 | 72 | - (double)doubleForQuery:(NSString*)query, ...; 73 | 74 | /** Return `NSString` value for query 75 | 76 | @param query The SQL query to be performed. 77 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 78 | 79 | @return `NSString` value. 80 | 81 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 82 | */ 83 | 84 | - (NSString*)stringForQuery:(NSString*)query, ...; 85 | 86 | /** Return `NSData` value for query 87 | 88 | @param query The SQL query to be performed. 89 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 90 | 91 | @return `NSData` value. 92 | 93 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 94 | */ 95 | 96 | - (NSData*)dataForQuery:(NSString*)query, ...; 97 | 98 | /** Return `NSDate` value for query 99 | 100 | @param query The SQL query to be performed. 101 | @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. 102 | 103 | @return `NSDate` value. 104 | 105 | @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. 106 | */ 107 | 108 | - (NSDate*)dateForQuery:(NSString*)query, ...; 109 | 110 | 111 | // Notice that there's no dataNoCopyForQuery:. 112 | // That would be a bad idea, because we close out the result set, and then what 113 | // happens to the data that we just didn't copy? Who knows, not I. 114 | 115 | 116 | ///-------------------------------- 117 | /// @name Schema related operations 118 | ///-------------------------------- 119 | 120 | /** Does table exist in database? 121 | 122 | @param tableName The name of the table being looked for. 123 | 124 | @return `YES` if table found; `NO` if not found. 125 | */ 126 | 127 | - (BOOL)tableExists:(NSString*)tableName; 128 | 129 | /** The schema of the database. 130 | 131 | This will be the schema for the entire database. For each entity, each row of the result set will include the following fields: 132 | 133 | - `type` - The type of entity (e.g. table, index, view, or trigger) 134 | - `name` - The name of the object 135 | - `tbl_name` - The name of the table to which the object references 136 | - `rootpage` - The page number of the root b-tree page for tables and indices 137 | - `sql` - The SQL that created the entity 138 | 139 | @return `FMResultSet` of schema; `nil` on error. 140 | 141 | @see [SQLite File Format](http://www.sqlite.org/fileformat.html) 142 | */ 143 | 144 | - (FMResultSet*)getSchema; 145 | 146 | /** The schema of the database. 147 | 148 | This will be the schema for a particular table as report by SQLite `PRAGMA`, for example: 149 | 150 | PRAGMA table_info('employees') 151 | 152 | This will report: 153 | 154 | - `cid` - The column ID number 155 | - `name` - The name of the column 156 | - `type` - The data type specified for the column 157 | - `notnull` - whether the field is defined as NOT NULL (i.e. values required) 158 | - `dflt_value` - The default value for the column 159 | - `pk` - Whether the field is part of the primary key of the table 160 | 161 | @param tableName The name of the table for whom the schema will be returned. 162 | 163 | @return `FMResultSet` of schema; `nil` on error. 164 | 165 | @see [table_info](http://www.sqlite.org/pragma.html#pragma_table_info) 166 | */ 167 | 168 | - (FMResultSet*)getTableSchema:(NSString*)tableName; 169 | 170 | /** Test to see if particular column exists for particular table in database 171 | 172 | @param columnName The name of the column. 173 | 174 | @param tableName The name of the table. 175 | 176 | @return `YES` if column exists in table in question; `NO` otherwise. 177 | */ 178 | 179 | - (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName; 180 | 181 | /** Test to see if particular column exists for particular table in database 182 | 183 | @param columnName The name of the column. 184 | 185 | @param tableName The name of the table. 186 | 187 | @return `YES` if column exists in table in question; `NO` otherwise. 188 | 189 | @see columnExists:inTableWithName: 190 | 191 | @warning Deprecated - use `` instead. 192 | */ 193 | 194 | - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)); 195 | 196 | 197 | /** Validate SQL statement 198 | 199 | This validates SQL statement by performing `sqlite3_prepare_v2`, but not returning the results, but instead immediately calling `sqlite3_finalize`. 200 | 201 | @param sql The SQL statement being validated. 202 | 203 | @param error This is a pointer to a `NSError` object that will receive the autoreleased `NSError` object if there was any error. If this is `nil`, no `NSError` result will be returned. 204 | 205 | @return `YES` if validation succeeded without incident; `NO` otherwise. 206 | 207 | */ 208 | 209 | - (BOOL)validateSQL:(NSString*)sql error:(NSError**)error; 210 | 211 | 212 | ///----------------------------------- 213 | /// @name Application identifier tasks 214 | ///----------------------------------- 215 | 216 | /** Retrieve application ID 217 | 218 | @return The `uint32_t` numeric value of the application ID. 219 | 220 | @see setApplicationID: 221 | */ 222 | 223 | - (uint32_t)applicationID; 224 | 225 | /** Set the application ID 226 | 227 | @param appID The `uint32_t` numeric value of the application ID. 228 | 229 | @see applicationID 230 | */ 231 | 232 | - (void)setApplicationID:(uint32_t)appID; 233 | 234 | #if TARGET_OS_MAC && !TARGET_OS_IPHONE 235 | /** Retrieve application ID string 236 | 237 | @return The `NSString` value of the application ID. 238 | 239 | @see setApplicationIDString: 240 | */ 241 | 242 | 243 | - (NSString*)applicationIDString; 244 | 245 | /** Set the application ID string 246 | 247 | @param string The `NSString` value of the application ID. 248 | 249 | @see applicationIDString 250 | */ 251 | 252 | - (void)setApplicationIDString:(NSString*)string; 253 | 254 | #endif 255 | 256 | ///----------------------------------- 257 | /// @name user version identifier tasks 258 | ///----------------------------------- 259 | 260 | /** Retrieve user version 261 | 262 | @return The `uint32_t` numeric value of the user version. 263 | 264 | @see setUserVersion: 265 | */ 266 | 267 | - (uint32_t)userVersion; 268 | 269 | /** Set the user-version 270 | 271 | @param version The `uint32_t` numeric value of the user version. 272 | 273 | @see userVersion 274 | */ 275 | 276 | - (void)setUserVersion:(uint32_t)version; 277 | 278 | @end 279 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabaseAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseAdditions.m 3 | // fmdb 4 | // 5 | // Created by August Mueller on 10/30/05. 6 | // Copyright 2005 Flying Meat Inc.. All rights reserved. 7 | // 8 | 9 | #import "FMDatabase.h" 10 | #import "FMDatabaseAdditions.h" 11 | #import "TargetConditionals.h" 12 | 13 | #if FMDB_SQLITE_STANDALONE 14 | #import 15 | #else 16 | #import 17 | #endif 18 | 19 | @interface FMDatabase (PrivateStuff) 20 | - (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; 21 | @end 22 | 23 | @implementation FMDatabase (FMDatabaseAdditions) 24 | 25 | #define RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(type, sel) \ 26 | va_list args; \ 27 | va_start(args, query); \ 28 | FMResultSet *resultSet = [self executeQuery:query withArgumentsInArray:0x00 orDictionary:0x00 orVAList:args]; \ 29 | va_end(args); \ 30 | if (![resultSet next]) { return (type)0; } \ 31 | type ret = [resultSet sel:0]; \ 32 | [resultSet close]; \ 33 | [resultSet setParentDB:nil]; \ 34 | return ret; 35 | 36 | 37 | - (NSString*)stringForQuery:(NSString*)query, ... { 38 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSString *, stringForColumnIndex); 39 | } 40 | 41 | - (int)intForQuery:(NSString*)query, ... { 42 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(int, intForColumnIndex); 43 | } 44 | 45 | - (long)longForQuery:(NSString*)query, ... { 46 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(long, longForColumnIndex); 47 | } 48 | 49 | - (BOOL)boolForQuery:(NSString*)query, ... { 50 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(BOOL, boolForColumnIndex); 51 | } 52 | 53 | - (double)doubleForQuery:(NSString*)query, ... { 54 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(double, doubleForColumnIndex); 55 | } 56 | 57 | - (NSData*)dataForQuery:(NSString*)query, ... { 58 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSData *, dataForColumnIndex); 59 | } 60 | 61 | - (NSDate*)dateForQuery:(NSString*)query, ... { 62 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSDate *, dateForColumnIndex); 63 | } 64 | 65 | 66 | - (BOOL)tableExists:(NSString*)tableName { 67 | 68 | tableName = [tableName lowercaseString]; 69 | 70 | FMResultSet *rs = [self executeQuery:@"select [sql] from sqlite_master where [type] = 'table' and lower(name) = ?", tableName]; 71 | 72 | //if at least one next exists, table exists 73 | BOOL returnBool = [rs next]; 74 | 75 | //close and free object 76 | [rs close]; 77 | 78 | return returnBool; 79 | } 80 | 81 | /* 82 | get table with list of tables: result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] 83 | check if table exist in database (patch from OZLB) 84 | */ 85 | - (FMResultSet*)getSchema { 86 | 87 | //result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] 88 | FMResultSet *rs = [self executeQuery:@"SELECT type, name, tbl_name, rootpage, sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type != 'meta' AND name NOT LIKE 'sqlite_%' ORDER BY tbl_name, type DESC, name"]; 89 | 90 | return rs; 91 | } 92 | 93 | /* 94 | get table schema: result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] 95 | */ 96 | - (FMResultSet*)getTableSchema:(NSString*)tableName { 97 | 98 | //result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] 99 | FMResultSet *rs = [self executeQuery:[NSString stringWithFormat: @"pragma table_info('%@')", tableName]]; 100 | 101 | return rs; 102 | } 103 | 104 | - (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName { 105 | 106 | BOOL returnBool = NO; 107 | 108 | tableName = [tableName lowercaseString]; 109 | columnName = [columnName lowercaseString]; 110 | 111 | FMResultSet *rs = [self getTableSchema:tableName]; 112 | 113 | //check if column is present in table schema 114 | while ([rs next]) { 115 | if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString:columnName]) { 116 | returnBool = YES; 117 | break; 118 | } 119 | } 120 | 121 | //If this is not done FMDatabase instance stays out of pool 122 | [rs close]; 123 | 124 | return returnBool; 125 | } 126 | 127 | 128 | 129 | - (uint32_t)applicationID { 130 | #if SQLITE_VERSION_NUMBER >= 3007017 131 | uint32_t r = 0; 132 | 133 | FMResultSet *rs = [self executeQuery:@"pragma application_id"]; 134 | 135 | if ([rs next]) { 136 | r = (uint32_t)[rs longLongIntForColumnIndex:0]; 137 | } 138 | 139 | [rs close]; 140 | 141 | return r; 142 | #else 143 | NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); 144 | if (self.logsErrors) NSLog(@"%@", errorMessage); 145 | return 0; 146 | #endif 147 | } 148 | 149 | - (void)setApplicationID:(uint32_t)appID { 150 | #if SQLITE_VERSION_NUMBER >= 3007017 151 | NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID]; 152 | FMResultSet *rs = [self executeQuery:query]; 153 | [rs next]; 154 | [rs close]; 155 | #else 156 | NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); 157 | if (self.logsErrors) NSLog(@"%@", errorMessage); 158 | #endif 159 | } 160 | 161 | 162 | #if TARGET_OS_MAC && !TARGET_OS_IPHONE 163 | 164 | - (NSString*)applicationIDString { 165 | #if SQLITE_VERSION_NUMBER >= 3007017 166 | NSString *s = NSFileTypeForHFSTypeCode([self applicationID]); 167 | 168 | assert([s length] == 6); 169 | 170 | s = [s substringWithRange:NSMakeRange(1, 4)]; 171 | 172 | 173 | return s; 174 | #else 175 | NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); 176 | if (self.logsErrors) NSLog(@"%@", errorMessage); 177 | return nil; 178 | #endif 179 | } 180 | 181 | - (void)setApplicationIDString:(NSString*)s { 182 | #if SQLITE_VERSION_NUMBER >= 3007017 183 | if ([s length] != 4) { 184 | NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]); 185 | } 186 | 187 | [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])]; 188 | #else 189 | NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); 190 | if (self.logsErrors) NSLog(@"%@", errorMessage); 191 | #endif 192 | } 193 | 194 | #endif 195 | 196 | - (uint32_t)userVersion { 197 | uint32_t r = 0; 198 | 199 | FMResultSet *rs = [self executeQuery:@"pragma user_version"]; 200 | 201 | if ([rs next]) { 202 | r = (uint32_t)[rs longLongIntForColumnIndex:0]; 203 | } 204 | 205 | [rs close]; 206 | return r; 207 | } 208 | 209 | - (void)setUserVersion:(uint32_t)version { 210 | NSString *query = [NSString stringWithFormat:@"pragma user_version = %d", version]; 211 | FMResultSet *rs = [self executeQuery:query]; 212 | [rs next]; 213 | [rs close]; 214 | } 215 | 216 | #pragma clang diagnostic push 217 | #pragma clang diagnostic ignored "-Wdeprecated-implementations" 218 | 219 | - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)) { 220 | return [self columnExists:columnName inTableWithName:tableName]; 221 | } 222 | 223 | #pragma clang diagnostic pop 224 | 225 | 226 | - (BOOL)validateSQL:(NSString*)sql error:(NSError**)error { 227 | sqlite3_stmt *pStmt = NULL; 228 | BOOL validationSucceeded = YES; 229 | 230 | int rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0); 231 | if (rc != SQLITE_OK) { 232 | validationSucceeded = NO; 233 | if (error) { 234 | *error = [NSError errorWithDomain:NSCocoaErrorDomain 235 | code:[self lastErrorCode] 236 | userInfo:[NSDictionary dictionaryWithObject:[self lastErrorMessage] 237 | forKey:NSLocalizedDescriptionKey]]; 238 | } 239 | } 240 | 241 | sqlite3_finalize(pStmt); 242 | 243 | return validationSucceeded; 244 | } 245 | 246 | @end 247 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabasePool.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FMDatabase; 12 | 13 | /** Pool of `` objects. 14 | 15 | ### See also 16 | 17 | - `` 18 | - `` 19 | 20 | @warning Before using `FMDatabasePool`, please consider using `` instead. 21 | 22 | If you really really really know what you're doing and `FMDatabasePool` is what 23 | you really really need (ie, you're using a read only database), OK you can use 24 | it. But just be careful not to deadlock! 25 | 26 | For an example on deadlocking, search for: 27 | `ONLY_USE_THE_POOL_IF_YOU_ARE_DOING_READS_OTHERWISE_YOULL_DEADLOCK_USE_FMDATABASEQUEUE_INSTEAD` 28 | in the main.m file. 29 | */ 30 | 31 | @interface FMDatabasePool : NSObject { 32 | NSString *_path; 33 | 34 | dispatch_queue_t _lockQueue; 35 | 36 | NSMutableArray *_databaseInPool; 37 | NSMutableArray *_databaseOutPool; 38 | 39 | __unsafe_unretained id _delegate; 40 | 41 | NSUInteger _maximumNumberOfDatabasesToCreate; 42 | int _openFlags; 43 | } 44 | 45 | /** Database path */ 46 | 47 | @property (atomic, retain) NSString *path; 48 | 49 | /** Delegate object */ 50 | 51 | @property (atomic, assign) id delegate; 52 | 53 | /** Maximum number of databases to create */ 54 | 55 | @property (atomic, assign) NSUInteger maximumNumberOfDatabasesToCreate; 56 | 57 | /** Open flags */ 58 | 59 | @property (atomic, readonly) int openFlags; 60 | 61 | 62 | ///--------------------- 63 | /// @name Initialization 64 | ///--------------------- 65 | 66 | /** Create pool using path. 67 | 68 | @param aPath The file path of the database. 69 | 70 | @return The `FMDatabasePool` object. `nil` on error. 71 | */ 72 | 73 | + (instancetype)databasePoolWithPath:(NSString*)aPath; 74 | 75 | /** Create pool using path and specified flags 76 | 77 | @param aPath The file path of the database. 78 | @param openFlags Flags passed to the openWithFlags method of the database 79 | 80 | @return The `FMDatabasePool` object. `nil` on error. 81 | */ 82 | 83 | + (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags; 84 | 85 | /** Create pool using path. 86 | 87 | @param aPath The file path of the database. 88 | 89 | @return The `FMDatabasePool` object. `nil` on error. 90 | */ 91 | 92 | - (instancetype)initWithPath:(NSString*)aPath; 93 | 94 | /** Create pool using path and specified flags. 95 | 96 | @param aPath The file path of the database. 97 | @param openFlags Flags passed to the openWithFlags method of the database 98 | 99 | @return The `FMDatabasePool` object. `nil` on error. 100 | */ 101 | 102 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; 103 | 104 | ///------------------------------------------------ 105 | /// @name Keeping track of checked in/out databases 106 | ///------------------------------------------------ 107 | 108 | /** Number of checked-in databases in pool 109 | 110 | @returns Number of databases 111 | */ 112 | 113 | - (NSUInteger)countOfCheckedInDatabases; 114 | 115 | /** Number of checked-out databases in pool 116 | 117 | @returns Number of databases 118 | */ 119 | 120 | - (NSUInteger)countOfCheckedOutDatabases; 121 | 122 | /** Total number of databases in pool 123 | 124 | @returns Number of databases 125 | */ 126 | 127 | - (NSUInteger)countOfOpenDatabases; 128 | 129 | /** Release all databases in pool */ 130 | 131 | - (void)releaseAllDatabases; 132 | 133 | ///------------------------------------------ 134 | /// @name Perform database operations in pool 135 | ///------------------------------------------ 136 | 137 | /** Synchronously perform database operations in pool. 138 | 139 | @param block The code to be run on the `FMDatabasePool` pool. 140 | */ 141 | 142 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 143 | 144 | /** Synchronously perform database operations in pool using transaction. 145 | 146 | @param block The code to be run on the `FMDatabasePool` pool. 147 | */ 148 | 149 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 150 | 151 | /** Synchronously perform database operations in pool using deferred transaction. 152 | 153 | @param block The code to be run on the `FMDatabasePool` pool. 154 | */ 155 | 156 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 157 | 158 | /** Synchronously perform database operations in pool using save point. 159 | 160 | @param block The code to be run on the `FMDatabasePool` pool. 161 | 162 | @return `NSError` object if error; `nil` if successful. 163 | 164 | @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use `<[FMDatabase startSavePointWithName:error:]>` instead. 165 | */ 166 | 167 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 168 | 169 | @end 170 | 171 | 172 | /** FMDatabasePool delegate category 173 | 174 | This is a category that defines the protocol for the FMDatabasePool delegate 175 | */ 176 | 177 | @interface NSObject (FMDatabasePoolDelegate) 178 | 179 | /** Asks the delegate whether database should be added to the pool. 180 | 181 | @param pool The `FMDatabasePool` object. 182 | @param database The `FMDatabase` object. 183 | 184 | @return `YES` if it should add database to pool; `NO` if not. 185 | 186 | */ 187 | 188 | - (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; 189 | 190 | /** Tells the delegate that database was added to the pool. 191 | 192 | @param pool The `FMDatabasePool` object. 193 | @param database The `FMDatabase` object. 194 | 195 | */ 196 | 197 | - (void)databasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database; 198 | 199 | @end 200 | 201 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabasePool.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabasePool.m 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #if FMDB_SQLITE_STANDALONE 10 | #import 11 | #else 12 | #import 13 | #endif 14 | 15 | #import "FMDatabasePool.h" 16 | #import "FMDatabase.h" 17 | 18 | @interface FMDatabasePool() 19 | 20 | - (void)pushDatabaseBackInPool:(FMDatabase*)db; 21 | - (FMDatabase*)db; 22 | 23 | @end 24 | 25 | 26 | @implementation FMDatabasePool 27 | @synthesize path=_path; 28 | @synthesize delegate=_delegate; 29 | @synthesize maximumNumberOfDatabasesToCreate=_maximumNumberOfDatabasesToCreate; 30 | @synthesize openFlags=_openFlags; 31 | 32 | 33 | + (instancetype)databasePoolWithPath:(NSString*)aPath { 34 | return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]); 35 | } 36 | 37 | + (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags { 38 | return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath flags:openFlags]); 39 | } 40 | 41 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { 42 | 43 | self = [super init]; 44 | 45 | if (self != nil) { 46 | _path = [aPath copy]; 47 | _lockQueue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL); 48 | _databaseInPool = FMDBReturnRetained([NSMutableArray array]); 49 | _databaseOutPool = FMDBReturnRetained([NSMutableArray array]); 50 | _openFlags = openFlags; 51 | } 52 | 53 | return self; 54 | } 55 | 56 | - (instancetype)initWithPath:(NSString*)aPath 57 | { 58 | // default flags for sqlite3_open 59 | return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE]; 60 | } 61 | 62 | - (instancetype)init { 63 | return [self initWithPath:nil]; 64 | } 65 | 66 | 67 | - (void)dealloc { 68 | 69 | _delegate = 0x00; 70 | FMDBRelease(_path); 71 | FMDBRelease(_databaseInPool); 72 | FMDBRelease(_databaseOutPool); 73 | 74 | if (_lockQueue) { 75 | FMDBDispatchQueueRelease(_lockQueue); 76 | _lockQueue = 0x00; 77 | } 78 | #if ! __has_feature(objc_arc) 79 | [super dealloc]; 80 | #endif 81 | } 82 | 83 | 84 | - (void)executeLocked:(void (^)(void))aBlock { 85 | dispatch_sync(_lockQueue, aBlock); 86 | } 87 | 88 | - (void)pushDatabaseBackInPool:(FMDatabase*)db { 89 | 90 | if (!db) { // db can be null if we set an upper bound on the # of databases to create. 91 | return; 92 | } 93 | 94 | [self executeLocked:^() { 95 | 96 | if ([self->_databaseInPool containsObject:db]) { 97 | [[NSException exceptionWithName:@"Database already in pool" reason:@"The FMDatabase being put back into the pool is already present in the pool" userInfo:nil] raise]; 98 | } 99 | 100 | [self->_databaseInPool addObject:db]; 101 | [self->_databaseOutPool removeObject:db]; 102 | 103 | }]; 104 | } 105 | 106 | - (FMDatabase*)db { 107 | 108 | __block FMDatabase *db; 109 | 110 | 111 | [self executeLocked:^() { 112 | db = [self->_databaseInPool lastObject]; 113 | 114 | BOOL shouldNotifyDelegate = NO; 115 | 116 | if (db) { 117 | [self->_databaseOutPool addObject:db]; 118 | [self->_databaseInPool removeLastObject]; 119 | } 120 | else { 121 | 122 | if (self->_maximumNumberOfDatabasesToCreate) { 123 | NSUInteger currentCount = [self->_databaseOutPool count] + [self->_databaseInPool count]; 124 | 125 | if (currentCount >= self->_maximumNumberOfDatabasesToCreate) { 126 | NSLog(@"Maximum number of databases (%ld) has already been reached!", (long)currentCount); 127 | return; 128 | } 129 | } 130 | 131 | db = [FMDatabase databaseWithPath:self->_path]; 132 | shouldNotifyDelegate = YES; 133 | } 134 | 135 | //This ensures that the db is opened before returning 136 | #if SQLITE_VERSION_NUMBER >= 3005000 137 | BOOL success = [db openWithFlags:self->_openFlags]; 138 | #else 139 | BOOL success = [db open]; 140 | #endif 141 | if (success) { 142 | if ([self->_delegate respondsToSelector:@selector(databasePool:shouldAddDatabaseToPool:)] && ![self->_delegate databasePool:self shouldAddDatabaseToPool:db]) { 143 | [db close]; 144 | db = 0x00; 145 | } 146 | else { 147 | //It should not get added in the pool twice if lastObject was found 148 | if (![self->_databaseOutPool containsObject:db]) { 149 | [self->_databaseOutPool addObject:db]; 150 | 151 | if (shouldNotifyDelegate && [self->_delegate respondsToSelector:@selector(databasePool:didAddDatabase:)]) { 152 | [self->_delegate databasePool:self didAddDatabase:db]; 153 | } 154 | } 155 | } 156 | } 157 | else { 158 | NSLog(@"Could not open up the database at path %@", self->_path); 159 | db = 0x00; 160 | } 161 | }]; 162 | 163 | return db; 164 | } 165 | 166 | - (NSUInteger)countOfCheckedInDatabases { 167 | 168 | __block NSUInteger count; 169 | 170 | [self executeLocked:^() { 171 | count = [self->_databaseInPool count]; 172 | }]; 173 | 174 | return count; 175 | } 176 | 177 | - (NSUInteger)countOfCheckedOutDatabases { 178 | 179 | __block NSUInteger count; 180 | 181 | [self executeLocked:^() { 182 | count = [self->_databaseOutPool count]; 183 | }]; 184 | 185 | return count; 186 | } 187 | 188 | - (NSUInteger)countOfOpenDatabases { 189 | __block NSUInteger count; 190 | 191 | [self executeLocked:^() { 192 | count = [self->_databaseOutPool count] + [self->_databaseInPool count]; 193 | }]; 194 | 195 | return count; 196 | } 197 | 198 | - (void)releaseAllDatabases { 199 | [self executeLocked:^() { 200 | [self->_databaseOutPool removeAllObjects]; 201 | [self->_databaseInPool removeAllObjects]; 202 | }]; 203 | } 204 | 205 | - (void)inDatabase:(void (^)(FMDatabase *db))block { 206 | 207 | FMDatabase *db = [self db]; 208 | 209 | block(db); 210 | 211 | [self pushDatabaseBackInPool:db]; 212 | } 213 | 214 | - (void)beginTransaction:(BOOL)useDeferred withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block { 215 | 216 | BOOL shouldRollback = NO; 217 | 218 | FMDatabase *db = [self db]; 219 | 220 | if (useDeferred) { 221 | [db beginDeferredTransaction]; 222 | } 223 | else { 224 | [db beginTransaction]; 225 | } 226 | 227 | 228 | block(db, &shouldRollback); 229 | 230 | if (shouldRollback) { 231 | [db rollback]; 232 | } 233 | else { 234 | [db commit]; 235 | } 236 | 237 | [self pushDatabaseBackInPool:db]; 238 | } 239 | 240 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 241 | [self beginTransaction:YES withBlock:block]; 242 | } 243 | 244 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 245 | [self beginTransaction:NO withBlock:block]; 246 | } 247 | 248 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block { 249 | #if SQLITE_VERSION_NUMBER >= 3007000 250 | static unsigned long savePointIdx = 0; 251 | 252 | NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++]; 253 | 254 | BOOL shouldRollback = NO; 255 | 256 | FMDatabase *db = [self db]; 257 | 258 | NSError *err = 0x00; 259 | 260 | if (![db startSavePointWithName:name error:&err]) { 261 | [self pushDatabaseBackInPool:db]; 262 | return err; 263 | } 264 | 265 | block(db, &shouldRollback); 266 | 267 | if (shouldRollback) { 268 | // We need to rollback and release this savepoint to remove it 269 | [db rollbackToSavePointWithName:name error:&err]; 270 | } 271 | [db releaseSavePointWithName:name error:&err]; 272 | 273 | [self pushDatabaseBackInPool:db]; 274 | 275 | return err; 276 | #else 277 | NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); 278 | if (self.logsErrors) NSLog(@"%@", errorMessage); 279 | return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}]; 280 | #endif 281 | } 282 | 283 | @end 284 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseQueue.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FMDatabase; 12 | 13 | /** To perform queries and updates on multiple threads, you'll want to use `FMDatabaseQueue`. 14 | 15 | Using a single instance of `` from multiple threads at once is a bad idea. It has always been OK to make a `` object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time. 16 | 17 | Instead, use `FMDatabaseQueue`. Here's how to use it: 18 | 19 | First, make your queue. 20 | 21 | FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath]; 22 | 23 | Then use it like so: 24 | 25 | [queue inDatabase:^(FMDatabase *db) { 26 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; 27 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; 28 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; 29 | 30 | FMResultSet *rs = [db executeQuery:@"select * from foo"]; 31 | while ([rs next]) { 32 | //… 33 | } 34 | }]; 35 | 36 | An easy way to wrap things up in a transaction can be done like this: 37 | 38 | [queue inTransaction:^(FMDatabase *db, BOOL *rollback) { 39 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; 40 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; 41 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; 42 | 43 | if (whoopsSomethingWrongHappened) { 44 | *rollback = YES; 45 | return; 46 | } 47 | // etc… 48 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]]; 49 | }]; 50 | 51 | `FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class). So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy. 52 | 53 | ### See also 54 | 55 | - `` 56 | 57 | @warning Do not instantiate a single `` object and use it across multiple threads. Use `FMDatabaseQueue` instead. 58 | 59 | @warning The calls to `FMDatabaseQueue`'s methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread. 60 | 61 | */ 62 | 63 | @interface FMDatabaseQueue : NSObject { 64 | NSString *_path; 65 | dispatch_queue_t _queue; 66 | FMDatabase *_db; 67 | int _openFlags; 68 | } 69 | 70 | /** Path of database */ 71 | 72 | @property (atomic, retain) NSString *path; 73 | 74 | /** Open flags */ 75 | 76 | @property (atomic, readonly) int openFlags; 77 | 78 | ///---------------------------------------------------- 79 | /// @name Initialization, opening, and closing of queue 80 | ///---------------------------------------------------- 81 | 82 | /** Create queue using path. 83 | 84 | @param aPath The file path of the database. 85 | 86 | @return The `FMDatabaseQueue` object. `nil` on error. 87 | */ 88 | 89 | + (instancetype)databaseQueueWithPath:(NSString*)aPath; 90 | 91 | /** Create queue using path and specified flags. 92 | 93 | @param aPath The file path of the database. 94 | @param openFlags Flags passed to the openWithFlags method of the database 95 | 96 | @return The `FMDatabaseQueue` object. `nil` on error. 97 | */ 98 | + (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags; 99 | 100 | /** Create queue using path. 101 | 102 | @param aPath The file path of the database. 103 | 104 | @return The `FMDatabaseQueue` object. `nil` on error. 105 | */ 106 | 107 | - (instancetype)initWithPath:(NSString*)aPath; 108 | 109 | /** Create queue using path and specified flags. 110 | 111 | @param aPath The file path of the database. 112 | @param openFlags Flags passed to the openWithFlags method of the database 113 | 114 | @return The `FMDatabaseQueue` object. `nil` on error. 115 | */ 116 | 117 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; 118 | 119 | /** Create queue using path and specified flags. 120 | 121 | @param aPath The file path of the database. 122 | @param openFlags Flags passed to the openWithFlags method of the database 123 | @param vfsName The name of a custom virtual file system 124 | 125 | @return The `FMDatabaseQueue` object. `nil` on error. 126 | */ 127 | 128 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName; 129 | 130 | /** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object. 131 | 132 | Subclasses can override this method to return specified Class of 'FMDatabase' subclass. 133 | 134 | @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object. 135 | */ 136 | 137 | + (Class)databaseClass; 138 | 139 | /** Close database used by queue. */ 140 | 141 | - (void)close; 142 | 143 | ///----------------------------------------------- 144 | /// @name Dispatching database operations to queue 145 | ///----------------------------------------------- 146 | 147 | /** Synchronously perform database operations on queue. 148 | 149 | @param block The code to be run on the queue of `FMDatabaseQueue` 150 | */ 151 | 152 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 153 | 154 | /** Synchronously perform database operations on queue, using transactions. 155 | 156 | @param block The code to be run on the queue of `FMDatabaseQueue` 157 | */ 158 | 159 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 160 | 161 | /** Synchronously perform database operations on queue, using deferred transactions. 162 | 163 | @param block The code to be run on the queue of `FMDatabaseQueue` 164 | */ 165 | 166 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 167 | 168 | ///----------------------------------------------- 169 | /// @name Dispatching database operations to queue 170 | ///----------------------------------------------- 171 | 172 | /** Synchronously perform database operations using save point. 173 | 174 | @param block The code to be run on the queue of `FMDatabaseQueue` 175 | */ 176 | 177 | // NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. 178 | // If you need to nest, use FMDatabase's startSavePointWithName:error: instead. 179 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 180 | 181 | @end 182 | 183 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMDatabaseQueue.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseQueue.m 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import "FMDatabaseQueue.h" 10 | #import "FMDatabase.h" 11 | 12 | #if FMDB_SQLITE_STANDALONE 13 | #import 14 | #else 15 | #import 16 | #endif 17 | 18 | /* 19 | 20 | Note: we call [self retain]; before using dispatch_sync, just incase 21 | FMDatabaseQueue is released on another thread and we're in the middle of doing 22 | something in dispatch_sync 23 | 24 | */ 25 | 26 | /* 27 | * A key used to associate the FMDatabaseQueue object with the dispatch_queue_t it uses. 28 | * This in turn is used for deadlock detection by seeing if inDatabase: is called on 29 | * the queue's dispatch queue, which should not happen and causes a deadlock. 30 | */ 31 | static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey; 32 | 33 | @implementation FMDatabaseQueue 34 | 35 | @synthesize path = _path; 36 | @synthesize openFlags = _openFlags; 37 | 38 | + (instancetype)databaseQueueWithPath:(NSString*)aPath { 39 | 40 | FMDatabaseQueue *q = [[self alloc] initWithPath:aPath]; 41 | 42 | FMDBAutorelease(q); 43 | 44 | return q; 45 | } 46 | 47 | + (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags { 48 | 49 | FMDatabaseQueue *q = [[self alloc] initWithPath:aPath flags:openFlags]; 50 | 51 | FMDBAutorelease(q); 52 | 53 | return q; 54 | } 55 | 56 | + (Class)databaseClass { 57 | return [FMDatabase class]; 58 | } 59 | 60 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName { 61 | 62 | self = [super init]; 63 | 64 | if (self != nil) { 65 | 66 | _db = [[[self class] databaseClass] databaseWithPath:aPath]; 67 | FMDBRetain(_db); 68 | 69 | #if SQLITE_VERSION_NUMBER >= 3005000 70 | BOOL success = [_db openWithFlags:openFlags vfs:vfsName]; 71 | #else 72 | BOOL success = [_db open]; 73 | #endif 74 | if (!success) { 75 | NSLog(@"Could not create database queue for path %@", aPath); 76 | FMDBRelease(self); 77 | return 0x00; 78 | } 79 | 80 | _path = FMDBReturnRetained(aPath); 81 | 82 | _queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL); 83 | dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL); 84 | _openFlags = openFlags; 85 | } 86 | 87 | return self; 88 | } 89 | 90 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { 91 | return [self initWithPath:aPath flags:openFlags vfs:nil]; 92 | } 93 | 94 | - (instancetype)initWithPath:(NSString*)aPath { 95 | 96 | // default flags for sqlite3_open 97 | return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE vfs:nil]; 98 | } 99 | 100 | - (instancetype)init { 101 | return [self initWithPath:nil]; 102 | } 103 | 104 | 105 | - (void)dealloc { 106 | 107 | FMDBRelease(_db); 108 | FMDBRelease(_path); 109 | 110 | if (_queue) { 111 | FMDBDispatchQueueRelease(_queue); 112 | _queue = 0x00; 113 | } 114 | #if ! __has_feature(objc_arc) 115 | [super dealloc]; 116 | #endif 117 | } 118 | 119 | - (void)close { 120 | FMDBRetain(self); 121 | dispatch_sync(_queue, ^() { 122 | [self->_db close]; 123 | FMDBRelease(_db); 124 | self->_db = 0x00; 125 | }); 126 | FMDBRelease(self); 127 | } 128 | 129 | - (FMDatabase*)database { 130 | if (!_db) { 131 | _db = FMDBReturnRetained([FMDatabase databaseWithPath:_path]); 132 | 133 | #if SQLITE_VERSION_NUMBER >= 3005000 134 | BOOL success = [_db openWithFlags:_openFlags]; 135 | #else 136 | BOOL success = [_db open]; 137 | #endif 138 | if (!success) { 139 | NSLog(@"FMDatabaseQueue could not reopen database for path %@", _path); 140 | FMDBRelease(_db); 141 | _db = 0x00; 142 | return 0x00; 143 | } 144 | } 145 | 146 | return _db; 147 | } 148 | 149 | - (void)inDatabase:(void (^)(FMDatabase *db))block { 150 | /* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue 151 | * and then check it against self to make sure we're not about to deadlock. */ 152 | FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey); 153 | assert(currentSyncQueue != self && "inDatabase: was called reentrantly on the same queue, which would lead to a deadlock"); 154 | 155 | FMDBRetain(self); 156 | 157 | dispatch_sync(_queue, ^() { 158 | 159 | FMDatabase *db = [self database]; 160 | block(db); 161 | 162 | if ([db hasOpenResultSets]) { 163 | NSLog(@"Warning: there is at least one open result set around after performing [FMDatabaseQueue inDatabase:]"); 164 | 165 | #if defined(DEBUG) && DEBUG 166 | NSSet *openSetCopy = FMDBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]); 167 | for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) { 168 | FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue]; 169 | NSLog(@"query: '%@'", [rs query]); 170 | } 171 | #endif 172 | } 173 | }); 174 | 175 | FMDBRelease(self); 176 | } 177 | 178 | 179 | - (void)beginTransaction:(BOOL)useDeferred withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block { 180 | FMDBRetain(self); 181 | dispatch_sync(_queue, ^() { 182 | 183 | BOOL shouldRollback = NO; 184 | 185 | if (useDeferred) { 186 | [[self database] beginDeferredTransaction]; 187 | } 188 | else { 189 | [[self database] beginTransaction]; 190 | } 191 | 192 | block([self database], &shouldRollback); 193 | 194 | if (shouldRollback) { 195 | [[self database] rollback]; 196 | } 197 | else { 198 | [[self database] commit]; 199 | } 200 | }); 201 | 202 | FMDBRelease(self); 203 | } 204 | 205 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 206 | [self beginTransaction:YES withBlock:block]; 207 | } 208 | 209 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 210 | [self beginTransaction:NO withBlock:block]; 211 | } 212 | 213 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block { 214 | #if SQLITE_VERSION_NUMBER >= 3007000 215 | static unsigned long savePointIdx = 0; 216 | __block NSError *err = 0x00; 217 | FMDBRetain(self); 218 | dispatch_sync(_queue, ^() { 219 | 220 | NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++]; 221 | 222 | BOOL shouldRollback = NO; 223 | 224 | if ([[self database] startSavePointWithName:name error:&err]) { 225 | 226 | block([self database], &shouldRollback); 227 | 228 | if (shouldRollback) { 229 | // We need to rollback and release this savepoint to remove it 230 | [[self database] rollbackToSavePointWithName:name error:&err]; 231 | } 232 | [[self database] releaseSavePointWithName:name error:&err]; 233 | 234 | } 235 | }); 236 | FMDBRelease(self); 237 | return err; 238 | #else 239 | NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); 240 | if (self.logsErrors) NSLog(@"%@", errorMessage); 241 | return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}]; 242 | #endif 243 | } 244 | 245 | @end 246 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMResultSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #ifndef __has_feature // Optional. 4 | #define __has_feature(x) 0 // Compatibility with non-clang compilers. 5 | #endif 6 | 7 | #ifndef NS_RETURNS_NOT_RETAINED 8 | #if __has_feature(attribute_ns_returns_not_retained) 9 | #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) 10 | #else 11 | #define NS_RETURNS_NOT_RETAINED 12 | #endif 13 | #endif 14 | 15 | @class FMDatabase; 16 | @class FMStatement; 17 | 18 | /** Represents the results of executing a query on an ``. 19 | 20 | ### See also 21 | 22 | - `` 23 | */ 24 | 25 | @interface FMResultSet : NSObject { 26 | FMDatabase *_parentDB; 27 | FMStatement *_statement; 28 | 29 | NSString *_query; 30 | NSMutableDictionary *_columnNameToIndexMap; 31 | } 32 | 33 | ///----------------- 34 | /// @name Properties 35 | ///----------------- 36 | 37 | /** Executed query */ 38 | 39 | @property (atomic, retain) NSString *query; 40 | 41 | /** `NSMutableDictionary` mapping column names to numeric index */ 42 | 43 | @property (readonly) NSMutableDictionary *columnNameToIndexMap; 44 | 45 | /** `FMStatement` used by result set. */ 46 | 47 | @property (atomic, retain) FMStatement *statement; 48 | 49 | ///------------------------------------ 50 | /// @name Creating and closing database 51 | ///------------------------------------ 52 | 53 | /** Create result set from `` 54 | 55 | @param statement A `` to be performed 56 | 57 | @param aDB A `` to be used 58 | 59 | @return A `FMResultSet` on success; `nil` on failure 60 | */ 61 | 62 | + (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB; 63 | 64 | /** Close result set */ 65 | 66 | - (void)close; 67 | 68 | - (void)setParentDB:(FMDatabase *)newDb; 69 | 70 | ///--------------------------------------- 71 | /// @name Iterating through the result set 72 | ///--------------------------------------- 73 | 74 | /** Retrieve next row for result set. 75 | 76 | You must always invoke `next` or `nextWithError` before attempting to access the values returned in a query, even if you're only expecting one. 77 | 78 | @return `YES` if row successfully retrieved; `NO` if end of result set reached 79 | 80 | @see hasAnotherRow 81 | */ 82 | 83 | - (BOOL)next; 84 | 85 | /** Retrieve next row for result set. 86 | 87 | You must always invoke `next` or `nextWithError` before attempting to access the values returned in a query, even if you're only expecting one. 88 | 89 | @param outErr A 'NSError' object to receive any error object (if any). 90 | 91 | @return 'YES' if row successfully retrieved; 'NO' if end of result set reached 92 | 93 | @see hasAnotherRow 94 | */ 95 | 96 | - (BOOL)nextWithError:(NSError **)outErr; 97 | 98 | /** Did the last call to `` succeed in retrieving another row? 99 | 100 | @return `YES` if the last call to `` succeeded in retrieving another record; `NO` if not. 101 | 102 | @see next 103 | 104 | @warning The `hasAnotherRow` method must follow a call to ``. If the previous database interaction was something other than a call to `next`, then this method may return `NO`, whether there is another row of data or not. 105 | */ 106 | 107 | - (BOOL)hasAnotherRow; 108 | 109 | ///--------------------------------------------- 110 | /// @name Retrieving information from result set 111 | ///--------------------------------------------- 112 | 113 | /** How many columns in result set 114 | 115 | @return Integer value of the number of columns. 116 | */ 117 | 118 | - (int)columnCount; 119 | 120 | /** Column index for column name 121 | 122 | @param columnName `NSString` value of the name of the column. 123 | 124 | @return Zero-based index for column. 125 | */ 126 | 127 | - (int)columnIndexForName:(NSString*)columnName; 128 | 129 | /** Column name for column index 130 | 131 | @param columnIdx Zero-based index for column. 132 | 133 | @return columnName `NSString` value of the name of the column. 134 | */ 135 | 136 | - (NSString*)columnNameForIndex:(int)columnIdx; 137 | 138 | /** Result set integer value for column. 139 | 140 | @param columnName `NSString` value of the name of the column. 141 | 142 | @return `int` value of the result set's column. 143 | */ 144 | 145 | - (int)intForColumn:(NSString*)columnName; 146 | 147 | /** Result set integer value for column. 148 | 149 | @param columnIdx Zero-based index for column. 150 | 151 | @return `int` value of the result set's column. 152 | */ 153 | 154 | - (int)intForColumnIndex:(int)columnIdx; 155 | 156 | /** Result set `long` value for column. 157 | 158 | @param columnName `NSString` value of the name of the column. 159 | 160 | @return `long` value of the result set's column. 161 | */ 162 | 163 | - (long)longForColumn:(NSString*)columnName; 164 | 165 | /** Result set long value for column. 166 | 167 | @param columnIdx Zero-based index for column. 168 | 169 | @return `long` value of the result set's column. 170 | */ 171 | 172 | - (long)longForColumnIndex:(int)columnIdx; 173 | 174 | /** Result set `long long int` value for column. 175 | 176 | @param columnName `NSString` value of the name of the column. 177 | 178 | @return `long long int` value of the result set's column. 179 | */ 180 | 181 | - (long long int)longLongIntForColumn:(NSString*)columnName; 182 | 183 | /** Result set `long long int` value for column. 184 | 185 | @param columnIdx Zero-based index for column. 186 | 187 | @return `long long int` value of the result set's column. 188 | */ 189 | 190 | - (long long int)longLongIntForColumnIndex:(int)columnIdx; 191 | 192 | /** Result set `unsigned long long int` value for column. 193 | 194 | @param columnName `NSString` value of the name of the column. 195 | 196 | @return `unsigned long long int` value of the result set's column. 197 | */ 198 | 199 | - (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName; 200 | 201 | /** Result set `unsigned long long int` value for column. 202 | 203 | @param columnIdx Zero-based index for column. 204 | 205 | @return `unsigned long long int` value of the result set's column. 206 | */ 207 | 208 | - (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx; 209 | 210 | /** Result set `BOOL` value for column. 211 | 212 | @param columnName `NSString` value of the name of the column. 213 | 214 | @return `BOOL` value of the result set's column. 215 | */ 216 | 217 | - (BOOL)boolForColumn:(NSString*)columnName; 218 | 219 | /** Result set `BOOL` value for column. 220 | 221 | @param columnIdx Zero-based index for column. 222 | 223 | @return `BOOL` value of the result set's column. 224 | */ 225 | 226 | - (BOOL)boolForColumnIndex:(int)columnIdx; 227 | 228 | /** Result set `double` value for column. 229 | 230 | @param columnName `NSString` value of the name of the column. 231 | 232 | @return `double` value of the result set's column. 233 | 234 | */ 235 | 236 | - (double)doubleForColumn:(NSString*)columnName; 237 | 238 | /** Result set `double` value for column. 239 | 240 | @param columnIdx Zero-based index for column. 241 | 242 | @return `double` value of the result set's column. 243 | 244 | */ 245 | 246 | - (double)doubleForColumnIndex:(int)columnIdx; 247 | 248 | /** Result set `NSString` value for column. 249 | 250 | @param columnName `NSString` value of the name of the column. 251 | 252 | @return `NSString` value of the result set's column. 253 | 254 | */ 255 | 256 | - (NSString*)stringForColumn:(NSString*)columnName; 257 | 258 | /** Result set `NSString` value for column. 259 | 260 | @param columnIdx Zero-based index for column. 261 | 262 | @return `NSString` value of the result set's column. 263 | */ 264 | 265 | - (NSString*)stringForColumnIndex:(int)columnIdx; 266 | 267 | /** Result set `NSDate` value for column. 268 | 269 | @param columnName `NSString` value of the name of the column. 270 | 271 | @return `NSDate` value of the result set's column. 272 | */ 273 | 274 | - (NSDate*)dateForColumn:(NSString*)columnName; 275 | 276 | /** Result set `NSDate` value for column. 277 | 278 | @param columnIdx Zero-based index for column. 279 | 280 | @return `NSDate` value of the result set's column. 281 | 282 | */ 283 | 284 | - (NSDate*)dateForColumnIndex:(int)columnIdx; 285 | 286 | /** Result set `NSData` value for column. 287 | 288 | This is useful when storing binary data in table (such as image or the like). 289 | 290 | @param columnName `NSString` value of the name of the column. 291 | 292 | @return `NSData` value of the result set's column. 293 | 294 | */ 295 | 296 | - (NSData*)dataForColumn:(NSString*)columnName; 297 | 298 | /** Result set `NSData` value for column. 299 | 300 | @param columnIdx Zero-based index for column. 301 | 302 | @return `NSData` value of the result set's column. 303 | */ 304 | 305 | - (NSData*)dataForColumnIndex:(int)columnIdx; 306 | 307 | /** Result set `(const unsigned char *)` value for column. 308 | 309 | @param columnName `NSString` value of the name of the column. 310 | 311 | @return `(const unsigned char *)` value of the result set's column. 312 | */ 313 | 314 | - (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName; 315 | 316 | /** Result set `(const unsigned char *)` value for column. 317 | 318 | @param columnIdx Zero-based index for column. 319 | 320 | @return `(const unsigned char *)` value of the result set's column. 321 | */ 322 | 323 | - (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx; 324 | 325 | /** Result set object for column. 326 | 327 | @param columnName `NSString` value of the name of the column. 328 | 329 | @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. 330 | 331 | @see objectForKeyedSubscript: 332 | */ 333 | 334 | - (id)objectForColumnName:(NSString*)columnName; 335 | 336 | /** Result set object for column. 337 | 338 | @param columnIdx Zero-based index for column. 339 | 340 | @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. 341 | 342 | @see objectAtIndexedSubscript: 343 | */ 344 | 345 | - (id)objectForColumnIndex:(int)columnIdx; 346 | 347 | /** Result set object for column. 348 | 349 | This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported: 350 | 351 | id result = rs[@"employee_name"]; 352 | 353 | This simplified syntax is equivalent to calling: 354 | 355 | id result = [rs objectForKeyedSubscript:@"employee_name"]; 356 | 357 | which is, it turns out, equivalent to calling: 358 | 359 | id result = [rs objectForColumnName:@"employee_name"]; 360 | 361 | @param columnName `NSString` value of the name of the column. 362 | 363 | @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. 364 | */ 365 | 366 | - (id)objectForKeyedSubscript:(NSString *)columnName; 367 | 368 | /** Result set object for column. 369 | 370 | This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported: 371 | 372 | id result = rs[0]; 373 | 374 | This simplified syntax is equivalent to calling: 375 | 376 | id result = [rs objectForKeyedSubscript:0]; 377 | 378 | which is, it turns out, equivalent to calling: 379 | 380 | id result = [rs objectForColumnName:0]; 381 | 382 | @param columnIdx Zero-based index for column. 383 | 384 | @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. 385 | */ 386 | 387 | - (id)objectAtIndexedSubscript:(int)columnIdx; 388 | 389 | /** Result set `NSData` value for column. 390 | 391 | @param columnName `NSString` value of the name of the column. 392 | 393 | @return `NSData` value of the result set's column. 394 | 395 | @warning If you are going to use this data after you iterate over the next row, or after you close the 396 | result set, make sure to make a copy of the data first (or just use ``/``) 397 | If you don't, you're going to be in a world of hurt when you try and use the data. 398 | 399 | */ 400 | 401 | - (NSData*)dataNoCopyForColumn:(NSString*)columnName NS_RETURNS_NOT_RETAINED; 402 | 403 | /** Result set `NSData` value for column. 404 | 405 | @param columnIdx Zero-based index for column. 406 | 407 | @return `NSData` value of the result set's column. 408 | 409 | @warning If you are going to use this data after you iterate over the next row, or after you close the 410 | result set, make sure to make a copy of the data first (or just use ``/``) 411 | If you don't, you're going to be in a world of hurt when you try and use the data. 412 | 413 | */ 414 | 415 | - (NSData*)dataNoCopyForColumnIndex:(int)columnIdx NS_RETURNS_NOT_RETAINED; 416 | 417 | /** Is the column `NULL`? 418 | 419 | @param columnIdx Zero-based index for column. 420 | 421 | @return `YES` if column is `NULL`; `NO` if not `NULL`. 422 | */ 423 | 424 | - (BOOL)columnIndexIsNull:(int)columnIdx; 425 | 426 | /** Is the column `NULL`? 427 | 428 | @param columnName `NSString` value of the name of the column. 429 | 430 | @return `YES` if column is `NULL`; `NO` if not `NULL`. 431 | */ 432 | 433 | - (BOOL)columnIsNull:(NSString*)columnName; 434 | 435 | 436 | /** Returns a dictionary of the row results mapped to case sensitive keys of the column names. 437 | 438 | @returns `NSDictionary` of the row results. 439 | 440 | @warning The keys to the dictionary are case sensitive of the column names. 441 | */ 442 | 443 | - (NSDictionary*)resultDictionary; 444 | 445 | /** Returns a dictionary of the row results 446 | 447 | @see resultDictionary 448 | 449 | @warning **Deprecated**: Please use `` instead. Also, beware that `` is case sensitive! 450 | */ 451 | 452 | - (NSDictionary*)resultDict __attribute__ ((deprecated)); 453 | 454 | ///----------------------------- 455 | /// @name Key value coding magic 456 | ///----------------------------- 457 | 458 | /** Performs `setValue` to yield support for key value observing. 459 | 460 | @param object The object for which the values will be set. This is the key-value-coding compliant object that you might, for example, observe. 461 | 462 | */ 463 | 464 | - (void)kvcMagic:(id)object; 465 | 466 | 467 | @end 468 | 469 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDB/src/fmdb/FMResultSet.m: -------------------------------------------------------------------------------- 1 | #import "FMResultSet.h" 2 | #import "FMDatabase.h" 3 | #import "unistd.h" 4 | 5 | #if FMDB_SQLITE_STANDALONE 6 | #import 7 | #else 8 | #import 9 | #endif 10 | 11 | @interface FMDatabase () 12 | - (void)resultSetDidClose:(FMResultSet *)resultSet; 13 | @end 14 | 15 | 16 | @implementation FMResultSet 17 | @synthesize query=_query; 18 | @synthesize statement=_statement; 19 | 20 | + (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB { 21 | 22 | FMResultSet *rs = [[FMResultSet alloc] init]; 23 | 24 | [rs setStatement:statement]; 25 | [rs setParentDB:aDB]; 26 | 27 | NSParameterAssert(![statement inUse]); 28 | [statement setInUse:YES]; // weak reference 29 | 30 | return FMDBReturnAutoreleased(rs); 31 | } 32 | 33 | - (void)finalize { 34 | [self close]; 35 | [super finalize]; 36 | } 37 | 38 | - (void)dealloc { 39 | [self close]; 40 | 41 | FMDBRelease(_query); 42 | _query = nil; 43 | 44 | FMDBRelease(_columnNameToIndexMap); 45 | _columnNameToIndexMap = nil; 46 | 47 | #if ! __has_feature(objc_arc) 48 | [super dealloc]; 49 | #endif 50 | } 51 | 52 | - (void)close { 53 | [_statement reset]; 54 | FMDBRelease(_statement); 55 | _statement = nil; 56 | 57 | // we don't need this anymore... (i think) 58 | //[_parentDB setInUse:NO]; 59 | [_parentDB resultSetDidClose:self]; 60 | _parentDB = nil; 61 | } 62 | 63 | - (int)columnCount { 64 | return sqlite3_column_count([_statement statement]); 65 | } 66 | 67 | - (NSMutableDictionary *)columnNameToIndexMap { 68 | if (!_columnNameToIndexMap) { 69 | int columnCount = sqlite3_column_count([_statement statement]); 70 | _columnNameToIndexMap = [[NSMutableDictionary alloc] initWithCapacity:(NSUInteger)columnCount]; 71 | int columnIdx = 0; 72 | for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { 73 | [_columnNameToIndexMap setObject:[NSNumber numberWithInt:columnIdx] 74 | forKey:[[NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)] lowercaseString]]; 75 | } 76 | } 77 | return _columnNameToIndexMap; 78 | } 79 | 80 | - (void)kvcMagic:(id)object { 81 | 82 | int columnCount = sqlite3_column_count([_statement statement]); 83 | 84 | int columnIdx = 0; 85 | for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { 86 | 87 | const char *c = (const char *)sqlite3_column_text([_statement statement], columnIdx); 88 | 89 | // check for a null row 90 | if (c) { 91 | NSString *s = [NSString stringWithUTF8String:c]; 92 | 93 | [object setValue:s forKey:[NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)]]; 94 | } 95 | } 96 | } 97 | 98 | #pragma clang diagnostic push 99 | #pragma clang diagnostic ignored "-Wdeprecated-implementations" 100 | 101 | - (NSDictionary*)resultDict { 102 | 103 | NSUInteger num_cols = (NSUInteger)sqlite3_data_count([_statement statement]); 104 | 105 | if (num_cols > 0) { 106 | NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:num_cols]; 107 | 108 | NSEnumerator *columnNames = [[self columnNameToIndexMap] keyEnumerator]; 109 | NSString *columnName = nil; 110 | while ((columnName = [columnNames nextObject])) { 111 | id objectValue = [self objectForColumnName:columnName]; 112 | [dict setObject:objectValue forKey:columnName]; 113 | } 114 | 115 | return FMDBReturnAutoreleased([dict copy]); 116 | } 117 | else { 118 | NSLog(@"Warning: There seem to be no columns in this set."); 119 | } 120 | 121 | return nil; 122 | } 123 | 124 | #pragma clang diagnostic pop 125 | 126 | - (NSDictionary*)resultDictionary { 127 | 128 | NSUInteger num_cols = (NSUInteger)sqlite3_data_count([_statement statement]); 129 | 130 | if (num_cols > 0) { 131 | NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:num_cols]; 132 | 133 | int columnCount = sqlite3_column_count([_statement statement]); 134 | 135 | int columnIdx = 0; 136 | for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { 137 | 138 | NSString *columnName = [NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)]; 139 | id objectValue = [self objectForColumnIndex:columnIdx]; 140 | [dict setObject:objectValue forKey:columnName]; 141 | } 142 | 143 | return dict; 144 | } 145 | else { 146 | NSLog(@"Warning: There seem to be no columns in this set."); 147 | } 148 | 149 | return nil; 150 | } 151 | 152 | 153 | 154 | 155 | - (BOOL)next { 156 | return [self nextWithError:nil]; 157 | } 158 | 159 | - (BOOL)nextWithError:(NSError **)outErr { 160 | 161 | int rc = sqlite3_step([_statement statement]); 162 | 163 | if (SQLITE_BUSY == rc || SQLITE_LOCKED == rc) { 164 | NSLog(@"%s:%d Database busy (%@)", __FUNCTION__, __LINE__, [_parentDB databasePath]); 165 | NSLog(@"Database busy"); 166 | if (outErr) { 167 | *outErr = [_parentDB lastError]; 168 | } 169 | } 170 | else if (SQLITE_DONE == rc || SQLITE_ROW == rc) { 171 | // all is well, let's return. 172 | } 173 | else if (SQLITE_ERROR == rc) { 174 | NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); 175 | if (outErr) { 176 | *outErr = [_parentDB lastError]; 177 | } 178 | } 179 | else if (SQLITE_MISUSE == rc) { 180 | // uh oh. 181 | NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); 182 | if (outErr) { 183 | if (_parentDB) { 184 | *outErr = [_parentDB lastError]; 185 | } 186 | else { 187 | // If 'next' or 'nextWithError' is called after the result set is closed, 188 | // we need to return the appropriate error. 189 | NSDictionary* errorMessage = [NSDictionary dictionaryWithObject:@"parentDB does not exist" forKey:NSLocalizedDescriptionKey]; 190 | *outErr = [NSError errorWithDomain:@"FMDatabase" code:SQLITE_MISUSE userInfo:errorMessage]; 191 | } 192 | 193 | } 194 | } 195 | else { 196 | // wtf? 197 | NSLog(@"Unknown error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); 198 | if (outErr) { 199 | *outErr = [_parentDB lastError]; 200 | } 201 | } 202 | 203 | 204 | if (rc != SQLITE_ROW) { 205 | [self close]; 206 | } 207 | 208 | return (rc == SQLITE_ROW); 209 | } 210 | 211 | - (BOOL)hasAnotherRow { 212 | return sqlite3_errcode([_parentDB sqliteHandle]) == SQLITE_ROW; 213 | } 214 | 215 | - (int)columnIndexForName:(NSString*)columnName { 216 | columnName = [columnName lowercaseString]; 217 | 218 | NSNumber *n = [[self columnNameToIndexMap] objectForKey:columnName]; 219 | 220 | if (n) { 221 | return [n intValue]; 222 | } 223 | 224 | NSLog(@"Warning: I could not find the column named '%@'.", columnName); 225 | 226 | return -1; 227 | } 228 | 229 | 230 | 231 | - (int)intForColumn:(NSString*)columnName { 232 | return [self intForColumnIndex:[self columnIndexForName:columnName]]; 233 | } 234 | 235 | - (int)intForColumnIndex:(int)columnIdx { 236 | return sqlite3_column_int([_statement statement], columnIdx); 237 | } 238 | 239 | - (long)longForColumn:(NSString*)columnName { 240 | return [self longForColumnIndex:[self columnIndexForName:columnName]]; 241 | } 242 | 243 | - (long)longForColumnIndex:(int)columnIdx { 244 | return (long)sqlite3_column_int64([_statement statement], columnIdx); 245 | } 246 | 247 | - (long long int)longLongIntForColumn:(NSString*)columnName { 248 | return [self longLongIntForColumnIndex:[self columnIndexForName:columnName]]; 249 | } 250 | 251 | - (long long int)longLongIntForColumnIndex:(int)columnIdx { 252 | return sqlite3_column_int64([_statement statement], columnIdx); 253 | } 254 | 255 | - (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName { 256 | return [self unsignedLongLongIntForColumnIndex:[self columnIndexForName:columnName]]; 257 | } 258 | 259 | - (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx { 260 | return (unsigned long long int)[self longLongIntForColumnIndex:columnIdx]; 261 | } 262 | 263 | - (BOOL)boolForColumn:(NSString*)columnName { 264 | return [self boolForColumnIndex:[self columnIndexForName:columnName]]; 265 | } 266 | 267 | - (BOOL)boolForColumnIndex:(int)columnIdx { 268 | return ([self intForColumnIndex:columnIdx] != 0); 269 | } 270 | 271 | - (double)doubleForColumn:(NSString*)columnName { 272 | return [self doubleForColumnIndex:[self columnIndexForName:columnName]]; 273 | } 274 | 275 | - (double)doubleForColumnIndex:(int)columnIdx { 276 | return sqlite3_column_double([_statement statement], columnIdx); 277 | } 278 | 279 | - (NSString*)stringForColumnIndex:(int)columnIdx { 280 | 281 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 282 | return nil; 283 | } 284 | 285 | const char *c = (const char *)sqlite3_column_text([_statement statement], columnIdx); 286 | 287 | if (!c) { 288 | // null row. 289 | return nil; 290 | } 291 | 292 | return [NSString stringWithUTF8String:c]; 293 | } 294 | 295 | - (NSString*)stringForColumn:(NSString*)columnName { 296 | return [self stringForColumnIndex:[self columnIndexForName:columnName]]; 297 | } 298 | 299 | - (NSDate*)dateForColumn:(NSString*)columnName { 300 | return [self dateForColumnIndex:[self columnIndexForName:columnName]]; 301 | } 302 | 303 | - (NSDate*)dateForColumnIndex:(int)columnIdx { 304 | 305 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 306 | return nil; 307 | } 308 | 309 | return [_parentDB hasDateFormatter] ? [_parentDB dateFromString:[self stringForColumnIndex:columnIdx]] : [NSDate dateWithTimeIntervalSince1970:[self doubleForColumnIndex:columnIdx]]; 310 | } 311 | 312 | 313 | - (NSData*)dataForColumn:(NSString*)columnName { 314 | return [self dataForColumnIndex:[self columnIndexForName:columnName]]; 315 | } 316 | 317 | - (NSData*)dataForColumnIndex:(int)columnIdx { 318 | 319 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 320 | return nil; 321 | } 322 | 323 | const char *dataBuffer = sqlite3_column_blob([_statement statement], columnIdx); 324 | int dataSize = sqlite3_column_bytes([_statement statement], columnIdx); 325 | 326 | if (dataBuffer == NULL) { 327 | return nil; 328 | } 329 | 330 | return [NSData dataWithBytes:(const void *)dataBuffer length:(NSUInteger)dataSize]; 331 | } 332 | 333 | 334 | - (NSData*)dataNoCopyForColumn:(NSString*)columnName { 335 | return [self dataNoCopyForColumnIndex:[self columnIndexForName:columnName]]; 336 | } 337 | 338 | - (NSData*)dataNoCopyForColumnIndex:(int)columnIdx { 339 | 340 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 341 | return nil; 342 | } 343 | 344 | const char *dataBuffer = sqlite3_column_blob([_statement statement], columnIdx); 345 | int dataSize = sqlite3_column_bytes([_statement statement], columnIdx); 346 | 347 | NSData *data = [NSData dataWithBytesNoCopy:(void *)dataBuffer length:(NSUInteger)dataSize freeWhenDone:NO]; 348 | 349 | return data; 350 | } 351 | 352 | 353 | - (BOOL)columnIndexIsNull:(int)columnIdx { 354 | return sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL; 355 | } 356 | 357 | - (BOOL)columnIsNull:(NSString*)columnName { 358 | return [self columnIndexIsNull:[self columnIndexForName:columnName]]; 359 | } 360 | 361 | - (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx { 362 | 363 | if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { 364 | return nil; 365 | } 366 | 367 | return sqlite3_column_text([_statement statement], columnIdx); 368 | } 369 | 370 | - (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName { 371 | return [self UTF8StringForColumnIndex:[self columnIndexForName:columnName]]; 372 | } 373 | 374 | - (id)objectForColumnIndex:(int)columnIdx { 375 | int columnType = sqlite3_column_type([_statement statement], columnIdx); 376 | 377 | id returnValue = nil; 378 | 379 | if (columnType == SQLITE_INTEGER) { 380 | returnValue = [NSNumber numberWithLongLong:[self longLongIntForColumnIndex:columnIdx]]; 381 | } 382 | else if (columnType == SQLITE_FLOAT) { 383 | returnValue = [NSNumber numberWithDouble:[self doubleForColumnIndex:columnIdx]]; 384 | } 385 | else if (columnType == SQLITE_BLOB) { 386 | returnValue = [self dataForColumnIndex:columnIdx]; 387 | } 388 | else { 389 | //default to a string for everything else 390 | returnValue = [self stringForColumnIndex:columnIdx]; 391 | } 392 | 393 | if (returnValue == nil) { 394 | returnValue = [NSNull null]; 395 | } 396 | 397 | return returnValue; 398 | } 399 | 400 | - (id)objectForColumnName:(NSString*)columnName { 401 | return [self objectForColumnIndex:[self columnIndexForName:columnName]]; 402 | } 403 | 404 | // returns autoreleased NSString containing the name of the column in the result set 405 | - (NSString*)columnNameForIndex:(int)columnIdx { 406 | return [NSString stringWithUTF8String: sqlite3_column_name([_statement statement], columnIdx)]; 407 | } 408 | 409 | - (void)setParentDB:(FMDatabase *)newDb { 410 | _parentDB = newDb; 411 | } 412 | 413 | - (id)objectAtIndexedSubscript:(int)columnIdx { 414 | return [self objectForColumnIndex:columnIdx]; 415 | } 416 | 417 | - (id)objectForKeyedSubscript:(NSString *)columnName { 418 | return [self objectForColumnName:columnName]; 419 | } 420 | 421 | 422 | @end 423 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDBMigrationManager/Code/FMDBMigrationManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDBMigrationManager.h 3 | // FMDBMigrationManager 4 | // 5 | // Created by Blake Watters on 6/4/14. 6 | // Copyright (c) 2014 Layer Inc. All rights reserved. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); 9 | // you may not use this file except in compliance with the License. 10 | // You may obtain a copy of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, 16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | // See the License for the specific language governing permissions and 18 | // limitations under the License. 19 | // 20 | 21 | #import 22 | #import 23 | 24 | @protocol FMDBMigrating; 25 | 26 | /** 27 | @abstract The `FMDBMigrationManager` class provides a simple, flexible interface for managing migrations for 28 | a SQLite database that is accessed via FMDB. 29 | */ 30 | @interface FMDBMigrationManager : NSObject 31 | 32 | ///----------------------------------- 33 | /// @name Creating a Migration Manager 34 | ///----------------------------------- 35 | 36 | /** 37 | @abstract Creates a new migration manager with a given database and migrations bundle. 38 | @param database The database with which to initialize the migration manager. 39 | @param bundle The bundle containing the migrations. 40 | @return A new migration manager. 41 | */ 42 | + (instancetype)managerWithDatabase:(FMDatabase *)database migrationsBundle:(NSBundle *)bundle; 43 | 44 | /** 45 | @abstract Creates a new migration manager with a database for the given database and migrations bundle. 46 | @param path The path to a database with which to initialize the migration manager. 47 | @param bundle The bundle containing the migrations. 48 | @return A new migration manager. 49 | */ 50 | + (instancetype)managerWithDatabaseAtPath:(NSString *)path migrationsBundle:(NSBundle *)bundle; 51 | 52 | /** 53 | @abstract Determines whether the receiver will perform a search for dynamically defined migrations. Default: `YES`. 54 | @discussion When `YES` all classes will be enumerated to search for any that conform to the `FMDBMigrating` protocol. 55 | */ 56 | @property (nonatomic, assign) BOOL dynamicMigrationsEnabled; 57 | 58 | ///-------------------------------------------------- 59 | /// @name Accessing Database Path & Migrations Bundle 60 | ///-------------------------------------------------- 61 | 62 | /** 63 | @abstract Returns the database of the receiver. 64 | */ 65 | @property (nonatomic, readonly) FMDatabase *database; 66 | 67 | /** 68 | @abstract Returns the migrations bundle for the receiver. 69 | */ 70 | @property (nonatomic, readonly) NSBundle *migrationsBundle; 71 | 72 | ///----------------------------- 73 | /// @name Accessing Version Info 74 | ///----------------------------- 75 | 76 | /** 77 | @abstract Returns the current version of the database managed by the receiver or `0` if the 78 | migrations table is not present. 79 | */ 80 | @property (nonatomic, readonly) uint64_t currentVersion; 81 | 82 | /** 83 | @abstract Returns the origin version of the database managed by the receiver or `0` if the 84 | migrations table is not present. 85 | */ 86 | @property (nonatomic, readonly) uint64_t originVersion; 87 | 88 | ///--------------------------- 89 | /// @name Accessing Migrations 90 | ///--------------------------- 91 | 92 | /** 93 | @abstract Returns all migrations discovered by the receiver. Each object returned conforms to the `FMDBMigrating` protocol. The 94 | array is returned in ascending order by version. 95 | @discussion The manager discovers migrations by analyzing all files that end in a .sql extension in the `migrationsBundle` 96 | and accumulating all classes that conform to the `FMDBMigrating` protocol. These migrations can then be sorted and applied 97 | to the target database. 98 | @note The list of migrations is memoized for efficiency. 99 | */ 100 | @property (nonatomic, readonly) NSArray *migrations; 101 | 102 | /** 103 | @abstract Returns the version numbers of the subset of `migrations` that have already been applied to the database 104 | managed by the receiver in ascending order. 105 | */ 106 | @property (nonatomic, readonly) NSArray *appliedVersions; 107 | 108 | /** 109 | @abstract Returns the version numbers of the subset of `migrations` that have not yet been applied to the database 110 | managed by the receiver in ascending order. 111 | */ 112 | @property (nonatomic, readonly) NSArray *pendingVersions; 113 | 114 | /** 115 | @abstract Returns a migration object with a given version number or `nil` if none could be found. 116 | @param version The version of the desired migration. 117 | @return A migration with the specified version or `nil` if none could be found. 118 | */ 119 | - (id)migrationForVersion:(uint64_t)version; 120 | 121 | /** 122 | @abstract Returns a migration object with a given name or `nil` if none could be found. 123 | @param name The name of the desired migration. 124 | @return A migration with the specified named or `nil` if none could be found. 125 | */ 126 | - (id)migrationForName:(NSString *)name; 127 | 128 | ///------------------------- 129 | /// @name Adding a Migration 130 | ///------------------------- 131 | 132 | /** 133 | @abstract Adds a migration to the receiver's list. 134 | @discussion This method can be used to append code based migrations to the set if you do not wish to use dynamic migration discovery. If 135 | the migration last has been previously computed, adding a migration will recompute the list. 136 | @param migration The migration to add. 137 | */ 138 | - (void)addMigration:(id)migration; 139 | 140 | /** 141 | @abstract Adds migrations from the array to the receiver's list. 142 | @discussion This method can be used to append code based migrations to the set if you do not wish to use dynamic migration discovery. If 143 | the migration last has been previously computed, adding migrations will recompute the list. 144 | @param migrations An array of objects conforming to `FMDBMigrating` protocol. 145 | */ 146 | - (void)addMigrations:(NSArray *)migrations; 147 | 148 | ///------------------------------------ 149 | /// @name Managing the Migrations Table 150 | ///------------------------------------ 151 | 152 | /** 153 | @abstract Returns a Boolean value that indicates if the `schema_migrations` table 154 | is present in the database. 155 | */ 156 | @property (nonatomic, readonly) BOOL hasMigrationsTable; 157 | 158 | /** 159 | @abstract Creates the `schema_migrations` table used by `FMDBMigrationManager` to maintain an index of applied migrations. 160 | @param error A pointer to an error object that is set upon failure to create the migrations table. 161 | @return A Boolean value that indicates if the creation of the migrations table was successful. 162 | */ 163 | - (BOOL)createMigrationsTable:(NSError **)error; 164 | 165 | ///-------------------------- 166 | /// @name Migrating Databases 167 | ///-------------------------- 168 | 169 | /** 170 | @abstract Returns a Boolean value that indicates if the database managed by the receiver is in need of migration. 171 | */ 172 | @property (nonatomic, readonly) BOOL needsMigration; 173 | 174 | /** 175 | @abstract Migrates the database managed by the receiver to the specified version, optionally providing progress via a block. 176 | @discussion Migration is performed within a transaction that is rolled back if any errors occur during migration. 177 | @param version The target version to migrate the database to. Pass `UINT64_MAX` to migrate to the latest version. 178 | @param progressBlock An optional block to be invoked each time a migration is applied. The block has no return value and accepts a single `NSProgress` argument. The 179 | progress object can be used to cancel a migration in progress. 180 | @param error A pointer to an error object that is set upon failure to complete the migrations. 181 | @return `YES` if migration was successful, else `NO`. 182 | */ 183 | - (BOOL)migrateDatabaseToVersion:(uint64_t)version progress:(void (^)(NSProgress *progress))progressBlock error:(NSError **)error; 184 | 185 | @end 186 | 187 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 188 | 189 | /** 190 | @abstract The `FMDBMigrating` protocol is adopted by classes that wish to provide migration of SQLite databases accessed via FMDB. The 191 | `FMDBMigrationManager` project ships with a single concrete implementation in the `FMDBFileMigration` class. Non file backed 192 | migrations can be implemented by conforming to the `FMDBMigrating` protocol. 193 | */ 194 | @protocol FMDBMigrating 195 | 196 | ///------------------------------------- 197 | /// @name Accessing Migration Properties 198 | ///------------------------------------- 199 | 200 | /** 201 | @abstract The name of the migration. 202 | */ 203 | @property (nonatomic, readonly) NSString *name; 204 | 205 | /** 206 | @abstract The numeric version of the migration. 207 | @discussion While monotonically incremented versions are fully supported, it is recommended that to use a timestamp format such as 208 | 201406063106474. Timestamps avoid unnecessary churn in a codebase that is heavily branched. 209 | */ 210 | @property (nonatomic, readonly) uint64_t version; 211 | 212 | ///-------------------------- 213 | /// @name Migrating Databases 214 | ///-------------------------- 215 | 216 | /** 217 | @abstract Tells the receiver to apply its changes to the given database and return a Boolean value indicating success or failure. 218 | @discussion The `FMDBMigrationManager` manages a transaction while migrations are being applied. Should any call to `migrateDatabase:error` return `NO`, 219 | then the transaction is rolled back. 220 | @param database The database on which to apply the migration. 221 | @param error A pointer to an error object to set should the transaction fail. 222 | @return A Boolean value indicating if the 223 | */ 224 | - (BOOL)migrateDatabase:(FMDatabase *)database error:(out NSError *__autoreleasing *)error; 225 | 226 | @end 227 | 228 | /** 229 | @abstract The `FMDBFileMigration` class provides a concrete implementation of the `FMDBMigrating` protocol that models 230 | a migration stored on disk a SQL file. The filename encodes the name and version of the migration. Conformant filenames are 231 | of the form `[version]_[name].sql`. 232 | */ 233 | @interface FMDBFileMigration : NSObject 234 | 235 | ///-------------------------------- 236 | /// @name Creating a File Migration 237 | ///-------------------------------- 238 | 239 | /** 240 | @abstract Creates and returns a new migration with the file at the given path. 241 | @discussion Conformance of filenames can be evaluated with the `FMDBIsMigrationAtPath` utility function. 242 | @param path The path to a file containing a SQL migration with a conformant filename. 243 | */ 244 | + (instancetype)migrationWithPath:(NSString *)path; 245 | 246 | /** 247 | @abstract The path to the SQL migration file on disk. 248 | */ 249 | @property (nonatomic, readonly) NSString *path; 250 | 251 | /** 252 | @abstract A convenience accessor for retrieving the SQL from the receiver's path. 253 | */ 254 | @property (nonatomic, readonly) NSString *SQL; 255 | 256 | @end 257 | 258 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 259 | 260 | /** 261 | @abstract The domain for errors created by `FMDBMigrationManager`. 262 | */ 263 | extern NSString *const FMDBMigrationManagerErrorDomain; 264 | 265 | /** 266 | @abstract A key for an `NSNumber` object in the `userInfo` of an `NSProgress` object specifying the version 267 | that the database was just migrated to. 268 | @see `migrateDatabase:error:` 269 | */ 270 | extern NSString *const FMDBMigrationManagerProgressVersionUserInfoKey; 271 | 272 | /** 273 | @abstract A key for an `id` object in the `userInfo` of an `NSProgress` object that identifies 274 | the migration that was just applied to the database. 275 | @see `migrateDatabase:error:` 276 | */ 277 | extern NSString *const FMDBMigrationManagerProgressMigrationUserInfoKey; 278 | 279 | /** 280 | @abstract Enumerates the errors returned by FMDBMigrationManager 281 | */ 282 | typedef NS_ENUM(NSUInteger, FMDBMigrationManagerError) { 283 | /// Indicates that migration was halted due to cancellation 284 | FMDBMigrationManagerErrorMigrationCancelled = 1 285 | }; 286 | 287 | /** 288 | @abstract Returns a Boolean value that indicates if the file at the given path is an FMDB Migration. 289 | @discussion This function evaluates the last path component of the input string against the regular expression `/\d{1,15}_.+sql$/`. 290 | @param path The path to inspect. 291 | @return `YES` if the path could be identified as a migration, else `NO`. 292 | */ 293 | BOOL FMDBIsMigrationAtPath(NSString *path); 294 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDBMigrationManager/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/FMDBMigrationManager/README.md: -------------------------------------------------------------------------------- 1 | # FMDBMigrationManager 2 | 3 | [![Build Status](https://travis-ci.org/layerhq/FMDBMigrationManager.png?branch=master)](https://travis-ci.org/layerhq/FMDBMigrationManager) 4 | [![Pod Version](http://img.shields.io/cocoapods/v/FMDBMigrationManager.svg?style=flat)](http://cocoadocs.org/docsets/FMDBMigrationManager/) 5 | [![Pod Platform](http://img.shields.io/cocoapods/p/FMDBMigrationManager.svg?style=flat)](http://cocoadocs.org/docsets/FMDBMigrationManager/) 6 | [![Pod License](http://img.shields.io/cocoapods/l/FMDBMigrationManager.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) 7 | 8 | **A SQLite schema migration management system for [FMDB](https://github.com/ccgus/fmdb).** 9 | 10 | FMDBMigrationManager is the missing schema management system for SQLite databases accessed via the [FMDB](https://github.com/ccgus/fmdb) 11 | library. It provides a simple, flexible solution for introducing versioned schema management into a new or existing Cocoa application using 12 | SQLite and FMDB for persistence. 13 | 14 | ## Features 15 | 16 | * Supports the creation and management of a dedicated migrations table within the host database. 17 | * Applies migrations safely using SQLite transactions. 18 | * Basic migrations are implemented as flat SQL files with a naming convention that encodes the version and name. 19 | * Supports code migration implementations for performing object graph migrations not expressible as SQL. 20 | * Discovers code based migrations via Objective-C runtime introspection of protocol conformance. 21 | * Includes a lightweight, yet rich API for introspecting schema state. 22 | * Exposes the status of migrations in progress and supports cancellation of migration via `NSProgress`. 23 | 24 | ## Implementation Details 25 | 26 | FMDBMigrationManager works by introducing a simple `schema_migrations` table into the database under management. This table has a schema of: 27 | 28 | ```sql 29 | CREATE TABLE schema_migrations( 30 | version INTEGER UNIQUE NOT NULL 31 | ); 32 | ``` 33 | 34 | Each row in the `schema_migrations` corresponds to a single migration that has been applied and represents a unique version of the schema. This schema 35 | supports any versioning scheme that is based on integers, but it is recommended that you utilize an integer that encodes a timestamp. 36 | 37 | ### Timestamped Versions 38 | 39 | Timestamps are preferable to a monotonically incrementing integers because they better support branched workflows as you do not need to resequence migrations when multiple 40 | lines of development are brought together. Timestamps with sufficient levels of precision are ensured a very low potential for conflict and are trivially 41 | sortable. 42 | 43 | The recommended format for timestamped migrations uses sub-second precision and can be generated via the `date` utility on platforms that provide GNU coreutils 44 | via `date +"%Y%m%d%H%M%S%3N"`. Unfortunately the build of `date` that ships with Mac OS X does not natively support this format. It can instead be generated via 45 | an invocation of Ruby: `ruby -e "puts Time.now.strftime('%Y%m%d%H%M%S%3N').to_i"`. 46 | 47 | ### Migration Naming 48 | 49 | FMDBMigrationManager favors migrations that are expressed as flat SQL files. These files can then be included into the host project via any `NSBundle`. In order 50 | for FMDBMigrationManager to be able to identify migration files within the bundle and interet the version they represent, the filename must encode the versioning 51 | data and may optionally include a descriptive name for the migration. Migrations filenames are matched with a regular expression that will recognize filenames of 52 | the form: `()_?( 123 | @end 124 | 125 | @implementation MyAwesomeMigration 126 | 127 | - (NSString *)name 128 | { 129 | return @"My Object Migration"; 130 | } 131 | 132 | - (uint64_t)version 133 | { 134 | return 201499000000000; 135 | } 136 | 137 | - (BOOL)migrateDatabase:(FMDatabase *)database error:(out NSError *__autoreleasing *)error 138 | { 139 | // Do something awesome 140 | return YES; 141 | } 142 | 143 | @end 144 | ``` 145 | 146 | When classes conforming to the `FMDBMigrating` protocol are added to the project they will be discovered by `FMDBMigrationManager` and considered for migration. 147 | 148 | ### Migrating a Database 149 | 150 | ```objc 151 | FMDBMigrationManager *manager = [FMDBMigrationManager managerWithDatabaseAtPath:@"path/to/your/DB.sqlite" migrationsBundle:[NSBundle mainBundle]]; 152 | NSError *error = nil; 153 | BOOL success = [manager migrateDatabaseToVersion:UINT64_MAX progress:nil error:&error]; 154 | ``` 155 | 156 | ### Inspecting Schema State 157 | 158 | The `FMDBMigrationManager` includes a number of methods for investigating the state of your database. Here's a quick tour: 159 | 160 | ```objc 161 | FMDBMigrationManager *manager = [FMDBMigrationManager managerWithDatabaseAtPath:@"path/to/your/DB.sqlite" migrationsBundle:[NSBundle mainBundle]]; 162 | NSLog(@"Has `schema_migrations` table?: %@", manager.hasMigrationsTable ? @"YES" : @"NO"); 163 | NSLog(@"Origin Version: %llu", manager.originVersion); 164 | NSLog(@"Current version: %llu", manager.currentVersion); 165 | NSLog(@"All migrations: %@", manager.migrations); 166 | NSLog(@"Applied versions: %@", manager.appliedVersions); 167 | NSLog(@"Pending versions: %@", manager.pendingVersions); 168 | ``` 169 | 170 | ## Installation 171 | 172 | FMDBMigrationManager is lightweight and depends only on SQLite and FMDB. As such, the library can be trivially be installed into any Cocoa project by directly adding the 173 | source code, linking against libsqlite, and including FMDB. Despite this fact, we recommend installing via CocoaPods as it provides modularity and easy version management. 174 | 175 | ### Via CocoaPods 176 | 177 | The recommended approach for installing FMDBMigrationManager is via the [CocoaPods](http://cocoapods.org/) package manager, as it provides flexible dependency management and dead simple installation. For best results, it is recommended that you install via CocoaPods **>= 0.31.0** using Git **>= 1.8.0** installed via Homebrew. 178 | 179 | Install CocoaPods if not already available: 180 | 181 | ``` bash 182 | $ [sudo] gem install cocoapods 183 | $ pod setup 184 | ``` 185 | 186 | Change to the directory of your Xcode project, and Create and Edit your Podfile and add FMDBMigrationManager: 187 | 188 | ``` bash 189 | $ cd /path/to/MyProject 190 | $ touch Podfile 191 | $ edit Podfile 192 | platform :ios, '5.0' 193 | # Or platform :osx, '10.7' 194 | pod 'FMDBMigrationManager' 195 | ``` 196 | 197 | Install into your project: 198 | 199 | ``` bash 200 | $ pod install 201 | ``` 202 | 203 | Open your project in Xcode from the .xcworkspace file (not the usual project file) 204 | 205 | ``` bash 206 | $ open MyProject.xcworkspace 207 | ``` 208 | 209 | ### Via Source Code 210 | 211 | Simply add `FMDBMigrationManager.h` and `FMDBMigrationManager.m` to your project and `#import "FMDBMigrationManager.h"`. 212 | 213 | ## Unit Tests 214 | 215 | FMDBMigrationManager is tested using the [Expecta](https://github.com/specta/Expecta) library of unit testing matchers. In order to run the tests, you must do the following: 216 | 217 | 1. Install the dependencies via CocoaPods: `pod install` 218 | 1. Open the workspace: `open FMDBMigrationManager.xcworkspace` 219 | 1. Run the tests via the **Product** menu > **Test** 220 | 221 | Alternately, you can run the tests on the commandline by installing the Ruby Gem dependencies. FMDBMigrationManager uses the [xctasks](http://github.com/layerhq/xctasks) Gem 222 | to expose CLI automation on top of [Rake](https://github.com/jimweirich/rake). To run the tests on the CLI: 223 | 224 | 1. Install the dependencies: `bundle install` 225 | 1. Invoke Rake: `bundle exec rake test` 226 | 227 | The Rake tasks are used to drive the continuous integration via Travis CI (see [.travis.yml]()). 228 | 229 | ## Credits 230 | 231 | FMDBMigrationManager was lovingly crafted in San Francisco by Blake Watters during his work on [Layer](http://layer.com). At Layer, we are building the Communications Layer 232 | for the Internet. We value, support, and create works of Open Source engineering excellence. 233 | 234 | Blake Watters 235 | 236 | - http://github.com/blakewatters 237 | - http://twitter.com/blakewatters 238 | - blakewatters@gmail.com 239 | 240 | ## License 241 | 242 | FMDBMigrationManager is available under the Apache 2 License. See the LICENSE file for more info. 243 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMDB.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDB.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMDatabase.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabase.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabaseAdditions.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabasePool.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabaseQueue.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDB/FMResultSet.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMResultSet.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Private/FMDBMigrationManager/FMDBMigrationManager.h: -------------------------------------------------------------------------------- 1 | ../../../FMDBMigrationManager/Code/FMDBMigrationManager.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMDB.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDB.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMDatabase.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabase.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabaseAdditions.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabasePool.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMDatabaseQueue.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDB/FMResultSet.h: -------------------------------------------------------------------------------- 1 | ../../../FMDB/src/fmdb/FMResultSet.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Headers/Public/FMDBMigrationManager/FMDBMigrationManager.h: -------------------------------------------------------------------------------- 1 | ../../../FMDBMigrationManager/Code/FMDBMigrationManager.h -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FMDB (2.6.2): 3 | - FMDB/standard (= 2.6.2) 4 | - FMDB/standard (2.6.2) 5 | - FMDBMigrationManager (1.4.1): 6 | - FMDBMigrationManager/System (= 1.4.1) 7 | - FMDBMigrationManager/System (1.4.1): 8 | - FMDB/standard (>= 2.3) 9 | 10 | DEPENDENCIES: 11 | - FMDB (~> 2.6.2) 12 | - FMDBMigrationManager (~> 1.4.1) 13 | 14 | SPEC CHECKSUMS: 15 | FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a 16 | FMDBMigrationManager: d52007f328ea0665e8985ca8a33500707aef084f 17 | 18 | PODFILE CHECKSUM: 6925e85e19fee5f7f41b9efe1edd39accccc07a4 19 | 20 | COCOAPODS: 1.2.0 21 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Pods.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/FMDB.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Pods.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/FMDBMigrationManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Pods.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/Pods-FMDBMigrationManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Pods.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/Pods-FMDBMigrationManagerTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Pods.xcodeproj/xcuserdata/alan.xcuserdatad/xcschemes/Pods-FMDBMigrationManagerUITests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDB/FMDB-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FMDB : NSObject 3 | @end 4 | @implementation PodsDummy_FMDB 5 | @end 6 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDB/FMDB-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDB/FMDB.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FMDB 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FMDB" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 4 | OTHER_LDFLAGS = -l"sqlite3" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FMDB 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDBMigrationManager/FMDBMigrationManager-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FMDBMigrationManager : NSObject 3 | @end 4 | @implementation PodsDummy_FMDBMigrationManager 5 | @end 6 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDBMigrationManager/FMDBMigrationManager-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/FMDBMigrationManager/FMDBMigrationManager.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FMDBMigrationManager" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FMDBMigrationManager 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## FMDB 5 | 6 | If you are using FMDB in your project, I'd love to hear about it. Let Gus know 7 | by sending an email to gus@flyingmeat.com. 8 | 9 | And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you 10 | might consider purchasing a drink of their choosing if FMDB has been useful to 11 | you. 12 | 13 | Finally, and shortly, this is the MIT License. 14 | 15 | Copyright (c) 2008-2014 Flying Meat Inc. 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy 18 | of this software and associated documentation files (the "Software"), to deal 19 | in the Software without restriction, including without limitation the rights 20 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | copies of the Software, and to permit persons to whom the Software is 22 | furnished to do so, subject to the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be included in 25 | all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 33 | THE SOFTWARE. 34 | 35 | ## FMDBMigrationManager 36 | 37 | Apache License 38 | Version 2.0, January 2004 39 | http://www.apache.org/licenses/ 40 | 41 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 42 | 43 | 1. Definitions. 44 | 45 | "License" shall mean the terms and conditions for use, reproduction, and 46 | distribution as defined by Sections 1 through 9 of this document. 47 | 48 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 49 | owner that is granting the License. 50 | 51 | "Legal Entity" shall mean the union of the acting entity and all other entities 52 | that control, are controlled by, or are under common control with that entity. 53 | For the purposes of this definition, "control" means (i) the power, direct or 54 | indirect, to cause the direction or management of such entity, whether by 55 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 56 | outstanding shares, or (iii) beneficial ownership of such entity. 57 | 58 | "You" (or "Your") shall mean an individual or Legal Entity exercising 59 | permissions granted by this License. 60 | 61 | "Source" form shall mean the preferred form for making modifications, including 62 | but not limited to software source code, documentation source, and configuration 63 | files. 64 | 65 | "Object" form shall mean any form resulting from mechanical transformation or 66 | translation of a Source form, including but not limited to compiled object code, 67 | generated documentation, and conversions to other media types. 68 | 69 | "Work" shall mean the work of authorship, whether in Source or Object form, made 70 | available under the License, as indicated by a copyright notice that is included 71 | in or attached to the work (an example is provided in the Appendix below). 72 | 73 | "Derivative Works" shall mean any work, whether in Source or Object form, that 74 | is based on (or derived from) the Work and for which the editorial revisions, 75 | annotations, elaborations, or other modifications represent, as a whole, an 76 | original work of authorship. For the purposes of this License, Derivative Works 77 | shall not include works that remain separable from, or merely link (or bind by 78 | name) to the interfaces of, the Work and Derivative Works thereof. 79 | 80 | "Contribution" shall mean any work of authorship, including the original version 81 | of the Work and any modifications or additions to that Work or Derivative Works 82 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 83 | by the copyright owner or by an individual or Legal Entity authorized to submit 84 | on behalf of the copyright owner. For the purposes of this definition, 85 | "submitted" means any form of electronic, verbal, or written communication sent 86 | to the Licensor or its representatives, including but not limited to 87 | communication on electronic mailing lists, source code control systems, and 88 | issue tracking systems that are managed by, or on behalf of, the Licensor for 89 | the purpose of discussing and improving the Work, but excluding communication 90 | that is conspicuously marked or otherwise designated in writing by the copyright 91 | owner as "Not a Contribution." 92 | 93 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 94 | of whom a Contribution has been received by Licensor and subsequently 95 | incorporated within the Work. 96 | 97 | 2. Grant of Copyright License. 98 | 99 | Subject to the terms and conditions of this License, each Contributor hereby 100 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 101 | irrevocable copyright license to reproduce, prepare Derivative Works of, 102 | publicly display, publicly perform, sublicense, and distribute the Work and such 103 | Derivative Works in Source or Object form. 104 | 105 | 3. Grant of Patent License. 106 | 107 | Subject to the terms and conditions of this License, each Contributor hereby 108 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 109 | irrevocable (except as stated in this section) patent license to make, have 110 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 111 | such license applies only to those patent claims licensable by such Contributor 112 | that are necessarily infringed by their Contribution(s) alone or by combination 113 | of their Contribution(s) with the Work to which such Contribution(s) was 114 | submitted. If You institute patent litigation against any entity (including a 115 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 116 | Contribution incorporated within the Work constitutes direct or contributory 117 | patent infringement, then any patent licenses granted to You under this License 118 | for that Work shall terminate as of the date such litigation is filed. 119 | 120 | 4. Redistribution. 121 | 122 | You may reproduce and distribute copies of the Work or Derivative Works thereof 123 | in any medium, with or without modifications, and in Source or Object form, 124 | provided that You meet the following conditions: 125 | 126 | You must give any other recipients of the Work or Derivative Works a copy of 127 | this License; and 128 | You must cause any modified files to carry prominent notices stating that You 129 | changed the files; and 130 | You must retain, in the Source form of any Derivative Works that You distribute, 131 | all copyright, patent, trademark, and attribution notices from the Source form 132 | of the Work, excluding those notices that do not pertain to any part of the 133 | Derivative Works; and 134 | If the Work includes a "NOTICE" text file as part of its distribution, then any 135 | Derivative Works that You distribute must include a readable copy of the 136 | attribution notices contained within such NOTICE file, excluding those notices 137 | that do not pertain to any part of the Derivative Works, in at least one of the 138 | following places: within a NOTICE text file distributed as part of the 139 | Derivative Works; within the Source form or documentation, if provided along 140 | with the Derivative Works; or, within a display generated by the Derivative 141 | Works, if and wherever such third-party notices normally appear. The contents of 142 | the NOTICE file are for informational purposes only and do not modify the 143 | License. You may add Your own attribution notices within Derivative Works that 144 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 145 | provided that such additional attribution notices cannot be construed as 146 | modifying the License. 147 | You may add Your own copyright statement to Your modifications and may provide 148 | additional or different license terms and conditions for use, reproduction, or 149 | distribution of Your modifications, or for any such Derivative Works as a whole, 150 | provided Your use, reproduction, and distribution of the Work otherwise complies 151 | with the conditions stated in this License. 152 | 153 | 5. Submission of Contributions. 154 | 155 | Unless You explicitly state otherwise, any Contribution intentionally submitted 156 | for inclusion in the Work by You to the Licensor shall be under the terms and 157 | conditions of this License, without any additional terms or conditions. 158 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 159 | any separate license agreement you may have executed with Licensor regarding 160 | such Contributions. 161 | 162 | 6. Trademarks. 163 | 164 | This License does not grant permission to use the trade names, trademarks, 165 | service marks, or product names of the Licensor, except as required for 166 | reasonable and customary use in describing the origin of the Work and 167 | reproducing the content of the NOTICE file. 168 | 169 | 7. Disclaimer of Warranty. 170 | 171 | Unless required by applicable law or agreed to in writing, Licensor provides the 172 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 173 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 174 | including, without limitation, any warranties or conditions of TITLE, 175 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 176 | solely responsible for determining the appropriateness of using or 177 | redistributing the Work and assume any risks associated with Your exercise of 178 | permissions under this License. 179 | 180 | 8. Limitation of Liability. 181 | 182 | In no event and under no legal theory, whether in tort (including negligence), 183 | contract, or otherwise, unless required by applicable law (such as deliberate 184 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 185 | liable to You for damages, including any direct, indirect, special, incidental, 186 | or consequential damages of any character arising as a result of this License or 187 | out of the use or inability to use the Work (including but not limited to 188 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 189 | any and all other commercial damages or losses), even if such Contributor has 190 | been advised of the possibility of such damages. 191 | 192 | 9. Accepting Warranty or Additional Liability. 193 | 194 | While redistributing the Work or Derivative Works thereof, You may choose to 195 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 196 | other liability obligations and/or rights consistent with this License. However, 197 | in accepting such obligations, You may act only on Your own behalf and on Your 198 | sole responsibility, not on behalf of any other Contributor, and only if You 199 | agree to indemnify, defend, and hold each Contributor harmless for any liability 200 | incurred by, or claims asserted against, such Contributor by reason of your 201 | accepting any such warranty or additional liability. 202 | 203 | END OF TERMS AND CONDITIONS 204 | 205 | APPENDIX: How to apply the Apache License to your work 206 | 207 | To apply the Apache License to your work, attach the following boilerplate 208 | notice, with the fields enclosed by brackets "[]" replaced with your own 209 | identifying information. (Don't include the brackets!) The text should be 210 | enclosed in the appropriate comment syntax for the file format. We also 211 | recommend that a file or class name and description of purpose be included on 212 | the same "printed page" as the copyright notice for easier identification within 213 | third-party archives. 214 | 215 | Copyright [yyyy] [name of copyright owner] 216 | 217 | Licensed under the Apache License, Version 2.0 (the "License"); 218 | you may not use this file except in compliance with the License. 219 | You may obtain a copy of the License at 220 | 221 | http://www.apache.org/licenses/LICENSE-2.0 222 | 223 | Unless required by applicable law or agreed to in writing, software 224 | distributed under the License is distributed on an "AS IS" BASIS, 225 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 226 | See the License for the specific language governing permissions and 227 | limitations under the License. 228 | 229 | Generated by CocoaPods - https://cocoapods.org 230 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | If you are using FMDB in your project, I'd love to hear about it. Let Gus know 18 | by sending an email to gus@flyingmeat.com. 19 | 20 | And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you 21 | might consider purchasing a drink of their choosing if FMDB has been useful to 22 | you. 23 | 24 | Finally, and shortly, this is the MIT License. 25 | 26 | Copyright (c) 2008-2014 Flying Meat Inc. 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy 29 | of this software and associated documentation files (the "Software"), to deal 30 | in the Software without restriction, including without limitation the rights 31 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | copies of the Software, and to permit persons to whom the Software is 33 | furnished to do so, subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in 36 | all copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 | THE SOFTWARE. 45 | License 46 | MIT 47 | Title 48 | FMDB 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | FooterText 54 | Apache License 55 | Version 2.0, January 2004 56 | http://www.apache.org/licenses/ 57 | 58 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 59 | 60 | 1. Definitions. 61 | 62 | "License" shall mean the terms and conditions for use, reproduction, and 63 | distribution as defined by Sections 1 through 9 of this document. 64 | 65 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 66 | owner that is granting the License. 67 | 68 | "Legal Entity" shall mean the union of the acting entity and all other entities 69 | that control, are controlled by, or are under common control with that entity. 70 | For the purposes of this definition, "control" means (i) the power, direct or 71 | indirect, to cause the direction or management of such entity, whether by 72 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 73 | outstanding shares, or (iii) beneficial ownership of such entity. 74 | 75 | "You" (or "Your") shall mean an individual or Legal Entity exercising 76 | permissions granted by this License. 77 | 78 | "Source" form shall mean the preferred form for making modifications, including 79 | but not limited to software source code, documentation source, and configuration 80 | files. 81 | 82 | "Object" form shall mean any form resulting from mechanical transformation or 83 | translation of a Source form, including but not limited to compiled object code, 84 | generated documentation, and conversions to other media types. 85 | 86 | "Work" shall mean the work of authorship, whether in Source or Object form, made 87 | available under the License, as indicated by a copyright notice that is included 88 | in or attached to the work (an example is provided in the Appendix below). 89 | 90 | "Derivative Works" shall mean any work, whether in Source or Object form, that 91 | is based on (or derived from) the Work and for which the editorial revisions, 92 | annotations, elaborations, or other modifications represent, as a whole, an 93 | original work of authorship. For the purposes of this License, Derivative Works 94 | shall not include works that remain separable from, or merely link (or bind by 95 | name) to the interfaces of, the Work and Derivative Works thereof. 96 | 97 | "Contribution" shall mean any work of authorship, including the original version 98 | of the Work and any modifications or additions to that Work or Derivative Works 99 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 100 | by the copyright owner or by an individual or Legal Entity authorized to submit 101 | on behalf of the copyright owner. For the purposes of this definition, 102 | "submitted" means any form of electronic, verbal, or written communication sent 103 | to the Licensor or its representatives, including but not limited to 104 | communication on electronic mailing lists, source code control systems, and 105 | issue tracking systems that are managed by, or on behalf of, the Licensor for 106 | the purpose of discussing and improving the Work, but excluding communication 107 | that is conspicuously marked or otherwise designated in writing by the copyright 108 | owner as "Not a Contribution." 109 | 110 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 111 | of whom a Contribution has been received by Licensor and subsequently 112 | incorporated within the Work. 113 | 114 | 2. Grant of Copyright License. 115 | 116 | Subject to the terms and conditions of this License, each Contributor hereby 117 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 118 | irrevocable copyright license to reproduce, prepare Derivative Works of, 119 | publicly display, publicly perform, sublicense, and distribute the Work and such 120 | Derivative Works in Source or Object form. 121 | 122 | 3. Grant of Patent License. 123 | 124 | Subject to the terms and conditions of this License, each Contributor hereby 125 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 126 | irrevocable (except as stated in this section) patent license to make, have 127 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 128 | such license applies only to those patent claims licensable by such Contributor 129 | that are necessarily infringed by their Contribution(s) alone or by combination 130 | of their Contribution(s) with the Work to which such Contribution(s) was 131 | submitted. If You institute patent litigation against any entity (including a 132 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 133 | Contribution incorporated within the Work constitutes direct or contributory 134 | patent infringement, then any patent licenses granted to You under this License 135 | for that Work shall terminate as of the date such litigation is filed. 136 | 137 | 4. Redistribution. 138 | 139 | You may reproduce and distribute copies of the Work or Derivative Works thereof 140 | in any medium, with or without modifications, and in Source or Object form, 141 | provided that You meet the following conditions: 142 | 143 | You must give any other recipients of the Work or Derivative Works a copy of 144 | this License; and 145 | You must cause any modified files to carry prominent notices stating that You 146 | changed the files; and 147 | You must retain, in the Source form of any Derivative Works that You distribute, 148 | all copyright, patent, trademark, and attribution notices from the Source form 149 | of the Work, excluding those notices that do not pertain to any part of the 150 | Derivative Works; and 151 | If the Work includes a "NOTICE" text file as part of its distribution, then any 152 | Derivative Works that You distribute must include a readable copy of the 153 | attribution notices contained within such NOTICE file, excluding those notices 154 | that do not pertain to any part of the Derivative Works, in at least one of the 155 | following places: within a NOTICE text file distributed as part of the 156 | Derivative Works; within the Source form or documentation, if provided along 157 | with the Derivative Works; or, within a display generated by the Derivative 158 | Works, if and wherever such third-party notices normally appear. The contents of 159 | the NOTICE file are for informational purposes only and do not modify the 160 | License. You may add Your own attribution notices within Derivative Works that 161 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 162 | provided that such additional attribution notices cannot be construed as 163 | modifying the License. 164 | You may add Your own copyright statement to Your modifications and may provide 165 | additional or different license terms and conditions for use, reproduction, or 166 | distribution of Your modifications, or for any such Derivative Works as a whole, 167 | provided Your use, reproduction, and distribution of the Work otherwise complies 168 | with the conditions stated in this License. 169 | 170 | 5. Submission of Contributions. 171 | 172 | Unless You explicitly state otherwise, any Contribution intentionally submitted 173 | for inclusion in the Work by You to the Licensor shall be under the terms and 174 | conditions of this License, without any additional terms or conditions. 175 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 176 | any separate license agreement you may have executed with Licensor regarding 177 | such Contributions. 178 | 179 | 6. Trademarks. 180 | 181 | This License does not grant permission to use the trade names, trademarks, 182 | service marks, or product names of the Licensor, except as required for 183 | reasonable and customary use in describing the origin of the Work and 184 | reproducing the content of the NOTICE file. 185 | 186 | 7. Disclaimer of Warranty. 187 | 188 | Unless required by applicable law or agreed to in writing, Licensor provides the 189 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 190 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 191 | including, without limitation, any warranties or conditions of TITLE, 192 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 193 | solely responsible for determining the appropriateness of using or 194 | redistributing the Work and assume any risks associated with Your exercise of 195 | permissions under this License. 196 | 197 | 8. Limitation of Liability. 198 | 199 | In no event and under no legal theory, whether in tort (including negligence), 200 | contract, or otherwise, unless required by applicable law (such as deliberate 201 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 202 | liable to You for damages, including any direct, indirect, special, incidental, 203 | or consequential damages of any character arising as a result of this License or 204 | out of the use or inability to use the Work (including but not limited to 205 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 206 | any and all other commercial damages or losses), even if such Contributor has 207 | been advised of the possibility of such damages. 208 | 209 | 9. Accepting Warranty or Additional Liability. 210 | 211 | While redistributing the Work or Derivative Works thereof, You may choose to 212 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 213 | other liability obligations and/or rights consistent with this License. However, 214 | in accepting such obligations, You may act only on Your own behalf and on Your 215 | sole responsibility, not on behalf of any other Contributor, and only if You 216 | agree to indemnify, defend, and hold each Contributor harmless for any liability 217 | incurred by, or claims asserted against, such Contributor by reason of your 218 | accepting any such warranty or additional liability. 219 | 220 | END OF TERMS AND CONDITIONS 221 | 222 | APPENDIX: How to apply the Apache License to your work 223 | 224 | To apply the Apache License to your work, attach the following boilerplate 225 | notice, with the fields enclosed by brackets "[]" replaced with your own 226 | identifying information. (Don't include the brackets!) The text should be 227 | enclosed in the appropriate comment syntax for the file format. We also 228 | recommend that a file or class name and description of purpose be included on 229 | the same "printed page" as the copyright notice for easier identification within 230 | third-party archives. 231 | 232 | Copyright [yyyy] [name of copyright owner] 233 | 234 | Licensed under the Apache License, Version 2.0 (the "License"); 235 | you may not use this file except in compliance with the License. 236 | You may obtain a copy of the License at 237 | 238 | http://www.apache.org/licenses/LICENSE-2.0 239 | 240 | Unless required by applicable law or agreed to in writing, software 241 | distributed under the License is distributed on an "AS IS" BASIS, 242 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 243 | See the License for the specific language governing permissions and 244 | limitations under the License. 245 | 246 | License 247 | Apache2 248 | Title 249 | FMDBMigrationManager 250 | Type 251 | PSGroupSpecifier 252 | 253 | 254 | FooterText 255 | Generated by CocoaPods - https://cocoapods.org 256 | Title 257 | 258 | Type 259 | PSGroupSpecifier 260 | 261 | 262 | StringsTable 263 | Acknowledgements 264 | Title 265 | Acknowledgements 266 | 267 | 268 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_FMDBMigrationManager : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_FMDBMigrationManager 5 | @end 6 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | 80 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 83 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | fi 86 | rm -f "$RESOURCES_TO_COPY" 87 | 88 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 89 | then 90 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 91 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 92 | while read line; do 93 | if [[ $line != "${PODS_ROOT}*" ]]; then 94 | XCASSET_FILES+=("$line") 95 | fi 96 | done <<<"$OTHER_XCASSETS" 97 | 98 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | fi 100 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"FMDB" -l"FMDBMigrationManager" -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManager/Pods-FMDBMigrationManager.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"FMDB" -l"FMDBMigrationManager" -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_FMDBMigrationManagerTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_FMDBMigrationManagerTests 5 | @end 6 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | 80 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 83 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | fi 86 | rm -f "$RESOURCES_TO_COPY" 87 | 88 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 89 | then 90 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 91 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 92 | while read line; do 93 | if [[ $line != "${PODS_ROOT}*" ]]; then 94 | XCASSET_FILES+=("$line") 95 | fi 96 | done <<<"$OTHER_XCASSETS" 97 | 98 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | fi 100 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerTests/Pods-FMDBMigrationManagerTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_FMDBMigrationManagerUITests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_FMDBMigrationManagerUITests 5 | @end 6 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | 80 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 83 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | fi 86 | rm -f "$RESOURCES_TO_COPY" 87 | 88 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 89 | then 90 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 91 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 92 | while read line; do 93 | if [[ $line != "${PODS_ROOT}*" ]]; then 94 | XCASSET_FILES+=("$line") 95 | fi 96 | done <<<"$OTHER_XCASSETS" 97 | 98 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | fi 100 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /FMDBMigrationManager/Pods/Target Support Files/Pods-FMDBMigrationManagerUITests/Pods-FMDBMigrationManagerUITests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/FMDBMigrationManager" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/FMDBMigrationManager" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"sqlite3" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # How-To-Use-FMDBMigrationManager 2 | -------------------------------------------------------------------------------- /readme: -------------------------------------------------------------------------------- 1 | 1 2 | --------------------------------------------------------------------------------