├── .travis.yml ├── AFSQLManager.h ├── AFSQLManager.m ├── AFSQLManager.podspec ├── Demo ├── .DS_Store ├── AFSQLManager-Demo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── AFSQLManager-Demo.xccheckout │ │ └── xcuserdata │ │ │ ├── alvaro.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── crumflash.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── AFSQLManager-Demo.xcscheme │ └── xcuserdata │ │ ├── alvaro.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── crumflash.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── AFSQLManager-Demo │ ├── .DS_Store │ ├── AFSQLManager-Demo-Info.plist │ ├── AFSQLManager-Demo-Prefix.pch │ ├── AFSQLManager.h │ ├── AFSQLManager.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── ResultsViewController.h │ ├── ResultsViewController.m │ ├── ViewController.h │ ├── ViewController.m │ ├── caja.sql │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── main.m │ └── test.sqlite └── AFSQLManager-DemoTests │ ├── AFSQLManager-DemoTests-Info.plist │ ├── AFSQLManager_DemoTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── preview.gif /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | brefore_install: 3 | - brew update 4 | - brew install xctool 5 | script: xctool -project Demo/AFSQLManager-Demo.xcodeproj -scheme AFSQLManager-Demo -sdk iphonesimulator7.0 ONLY_ACTIVE_ARCH=NO TEST_AFTER_BUILD=YES clean build -------------------------------------------------------------------------------- /AFSQLManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFSQLManager.h 3 | // AFSQLManager 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AFSQLManager : NSObject 13 | 14 | typedef void (^statusBlock)(BOOL success, NSError *error); 15 | typedef void (^completionBlock)(NSArray *row, NSError *error, BOOL finished); 16 | 17 | +(instancetype)sharedManager; 18 | 19 | @property (nonatomic) sqlite3 *database; 20 | 21 | -(void)createDatabaseWithName:(NSString *)name openImmediately:(BOOL)open withStatusBlock:(statusBlock)status; 22 | -(void)openLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status; 23 | -(void)closeLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status; 24 | -(void)renameDatabaseWithName:(NSString *)originalName toName:(NSString *)newName andStatus:(statusBlock)status; 25 | -(void)deleteDatabaseWithName:(NSString *)name andStatus:(statusBlock)status; 26 | 27 | -(void)performQuery:(NSString *)query withBlock:(completionBlock)completion; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /AFSQLManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFSQLManager.m 3 | // AFSQLManager 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import "AFSQLManager.h" 10 | 11 | @interface AFSQLManager () 12 | 13 | @property (nonatomic, strong) NSDictionary *currentDbInfo; 14 | @end 15 | 16 | @implementation AFSQLManager 17 | 18 | +(instancetype)sharedManager { 19 | 20 | static AFSQLManager *sharedManager = nil; 21 | static dispatch_once_t onceToken; 22 | dispatch_once(&onceToken, ^{ 23 | sharedManager = [[self alloc]init]; 24 | }); 25 | 26 | return sharedManager; 27 | } 28 | 29 | -(void)createDatabaseWithName:(NSString *)name openImmediately:(BOOL)openImmediately withStatusBlock:(statusBlock)status { 30 | 31 | NSError *error = nil; 32 | [[NSData data]writeToFile:[[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]] options:NSDataWritingAtomic error:&error]; 33 | 34 | if (!error) { 35 | if (openImmediately) { 36 | [self openLocalDatabaseWithName:name andStatusBlock:^(BOOL success, NSError *error) { 37 | if (success) { 38 | _currentDbInfo = @{@"name": name}; 39 | } 40 | 41 | status(success, error); 42 | }]; 43 | } else { 44 | status(YES, nil); 45 | } 46 | } else { 47 | status(NO, error); 48 | } 49 | } 50 | 51 | -(void)openLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status { 52 | 53 | NSString *path = [[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]]; 54 | 55 | if (sqlite3_open([path UTF8String], &_database) != SQLITE_OK) { 56 | NSLog(@"Failed to open database!"); 57 | status(NO, nil); 58 | } else { 59 | NSLog(@"Database opened properly"); 60 | status(YES, nil); 61 | } 62 | } 63 | 64 | -(void)closeLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status { 65 | 66 | if (sqlite3_close(_database) == SQLITE_OK) { 67 | status(YES, nil); 68 | } else { 69 | 70 | } 71 | } 72 | 73 | -(void)renameDatabaseWithName:(NSString *)originalName toName:(NSString *)newName andStatus:(statusBlock)status { 74 | 75 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName]) { 76 | sqlite3_close(_database); 77 | } 78 | 79 | NSError *error; 80 | NSFileManager *fileManager = [NSFileManager defaultManager]; 81 | [fileManager moveItemAtPath:[[NSBundle mainBundle]pathForResource:[[originalName lastPathComponent]stringByDeletingPathExtension] ofType:[originalName pathExtension]] toPath:[[NSBundle mainBundle]pathForResource:[[newName lastPathComponent]stringByDeletingPathExtension] ofType:[newName pathExtension]] error:&error]; 82 | 83 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName] && !error) { 84 | [self openLocalDatabaseWithName:newName andStatusBlock:nil]; 85 | _currentDbInfo = @{@"name": newName}; 86 | status(YES, nil); 87 | } else if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName] && error) { 88 | [self openLocalDatabaseWithName:originalName andStatusBlock:nil]; 89 | status(YES, error); 90 | } 91 | } 92 | 93 | -(void)deleteDatabaseWithName:(NSString *)name andStatus:(statusBlock)status { 94 | 95 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:name]) { 96 | sqlite3_close(_database); 97 | } 98 | 99 | NSError *error; 100 | NSFileManager *fileManager = [NSFileManager defaultManager]; 101 | [fileManager removeItemAtPath:[[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]] error:&error]; 102 | 103 | if (!error) { 104 | status(YES, nil); 105 | _currentDbInfo = @{@"name": [NSNull null]}; 106 | } else { 107 | status(NO, error); 108 | [self openLocalDatabaseWithName:name andStatusBlock:nil]; 109 | } 110 | } 111 | 112 | -(void)performQuery:(NSString *)query withBlock:(completionBlock)completion { 113 | 114 | NSString *fixedQuery = [query stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 115 | 116 | sqlite3_stmt *statement; 117 | 118 | if (sqlite3_prepare_v2(_database, [fixedQuery UTF8String], -1, &statement, nil) == SQLITE_OK) { 119 | 120 | while (sqlite3_step(statement) == SQLITE_ROW) { 121 | 122 | NSMutableArray *row = [NSMutableArray array]; 123 | 124 | for (int i = 0; i < sqlite3_column_count(statement); i++) { 125 | 126 | [row addObject:((char *)sqlite3_column_text(statement, i)) ? [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] : [NSNull null]]; 127 | } 128 | 129 | if (completion) { 130 | completion(row, nil, NO); 131 | } 132 | } 133 | 134 | sqlite3_finalize(statement); 135 | completion(nil, nil, YES); 136 | } 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /AFSQLManager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "AFSQLManager" 4 | 5 | s.version = "1.0.1" 6 | 7 | s.summary = "SQL and SQLite manager for iOS." 8 | 9 | s.description = "SQL and SQLite database manage on iOS made easy. Create, open, rename and delete databases with AFSQLManager, a block-driven iOS SQL and SQLite manager class. Perform queries never has been that easy!" 10 | 11 | s.homepage = "https://github.com/AlvaroFranco/AFSQLManager" 12 | 13 | s.license = 'MIT' 14 | 15 | s.license = { :type => 'MIT', :file => 'LICENSE' } 16 | 17 | s.author = { "Alvaro Franco" => "alvarofrancoayala@gmail.com" } 18 | 19 | s.screenshot = 'https://s3.amazonaws.com/cocoacontrols_production/uploads/control_image/image/3496/preview-181__dragged_.png' 20 | 21 | s.source = { :git => "https://github.com/AlvaroFranco/AFSQLManager.git", :tag => 'v1.0.1' } 22 | 23 | s.source_files = 'AFSQLManager.h','AFSQLManager.m' 24 | 25 | s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libsqlite3' } 26 | 27 | s.requires_arc = true 28 | 29 | end 30 | -------------------------------------------------------------------------------- /Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/.DS_Store -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3840A73019661A1500AADB8C /* caja.sql in Resources */ = {isa = PBXBuildFile; fileRef = 3840A72F19661A1500AADB8C /* caja.sql */; }; 11 | A73B900E18FFF55E009CECF0 /* test.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = A77919F418FFECBA008FFC3A /* test.sqlite */; }; 12 | A74038AB18FFC523001D71DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AA18FFC523001D71DD /* Foundation.framework */; }; 13 | A74038AD18FFC523001D71DD /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AC18FFC523001D71DD /* CoreGraphics.framework */; }; 14 | A74038AF18FFC523001D71DD /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AE18FFC523001D71DD /* UIKit.framework */; }; 15 | A74038B518FFC523001D71DD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A74038B318FFC523001D71DD /* InfoPlist.strings */; }; 16 | A74038B718FFC523001D71DD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A74038B618FFC523001D71DD /* main.m */; }; 17 | A74038BB18FFC523001D71DD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A74038BA18FFC523001D71DD /* AppDelegate.m */; }; 18 | A74038BE18FFC523001D71DD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A74038BC18FFC523001D71DD /* Main.storyboard */; }; 19 | A74038C118FFC523001D71DD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A74038C018FFC523001D71DD /* ViewController.m */; }; 20 | A74038C318FFC523001D71DD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A74038C218FFC523001D71DD /* Images.xcassets */; }; 21 | A74038CA18FFC523001D71DD /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038C918FFC523001D71DD /* XCTest.framework */; }; 22 | A74038CB18FFC523001D71DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AA18FFC523001D71DD /* Foundation.framework */; }; 23 | A74038CC18FFC523001D71DD /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A74038AE18FFC523001D71DD /* UIKit.framework */; }; 24 | A74038D418FFC523001D71DD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A74038D218FFC523001D71DD /* InfoPlist.strings */; }; 25 | A74038D618FFC523001D71DD /* AFSQLManager_DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A74038D518FFC523001D71DD /* AFSQLManager_DemoTests.m */; }; 26 | A74038E118FFC541001D71DD /* AFSQLManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A74038E018FFC541001D71DD /* AFSQLManager.m */; }; 27 | A77919F318FFE657008FFC3A /* ResultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A77919F218FFE657008FFC3A /* ResultsViewController.m */; }; 28 | A77919F618FFECE4008FFC3A /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A77919F518FFECE4008FFC3A /* libsqlite3.dylib */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | A74038CD18FFC523001D71DD /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = A740389F18FFC522001D71DD /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = A74038A618FFC522001D71DD; 37 | remoteInfo = "AFSQLManager-Demo"; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 3840A72F19661A1500AADB8C /* caja.sql */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = caja.sql; sourceTree = ""; }; 43 | A74038A718FFC523001D71DD /* AFSQLManager-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AFSQLManager-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | A74038AA18FFC523001D71DD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 45 | A74038AC18FFC523001D71DD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 46 | A74038AE18FFC523001D71DD /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 47 | A74038B218FFC523001D71DD /* AFSQLManager-Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AFSQLManager-Demo-Info.plist"; sourceTree = ""; }; 48 | A74038B418FFC523001D71DD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 49 | A74038B618FFC523001D71DD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 50 | A74038B818FFC523001D71DD /* AFSQLManager-Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AFSQLManager-Demo-Prefix.pch"; sourceTree = ""; }; 51 | A74038B918FFC523001D71DD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | A74038BA18FFC523001D71DD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | A74038BD18FFC523001D71DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | A74038BF18FFC523001D71DD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 55 | A74038C018FFC523001D71DD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 56 | A74038C218FFC523001D71DD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 57 | A74038C818FFC523001D71DD /* AFSQLManager-DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFSQLManager-DemoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | A74038C918FFC523001D71DD /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 59 | A74038D118FFC523001D71DD /* AFSQLManager-DemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AFSQLManager-DemoTests-Info.plist"; sourceTree = ""; }; 60 | A74038D318FFC523001D71DD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 61 | A74038D518FFC523001D71DD /* AFSQLManager_DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFSQLManager_DemoTests.m; sourceTree = ""; }; 62 | A74038DF18FFC541001D71DD /* AFSQLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSQLManager.h; sourceTree = ""; }; 63 | A74038E018FFC541001D71DD /* AFSQLManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSQLManager.m; sourceTree = ""; }; 64 | A77919F118FFE657008FFC3A /* ResultsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultsViewController.h; sourceTree = ""; }; 65 | A77919F218FFE657008FFC3A /* ResultsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultsViewController.m; sourceTree = ""; }; 66 | A77919F418FFECBA008FFC3A /* test.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.sqlite; sourceTree = ""; }; 67 | A77919F518FFECE4008FFC3A /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | A74038A418FFC522001D71DD /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | A77919F618FFECE4008FFC3A /* libsqlite3.dylib in Frameworks */, 76 | A74038AD18FFC523001D71DD /* CoreGraphics.framework in Frameworks */, 77 | A74038AF18FFC523001D71DD /* UIKit.framework in Frameworks */, 78 | A74038AB18FFC523001D71DD /* Foundation.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | A74038C518FFC523001D71DD /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | A74038CA18FFC523001D71DD /* XCTest.framework in Frameworks */, 87 | A74038CC18FFC523001D71DD /* UIKit.framework in Frameworks */, 88 | A74038CB18FFC523001D71DD /* Foundation.framework in Frameworks */, 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | /* End PBXFrameworksBuildPhase section */ 93 | 94 | /* Begin PBXGroup section */ 95 | A710DE5F19001C9300F0977B /* Resources */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | A77919F418FFECBA008FFC3A /* test.sqlite */, 99 | 3840A72F19661A1500AADB8C /* caja.sql */, 100 | ); 101 | name = Resources; 102 | sourceTree = ""; 103 | }; 104 | A740389E18FFC522001D71DD = { 105 | isa = PBXGroup; 106 | children = ( 107 | A74038B018FFC523001D71DD /* AFSQLManager-Demo */, 108 | A74038CF18FFC523001D71DD /* AFSQLManager-DemoTests */, 109 | A74038A918FFC523001D71DD /* Frameworks */, 110 | A74038A818FFC523001D71DD /* Products */, 111 | ); 112 | sourceTree = ""; 113 | }; 114 | A74038A818FFC523001D71DD /* Products */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | A74038A718FFC523001D71DD /* AFSQLManager-Demo.app */, 118 | A74038C818FFC523001D71DD /* AFSQLManager-DemoTests.xctest */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | A74038A918FFC523001D71DD /* Frameworks */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | A77919F518FFECE4008FFC3A /* libsqlite3.dylib */, 127 | A74038AA18FFC523001D71DD /* Foundation.framework */, 128 | A74038AC18FFC523001D71DD /* CoreGraphics.framework */, 129 | A74038AE18FFC523001D71DD /* UIKit.framework */, 130 | A74038C918FFC523001D71DD /* XCTest.framework */, 131 | ); 132 | name = Frameworks; 133 | sourceTree = ""; 134 | }; 135 | A74038B018FFC523001D71DD /* AFSQLManager-Demo */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | A74038B918FFC523001D71DD /* AppDelegate.h */, 139 | A74038BA18FFC523001D71DD /* AppDelegate.m */, 140 | A74038BC18FFC523001D71DD /* Main.storyboard */, 141 | A74038BF18FFC523001D71DD /* ViewController.h */, 142 | A74038C018FFC523001D71DD /* ViewController.m */, 143 | A77919F118FFE657008FFC3A /* ResultsViewController.h */, 144 | A77919F218FFE657008FFC3A /* ResultsViewController.m */, 145 | A710DE5F19001C9300F0977B /* Resources */, 146 | A74038E218FFC545001D71DD /* AFSQLManager */, 147 | A74038C218FFC523001D71DD /* Images.xcassets */, 148 | A74038B118FFC523001D71DD /* Supporting Files */, 149 | ); 150 | path = "AFSQLManager-Demo"; 151 | sourceTree = ""; 152 | }; 153 | A74038B118FFC523001D71DD /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | A74038B218FFC523001D71DD /* AFSQLManager-Demo-Info.plist */, 157 | A74038B318FFC523001D71DD /* InfoPlist.strings */, 158 | A74038B618FFC523001D71DD /* main.m */, 159 | A74038B818FFC523001D71DD /* AFSQLManager-Demo-Prefix.pch */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | A74038CF18FFC523001D71DD /* AFSQLManager-DemoTests */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | A74038D518FFC523001D71DD /* AFSQLManager_DemoTests.m */, 168 | A74038D018FFC523001D71DD /* Supporting Files */, 169 | ); 170 | path = "AFSQLManager-DemoTests"; 171 | sourceTree = ""; 172 | }; 173 | A74038D018FFC523001D71DD /* Supporting Files */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | A74038D118FFC523001D71DD /* AFSQLManager-DemoTests-Info.plist */, 177 | A74038D218FFC523001D71DD /* InfoPlist.strings */, 178 | ); 179 | name = "Supporting Files"; 180 | sourceTree = ""; 181 | }; 182 | A74038E218FFC545001D71DD /* AFSQLManager */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | A74038DF18FFC541001D71DD /* AFSQLManager.h */, 186 | A74038E018FFC541001D71DD /* AFSQLManager.m */, 187 | ); 188 | name = AFSQLManager; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | A74038A618FFC522001D71DD /* AFSQLManager-Demo */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = A74038D918FFC523001D71DD /* Build configuration list for PBXNativeTarget "AFSQLManager-Demo" */; 197 | buildPhases = ( 198 | A74038A318FFC522001D71DD /* Sources */, 199 | A74038A418FFC522001D71DD /* Frameworks */, 200 | A74038A518FFC522001D71DD /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = "AFSQLManager-Demo"; 207 | productName = "AFSQLManager-Demo"; 208 | productReference = A74038A718FFC523001D71DD /* AFSQLManager-Demo.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | A74038C718FFC523001D71DD /* AFSQLManager-DemoTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = A74038DC18FFC523001D71DD /* Build configuration list for PBXNativeTarget "AFSQLManager-DemoTests" */; 214 | buildPhases = ( 215 | A74038C418FFC523001D71DD /* Sources */, 216 | A74038C518FFC523001D71DD /* Frameworks */, 217 | A74038C618FFC523001D71DD /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | A74038CE18FFC523001D71DD /* PBXTargetDependency */, 223 | ); 224 | name = "AFSQLManager-DemoTests"; 225 | productName = "AFSQLManager-DemoTests"; 226 | productReference = A74038C818FFC523001D71DD /* AFSQLManager-DemoTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | /* End PBXNativeTarget section */ 230 | 231 | /* Begin PBXProject section */ 232 | A740389F18FFC522001D71DD /* Project object */ = { 233 | isa = PBXProject; 234 | attributes = { 235 | LastUpgradeCheck = 0500; 236 | ORGANIZATIONNAME = AlvaroFranco; 237 | TargetAttributes = { 238 | A74038C718FFC523001D71DD = { 239 | TestTargetID = A74038A618FFC522001D71DD; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = A74038A218FFC522001D71DD /* Build configuration list for PBXProject "AFSQLManager-Demo" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = A740389E18FFC522001D71DD; 252 | productRefGroup = A74038A818FFC523001D71DD /* Products */; 253 | projectDirPath = ""; 254 | projectRoot = ""; 255 | targets = ( 256 | A74038A618FFC522001D71DD /* AFSQLManager-Demo */, 257 | A74038C718FFC523001D71DD /* AFSQLManager-DemoTests */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | A74038A518FFC522001D71DD /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | A74038C318FFC523001D71DD /* Images.xcassets in Resources */, 268 | A74038B518FFC523001D71DD /* InfoPlist.strings in Resources */, 269 | 3840A73019661A1500AADB8C /* caja.sql in Resources */, 270 | A74038BE18FFC523001D71DD /* Main.storyboard in Resources */, 271 | A73B900E18FFF55E009CECF0 /* test.sqlite in Resources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | A74038C618FFC523001D71DD /* Resources */ = { 276 | isa = PBXResourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | A74038D418FFC523001D71DD /* InfoPlist.strings in Resources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXSourcesBuildPhase section */ 286 | A74038A318FFC522001D71DD /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | A74038C118FFC523001D71DD /* ViewController.m in Sources */, 291 | A74038BB18FFC523001D71DD /* AppDelegate.m in Sources */, 292 | A74038B718FFC523001D71DD /* main.m in Sources */, 293 | A74038E118FFC541001D71DD /* AFSQLManager.m in Sources */, 294 | A77919F318FFE657008FFC3A /* ResultsViewController.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | A74038C418FFC523001D71DD /* Sources */ = { 299 | isa = PBXSourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | A74038D618FFC523001D71DD /* AFSQLManager_DemoTests.m in Sources */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | /* End PBXSourcesBuildPhase section */ 307 | 308 | /* Begin PBXTargetDependency section */ 309 | A74038CE18FFC523001D71DD /* PBXTargetDependency */ = { 310 | isa = PBXTargetDependency; 311 | target = A74038A618FFC522001D71DD /* AFSQLManager-Demo */; 312 | targetProxy = A74038CD18FFC523001D71DD /* PBXContainerItemProxy */; 313 | }; 314 | /* End PBXTargetDependency section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | A74038B318FFC523001D71DD /* InfoPlist.strings */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | A74038B418FFC523001D71DD /* en */, 321 | ); 322 | name = InfoPlist.strings; 323 | sourceTree = ""; 324 | }; 325 | A74038BC18FFC523001D71DD /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | A74038BD18FFC523001D71DD /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | A74038D218FFC523001D71DD /* InfoPlist.strings */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | A74038D318FFC523001D71DD /* en */, 337 | ); 338 | name = InfoPlist.strings; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | A74038D718FFC523001D71DD /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | GCC_C_LANGUAGE_STANDARD = gnu99; 364 | GCC_DYNAMIC_NO_PIC = NO; 365 | GCC_OPTIMIZATION_LEVEL = 0; 366 | GCC_PREPROCESSOR_DEFINITIONS = ( 367 | "DEBUG=1", 368 | "$(inherited)", 369 | ); 370 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 371 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 372 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 373 | GCC_WARN_UNDECLARED_SELECTOR = YES; 374 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 375 | GCC_WARN_UNUSED_FUNCTION = YES; 376 | GCC_WARN_UNUSED_VARIABLE = YES; 377 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 378 | ONLY_ACTIVE_ARCH = YES; 379 | SDKROOT = iphoneos; 380 | }; 381 | name = Debug; 382 | }; 383 | A74038D818FFC523001D71DD /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 389 | CLANG_CXX_LIBRARY = "libc++"; 390 | CLANG_ENABLE_MODULES = YES; 391 | CLANG_ENABLE_OBJC_ARC = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 400 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 401 | COPY_PHASE_STRIP = YES; 402 | ENABLE_NS_ASSERTIONS = NO; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 405 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 406 | GCC_WARN_UNDECLARED_SELECTOR = YES; 407 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 408 | GCC_WARN_UNUSED_FUNCTION = YES; 409 | GCC_WARN_UNUSED_VARIABLE = YES; 410 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 411 | SDKROOT = iphoneos; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | A74038DA18FFC523001D71DD /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | buildSettings = { 419 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 420 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 421 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 422 | GCC_PREFIX_HEADER = "AFSQLManager-Demo/AFSQLManager-Demo-Prefix.pch"; 423 | INFOPLIST_FILE = "AFSQLManager-Demo/AFSQLManager-Demo-Info.plist"; 424 | PRODUCT_NAME = "$(TARGET_NAME)"; 425 | WRAPPER_EXTENSION = app; 426 | }; 427 | name = Debug; 428 | }; 429 | A74038DB18FFC523001D71DD /* Release */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 434 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 435 | GCC_PREFIX_HEADER = "AFSQLManager-Demo/AFSQLManager-Demo-Prefix.pch"; 436 | INFOPLIST_FILE = "AFSQLManager-Demo/AFSQLManager-Demo-Info.plist"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | WRAPPER_EXTENSION = app; 439 | }; 440 | name = Release; 441 | }; 442 | A74038DD18FFC523001D71DD /* Debug */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 446 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AFSQLManager-Demo.app/AFSQLManager-Demo"; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(SDKROOT)/Developer/Library/Frameworks", 449 | "$(inherited)", 450 | "$(DEVELOPER_FRAMEWORKS_DIR)", 451 | ); 452 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 453 | GCC_PREFIX_HEADER = "AFSQLManager-Demo/AFSQLManager-Demo-Prefix.pch"; 454 | GCC_PREPROCESSOR_DEFINITIONS = ( 455 | "DEBUG=1", 456 | "$(inherited)", 457 | ); 458 | INFOPLIST_FILE = "AFSQLManager-DemoTests/AFSQLManager-DemoTests-Info.plist"; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | TEST_HOST = "$(BUNDLE_LOADER)"; 461 | WRAPPER_EXTENSION = xctest; 462 | }; 463 | name = Debug; 464 | }; 465 | A74038DE18FFC523001D71DD /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 469 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AFSQLManager-Demo.app/AFSQLManager-Demo"; 470 | FRAMEWORK_SEARCH_PATHS = ( 471 | "$(SDKROOT)/Developer/Library/Frameworks", 472 | "$(inherited)", 473 | "$(DEVELOPER_FRAMEWORKS_DIR)", 474 | ); 475 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 476 | GCC_PREFIX_HEADER = "AFSQLManager-Demo/AFSQLManager-Demo-Prefix.pch"; 477 | INFOPLIST_FILE = "AFSQLManager-DemoTests/AFSQLManager-DemoTests-Info.plist"; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | TEST_HOST = "$(BUNDLE_LOADER)"; 480 | WRAPPER_EXTENSION = xctest; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | A74038A218FFC522001D71DD /* Build configuration list for PBXProject "AFSQLManager-Demo" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | A74038D718FFC523001D71DD /* Debug */, 491 | A74038D818FFC523001D71DD /* Release */, 492 | ); 493 | defaultConfigurationIsVisible = 0; 494 | defaultConfigurationName = Release; 495 | }; 496 | A74038D918FFC523001D71DD /* Build configuration list for PBXNativeTarget "AFSQLManager-Demo" */ = { 497 | isa = XCConfigurationList; 498 | buildConfigurations = ( 499 | A74038DA18FFC523001D71DD /* Debug */, 500 | A74038DB18FFC523001D71DD /* Release */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | A74038DC18FFC523001D71DD /* Build configuration list for PBXNativeTarget "AFSQLManager-DemoTests" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | A74038DD18FFC523001D71DD /* Debug */, 509 | A74038DE18FFC523001D71DD /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | /* End XCConfigurationList section */ 515 | }; 516 | rootObject = A740389F18FFC522001D71DD /* Project object */; 517 | } 518 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/xcshareddata/AFSQLManager-Demo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 83D5F064-7673-41C4-91F2-0B68269E6ACB 9 | IDESourceControlProjectName 10 | AFSQLManager-Demo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 9CA81C6E-E483-4947-B20D-B9A53E6A00F6 14 | ssh://github.com/AlvaroFranco/AFSQLManager.git 15 | 16 | IDESourceControlProjectPath 17 | Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 9CA81C6E-E483-4947-B20D-B9A53E6A00F6 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/AlvaroFranco/AFSQLManager.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 9CA81C6E-E483-4947-B20D-B9A53E6A00F6 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 9CA81C6E-E483-4947-B20D-B9A53E6A00F6 36 | IDESourceControlWCCName 37 | AFSQLManager 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/xcuserdata/alvaro.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/xcuserdata/alvaro.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/xcuserdata/crumflash.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/AFSQLManager-Demo.xcodeproj/project.xcworkspace/xcuserdata/crumflash.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/xcshareddata/xcschemes/AFSQLManager-Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/xcuserdata/alvaro.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | A74038A618FFC522001D71DD 8 | 9 | primary 10 | 11 | 12 | A74038C718FFC523001D71DD 13 | 14 | primary 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/xcuserdata/crumflash.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo.xcodeproj/xcuserdata/crumflash.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFSQLManager-Demo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A74038A618FFC522001D71DD 16 | 17 | primary 18 | 19 | 20 | A74038C718FFC523001D71DD 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/AFSQLManager-Demo/.DS_Store -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AFSQLManager-Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.alvarofranco.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AFSQLManager-Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AFSQLManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFSQLManager.h 3 | // AFSQLManager 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AFSQLManager : NSObject 13 | 14 | typedef void (^statusBlock)(BOOL success, NSError *error); 15 | typedef void (^completionBlock)(NSArray *row, NSError *error, BOOL finished); 16 | 17 | +(instancetype)sharedManager; 18 | 19 | @property (nonatomic) sqlite3 *database; 20 | 21 | -(void)createDatabaseWithName:(NSString *)name openImmediately:(BOOL)open withStatusBlock:(statusBlock)status; 22 | -(void)openLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status; 23 | -(void)closeLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status; 24 | -(void)renameDatabaseWithName:(NSString *)originalName toName:(NSString *)newName andStatus:(statusBlock)status; 25 | -(void)deleteDatabaseWithName:(NSString *)name andStatus:(statusBlock)status; 26 | 27 | -(void)performQuery:(NSString *)query withBlock:(completionBlock)completion; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AFSQLManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFSQLManager.m 3 | // AFSQLManager 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import "AFSQLManager.h" 10 | 11 | @interface AFSQLManager () 12 | 13 | @property (nonatomic, strong) NSDictionary *currentDbInfo; 14 | @end 15 | 16 | @implementation AFSQLManager 17 | 18 | +(instancetype)sharedManager { 19 | 20 | static AFSQLManager *sharedManager = nil; 21 | static dispatch_once_t onceToken; 22 | dispatch_once(&onceToken, ^{ 23 | sharedManager = [[self alloc]init]; 24 | }); 25 | 26 | return sharedManager; 27 | } 28 | 29 | -(void)createDatabaseWithName:(NSString *)name openImmediately:(BOOL)openImmediately withStatusBlock:(statusBlock)status { 30 | 31 | NSError *error = nil; 32 | [[NSData data]writeToFile:[[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]] options:NSDataWritingAtomic error:&error]; 33 | 34 | if (!error) { 35 | if (openImmediately) { 36 | [self openLocalDatabaseWithName:name andStatusBlock:^(BOOL success, NSError *error) { 37 | if (success) { 38 | _currentDbInfo = @{@"name": name}; 39 | } 40 | 41 | status(success, error); 42 | }]; 43 | } else { 44 | status(YES, nil); 45 | } 46 | } else { 47 | status(NO, error); 48 | } 49 | } 50 | 51 | -(void)openLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status { 52 | 53 | NSString *path = [[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]]; 54 | 55 | if (sqlite3_open([path UTF8String], &_database) != SQLITE_OK) { 56 | NSLog(@"Failed to open database!"); 57 | status(NO, nil); 58 | } else { 59 | NSLog(@"Database opened properly"); 60 | status(YES, nil); 61 | } 62 | } 63 | 64 | -(void)closeLocalDatabaseWithName:(NSString *)name andStatusBlock:(statusBlock)status { 65 | 66 | if (sqlite3_close(_database) == SQLITE_OK) { 67 | status(YES, nil); 68 | } else { 69 | 70 | } 71 | } 72 | 73 | -(void)renameDatabaseWithName:(NSString *)originalName toName:(NSString *)newName andStatus:(statusBlock)status { 74 | 75 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName]) { 76 | sqlite3_close(_database); 77 | } 78 | 79 | NSError *error; 80 | NSFileManager *fileManager = [NSFileManager defaultManager]; 81 | [fileManager moveItemAtPath:[[NSBundle mainBundle]pathForResource:[[originalName lastPathComponent]stringByDeletingPathExtension] ofType:[originalName pathExtension]] toPath:[[NSBundle mainBundle]pathForResource:[[newName lastPathComponent]stringByDeletingPathExtension] ofType:[newName pathExtension]] error:&error]; 82 | 83 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName] && !error) { 84 | [self openLocalDatabaseWithName:newName andStatusBlock:nil]; 85 | _currentDbInfo = @{@"name": newName}; 86 | status(YES, nil); 87 | } else if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:originalName] && error) { 88 | [self openLocalDatabaseWithName:originalName andStatusBlock:nil]; 89 | status(YES, error); 90 | } 91 | } 92 | 93 | -(void)deleteDatabaseWithName:(NSString *)name andStatus:(statusBlock)status { 94 | 95 | if ([[_currentDbInfo objectForKey:@"name"]isEqualToString:name]) { 96 | sqlite3_close(_database); 97 | } 98 | 99 | NSError *error; 100 | NSFileManager *fileManager = [NSFileManager defaultManager]; 101 | [fileManager removeItemAtPath:[[NSBundle mainBundle]pathForResource:[[name lastPathComponent]stringByDeletingPathExtension] ofType:[name pathExtension]] error:&error]; 102 | 103 | if (!error) { 104 | status(YES, nil); 105 | _currentDbInfo = @{@"name": [NSNull null]}; 106 | } else { 107 | status(NO, error); 108 | [self openLocalDatabaseWithName:name andStatusBlock:nil]; 109 | } 110 | } 111 | 112 | -(void)performQuery:(NSString *)query withBlock:(completionBlock)completion { 113 | 114 | NSString *fixedQuery = [query stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 115 | 116 | sqlite3_stmt *statement; 117 | 118 | if (sqlite3_prepare_v2(_database, [fixedQuery UTF8String], -1, &statement, nil) == SQLITE_OK) { 119 | 120 | while (sqlite3_step(statement) == SQLITE_ROW) { 121 | 122 | NSMutableArray *row = [NSMutableArray array]; 123 | 124 | for (int i = 0; i < sqlite3_column_count(statement); i++) { 125 | 126 | [row addObject:((char *)sqlite3_column_text(statement, i)) ? [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] : [NSNull null]]; 127 | } 128 | 129 | if (completion) { 130 | completion(row, nil, NO); 131 | } 132 | } 133 | 134 | sqlite3_finalize(statement); 135 | completion(nil, nil, YES); 136 | } 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window.tintColor = [UIColor whiteColor]; 16 | // Override point for customization after application launch. 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application 21 | { 22 | // 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. 23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 24 | } 25 | 26 | - (void)applicationDidEnterBackground:(UIApplication *)application 27 | { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | - (void)applicationWillEnterForeground:(UIApplication *)application 33 | { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application 38 | { 39 | // 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. 40 | } 41 | 42 | - (void)applicationWillTerminate:(UIApplication *)application 43 | { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 33 | 40 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/ResultsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ResultsViewController.h 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ResultsViewController : UITableViewController 12 | 13 | @property (nonatomic, strong) NSArray *results; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/ResultsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ResultsViewController.m 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import "ResultsViewController.h" 10 | 11 | @interface ResultsViewController () 12 | 13 | @end 14 | 15 | @implementation ResultsViewController 16 | 17 | -(void)viewWillAppear:(BOOL)animated { 18 | [super viewWillAppear:animated]; 19 | 20 | [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent]; 21 | [self.navigationController setNavigationBarHidden:NO animated:YES]; 22 | } 23 | 24 | -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 25 | 26 | UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)]; 27 | [headerView setBackgroundColor:[UIColor colorWithRed:0.062745098 green:0.380392157 blue:1 alpha:0.7]]; 28 | 29 | UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 1, 200, 20)]; 30 | label.text = [NSString stringWithFormat:@"User %li",(long)section + 1]; 31 | label.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17]; 32 | label.textColor = [UIColor whiteColor]; 33 | [headerView addSubview:label]; 34 | 35 | return headerView; 36 | } 37 | 38 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 39 | return _results.count; 40 | } 41 | 42 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 43 | return [_results[section] count]; 44 | } 45 | 46 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 47 | 48 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 49 | 50 | cell.textLabel.text = [_results[indexPath.section] objectAtIndex:indexPath.row]; 51 | 52 | return cell; 53 | } 54 | 55 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 56 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (nonatomic, strong) IBOutlet UITextField *textField; 14 | @property (nonatomic, strong) IBOutlet UIButton *button; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "AFSQLManager.h" 11 | #import "ResultsViewController.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (nonatomic, strong) NSMutableArray *array; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | -(void)viewWillAppear:(BOOL)animated { 22 | [super viewWillAppear:animated]; 23 | 24 | [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent]; 25 | [self.navigationController setNavigationBarHidden:YES animated:YES]; 26 | } 27 | 28 | -(void)viewDidLoad { 29 | [super viewDidLoad]; 30 | 31 | [_button addTarget:self action:@selector(performQuery) forControlEvents:UIControlEventTouchUpInside]; 32 | 33 | [[AFSQLManager sharedManager]openLocalDatabaseWithName:@"test.sqlite" andStatusBlock:^(BOOL success, NSError *error) { 34 | if (error) { 35 | UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Oops" message:error.description delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 36 | [alertView show]; 37 | } 38 | }]; 39 | } 40 | 41 | -(void)performQuery { 42 | 43 | _array = [NSMutableArray array]; 44 | [[AFSQLManager sharedManager]performQuery:_textField.text withBlock:^(NSArray *row, NSError *error, BOOL finished) { 45 | 46 | if (!error) { 47 | 48 | if (!finished) { 49 | [_array addObject:row]; 50 | } else { 51 | [self performSegueWithIdentifier:@"PerformQuery" sender:self]; 52 | } 53 | } else { 54 | 55 | UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Oops" message:error.description delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 56 | [alertView show]; 57 | } 58 | }]; 59 | } 60 | 61 | -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 62 | 63 | if ([segue.identifier isEqualToString:@"PerformQuery"]) { 64 | ResultsViewController *resultsVC = segue.destinationViewController; 65 | resultsVC.results = _array; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/caja.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/AFSQLManager-Demo/caja.sql -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AFSQLManager-Demo 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-Demo/test.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/Demo/AFSQLManager-Demo/test.sqlite -------------------------------------------------------------------------------- /Demo/AFSQLManager-DemoTests/AFSQLManager-DemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.alvarofranco.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-DemoTests/AFSQLManager_DemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFSQLManager_DemoTests.m 3 | // AFSQLManager-DemoTests 4 | // 5 | // Created by Alvaro Franco on 4/17/14. 6 | // Copyright (c) 2014 AlvaroFranco. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFSQLManager_DemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AFSQLManager_DemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Demo/AFSQLManager-DemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Álvaro Franco 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AFSQLManager 2 | ============== 3 | 4 | [![Build Status](https://travis-ci.org/AlvaroFranco/AFSQLManager.svg?branch=v1.0)](https://travis-ci.org/AlvaroFranco/AFSQLManager) 5 | [![alt text](https://cocoapod-badges.herokuapp.com/v/AFSQLManager/badge.png "")]() 6 | [![alt text](https://cocoapod-badges.herokuapp.com/p/AFSQLManager/badge.png "")]() 7 | [![alt text](https://camo.githubusercontent.com/f513623dcee61532125032bbf1ddffda06ba17c7/68747470733a2f2f676f2d736869656c64732e6865726f6b756170702e636f6d2f6c6963656e73652d4d49542d626c75652e706e67 "")]() 8 | 9 | SQL and SQLite database manage on iOS made easy. Create, open, rename and delete databases with AFSQLManager, a block-driven iOS SQL and SQLite manager class. Perform queries never has been that easy! 10 | 11 | ![alt text](https://raw.github.com/AlvaroFranco/AFSQLManager/master/preview.gif "Preview") 12 | 13 | ##Installation 14 | 15 | AFSQLManager is available on CocoaPods so you can get it by adding this line to your Podfile: 16 | 17 | pod 'AFSQLManager', '~> 1.0' 18 | 19 | If you don't use CocoaPods, you will have to import these files into your project: 20 | 21 | AFSQLManager.h 22 | AFSQLManager.m 23 | 24 | Also, make sure to import ```libsqlite3.dylib``` library on the Frameworks section! 25 | 26 | ##Usage 27 | 28 | First of all, make sure that you have imported the main class into the class where you are going to play audio. 29 | 30 | #import "AFSQLManager.h" 31 | 32 | ###Managing the databases files 33 | 34 | #####Create a brand new database 35 | 36 | To create a new file, use the method ```-createDatabaseWithName:openImmediately:withStatusBlock:```. Let's say you need to create a database called nyancat.sqlite: 37 | 38 | [[AFSQLManager sharedManager]createDatabaseWithName:@"nyancat.sqlite" openInmediately:YES withStatusBlock:^(BOOL success, NSError *error) { 39 | 40 | if (success) { 41 | // Yeah, database created successfully 42 | } else { 43 | NSLog(@"%@",error); 44 | } 45 | }]; 46 | 47 | You can also choose if the database should be opened once it's created. 48 | 49 | #####Open and closing an existing database 50 | 51 | If you already have your database imported into your project, start using that database is as simple as use ```-openLocalDatabaseWithName:andStatusBlock:``` 52 | 53 | [[AFSQLManager sharedManager]openLocalDatabaseWithName:@"my-awesome-db.sql" andStatusBlock:^(BOOL success, NSError *error) { 54 | 55 | // Handle the error to check it has been opened properly 56 | }]; 57 | 58 | To close it, call ```-closeLocalDatabaseWithName:andStatusBlock:``` 59 | 60 | #####Renaming and deleting 61 | 62 | To rename and delete your database, we have these two methods: 63 | 64 | -renameDatabaseWithName:toName:andStatus: 65 | -deleteDatabaseWithName:andStatus: 66 | 67 | ###Performing queries 68 | 69 | Queries are performed with the method ```-performQuery:withBlock:```, which is also block-based. 70 | 71 | For example, if you want to look for all the items inside a table (which query is ```SELECT * FROM tableName```), the code would be: 72 | 73 | [[AFSQLManager sharedManager]performQuery:@"SELECT * FROM tableName" withBlock:^(NSArray *row, NSError *error, BOOL finished) { 74 | 75 | // Handle each row 76 | }]; 77 | 78 | The block will be executed on every row, and it will contain an array (```row```) with each column in that row. 79 | 80 | ##License 81 | AFSQLManager is under MIT license so feel free to use it! 82 | 83 | ##Author 84 | Made by Alvaro Franco. If you have any question, feel free to drop me a line at [alvarofrancoayala@gmail.com](mailto:alvarofrancoayala@gmail.com) 85 | -------------------------------------------------------------------------------- /preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlvaroFranco/AFSQLManager/b961a7419c5fa6868cd6fc531f7d23d1a64df579/preview.gif --------------------------------------------------------------------------------