├── DDSQLiteKit
├── Images.xcassets
│ ├── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── Device.m
├── AddViewController.h
├── AppDelegate.h
├── main.m
├── TableViewController.h
├── SQLitePersistentObject
│ ├── NSString-NumberStuff.h
│ ├── NSObject-MissingKV.h
│ ├── UIColor-SQLitePersistentObject.h
│ ├── NSObject-MissingKV.m
│ ├── NSString-SQLiteColumnName.h
│ ├── NSObject-ClassName.h
│ ├── NSMutableData-SQLitePersistence.m
│ ├── UIColor-SQLitePersistentObject.m
│ ├── NSString-UppercaseFirst.h
│ ├── NSMutableData-SQLitePersistence.h
│ ├── NSObject-ClassName.m
│ ├── UIImage-SQLitePersistence.h
│ ├── NSString-SQLitePersistence.m
│ ├── NSData-SQLitePersistence.m
│ ├── UIImage-SQLitePersistence.m
│ ├── NSData-SQLitePersistence.h
│ ├── NSString-SQLitePersistence.h
│ ├── NSNumber-SQLitePersistence.h
│ ├── NSString-UppercaseFirst.m
│ ├── NSDate-SQLitePersistence.h
│ ├── NSNumber-SQLitePersistence.m
│ ├── NSObject-SQLitePersistence.m
│ ├── NSMutableArray-MultipleSort.h
│ ├── NSString-SQLiteColumnName.m
│ ├── NSDate-SQLitePersistence.m
│ ├── SQLiteInstanceManager.h
│ ├── NSString-NumberStuff.m
│ ├── NSMutableArray-MultipleSort.m
│ ├── NSObject-SQLitePersistence.h
│ ├── SQLiteInstanceManager.m
│ └── SQLitePersistentObject.h
├── Device.h
├── DDSqliteViewController.h
├── Info.plist
├── AddViewController.m
├── AppDelegate.m
├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── TableViewController.m
└── DDSqliteViewController.m
├── DDSQLiteKit.xcodeproj
├── xcuserdata
│ └── macpro.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── DDSQLiteKit.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── macpro.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── project.pbxproj
├── .gitignore
├── SQLitePersistentObject.podspec
├── DDSQLiteKitTests
├── Info.plist
└── DDSQLiteKitTests.m
├── LICENSE
└── README.md
/DDSQLiteKit/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/xcuserdata/macpro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/project.xcworkspace/xcuserdata/macpro.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openboy2012/DDSQLiteKit/HEAD/DDSQLiteKit.xcodeproj/project.xcworkspace/xcuserdata/macpro.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/DDSQLiteKit/Device.m:
--------------------------------------------------------------------------------
1 | //
2 | // Device.m
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import "Device.h"
10 |
11 | @implementation Device
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | _Store
2 | build/
3 | *.pbxuser
4 | !default.pbxuser
5 | *.mode1v3
6 | !default.mode1v3
7 | *.mode2v3
8 | !default.mode2v3
9 | *.perspectivev3
10 | !default.perspectivev3
11 | *.xcworkspace
12 | !default.xcworkspace
13 | xcuserdata
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 |
18 |
19 |
--------------------------------------------------------------------------------
/DDSQLiteKit/AddViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AddViewController : UIViewController
12 |
13 | @property (nonatomic, strong) NSDictionary *params;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/DDSQLiteKit/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. 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 |
--------------------------------------------------------------------------------
/DDSQLiteKit/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. 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 |
--------------------------------------------------------------------------------
/DDSQLiteKit/TableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // TableViewController.h
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern char * const ddkit_db_queue_name;
12 |
13 | extern dispatch_queue_t ddkit_db_read_queue();
14 |
15 |
16 | @interface TableViewController : UITableViewController
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-NumberStuff.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-NumberStuff.h
3 | // CashFlow
4 | //
5 | // Created by Jeff LaMarche on 11/6/08.
6 |
7 | #import
8 |
9 | @interface NSString(NumberStuff)
10 | - (BOOL)holdsFloatingPointValue;
11 | - (BOOL)holdsFloatingPointValueForLocale:(NSLocale *)locale;
12 | - (BOOL)holdsIntegerValue;
13 | + (id)formattedCurrencyStringWithValue:(float)inValue;
14 | @end
15 |
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/project.xcworkspace/xcuserdata/macpro.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/DDSQLiteKit/Device.h:
--------------------------------------------------------------------------------
1 | //
2 | // Device.h
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import "SQLitePersistentObject.h"
10 |
11 | @interface Device : SQLitePersistentObject
12 |
13 | @property (nonatomic, copy) NSString *name;
14 | @property (nonatomic, copy) NSString *modelName;
15 | @property (nonatomic, strong) NSNumber *price;
16 | @property (nonatomic, copy) NSString *system;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-MissingKV.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject-MissingKV.h
3 | // iContractor
4 | //
5 | // Created by Jeff LaMarche on 2/18/09.
6 | // Copyright 2009 Jeff LaMarche Consulting. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifdef TARGET_OS_IPHONE
12 | @interface NSObject(MissingKV)
13 | - (void)takeValuesFromDictionary:(NSDictionary *)properties;
14 | - (void)takeValue:(id)value forKey:(NSString *)key;
15 | @end
16 | #endif
17 |
--------------------------------------------------------------------------------
/DDSQLiteKit/DDSqliteViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DDSqliteViewController.h
3 | // DDKit
4 | //
5 | // Created by Diaoshu on 14-12-21.
6 | // Copyright (c) 2014年 Dejohn Dong. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // 版本号
12 | #ifndef OS_VERSION
13 | #define OS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
14 | #endif
15 |
16 | #define VERSION_GREATER(x) (OS_VERSION > x) ? 1 : 0
17 |
18 | @interface DDSqliteViewController : UIViewController
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/SQLitePersistentObject.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'SQLitePersistentObject'
3 | s.version = '0.3.2'
4 | s.license = 'MIT'
5 | s.summary = 'An ORM kit of object persistence use SQLite'
6 | s.homepage = 'https://github.com/openboy2012/DDSQLiteKit.git'
7 | s.author = { 'DeJohn Dong' => 'dongjia_9251@126.com' }
8 | s.source = { :git => 'https://github.com/openboy2012/DDSQLiteKit.git', :tag => s.version.to_s}
9 | s.ios.deployment_target = '5.1.1'
10 | s.osx.deployment_target = '10.7'
11 | s.source_files = 'DDSQLiteKit/SQLitePersistentObject/*.{h,m}'
12 | s.requires_arc = true
13 | s.library = 'sqlite3.0'
14 | end
15 |
16 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/UIColor-SQLitePersistentObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor-SQLitePersistentObject.h
3 | // KnitMinder
4 | //
5 | // Created by Paul Mietz Egli on 12/28/08.
6 | // Copyright 2008 Fullpower. All rights reserved.
7 | //
8 |
9 | #if (TARGET_OS_IPHONE)
10 | #import "NSObject-SQLitePersistence.h"
11 | #import
12 |
13 | @interface UIColor(SQLitePersistence)
14 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
15 | - (NSData *)sqlBlobRepresentationOfSelf;
16 | + (BOOL)canBeStoredInSQLite;
17 | + (NSString *)columnTypeForObjectStorage;
18 | + (BOOL)shouldBeStoredInBlob;
19 | @end
20 | #endif
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-MissingKV.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject-MissingKV.m
3 | // iContractor
4 | //
5 | // Created by Jeff LaMarche on 2/18/09.
6 | // Copyright 2009 Jeff LaMarche Consulting. All rights reserved.
7 | //
8 |
9 | #import "NSObject-MissingKV.h"
10 |
11 | #ifdef TARGET_OS_IPHONE
12 | @implementation NSObject(MissingKV)
13 | - (void)takeValuesFromDictionary:(NSDictionary *)properties
14 | {
15 | for (id oneKey in [properties allKeys])
16 | {
17 | id oneObject = [properties objectForKey:oneKey];
18 | [self setValue:oneObject forKey:oneKey];
19 | }
20 | }
21 | - (void)takeValue:(id)value forKey:(NSString *)key
22 | {
23 | [self setValue:value forKey:key];
24 | }
25 | @end
26 | #endif
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/xcuserdata/macpro.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | DDSQLiteKit.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 8E76A7061A81CBEC00352063
16 |
17 | primary
18 |
19 |
20 | 8E76A71F1A81CBEC00352063
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/DDSQLiteKit/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" : "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 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/DDSQLiteKitTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/DDSQLiteKit/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "8.0",
8 | "subtype" : "736h",
9 | "scale" : "3x"
10 | },
11 | {
12 | "orientation" : "portrait",
13 | "idiom" : "iphone",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "8.0",
16 | "subtype" : "667h",
17 | "scale" : "2x"
18 | },
19 | {
20 | "orientation" : "portrait",
21 | "idiom" : "iphone",
22 | "extent" : "full-screen",
23 | "minimum-system-version" : "7.0",
24 | "scale" : "2x"
25 | },
26 | {
27 | "orientation" : "portrait",
28 | "idiom" : "iphone",
29 | "extent" : "full-screen",
30 | "minimum-system-version" : "7.0",
31 | "subtype" : "retina4",
32 | "scale" : "2x"
33 | }
34 | ],
35 | "info" : {
36 | "version" : 1,
37 | "author" : "xcode"
38 | }
39 | }
--------------------------------------------------------------------------------
/DDSQLiteKitTests/DDSQLiteKitTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // DDSQLiteKitTests.m
3 | // DDSQLiteKitTests
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface DDSQLiteKitTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation DDSQLiteKitTests
17 |
18 | - (void)setUp {
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 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008-2015 SQLitePersistentObject (jeff_Lamarche@mac.com or dongjia_9251@126.com)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-SQLiteColumnName.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-SQLiteColumnName.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import
22 |
23 |
24 | @interface NSString(SQLiteColumnName)
25 | - (NSString *)stringAsSQLColumnName;
26 | - (NSString *)stringAsPropertyString;
27 | @end
28 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-ClassName.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------
2 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
3 | //
4 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
5 | // ----------------------------------------------------------------------
6 | // This code may be used without restriction in any software, commercial,
7 | // free, or otherwise. There are no attribution requirements, and no
8 | // requirement that you distribute your changes, although bugfixes and
9 | // enhancements are welcome.
10 | //
11 | // If you do choose to re-distribute the source code, you must retain the
12 | // copyright notice and this license information. I also request that you
13 | // place comments in to identify your changes.
14 | //
15 | // For information on how to use these classes, take a look at the
16 | // included Readme.txt file
17 | // ----------------------------------------------------------------------
18 |
19 | #if (TARGET_OS_IPHONE)
20 | #import
21 |
22 | /*!
23 | On the iPhone NSObject does not provide the className method.
24 | */
25 | @interface NSObject(ClassName)
26 | - (NSString *)className;
27 | + (NSString *)className;
28 | @end
29 | #endif
30 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSMutableData-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableData-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import "NSMutableData-SQLitePersistence.h"
22 |
23 |
24 | @implementation NSMutableData(SQLitePersistence)
25 | - (id)initWithSQLBlobRepresentation:(NSData *)data
26 | {
27 | return [self initWithData:data];
28 | }
29 | @end
30 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/UIColor-SQLitePersistentObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor-SQLitePersistentObject.m
3 | // KnitMinder
4 | //
5 | // Created by Paul Mietz Egli on 12/28/08.
6 | // Copyright 2008 Fullpower. All rights reserved.
7 | //
8 |
9 | #if (TARGET_OS_IPHONE)
10 | #import "UIColor-SQLitePersistentObject.h"
11 |
12 | #define kUIImageArchiverKey @"UIImage"
13 |
14 | @implementation UIColor(SQLitePersistence)
15 | + (id)objectWithSQLBlobRepresentation:(NSData *)data {
16 | if (data == nil || [data length] == 0)
17 | return nil;
18 |
19 | NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
20 | id ret = [unarchiver decodeObjectForKey:kUIImageArchiverKey];
21 | [unarchiver finishDecoding];
22 |
23 | return ret;
24 | }
25 | - (NSData *)sqlBlobRepresentationOfSelf {
26 | NSMutableData *data = [[NSMutableData alloc] init];
27 | NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
28 | [archiver encodeObject:self forKey:kUIImageArchiverKey];
29 | [archiver finishEncoding];
30 | return data;
31 | }
32 | + (BOOL)canBeStoredInSQLite {
33 | return YES;
34 | }
35 | + (NSString *)columnTypeForObjectStorage {
36 | return kSQLiteColumnTypeBlob;
37 | }
38 | + (BOOL)shouldBeStoredInBlob {
39 | return YES;
40 | }
41 | @end
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/DDSQLiteKit/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-UppercaseFirst.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-UppercaseFirst.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #if (TARGET_OS_MAC && ! (TARGET_OS_EMBEDDED || TARGET_OS_ASPEN || TARGET_OS_IPHONE))
21 | #import
22 | #else
23 | #import
24 | #endif
25 |
26 |
27 | @interface NSString(UppercaseFirst)
28 | - (NSString *) stringByUppercasingFirstLetter;
29 | - (NSString *) stringByLowercasingFirstLetter;
30 | @end
31 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSMutableData-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableData-SQLitePersistence.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import
21 | #import "NSObject-SQLitePersistence.h"
22 | #import "NSData-SQLitePersistence.h"
23 |
24 | @interface NSMutableData(SQLitePersistence)
25 | /*!
26 | This method initializes an NSData from blob pulled from the database.
27 | */
28 | - (id)initWithSQLBlobRepresentation:(NSData *)data;
29 | @end
30 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-ClassName.m:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------
2 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
3 | //
4 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
5 | // ----------------------------------------------------------------------
6 | // This code may be used without restriction in any software, commercial,
7 | // free, or otherwise. There are no attribution requirements, and no
8 | // requirement that you distribute your changes, although bugfixes and
9 | // enhancements are welcome.
10 | //
11 | // If you do choose to re-distribute the source code, you must retain the
12 | // copyright notice and this license information. I also request that you
13 | // place comments in to identify your changes.
14 | //
15 | // For information on how to use these classes, take a look at the
16 | // included Readme.txt file
17 | // ----------------------------------------------------------------------
18 |
19 | #if (TARGET_OS_IPHONE)
20 | #import "NSObject-ClassName.h"
21 | #import
22 |
23 | @implementation NSObject(ClassName)
24 | - (NSString *)className
25 | {
26 | return [NSString stringWithUTF8String:class_getName([self class])];
27 | }
28 | + (NSString *)className
29 | {
30 | return [NSString stringWithUTF8String:class_getName(self)];
31 | }
32 |
33 | @end
34 | #endif
35 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/UIImage-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | // UIImage-SQLitePersistence.h
2 | // ----------------------------------------------------------------------
3 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
4 | //
5 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
6 | // ----------------------------------------------------------------------
7 | // This code may be used without restriction in any software, commercial,
8 | // free, or otherwise. There are no attribution requirements, and no
9 | // requirement that you distribute your changes, although bugfixes and
10 | // enhancements are welcome.
11 | //
12 | // If you do choose to re-distribute the source code, you must retain the
13 | // copyright notice and this license information. I also request that you
14 | // place comments in to identify your changes.
15 | //
16 | // For information on how to use these classes, take a look at the
17 | // included Readme.txt file
18 | // ----------------------------------------------------------------------
19 | #if (TARGET_OS_IPHONE)
20 | #import
21 |
22 | @interface UIImage(SQLitePersistence)
23 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
24 | - (NSData *)sqlBlobRepresentationOfSelf;
25 | + (BOOL)canBeStoredInSQLite;
26 | + (NSString *)columnTypeForObjectStorage;
27 | + (BOOL)shouldBeStoredInBlob;
28 | @end
29 | #endif
--------------------------------------------------------------------------------
/DDSQLiteKit/AddViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import "AddViewController.h"
10 | #import "Device.h"
11 |
12 | @interface AddViewController (){
13 | Device *device;
14 | BOOL pageStillLoading;
15 | }
16 |
17 | @property (nonatomic, weak) IBOutlet UITextField *tfName;
18 | @property (nonatomic, weak) IBOutlet UITextField *tfModel;
19 | @property (nonatomic, weak) IBOutlet UITextField *tfPrice;
20 |
21 | @end
22 |
23 | @implementation AddViewController
24 |
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 | // Do any additional setup after loading the view, typically from a nib.
28 | device = self.params[@"device"];
29 | if(!device)
30 | device = [[Device alloc] init];
31 | else{
32 | self.tfModel.text = device.modelName;
33 | self.tfName.text = device.name;
34 | self.tfPrice.text = [NSString stringWithFormat:@"%@",device.price];
35 | }
36 | }
37 |
38 | - (void)didReceiveMemoryWarning {
39 | [super didReceiveMemoryWarning];
40 | // Dispose of any resources that can be recreated.
41 | }
42 |
43 | #pragma mark - Action Methods
44 |
45 | - (IBAction)add:(id)sender{
46 | device.name = self.tfName.text;
47 | device.modelName = self.tfModel.text;
48 | device.price = @([self.tfPrice.text integerValue]);
49 | [device save];
50 | [self.navigationController popViewControllerAnimated:YES];
51 |
52 | [self.tfPrice setHidden:YES];
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import "NSString-SQLitePersistence.h"
21 |
22 |
23 | @implementation NSString(SQLitePersistence)
24 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData
25 | {
26 | return columnData;
27 | }
28 | - (NSString *)sqlColumnRepresentationOfSelf
29 | {
30 | return self;
31 | }
32 | + (BOOL)canBeStoredInSQLite;
33 | {
34 | return YES;
35 | }
36 | + (NSString *)columnTypeForObjectStorage
37 | {
38 | return kSQLiteColumnTypeText;
39 | }
40 | + (BOOL)shouldBeStoredInBlob
41 | {
42 | return NO;
43 | }
44 | @end
45 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSData-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSData-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import "NSData-SQLitePersistence.h"
22 |
23 | @implementation NSData(SQLitePersistence)
24 |
25 | - (NSData *)sqlBlobRepresentationOfSelf
26 | {
27 | return self;
28 | }
29 | + (BOOL)canBeStoredInSQLite
30 | {
31 | return YES;
32 | }
33 | + (NSString *)columnTypeForObjectStorage
34 | {
35 | return kSQLiteColumnTypeText; // Look at using blob
36 | }
37 | + (BOOL)shouldBeStoredInBlob
38 | {
39 | return YES;
40 | }
41 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
42 | {
43 | // Simple pass through
44 | return data;
45 | }
46 | @end
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/UIImage-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | // UIImage-SQLitePersistence.h
2 | // ----------------------------------------------------------------------
3 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
4 | //
5 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
6 | // ----------------------------------------------------------------------
7 | // This code may be used without restriction in any software, commercial,
8 | // free, or otherwise. There are no attribution requirements, and no
9 | // requirement that you distribute your changes, although bugfixes and
10 | // enhancements are welcome.
11 | //
12 | // If you do choose to re-distribute the source code, you must retain the
13 | // copyright notice and this license information. I also request that you
14 | // place comments in to identify your changes.
15 | //
16 | // For information on how to use these classes, take a look at the
17 | // included Readme.txt file
18 | // ----------------------------------------------------------------------
19 | #if (TARGET_OS_IPHONE)
20 | #import "NSObject-SQLitePersistence.h"
21 |
22 | @implementation UIImage(SQLitePersistence)
23 | + (id)objectWithSQLBlobRepresentation:(NSData *)data
24 | {
25 | return [UIImage imageWithData:data];
26 | }
27 | - (NSData *)sqlBlobRepresentationOfSelf{
28 | return UIImagePNGRepresentation (self);
29 | }
30 | + (BOOL)canBeStoredInSQLite
31 | {
32 | return YES;
33 | }
34 | + (NSString *)columnTypeForObjectStorage
35 | {
36 | return kSQLiteColumnTypeBlob;
37 | }
38 | + (BOOL)shouldBeStoredInBlob
39 | {
40 | return YES;
41 | }
42 | @end
43 | #endif
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSData-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSData-SQLitePersistence.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import
21 | #import "NSObject-SQLitePersistence.h"
22 |
23 | @interface NSData(SQLitePersistence)
24 | /*!
25 | This method initializes an NSData from blob pulled from the database.
26 | */
27 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
28 | /*!
29 | This method returns self as a Base-64 encoded NSString.
30 | */
31 | - (NSData *)sqlBlobRepresentationOfSelf;
32 |
33 | /*!
34 | Returns YES to indicate it can be stored in a column of a database
35 | */
36 | + (BOOL)canBeStoredInSQLite;
37 |
38 | /*!
39 | Returns REAL to inidicate this object can be stored in a TEXT column
40 | */
41 | + (NSString *)columnTypeForObjectStorage;
42 | + (BOOL)shouldBeStoredInBlob;
43 | @end
44 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-SQLitePersistence.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import
22 | #import "NSObject-SQLitePersistence.h"
23 |
24 | @interface NSString(SQLitePersistence)
25 | /*!
26 | This method initializes an NSString from TEXT colum data pulled from the database.
27 | */
28 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData;
29 |
30 | /*!
31 | This method returns self.
32 | */
33 | - (NSString *)sqlColumnRepresentationOfSelf;
34 |
35 | /*!
36 | Returns YES to indicate it can be stored in a column of a database
37 | */
38 | + (BOOL)canBeStoredInSQLite;
39 |
40 | /*!
41 | Returns TEXT to inidicate this object can be stored in a TEXT column
42 | */
43 | + (NSString *)columnTypeForObjectStorage;
44 |
45 | + (BOOL)shouldBeStoredInBlob;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSNumber-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSNumber-SQLitePersistence.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import
22 | #import "NSObject-SQLitePersistence.h"
23 |
24 | @interface NSNumber(SQLitePersistence)
25 |
26 | /*!
27 | This method initializes an NSNumber from REAL colum data pulled from the database.
28 | */
29 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData;
30 |
31 | /*!
32 | This method returns self as a number.
33 | */
34 | - (NSString *)sqlColumnRepresentationOfSelf;
35 |
36 | /*!
37 | Returns YES to indicate it can be stored in a column of a database
38 | */
39 | + (BOOL)canBeStoredInSQLite;
40 |
41 | /*!
42 | Returns REAL to inidicate this object can be stored in a REAL column
43 | */
44 | + (NSString *)columnTypeForObjectStorage;
45 |
46 | + (BOOL)shouldBeStoredInBlob;
47 | @end
48 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-UppercaseFirst.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-UppercaseFirst.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import "NSString-UppercaseFirst.h"
21 |
22 |
23 | @implementation NSString(UppercaseFirst)
24 | - (NSString *)stringByUppercasingFirstLetter
25 | {
26 | NSRange firstLetterRange = NSMakeRange(0,1);
27 | NSRange restOfWordRange = NSMakeRange(1,[self length]-1);
28 | return [NSString stringWithFormat:@"%@%@", [[self substringWithRange:firstLetterRange] uppercaseString], [self substringWithRange:restOfWordRange]];
29 |
30 | }
31 | - (NSString *)stringByLowercasingFirstLetter
32 | {
33 | NSRange firstLetterRange = NSMakeRange(0,1);
34 | NSRange restOfWordRange = NSMakeRange(1,[self length]-1);
35 | return [NSString stringWithFormat:@"%@%@", [[self substringWithRange:firstLetterRange] lowercaseString], [self substringWithRange:restOfWordRange]];
36 | }
37 | @end
38 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSDate-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate-SQLitePersistence.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import
22 | #import "NSObject-SQLitePersistence.h"
23 |
24 | @interface NSDate(SQLitePersistence)
25 | /*!
26 | This method initializes an NSDate from REAL colum data pulled from the database.
27 | */
28 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData;
29 |
30 | /*!
31 | This method returns self the time interval since 1970 ncoded NSString.
32 | */
33 | - (NSString *)sqlColumnRepresentationOfSelf;
34 |
35 | /*!
36 | Returns YES to indicate it can be stored in a column of a database
37 | */
38 | + (BOOL)canBeStoredInSQLite;
39 |
40 | /*!
41 | Returns REAL to inidicate this object can be stored in a TEXT column
42 | */
43 | + (NSString *)columnTypeForObjectStorage;
44 |
45 | + (BOOL)shouldBeStoredInBlob;
46 | @end
47 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSNumber-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSNumber-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import "NSNumber-SQLitePersistence.h"
21 |
22 |
23 | @implementation NSNumber(SQLitePersistence)
24 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData
25 | {
26 | NSNumber *ret = nil;
27 | double doubleValue = [columnData doubleValue];
28 | long long longValue = [columnData longLongValue];
29 |
30 | if (doubleValue == longValue)
31 | ret = [[NSNumber alloc] initWithLongLong:longValue];
32 | else
33 | ret = [[NSNumber alloc] initWithDouble:doubleValue];
34 |
35 | return ret;
36 | }
37 |
38 | - (NSString *)sqlColumnRepresentationOfSelf
39 | {
40 | return [self stringValue];
41 | }
42 |
43 | + (BOOL)canBeStoredInSQLite
44 | {
45 | return YES;
46 | }
47 |
48 | + (NSString *)columnTypeForObjectStorage
49 | {
50 | return kSQLiteColumnTypeReal;
51 | }
52 |
53 | + (BOOL)shouldBeStoredInBlob
54 | {
55 | return NO;
56 | }
57 | @end
58 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import "NSObject-SQLitePersistence.h"
22 | #import "NSObject-ClassName.h"
23 |
24 |
25 | @implementation NSObject(SQLitePersistence)
26 |
27 | + (BOOL)canBeStoredInSQLite;
28 | {
29 | return [self conformsToProtocol:@protocol(NSCoding)];
30 | }
31 | + (NSString *)columnTypeForObjectStorage
32 | {
33 | return kSQLiteColumnTypeBlob;
34 | }
35 | - (NSData *)sqlBlobRepresentationOfSelf
36 | {
37 | NSMutableData *data = [[NSMutableData alloc] init];
38 | NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
39 | [archiver encodeObject:self forKey:[self className]];
40 | [archiver finishEncoding];
41 | return data;
42 | }
43 | + (BOOL)shouldBeStoredInBlob
44 | {
45 | return YES;
46 | }
47 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
48 | {
49 | if (data == nil || [data length] == 0)
50 | return nil;
51 |
52 | NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
53 | id ret = [unarchiver decodeObjectForKey:[self className]];
54 | [unarchiver finishDecoding];
55 |
56 | return ret;
57 | }
58 | @end
59 |
--------------------------------------------------------------------------------
/DDSQLiteKit/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. 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 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // 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.
25 | // 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.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // 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.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
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 | // 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.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSMutableArray-MultipleSort.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableArray-MultipleSort.h
3 | // iContractor
4 | //
5 | // Created by Jeff LaMarche on 1/16/09.
6 | // Copyright 2009 Jeff LaMarche. All rights reserved.
7 | //
8 |
9 | // This category on NSMutableArray implements a shell sort based on the old NeXT example
10 | // SortingInAction. It is functionally identical to sortArrayUsingSelector: except that
11 | // it will sort other paired arrays based on the comparison values of the original array
12 | // this is for use in paired array situations, such as when you use one array to store
13 | // keys and another array to store values. This is a variadic method, so you can sort
14 | // as many paired arrays as you have.
15 |
16 | // This source may be used, free of charge, for any purposes. commercial or non-
17 | // commercial. There is no attribution requirement, nor any need to distribute
18 | // your source code. If you do redistribute the unmodified source code, you must
19 | // leave the original header comments, but you may add additional ones.
20 |
21 |
22 | // Stride factor defines the size of the shell sort loop's stride. It can be tweaked
23 | // for performance, though 3 seems to be a good general purpose value
24 | #define STRIDE_FACTOR 3
25 |
26 | #import
27 |
28 | // This compare method was taken from the GNUStep project. GNUStep is
29 | // licensed under the LGPL, which allows such use.
30 | static inline NSComparisonResult compare(id elem1, id elem2, void* context)
31 | {
32 | NSComparisonResult (*imp)(id, SEL, id);
33 |
34 | if (context == 0)
35 | {
36 | [NSException raise: NSInvalidArgumentException
37 | format: @"compare null selector given"];
38 | }
39 |
40 | imp = (NSComparisonResult (*)(id, SEL, id))
41 | [elem1 methodForSelector: context];
42 |
43 | if (imp == NULL)
44 | {
45 | [NSException raise: NSGenericException
46 | format: @"invalid selector passed to compare"];
47 | }
48 |
49 | return (*imp)(elem1, context, elem2);
50 | }
51 |
52 | @interface NSMutableArray(MultipleSort)
53 | // Takes a comparator and a nil-terminated list of paired arrays
54 | - (void)sortArrayUsingSelector:(SEL)comparator withPairedMutableArrays:(NSMutableArray *)array1, ...;
55 | @end
56 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-SQLiteColumnName.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-SQLiteColumnName.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import "NSString-SQLiteColumnName.h"
22 |
23 | @implementation NSString(SQLiteColumnName)
24 | - (NSString *)stringAsSQLColumnName
25 | {
26 | if ([self isEqualToString:[self lowercaseString]]) {
27 | return self;
28 | }
29 | NSMutableString *ret = [NSMutableString string];
30 | for (int i=0; i < [self length]; i++)
31 | {
32 | NSRange sRange = NSMakeRange(i,1);
33 | NSString *oneChar = [self substringWithRange:sRange];
34 | if ([oneChar isEqualToString:[oneChar uppercaseString]] && i > 0)
35 | [ret appendFormat:@"_%@", [oneChar lowercaseString]];
36 | else
37 | [ret appendString:[oneChar lowercaseString]];
38 | }
39 | return ret;
40 | }
41 |
42 | - (NSString *)stringAsPropertyString
43 | {
44 | if ([self rangeOfString:@"_"].location == NSNotFound) {
45 | return self;
46 | }
47 | BOOL lastWasUnderscore = NO;
48 | NSMutableString *ret = [NSMutableString string];
49 | for (int i=0; i < [self length]; i++)
50 | {
51 | NSRange sRange = NSMakeRange(i,1);
52 | NSString *oneChar = [self substringWithRange:sRange];
53 | if ([oneChar isEqualToString:@"_"])
54 | lastWasUnderscore = YES;
55 | else
56 | {
57 | if (lastWasUnderscore)
58 | [ret appendString:[oneChar uppercaseString]];
59 | else
60 | [ret appendString:oneChar];
61 |
62 | lastWasUnderscore = NO;
63 | }
64 | }
65 | return ret;
66 | }
67 | @end
68 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSDate-SQLitePersistence.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate-SQLitePersistence.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #import "NSDate-SQLitePersistence.h"
21 |
22 |
23 | @implementation NSDate(SQLitePersistence)
24 |
25 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData;
26 | {
27 | #ifdef TARGET_OS_COCOTRON
28 | static NSDateFormatter *dateFormatter = nil;
29 | if (!dateFormatter)
30 | dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:
31 | @"%Y-%m-%d %H:%M:%S.%F" allowNaturalLanguage:NO];
32 | NSDate *d;
33 | BOOL cvt = [dateFormatter getObjectValue:&d forString:columnData errorDescription:nil];
34 | assert(cvt);
35 | return d;
36 | #else
37 | static NSDateFormatter *dateFormatter = nil;
38 | if (!dateFormatter) {
39 | dateFormatter = [[NSDateFormatter alloc] init];
40 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSS"];
41 | }
42 | return [dateFormatter dateFromString:columnData];
43 | #endif
44 | }
45 |
46 | - (NSString *)sqlColumnRepresentationOfSelf
47 | {
48 | #ifdef TARGET_OS_COCOTRON
49 | static NSDateFormatter *dateFormatter = nil;
50 | if (!dateFormatter)
51 | dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:
52 | @"%Y-%m-%d %H:%M:%S.%F" allowNaturalLanguage:NO]];
53 | return [dateFormatter stringForObjectValue:self];
54 | #else
55 | static NSDateFormatter *dateFormatter = nil;
56 | if (!dateFormatter) {
57 | dateFormatter = [[NSDateFormatter alloc] init];
58 | [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSS"];
59 | }
60 |
61 | NSString *formattedDateString = [dateFormatter stringFromDate:self];
62 |
63 | return formattedDateString;
64 | #endif
65 | }
66 |
67 | + (BOOL)canBeStoredInSQLite
68 | {
69 | return YES;
70 | }
71 |
72 | + (NSString *)columnTypeForObjectStorage
73 | {
74 | return kSQLiteColumnTypeReal;
75 | }
76 |
77 | + (BOOL)shouldBeStoredInBlob
78 | {
79 | return NO;
80 | }
81 |
82 | @end
83 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/SQLiteInstanceManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SQLiteInstanceManager.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 | #if (TARGET_OS_MAC && ! (TARGET_OS_EMBEDDED || TARGET_OS_ASPEN || TARGET_OS_IPHONE))
21 | #import
22 | #else
23 | #import
24 | #endif
25 |
26 | #import
27 |
28 | #if (! TARGET_OS_IPHONE)
29 | #import
30 | #else
31 | #import
32 | #import
33 | #endif
34 |
35 | /**
36 | * Define db queue name by DeJohn Dong 2015-02-06
37 | *
38 | * @return db queue name
39 | */
40 | #define db_queue_name "com.ddkit.db.queue"
41 |
42 | /**
43 | * Singleton a dispatch_queue_t by DeJohn Dong 2015-02-16
44 | *
45 | * @return a singleton dispatch_queue_t 'ddkit_db_queue'
46 | */
47 | static __unused dispatch_queue_t ddkit_db_queue() {
48 | static dispatch_queue_t ddkit_db_queue;
49 | static dispatch_once_t onceToken;
50 | dispatch_once(&onceToken, ^{
51 | ddkit_db_queue = dispatch_queue_create(db_queue_name, DISPATCH_QUEUE_SERIAL);
52 | });
53 | return ddkit_db_queue;
54 | }
55 |
56 | typedef enum SQLITE3AutoVacuum
57 | {
58 | kSQLITE3AutoVacuumNoAutoVacuum = 0,
59 | kSQLITE3AutoVacuumFullVacuum,
60 | kSQLITE3AutoVacuumIncrementalVacuum,
61 |
62 | } SQLITE3AutoVacuum;
63 |
64 | typedef enum SQLITE3LockingMode
65 | {
66 | kSQLITE3LockingModeNormal = 0,
67 | kSQLITE3LockingModeExclusive,
68 | } SQLITE3LockingMode;
69 |
70 |
71 | @interface SQLiteInstanceManager : NSObject
72 | {
73 | @private
74 | NSString *databaseFilepath;
75 | NSString *databaseName;
76 | sqlite3 *database;
77 | pthread_mutex_t metux;
78 | }
79 |
80 | @property (nonatomic, readwrite, copy) NSString *databaseName;
81 | @property (nonatomic, readwrite, copy) NSString *databaseFilepath;
82 | // add by DeJohn Dong
83 | @property (nonatomic, strong) NSMutableArray *dbEvents;
84 |
85 | + (id)sharedManager;
86 | - (sqlite3 *)database;
87 | - (BOOL)tableExists:(NSString *)tableName;
88 | - (void)setAutoVacuum:(SQLITE3AutoVacuum)mode;
89 | - (void)setCacheSize:(NSUInteger)pages;
90 | - (void)setLockingMode:(SQLITE3LockingMode)mode;
91 | - (void)deleteDatabase;
92 | - (void)vacuum;
93 | - (void)executeUpdateSQL:(NSString *)updateSQL;
94 |
95 | - (void)eventsLock;
96 | - (void)eventsUnlock;
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSString-NumberStuff.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString-NumberStuff.m
3 | // CashFlow
4 | //
5 | // Created by Jeff LaMarche on 11/6/08.
6 | // Copyright 2008 Jeff LaMarche Consulting. All rights reserved.
7 | //
8 |
9 | #import "NSString-NumberStuff.h"
10 |
11 |
12 | @implementation NSString(NumberStuff)
13 | - (BOOL)holdsFloatingPointValue
14 | {
15 | return [self holdsFloatingPointValueForLocale:[NSLocale currentLocale]];
16 | }
17 | - (BOOL)holdsFloatingPointValueForLocale:(NSLocale *)locale
18 | {
19 | NSString *currencySymbol = [locale objectForKey:NSLocaleCurrencySymbol];
20 | NSString *decimalSeparator = [locale objectForKey:NSLocaleDecimalSeparator];
21 | NSString *groupingSeparator = [locale objectForKey:NSLocaleGroupingSeparator];
22 |
23 |
24 | // Must be at least one character
25 | if ([self length] == 0)
26 | return NO;
27 | NSString *compare = [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
28 |
29 | // Strip out grouping separators
30 | compare = [compare stringByReplacingOccurrencesOfString:groupingSeparator withString:@""];
31 |
32 | // We'll allow a single dollar sign in the mix
33 | if ([compare hasPrefix:currencySymbol])
34 | {
35 | compare = [compare substringFromIndex:1];
36 | // could be spaces between dollar sign and first digit
37 | compare = [compare stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
38 | }
39 |
40 | NSUInteger numberOfSeparators = 0;
41 |
42 | NSCharacterSet *validCharacters = [NSCharacterSet decimalDigitCharacterSet];
43 | for (NSUInteger i = 0; i < [compare length]; i++)
44 | {
45 | unichar oneChar = [compare characterAtIndex:i];
46 | if (oneChar == [decimalSeparator characterAtIndex:0])
47 | numberOfSeparators++;
48 | else if (![validCharacters characterIsMember:oneChar])
49 | return NO;
50 | }
51 | return (numberOfSeparators == 1);
52 |
53 | }
54 | - (BOOL)holdsIntegerValue
55 | {
56 | if ([self length] == 0)
57 | return NO;
58 |
59 | NSString *compare = [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
60 | NSCharacterSet *validCharacters = [NSCharacterSet decimalDigitCharacterSet];
61 | for (NSUInteger i = 0; i < [compare length]; i++)
62 | {
63 | unichar oneChar = [compare characterAtIndex:i];
64 | if (![validCharacters characterIsMember:oneChar])
65 | return NO;
66 | }
67 | return YES;
68 | }
69 | + (id)formattedCurrencyStringWithValue:(float)inValue
70 | {
71 |
72 | NSNumberFormatter *numberFormatter;
73 | NSString *ret;
74 | numberFormatter = [[NSNumberFormatter alloc] init];
75 | [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
76 | [numberFormatter setCurrencyCode:[[NSLocale currentLocale] objectForKey:NSLocaleCurrencyCode]];
77 | // [numberFormatter setNegativePrefix:[[NSLocale currentLocale] negativePrefix]];
78 |
79 |
80 | ret = [numberFormatter stringFromNumber:[NSNumber numberWithFloat:inValue]];
81 | #if !__has_feature(objc_arc)
82 | [numberFormatter release];
83 | #endif
84 | return ret;
85 |
86 | }
87 | @end
88 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSMutableArray-MultipleSort.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableArray-MultipleSort.m
3 | // iContractor
4 | //
5 | // Created by Jeff LaMarche on 1/16/09.
6 | // Copyright 2009 Jeff LaMarche Consulting. All rights reserved.
7 | //
8 | // This source may be used, free of charge, for any purposes. commercial or non-
9 | // commercial. There is no attribution requirement, nor any need to distribute
10 | // your source code. If you do redistribute the unmodified source code, you must
11 | // leave the original header comments, but you may add additional ones.
12 |
13 | #import "NSMutableArray-MultipleSort.h"
14 |
15 | @implementation NSMutableArray(MultipleSort)
16 | - (void)sortArrayUsingSelector:(SEL)comparator withPairedMutableArrays:(NSMutableArray *)array1, ...
17 | {
18 | unsigned int stride = 1;
19 | BOOL found = NO;
20 | NSUInteger count = [self count];
21 | unsigned int d;
22 |
23 | while (stride <= count)
24 | stride = stride * STRIDE_FACTOR + 1;
25 |
26 | while (stride > (STRIDE_FACTOR - 1))
27 | {
28 | stride = stride / STRIDE_FACTOR;
29 | for (unsigned int c = stride; c < count; c++)
30 | {
31 | found = NO;
32 | if (stride > c)
33 | break;
34 |
35 | d = c - stride;
36 | while (!found)
37 | {
38 | id a = [self objectAtIndex: d + stride];
39 | id b = [self objectAtIndex: d];
40 |
41 | NSComparisonResult result = (*compare)(a, b, (void *)comparator);
42 |
43 | if (result < 0)
44 | {
45 | #if !__has_feature(objc_arc)
46 | [a retain];
47 | #endif
48 | [self replaceObjectAtIndex: d + stride withObject: b];
49 | [self replaceObjectAtIndex: d withObject: a];
50 |
51 | id eachObject;
52 | va_list argumentList;
53 | if (array1)
54 | {
55 | id a1 = [array1 objectAtIndex:d+stride];
56 | id b1 = [array1 objectAtIndex:d];
57 | #if !__has_feature(objc_arc)
58 | [a1 retain];
59 | #endif
60 | [array1 replaceObjectAtIndex: d + stride withObject:b1];
61 | [array1 replaceObjectAtIndex: d withObject: a1];
62 | #if !__has_feature(objc_arc)
63 | [a1 release];
64 | #endif
65 | va_start(argumentList, array1);
66 | while ((eachObject = va_arg(argumentList, id)))
67 | {
68 | id ax = [eachObject objectAtIndex:d+stride];
69 | id bx = [eachObject objectAtIndex:d];
70 | #if !__has_feature(objc_arc)
71 | [ax retain];
72 | #endif
73 | [eachObject replaceObjectAtIndex: d + stride withObject:bx];
74 | [eachObject replaceObjectAtIndex: d withObject: ax];
75 | #if !__has_feature(objc_arc)
76 | [ax release];
77 | #endif
78 | }
79 | va_end(argumentList);
80 | }
81 | #if !__has_feature(objc_arc)
82 | [a release];
83 | #endif
84 | if (stride > d)
85 | break;
86 |
87 | d -= stride;
88 | }
89 | else
90 | found = YES;
91 | }
92 | }
93 | }
94 | }
95 | @end
96 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DDSQLiteKit
2 | An ORM kit of object persistence use SQLite
3 |
4 | ##SQLitePersistentObject
5 |
6 | SQLitePersistentObject is an ORM Kit Write by Jeff LaMarche, it's excellent.
7 |
8 | Any class that subclasses this class can have their properties automatically persisted into a sqlite database. There are some limits - currently certain property types aren't supported like void *, char *, structs and unions. Anything that doesn't work correctly with Key Value Coding will not work with this. Ordinary scalars (ints, floats, etc) will be converted to NSNumber, as will BOOL.
9 |
10 | SQLite is very good about converting types, so you can search on a number field passing in a number in a string, and can search on a string field by passing in a number. The only limitation we place on the search methods is that we don't allow searching on blobs, which is simply for performance reasons.
11 |
12 | but now, Jeff not work on this library. so I will work on this library.
13 | in original this library is non-safe-thread in multithread opearations , I just make it thread-safe in multithread use some new methods
14 |
15 | ##Installation
16 |
17 | [](http://cocoadocs.org/docsets/SQLitePersistentObject/) [](http://cocoadocs.org/docsets/SQLitePersistentObject/)
18 | SQLitePersisentObject is available through [CocoaPods](http://cocoapods.org), to install
19 | it simply add the following line to your Podfile:
20 |
21 | pod "SQLitePersistentObject"
22 | Alternatively, you can just drag the files from `SQLitePersistentObject / SQLitePersistentObject` into your own project.
23 |
24 | ## Usage
25 |
26 | create an object inherit SQLitePersistentObject
27 | ```objective-c
28 | header file:
29 | #import "SQLitePersistentObject.h"
30 |
31 | @interface Device : SQLitePersistentObject
32 |
33 | @property (nonatomic, copy) NSString *name;
34 | @property (nonatomic, copy) NSString *model;
35 | @property (nonatomic, strong) NSNumber *price;
36 |
37 | @end
38 |
39 |
40 | implementation file:
41 | #import "Device.h"
42 |
43 | @implementation Device
44 |
45 | @end
46 |
47 | ```
48 |
49 | ## Methods
50 | ```objective-c
51 | #pragma mark - DeJohn Dong Added Methods
52 | /**
53 | * Asynchronous add/update an object to db.
54 | */
55 | - (void)save;
56 |
57 | /**
58 | * Asynchronous delete an object from db.
59 | */
60 | - (void)asynDeleteObject;
61 |
62 | /**
63 | * Asynchronous delete an object and the cascade objects from db.
64 | */
65 | - (void)asynDeleteObjectCascade:(BOOL)cascade;
66 |
67 | /**
68 | * Asynchronous Query the object list with criteria from db.
69 | *
70 | * @param criteria criteria string
71 | * @param result result list
72 | */
73 | + (void)queryByCriteria:(NSString *)criteria result:(DBQueryResult)result;
74 |
75 | /**
76 | * Asynchronous Query the first object with criteria from db
77 | *
78 | * @param criteria criteria string
79 | * @param result result object
80 | */
81 | + (void)queryFirstItemByCriteria:(NSString *)criteria result:(DBQueryResult)result;
82 |
83 | /**
84 | * Asynchronous Query all the objects from db
85 | *
86 | * @param result result list
87 | */
88 | + (void)queryResult:(DBQueryResult)result;
89 | ```
90 |
91 | ## Requirements
92 |
93 | - Xcode 6
94 | - iOS 5.1.1 or Mac OSX 10.8
95 |
96 | ## Author
97 |
98 | Jeff LaMarche jeff_Lamarche@mac.com / DeJohn Dong, dongjia_9251@126.com
99 |
100 | ## License
101 |
102 | SQLitePersistentObject is available under the MIT license. See the LICENSE file for more info.
103 |
--------------------------------------------------------------------------------
/DDSQLiteKit/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/DDSQLiteKit/TableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // TableViewController.m
3 | // DDSQLiteKit
4 | //
5 | // Created by Diaoshu on 15-2-4.
6 | // Copyright (c) 2015年 DDKit. All rights reserved.
7 | //
8 |
9 | #import "TableViewController.h"
10 | #import "Device.h"
11 |
12 | @interface TableViewController (){
13 | NSMutableArray *dataList;
14 | }
15 |
16 | @end
17 |
18 | @implementation TableViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 | // Uncomment the following line to preserve selection between presentations.
24 | // self.clearsSelectionOnViewWillAppear = NO;
25 |
26 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
27 | // self.navigationItem.rightBarButtonItem = self.editButtonItem;
28 |
29 | if(!dataList)
30 | dataList = [[NSMutableArray alloc] initWithCapacity:0];
31 |
32 | }
33 |
34 | - (void)viewWillAppear:(BOOL)animated{
35 | [super viewWillAppear:animated];
36 |
37 | [Device queryResult:^(id data) {
38 | [dataList removeAllObjects];
39 | [dataList addObjectsFromArray:data];
40 | [self.tableView reloadData];
41 | }];
42 | }
43 |
44 | - (void)didReceiveMemoryWarning {
45 | [super didReceiveMemoryWarning];
46 | // Dispose of any resources that can be recreated.
47 | }
48 |
49 | #pragma mark - Table view data source
50 |
51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
52 | // Return the number of rows in the section.
53 | return dataList.count;
54 | }
55 |
56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
57 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DeviceCell" forIndexPath:indexPath];
58 | // Configure the cell...
59 | Device *d = dataList[indexPath.row];
60 | cell.textLabel.text = [NSString stringWithFormat:@"%@-[%@]-(¥%@)-%@",d.name, d.name,d.price,d.system];
61 | return cell;
62 | }
63 |
64 | /*
65 | // Override to support conditional editing of the table view.
66 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
67 | // Return NO if you do not want the specified item to be editable.
68 | return YES;
69 | }
70 | */
71 |
72 | /*
73 | // Override to support editing the table view.
74 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
75 | if (editingStyle == UITableViewCellEditingStyleDelete) {
76 | // Delete the row from the data source
77 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
78 | } else if (editingStyle == UITableViewCellEditingStyleInsert) {
79 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
80 | }
81 | }
82 | */
83 |
84 | /*
85 | // Override to support rearranging the table view.
86 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
87 | }
88 | */
89 |
90 | /*
91 | // Override to support conditional rearranging of the table view.
92 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
93 | // Return NO if you do not want the item to be re-orderable.
94 | return YES;
95 | }
96 | */
97 | #pragma mark - UITableView Delegate Methods
98 |
99 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
100 | Device *d = dataList[indexPath.row];
101 | [self performSegueWithIdentifier:@"addSegue" sender:d];
102 | }
103 |
104 |
105 | #pragma mark - Navigation
106 |
107 | // In a storyboard-based application, you will often want to do a little preparation before navigation
108 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
109 | // Get the new view controller using [segue destinationViewController].
110 | // Pass the selected object to the new view controller.
111 | if([sender isKindOfClass:[Device class]]){
112 | [[segue destinationViewController] setValue:@{@"device":sender} forKey:@"params"];
113 | }
114 | }
115 |
116 | - (IBAction)add:(id)sender{
117 | [self performSegueWithIdentifier:@"addSegue" sender:@"add"];
118 | }
119 |
120 | - (IBAction)function:(id)sender{
121 | [self performSegueWithIdentifier:@"DDSqliteSegue" sender:@"function"];
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/xcuserdata/macpro.xcuserdatad/xcschemes/DDSQLiteKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/NSObject-SQLitePersistence.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------
2 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
3 | //
4 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
5 | // ----------------------------------------------------------------------
6 | // This code may be used without restriction in any software, commercial,
7 | // free, or otherwise. There are no attribution requirements, and no
8 | // requirement that you distribute your changes, although bugfixes and
9 | // enhancements are welcome.
10 | //
11 | // If you do choose to re-distribute the source code, you must retain the
12 | // copyright notice and this license information. I also request that you
13 | // place comments in to identify your changes.
14 | //
15 | // For information on how to use these classes, take a look at the
16 | // included Readme.txt file
17 | // ----------------------------------------------------------------------
18 | #define kSQLiteColumnTypeText @"TEXT"
19 | #define kSQLIteColumnTypeInteger @"INTEGER"
20 | #define kSQLiteColumnTypeReal @"REAL"
21 | #define kSQLiteColumnTypeBlob @"BLOB"
22 | #define kSQLiteColumnTypeNULL @"NULL"
23 |
24 | #import
25 | @protocol SQLitePersistence
26 |
27 | /*!
28 | This protocol should be implemented by any object that needs to be stored in a database as a single column. This protocol is not for objects that will be persisted as a table, but only those that need to be persisted inside a column of a table. This is primarily for objects that store numbers, text, dates, and other values that can easily be represented in a column of a database table. For more complex objects, subclass SQLitePersistentObject
29 | */
30 |
31 | @required
32 | /*!
33 | This method is used to indicate whether this data object can be stored in a column of a SQLite3 table
34 | */
35 | + (BOOL)canBeStoredInSQLite;
36 |
37 | /*!
38 | Returns the SQL data type to use to store this object in a SQLite3 database. Must be one of kSQLiteColumnTypeText, kSQLIteColumnTypeInteger, kSQLiteColumnTypeReal, kSQLiteColumnTypeBlob
39 | */
40 | + (NSString *)columnTypeForObjectStorage;
41 | + (BOOL)shouldBeStoredInBlob;
42 |
43 | @optional
44 | /*!
45 | This method needs to be implemented only if a class returns YES to shouldBeStoredInBlob. Inits an object from a blob.
46 | */
47 | + (id)objectWithSqlColumnRepresentation:(NSString *)columnData;
48 | /*!
49 | This method needs to be implemented only if this class returns YES to shouldBeStoredInBlob. Returns an NSData containing the data to go in the blob. This method must be implemented by objects that return YES in canBeStoredInSQLite and YES in shouldBeStoredInBlob.
50 | */
51 | - (NSData *)sqlBlobRepresentationOfSelf;
52 |
53 | /*!
54 | This method returns an autoreleased object from column data pulled from the database. This is the reverse to sqlColumnRepresentationOfSelf and needs to be able to create a data from whatever is returned by that method. This method must be implemented by objects that return YES in canBeStoredInSQLite but YES in shouldBeStoredInBlob. */
55 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
56 |
57 | /*!
58 | This method returns a string that holds this object's data and which can be used to re-constitute the object using objectWithSqlColumnRepresentation:. This method must be implemented by objects that return YES in canBeStoredInSQLite but NO in shouldBeStoredInBlob.
59 | */
60 | - (NSString *)sqlColumnRepresentationOfSelf;
61 |
62 |
63 | @end
64 |
65 | /*!
66 | This category on NSObject provides a basic mechanism for objects to be written into the database as the column of a table. The methods in this category should be overwritten by any class that needs to be stored in the database, as the method used here is to archive the object into an an NSData instance, then Base64 the archived data and store it in a TEXT column. This method is inefficient and does not allow meaningful searches on the column, but it does provide a mechanism to allow any object that implements NSCoding to be stored in the database.
67 |
68 | NOTE: Investigate using a BLOB instead of BASE64 encoded TEXT for the default implementation.
69 | */
70 | @interface NSObject(SQLitePersistence)
71 | /*!
72 | This method is used to indicate whether this data object can be stored in a column of a SQLite3 table. This default implementation returns YES if this object conforms to NSCoding.
73 | */
74 | + (BOOL)canBeStoredInSQLite;
75 |
76 | /*!
77 | Returns the SQL data type to use to store this object in a SQLite3 database. This default implementation returns TEXT, since the object will be stored BASE64 encoded.
78 | */
79 | + (NSString *)columnTypeForObjectStorage;
80 |
81 | + (BOOL)shouldBeStoredInBlob;
82 | - (NSData *)sqlBlobRepresentationOfSelf;
83 | + (id)objectWithSQLBlobRepresentation:(NSData *)data;
84 | @end
85 |
--------------------------------------------------------------------------------
/DDSQLiteKit/DDSqliteViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DDSqliteViewController.m
3 | // DDKit
4 | //
5 | // Created by Diaoshu on 14-12-21.
6 | // Copyright (c) 2014年 Dejohn Dong. All rights reserved.
7 | //
8 |
9 | #import "DDSqliteViewController.h"
10 | #import "SQLiteInstanceManager.h"
11 | #import "Device.h"
12 |
13 | #import
14 |
15 | #define number 3000
16 | #define isUseFMDB 0
17 |
18 | @interface DDSqliteViewController (){
19 | NSTimer *timer;
20 | NSInteger time;
21 |
22 | }
23 |
24 | @property (nonatomic, weak) IBOutlet UILabel *lblTimer;
25 | @property (nonatomic, weak) IBOutlet UILabel *lblResult;
26 | @property (nonatomic, weak) IBOutlet UISegmentedControl *segmentedControl;
27 |
28 | @end
29 |
30 | @implementation DDSqliteViewController
31 |
32 | - (void)viewDidLoad {
33 | [super viewDidLoad];
34 | // Do any additional setup after loading the view.
35 | self.title = @"SQLiteSave";
36 | }
37 |
38 | - (void)didReceiveMemoryWarning {
39 | [super didReceiveMemoryWarning];
40 | // Dispose of any resources that can be recreated.
41 | }
42 |
43 |
44 | - (void)viewDidAppear:(BOOL)animated{
45 | [super viewDidAppear:animated];
46 | [[SQLiteInstanceManager sharedManager] vacuum];
47 | }
48 |
49 | /*
50 | #pragma mark - Navigation
51 |
52 | // In a storyboard-based application, you will often want to do a little preparation before navigation
53 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
54 | // Get the new view controller using [segue destinationViewController].
55 | // Pass the selected object to the new view controller.
56 | }
57 | */
58 |
59 | - (IBAction)segmentControlChanged:(id)sender{
60 | if(self.segmentedControl.selectedSegmentIndex == 0){
61 | [self saveDB];
62 | }else if(self.segmentedControl.selectedSegmentIndex == 3){
63 | [self queryDB];
64 | }else if (self.segmentedControl.selectedSegmentIndex == 1){
65 | [self deleteDB];
66 | }else if (self.segmentedControl.selectedSegmentIndex == 2){
67 | [self updateDB];
68 | }
69 | }
70 |
71 | #pragma mark - Custom Methods
72 |
73 | - (void)refreshTimer
74 | {
75 | self.lblTimer.text = [NSString stringWithFormat:@"Timer:%.2fs",time/100.0];
76 | time++;
77 | }
78 |
79 | - (void)saveDB
80 | {
81 | [self timerStart];
82 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
83 | dispatch_async(queue, ^{
84 | for (int i = 0 ; i < number; i++) {
85 | Device *p = [[Device alloc] init];
86 | p.name = [NSString stringWithFormat:@"iPhone %d",i];
87 | p.modelName = [NSString stringWithFormat:@"ME2814/%d",i];
88 | p.price = @(i);
89 | p.system = [NSString stringWithFormat:@"iOS%d",i];
90 | [p save];
91 | }
92 | [[SQLiteInstanceManager sharedManager] vacuum];
93 | dispatch_async(dispatch_get_main_queue(), ^{
94 | [self timerEnd];
95 | self.lblResult.text = [NSString stringWithFormat:@"success add %d datas",number];
96 | });
97 | });
98 | }
99 |
100 | - (void)queryDB{
101 | [self timerStart];
102 | // [Device queryByCriteria:nil result:^(id data) {
103 | // if([data isKindOfClass:[NSArray class]]){
104 | // NSArray *list = data;
105 | // [self timerEnd];
106 | // self.lblResult.text = [NSString stringWithFormat:@"success query %lu datas",[list count]];
107 | // }else{
108 | //
109 | // }
110 | // }];
111 | [Device queryFirstItemByCriteria:@"WHERE price = '125';" result:^(id data) {
112 | NSLog(@"data is %@", data);
113 | [self timerEnd];
114 | }];
115 | }
116 |
117 | - (void)deleteDB{
118 | [self timerStart];
119 | [Device queryByCriteria:@"WHERE price = '15';" result:^(id data) {
120 | if([data isKindOfClass:[NSArray class]]){
121 | NSArray *list = data;
122 | for (Device *d in list) {
123 | [d asynDeleteObjectCascade:YES];
124 | }
125 | [self timerEnd];
126 | self.lblResult.text = [NSString stringWithFormat:@"success delete %lu datas",[list count]];
127 | }
128 | }];
129 | }
130 |
131 | - (void)updateDB{
132 | [self timerStart];
133 | [Device queryByCriteria:@"WHERE price = '10';" result:^(id data) {
134 | if([data isKindOfClass:[NSArray class]]){
135 | NSArray *list = data;
136 | for (Device *d in list) {
137 | d.price = @(13);
138 | [d save];
139 | }
140 | [self timerEnd];
141 | self.lblResult.text = [NSString stringWithFormat:@"success update %lu datas",[list count]];
142 | }
143 | }];
144 | }
145 |
146 | - (IBAction)clearDB:(id)sender{
147 | [[SQLiteInstanceManager sharedManager] deleteDatabase];
148 | }
149 |
150 | - (void)timerStart{
151 | [self timerEnd];
152 | time = 0;
153 | timer = [NSTimer scheduledTimerWithTimeInterval:1/100.0f target:self selector:@selector(refreshTimer) userInfo:nil repeats:YES];
154 | }
155 |
156 | - (void)timerEnd{
157 | if(timer){
158 | [timer invalidate];
159 | timer = nil;
160 | }
161 | }
162 |
163 | @end
164 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/SQLiteInstanceManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // SQLiteInstanceManager.m
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import "SQLiteInstanceManager.h"
22 | #import "SQLitePersistentObject.h"
23 | #include
24 |
25 | #pragma mark Private Method Declarations
26 | @interface SQLiteInstanceManager (private)
27 |
28 | - (NSString *)databaseFilepath;
29 | @end
30 |
31 | @implementation SQLiteInstanceManager
32 |
33 | @synthesize databaseFilepath, databaseName;
34 |
35 | #pragma mark -
36 | #pragma mark Singleton Methods
37 | + (instancetype)sharedManager
38 | {
39 | static dispatch_once_t onceToken;
40 | static SQLiteInstanceManager *sharedSQLiteManager = nil;
41 | dispatch_once(&onceToken, ^{
42 | sharedSQLiteManager = [[self alloc] init];
43 | sharedSQLiteManager.dbEvents = [[NSMutableArray alloc] initWithCapacity:0];
44 | [sharedSQLiteManager createLock];
45 | });
46 | return sharedSQLiteManager;
47 | }
48 |
49 | - (void)dealloc
50 | {
51 | [self destroyLock];
52 | }
53 |
54 | #pragma mark - Safe thread semaphore methods
55 |
56 | - (void)createLock
57 | {
58 | pthread_mutex_init(&metux, NULL);
59 | }
60 |
61 | - (void)eventsLock
62 | {
63 | pthread_mutex_lock(&metux);
64 | }
65 |
66 | - (void)eventsUnlock
67 | {
68 | pthread_mutex_unlock(&metux);
69 | }
70 |
71 | - (void)destroyLock
72 | {
73 | pthread_mutex_destroy(&metux);
74 | }
75 |
76 | #pragma mark -
77 | #pragma mark Public Instance Methods
78 | - (sqlite3 *)database
79 | {
80 | static BOOL first = YES;
81 |
82 | if (first || database == NULL)
83 | {
84 | first = NO;
85 | if (!(sqlite3_open([[self databaseFilepath] UTF8String], &database) == SQLITE_OK))
86 | {
87 | // Even though the open failed, call close to properly clean up resources.
88 | NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
89 | sqlite3_close(database);
90 | }
91 | else
92 | {
93 | // Default to UTF-8 encoding
94 | [self executeUpdateSQL:@"PRAGMA encoding = \"UTF-8\""];
95 |
96 | // Turn on full auto-vacuuming to keep the size of the database down
97 | // This setting can be changed per database using the setAutoVacuum instance method
98 | [self executeUpdateSQL:@"PRAGMA auto_vacuum=1"];
99 |
100 | }
101 | }
102 | return database;
103 | }
104 |
105 | - (BOOL)tableExists:(NSString *)tableName
106 | {
107 | BOOL ret = NO;
108 | // pragma table_info(i_c_project);
109 | NSString *query = [NSString stringWithFormat:@"pragma table_info(%@);", tableName];
110 | sqlite3_stmt *stmt;
111 | if (sqlite3_prepare_v2( database, [query UTF8String], -1, &stmt, nil) == SQLITE_OK) {
112 | if (sqlite3_step(stmt) == SQLITE_ROW)
113 | ret = YES;
114 | sqlite3_finalize(stmt);
115 | }
116 | return ret;
117 | }
118 |
119 | - (void)setAutoVacuum:(SQLITE3AutoVacuum)mode
120 | {
121 | NSString *updateSQL = [NSString stringWithFormat:@"PRAGMA auto_vacuum=%d", mode];
122 | [self executeUpdateSQL:updateSQL];
123 | }
124 |
125 | - (void)setCacheSize:(NSUInteger)pages
126 | {
127 | NSString *updateSQL = [NSString stringWithFormat:@"PRAGMA cache_size=%lu",(unsigned long)pages];
128 | [self executeUpdateSQL:updateSQL];
129 | }
130 |
131 | - (void)setLockingMode:(SQLITE3LockingMode)mode
132 | {
133 | NSString *updateSQL = [NSString stringWithFormat:@"PRAGMA locking_mode=%d", mode];
134 | [self executeUpdateSQL:updateSQL];
135 | }
136 |
137 | - (void)deleteDatabase
138 | {
139 | if (self.dbEvents.count > 0)
140 | {
141 | dispatch_async(ddkit_db_queue(), ^{
142 | NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:0];
143 | [dictionary setObject:self forKey:@"object"];
144 | SEL methodSEL = @selector(doDeleteDatabase);
145 | [dictionary setObject:[NSValue valueWithBytes:&methodSEL objCType:@encode(SEL)] forKey:@"performMethod"];
146 | [dictionary setObject:@"removeAllObjects" forKey:@"params"];
147 | [self eventsLock];
148 | [self.dbEvents insertObject:dictionary atIndex:0];
149 | [self eventsUnlock];
150 | });
151 | return;
152 | }
153 | dispatch_async(ddkit_db_queue(), ^{
154 | [self doDeleteDatabase];
155 | });
156 | }
157 |
158 | - (void)doDeleteDatabase
159 | {
160 | NSString *path = [self databaseFilepath];
161 | NSFileManager *fm = [NSFileManager defaultManager];
162 | [fm removeItemAtPath:path error:NULL];
163 | database = NULL;
164 | [SQLitePersistentObject clearCache];
165 | }
166 |
167 | - (void)vacuum
168 | {
169 | [self executeUpdateSQL:@"VACUUM"];
170 | }
171 |
172 | - (void)executeUpdateSQL:(NSString *)updateSQL
173 | {
174 | if ([self.dbEvents count] > 0)
175 | {
176 | NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:0];
177 | [dictionary setObject:self forKey:@"object"];
178 | SEL methodSEL = @selector(executeUpdateSQLWithSQLString:);
179 | [dictionary setObject:[NSValue valueWithBytes:&methodSEL objCType:@encode(SEL)] forKey:@"performMethod"];
180 | [dictionary setObject:updateSQL?:@"" forKey:@"params"];
181 | [self eventsLock];
182 | [self.dbEvents insertObject:dictionary atIndex:0];
183 | [self eventsUnlock];
184 | return;
185 | }
186 | dispatch_async(ddkit_db_queue(), ^{
187 | [self executeUpdateSQLWithSQLString:updateSQL];
188 | });
189 | }
190 |
191 | - (void)executeUpdateSQLWithSQLString:(NSString *)sqlString{
192 | char *errorMsg;
193 | if (sqlite3_exec([self database],[sqlString UTF8String] , NULL, NULL, &errorMsg) != SQLITE_OK) {
194 | __unused NSString *errorMessage = [NSString stringWithFormat:@"Failed to execute SQL '%@' with message '%s'.", sqlString, errorMsg];
195 | NSAssert(0, errorMessage);
196 | sqlite3_free(errorMsg);
197 | }
198 | }
199 |
200 | #pragma mark - Private Methods
201 |
202 | - (NSString *)databaseFilepath
203 | {
204 | NSAssert(self.databaseName != nil, @"You must specify a databaseName for non-shared instances");
205 | if (!databaseFilepath) {
206 | #if (TARGET_OS_COCOTRON)
207 | databaseFilepath = [@"./" stringByAppendingPathComponent:self.databaseName];
208 | #elif (TARGET_OS_MAC && ! TARGET_OS_IPHONE)
209 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
210 | NSString *base = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory();
211 | databaseFilepath = [base stringByAppendingPathComponent:self.databaseName];
212 | #else
213 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
214 | databaseFilepath = [[paths objectAtIndex:0] stringByAppendingPathComponent:self.databaseName];
215 | #endif
216 | }
217 | return databaseFilepath;
218 | }
219 |
220 | - (NSString *)databaseName
221 | {
222 | if (!databaseName && self == [SQLiteInstanceManager sharedManager]) {
223 | NSMutableString *ret = [NSMutableString string];
224 | NSString *appName = [[NSProcessInfo processInfo] processName];
225 | for (int i = 0; i < [appName length]; i++) {
226 | NSRange range = NSMakeRange(i, 1);
227 | NSString *oneChar = [appName substringWithRange:range];
228 | if (![oneChar isEqualToString:@" "])
229 | [ret appendString:[oneChar lowercaseString]];
230 | }
231 | databaseName = [ret stringByAppendingString:@".sqlite3"];
232 | }
233 | return databaseName;
234 | }
235 |
236 | @end
237 |
--------------------------------------------------------------------------------
/DDSQLiteKit/SQLitePersistentObject/SQLitePersistentObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // SQLitePersistentObject.h
3 | // ----------------------------------------------------------------------
4 | // Part of the SQLite Persistent Objects for Cocoa and Cocoa Touch
5 | //
6 | // Original Version: (c) 2008 Jeff LaMarche (jeff_Lamarche@mac.com)
7 | // ----------------------------------------------------------------------
8 | // This code may be used without restriction in any software, commercial,
9 | // free, or otherwise. There are no attribution requirements, and no
10 | // requirement that you distribute your changes, although bugfixes and
11 | // enhancements are welcome.
12 | //
13 | // If you do choose to re-distribute the source code, you must retain the
14 | // copyright notice and this license information. I also request that you
15 | // place comments in to identify your changes.
16 | //
17 | // For information on how to use these classes, take a look at the
18 | // included Readme.txt file
19 | // ----------------------------------------------------------------------
20 |
21 | #import
22 | #import
23 |
24 | #if (!TARGET_OS_IPHONE)
25 | #import
26 | #else
27 | #import
28 | #import
29 | #endif
30 |
31 | #define isCollectionType(x) (isNSSetType(x) || isNSArrayType(x) || isNSDictionaryType(x))
32 | #define isNSArrayType(x) ([x isEqualToString:@"NSArray"] || [x isEqualToString:@"NSMutableArray"])
33 | #define isNSDictionaryType(x) ([x isEqualToString:@"NSDictionary"] || [x isEqualToString:@"NSMutableDictionary"])
34 | #define isNSSetType(x) ([x isEqualToString:@"NSSet"] || [x isEqualToString:@"NSMutableSet"])
35 |
36 | #define DECLARE_PROPERTIES(...) + (NSArray *)getPropertiesList \
37 | { \
38 | return [NSArray arrayWithObjects: \
39 | __VA_ARGS__ \
40 | , nil]; \
41 | } \
42 | + (NSDictionary *)propertiesWithEncodedTypes { \
43 | static NSDictionary *propertiesWithEncodedTypesDict = nil; \
44 | if(!propertiesWithEncodedTypesDict) { \
45 | propertiesWithEncodedTypesDict = [super propertiesWithEncodedTypes]; \
46 | } \
47 | return propertiesWithEncodedTypesDict; \
48 | }
49 |
50 | #define DECLARE_PROPERTY(n,t) [NSArray arrayWithObjects:n, t, nil]
51 |
52 | /*!
53 | Any class that subclasses this class can have their properties automatically persisted into a sqlite database. There are some limits - currently certain property types aren't supported like void *, char *, structs and unions. Anything that doesn't work correctly with Key Value Coding will not work with this. Ordinary scalars (ints, floats, etc) will be converted to NSNumber, as will BOOL.
54 |
55 | SQLite is very good about converting types, so you can search on a number field passing in a number in a string, and can search on a string field by passing in a number. The only limitation we place on the search methods is that we don't allow searching on blobs, which is simply for performance reasons.
56 |
57 | */
58 | // TODO: Look at marking object "dirty" when changes are made, and if it's not dirty, save becomes a no-op.
59 |
60 |
61 | #if NS_BLOCKS_AVAILABLE
62 | typedef void(^ DBQueryResult)(id data);
63 | #endif
64 |
65 |
66 | @class SQLiteInstanceManager;
67 |
68 | @interface SQLitePersistentObject : NSObject {
69 |
70 | @private
71 | int pk;
72 | BOOL dirty;
73 | BOOL alreadySaving;
74 | BOOL alreadyDeleting;
75 | }
76 |
77 | /*!
78 | Returns the name of the table that this object will use to save its data
79 | */
80 | + (NSString *)tableName;
81 |
82 | + (void)clearCache;
83 |
84 | /*!
85 | Find by criteria lets you specify the SQL conditions that will be used. The string passed in should start with the word WHERE. So, to search for a value with a pk value of 1, you would pass in @"WHERE pk = 1". When comparing to strings, the string comparison must be in single-quotes like this @"WHERE name = 'smith'".
86 | */
87 | + (NSArray *)findByCriteria:(NSString *)criteriaString, ...;
88 | + (SQLitePersistentObject *)findFirstByCriteria:(NSString *)criteriaString, ...;
89 | + (SQLitePersistentObject *)findByPK:(int)inPk;
90 | + (NSArray *)allObjects;
91 |
92 | /*!
93 | Find related objects
94 | */
95 | - (NSArray *)findRelated:(Class)cls forProperty:(NSString *)prop filter:(NSString *)filter, ...;
96 | - (NSArray *)findRelated:(Class)cls filter:(NSString *)filter, ...;
97 | - (NSArray *)findRelated:(Class)cls;
98 |
99 |
100 | // Allows easy execution of SQL commands that return a single row, good for getting sums and averages of a single property
101 | + (double)performSQLAggregation: (NSString *)query, ...;
102 | /*!
103 | This method should be overridden by subclasses in order to specify performance indices on the underyling table.
104 | @result Should return an array of arrays. Each array represents one index, and should contain a list of the properties that the index should be created on, in the order the database should use to create it. This is case sensitive, and the values must match the value of property names
105 | */
106 | + (NSArray *)indices;
107 |
108 | /*!
109 | This method should be overridden by subclasses in order to specify transient properties on the underlying table.
110 | @result Should return an array of property names to be ignored. These are case sensitive, and the values must match the value of property names
111 | */
112 | + (NSArray *)transients;
113 |
114 | // This method returns a list of the names of thecolumns actually used in the database
115 | // table backing this class. It's used to make sure that all properties have a corresponding column
116 | + (NSArray *)tableColumns;
117 |
118 | /*!
119 | Deletes this object's corresponding row from the database table. This version does NOT cascade to child objects in other tables.
120 | */
121 | - (void)deleteObject;
122 | + (void)deleteObject:(int)pk cascade:(BOOL)cascade;
123 |
124 | /*!
125 | Deletes this object's corresponding row from the database table.
126 | @param cascade Specifies whether child rows should be also deleted
127 | */
128 | - (void)deleteObjectCascade:(BOOL)cascade;
129 |
130 | /*!
131 | This is just a convenience routine; in several places we have to iterate through the properties and take some action based
132 | on their type. This method creates an array with all the property names and their types in a dictionary. The values for
133 | the encoded types will be one of:
134 |
135 | c A char
136 | i An int
137 | s A short
138 | l A long
139 | q A long long
140 | C An unsigned char
141 | I An unsigned int
142 | S An unsigned short
143 | L An unsigned long
144 | Q An unsigned long long
145 | f A float
146 | d A double
147 | B A C++ bool or a C99 _Bool
148 | v A void
149 | * A character string (char *)
150 | @ An object (whether statically typed or typed id)
151 | # A class object (Class)
152 | : A method selector (SEL)
153 | [array type] An array
154 | {name=type...} A structure
155 | (name=type...) A union
156 | bnum A bit field of num bits
157 | ^type A pointer to type
158 | ? An unknown type (among other things, this code is used for function pointers)
159 |
160 | Currently, the following properties cannot be persisted using this class: C, c, v, #, :, [array type], *, {name=type...}, (name=type...), bnum, ^type, or ?
161 | TODO: Look at finding ways to allow people to use some or all of the currently unsupported types... we could probably use sizeof to store the structs and unions maybe??.
162 | TODO: Look at overriding valueForUndefinedKey: to handle the char, char * and unsigned char property types - valueForKey: doesn't return anything for these, so currently they do not work.
163 | */
164 | + (NSDictionary *)propertiesWithEncodedTypes;
165 |
166 | /*!
167 | Indicates whether this object has ever been saved to the database. It does not indicate that the data matches what's in the database, just that there is a corresponding row
168 | */
169 | - (BOOL)existsInDB;
170 |
171 | /*
172 | * Reverts the object back to database state. Any changes that have been
173 | * made since the object was loaded are undone.
174 | */
175 | - (void)revert;
176 |
177 | /*
178 | * Reverts the given property (by name) back to its database state.
179 | */
180 | - (void)revertProperty:(NSString *)propName;
181 |
182 | /*
183 | * Reverts an NSArray of property names back to their database states.
184 | */
185 | - (void)revertProperties:(NSArray *)propNames;
186 |
187 | /*!
188 | Returns this objects primary key
189 | */
190 | - (int)pk;
191 |
192 | - (BOOL)areAllPropertiesEqual:(SQLitePersistentObject *)object;
193 |
194 | + (void)tableCheck;
195 |
196 | /*!
197 | This method will return a dictionary using the value for one specified field as the key and the pk stored as an NSNumber as the object. This is designed for letting you retrieve a list for display without having to load all objects into memory.
198 | */
199 | + (NSMutableDictionary *)sortedFieldValuesWithKeysForProperty:(NSString *)theProp;
200 |
201 | /*!
202 | This method will return paired mutable arrays (packed into an array) for each of the specified fields in the theProps array. The number of returned arrays will always be one greater than the number of values in theProps (assuming all of the passed values are valid fields), as the first mutable array will contain the primary key values for the object; the remainder of the arrays will correspond to the props in the same order they were passed in. The paired arrays will containe information at the same index about the same object. The values will be returned as formatted strings, as this method is intended for display in an iPhone table
203 | */
204 | + (NSArray *)pairedArraysForProperties:(NSArray *)theProps withCriteria:(NSString *)criteriaString, ...;
205 | + (NSArray *)pairedArraysForProperties:(NSArray *)theProps;
206 |
207 | + (NSArray *)pairedArraySelect:(NSString *)selectString fields:(NSInteger)fieldCount;
208 |
209 | + (NSInteger)count;
210 | + (NSInteger)countByCriteria:(NSString *)criteriaString, ...;
211 |
212 | #ifdef TARGET_OS_COCOTRON
213 | + (NSArray *)getPropertiesList;
214 | #endif
215 |
216 | + (sqlite3 *)database;
217 | + (SQLiteInstanceManager *)manager;
218 |
219 | #pragma mark - DeJohn Dong Added Methods
220 | /**
221 | * Asynchronous add/update an object to db.
222 | */
223 | - (void)save;
224 |
225 | /**
226 | * Asynchronous delete an object from db.
227 | */
228 | - (void)asynDeleteObject;
229 |
230 | /**
231 | * Asynchronous delete an object and the cascade objects from db.
232 | */
233 | - (void)asynDeleteObjectCascade:(BOOL)cascade;
234 |
235 | /**
236 | * Asynchronous Query the object list with criteria from db.
237 | *
238 | * @param criteria criteria string
239 | * @param result result list
240 | */
241 | + (void)queryByCriteria:(NSString *)criteria result:(DBQueryResult)result;
242 |
243 | /**
244 | * Asynchronous Query the first object with criteria from db
245 | *
246 | * @param criteria criteria string
247 | * @param result result object
248 | */
249 | + (void)queryFirstItemByCriteria:(NSString *)criteria result:(DBQueryResult)result;
250 |
251 | /**
252 | * Asynchronous Query all the objects from db
253 | *
254 | * @param result result list
255 | */
256 | + (void)queryResult:(DBQueryResult)result;
257 |
258 | @end
259 |
--------------------------------------------------------------------------------
/DDSQLiteKit/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 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
80 |
87 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
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 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
166 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------
/DDSQLiteKit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0D8CF35F1BDE776500A50266 /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D8CF35E1BDE776500A50266 /* libsqlite3.0.tbd */; };
11 | 8E0B672A1AAC7F880020FD73 /* SQLitePersistentObject.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 8E0B67291AAC7F880020FD73 /* SQLitePersistentObject.podspec */; };
12 | 8E334A2B1A84709C0076C92B /* DDSqliteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E334A2A1A84709C0076C92B /* DDSqliteViewController.m */; };
13 | 8E76A70D1A81CBEC00352063 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A70C1A81CBEC00352063 /* main.m */; };
14 | 8E76A7101A81CBEC00352063 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A70F1A81CBEC00352063 /* AppDelegate.m */; };
15 | 8E76A7131A81CBEC00352063 /* AddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7121A81CBEC00352063 /* AddViewController.m */; };
16 | 8E76A7161A81CBEC00352063 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8E76A7141A81CBEC00352063 /* Main.storyboard */; };
17 | 8E76A7181A81CBEC00352063 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8E76A7171A81CBEC00352063 /* Images.xcassets */; };
18 | 8E76A71B1A81CBEC00352063 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E76A7191A81CBEC00352063 /* LaunchScreen.xib */; };
19 | 8E76A7271A81CBEC00352063 /* DDSQLiteKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7261A81CBEC00352063 /* DDSQLiteKitTests.m */; };
20 | 8E76A7511A81CD5000352063 /* NSData-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7321A81CD5000352063 /* NSData-SQLitePersistence.m */; };
21 | 8E76A7521A81CD5000352063 /* NSDate-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7341A81CD5000352063 /* NSDate-SQLitePersistence.m */; };
22 | 8E76A7531A81CD5000352063 /* NSMutableArray-MultipleSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7361A81CD5000352063 /* NSMutableArray-MultipleSort.m */; };
23 | 8E76A7541A81CD5000352063 /* NSMutableData-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7381A81CD5000352063 /* NSMutableData-SQLitePersistence.m */; };
24 | 8E76A7551A81CD5000352063 /* NSNumber-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A73A1A81CD5000352063 /* NSNumber-SQLitePersistence.m */; };
25 | 8E76A7561A81CD5000352063 /* NSObject-ClassName.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A73C1A81CD5000352063 /* NSObject-ClassName.m */; };
26 | 8E76A7571A81CD5000352063 /* NSObject-MissingKV.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A73E1A81CD5000352063 /* NSObject-MissingKV.m */; };
27 | 8E76A7581A81CD5000352063 /* NSObject-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7401A81CD5000352063 /* NSObject-SQLitePersistence.m */; };
28 | 8E76A7591A81CD5000352063 /* NSString-NumberStuff.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7421A81CD5000352063 /* NSString-NumberStuff.m */; };
29 | 8E76A75A1A81CD5000352063 /* NSString-SQLiteColumnName.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7441A81CD5000352063 /* NSString-SQLiteColumnName.m */; };
30 | 8E76A75B1A81CD5000352063 /* NSString-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7461A81CD5000352063 /* NSString-SQLitePersistence.m */; };
31 | 8E76A75C1A81CD5000352063 /* NSString-UppercaseFirst.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7481A81CD5000352063 /* NSString-UppercaseFirst.m */; };
32 | 8E76A75D1A81CD5000352063 /* SQLiteInstanceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A74A1A81CD5000352063 /* SQLiteInstanceManager.m */; };
33 | 8E76A75E1A81CD5000352063 /* SQLitePersistentObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A74C1A81CD5000352063 /* SQLitePersistentObject.m */; };
34 | 8E76A75F1A81CD5000352063 /* UIColor-SQLitePersistentObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A74E1A81CD5000352063 /* UIColor-SQLitePersistentObject.m */; };
35 | 8E76A7601A81CD5000352063 /* UIImage-SQLitePersistence.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7501A81CD5000352063 /* UIImage-SQLitePersistence.m */; };
36 | 8E76A7651A81CE6400352063 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7641A81CE6400352063 /* TableViewController.m */; };
37 | 8E76A7681A81CF9D00352063 /* Device.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E76A7671A81CF9D00352063 /* Device.m */; };
38 | /* End PBXBuildFile section */
39 |
40 | /* Begin PBXContainerItemProxy section */
41 | 8E76A7211A81CBEC00352063 /* PBXContainerItemProxy */ = {
42 | isa = PBXContainerItemProxy;
43 | containerPortal = 8E76A6FF1A81CBEC00352063 /* Project object */;
44 | proxyType = 1;
45 | remoteGlobalIDString = 8E76A7061A81CBEC00352063;
46 | remoteInfo = DDSQLiteKit;
47 | };
48 | /* End PBXContainerItemProxy section */
49 |
50 | /* Begin PBXFileReference section */
51 | 0D8CF35E1BDE776500A50266 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
52 | 8E0B67291AAC7F880020FD73 /* SQLitePersistentObject.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLitePersistentObject.podspec; sourceTree = ""; };
53 | 8E334A291A84709C0076C92B /* DDSqliteViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDSqliteViewController.h; sourceTree = ""; };
54 | 8E334A2A1A84709C0076C92B /* DDSqliteViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDSqliteViewController.m; sourceTree = ""; };
55 | 8E76A7071A81CBEC00352063 /* DDSQLiteKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DDSQLiteKit.app; sourceTree = BUILT_PRODUCTS_DIR; };
56 | 8E76A70B1A81CBEC00352063 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
57 | 8E76A70C1A81CBEC00352063 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
58 | 8E76A70E1A81CBEC00352063 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
59 | 8E76A70F1A81CBEC00352063 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
60 | 8E76A7111A81CBEC00352063 /* AddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AddViewController.h; sourceTree = ""; };
61 | 8E76A7121A81CBEC00352063 /* AddViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AddViewController.m; sourceTree = ""; };
62 | 8E76A7151A81CBEC00352063 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
63 | 8E76A7171A81CBEC00352063 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
64 | 8E76A71A1A81CBEC00352063 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
65 | 8E76A7201A81CBEC00352063 /* DDSQLiteKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DDSQLiteKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
66 | 8E76A7251A81CBEC00352063 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
67 | 8E76A7261A81CBEC00352063 /* DDSQLiteKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDSQLiteKitTests.m; sourceTree = ""; };
68 | 8E76A7311A81CD5000352063 /* NSData-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData-SQLitePersistence.h"; sourceTree = ""; };
69 | 8E76A7321A81CD5000352063 /* NSData-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData-SQLitePersistence.m"; sourceTree = ""; };
70 | 8E76A7331A81CD5000352063 /* NSDate-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate-SQLitePersistence.h"; sourceTree = ""; };
71 | 8E76A7341A81CD5000352063 /* NSDate-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate-SQLitePersistence.m"; sourceTree = ""; };
72 | 8E76A7351A81CD5000352063 /* NSMutableArray-MultipleSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray-MultipleSort.h"; sourceTree = ""; };
73 | 8E76A7361A81CD5000352063 /* NSMutableArray-MultipleSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray-MultipleSort.m"; sourceTree = ""; };
74 | 8E76A7371A81CD5000352063 /* NSMutableData-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableData-SQLitePersistence.h"; sourceTree = ""; };
75 | 8E76A7381A81CD5000352063 /* NSMutableData-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableData-SQLitePersistence.m"; sourceTree = ""; };
76 | 8E76A7391A81CD5000352063 /* NSNumber-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber-SQLitePersistence.h"; sourceTree = ""; };
77 | 8E76A73A1A81CD5000352063 /* NSNumber-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNumber-SQLitePersistence.m"; sourceTree = ""; };
78 | 8E76A73B1A81CD5000352063 /* NSObject-ClassName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject-ClassName.h"; sourceTree = ""; };
79 | 8E76A73C1A81CD5000352063 /* NSObject-ClassName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject-ClassName.m"; sourceTree = ""; };
80 | 8E76A73D1A81CD5000352063 /* NSObject-MissingKV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject-MissingKV.h"; sourceTree = ""; };
81 | 8E76A73E1A81CD5000352063 /* NSObject-MissingKV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject-MissingKV.m"; sourceTree = ""; };
82 | 8E76A73F1A81CD5000352063 /* NSObject-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject-SQLitePersistence.h"; sourceTree = ""; };
83 | 8E76A7401A81CD5000352063 /* NSObject-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject-SQLitePersistence.m"; sourceTree = ""; };
84 | 8E76A7411A81CD5000352063 /* NSString-NumberStuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString-NumberStuff.h"; sourceTree = ""; };
85 | 8E76A7421A81CD5000352063 /* NSString-NumberStuff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString-NumberStuff.m"; sourceTree = ""; };
86 | 8E76A7431A81CD5000352063 /* NSString-SQLiteColumnName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString-SQLiteColumnName.h"; sourceTree = ""; };
87 | 8E76A7441A81CD5000352063 /* NSString-SQLiteColumnName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString-SQLiteColumnName.m"; sourceTree = ""; };
88 | 8E76A7451A81CD5000352063 /* NSString-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString-SQLitePersistence.h"; sourceTree = ""; };
89 | 8E76A7461A81CD5000352063 /* NSString-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString-SQLitePersistence.m"; sourceTree = ""; };
90 | 8E76A7471A81CD5000352063 /* NSString-UppercaseFirst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString-UppercaseFirst.h"; sourceTree = ""; };
91 | 8E76A7481A81CD5000352063 /* NSString-UppercaseFirst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString-UppercaseFirst.m"; sourceTree = ""; };
92 | 8E76A7491A81CD5000352063 /* SQLiteInstanceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteInstanceManager.h; sourceTree = ""; };
93 | 8E76A74A1A81CD5000352063 /* SQLiteInstanceManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQLiteInstanceManager.m; sourceTree = ""; };
94 | 8E76A74B1A81CD5000352063 /* SQLitePersistentObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLitePersistentObject.h; sourceTree = ""; };
95 | 8E76A74C1A81CD5000352063 /* SQLitePersistentObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQLitePersistentObject.m; sourceTree = ""; };
96 | 8E76A74D1A81CD5000352063 /* UIColor-SQLitePersistentObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor-SQLitePersistentObject.h"; sourceTree = ""; };
97 | 8E76A74E1A81CD5000352063 /* UIColor-SQLitePersistentObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor-SQLitePersistentObject.m"; sourceTree = ""; };
98 | 8E76A74F1A81CD5000352063 /* UIImage-SQLitePersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage-SQLitePersistence.h"; sourceTree = ""; };
99 | 8E76A7501A81CD5000352063 /* UIImage-SQLitePersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage-SQLitePersistence.m"; sourceTree = ""; };
100 | 8E76A7631A81CE6400352063 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; };
101 | 8E76A7641A81CE6400352063 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; };
102 | 8E76A7661A81CF9D00352063 /* Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Device.h; sourceTree = ""; };
103 | 8E76A7671A81CF9D00352063 /* Device.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Device.m; sourceTree = ""; };
104 | /* End PBXFileReference section */
105 |
106 | /* Begin PBXFrameworksBuildPhase section */
107 | 8E76A7041A81CBEC00352063 /* Frameworks */ = {
108 | isa = PBXFrameworksBuildPhase;
109 | buildActionMask = 2147483647;
110 | files = (
111 | 0D8CF35F1BDE776500A50266 /* libsqlite3.0.tbd in Frameworks */,
112 | );
113 | runOnlyForDeploymentPostprocessing = 0;
114 | };
115 | 8E76A71D1A81CBEC00352063 /* Frameworks */ = {
116 | isa = PBXFrameworksBuildPhase;
117 | buildActionMask = 2147483647;
118 | files = (
119 | );
120 | runOnlyForDeploymentPostprocessing = 0;
121 | };
122 | /* End PBXFrameworksBuildPhase section */
123 |
124 | /* Begin PBXGroup section */
125 | 8E76A6FE1A81CBEC00352063 = {
126 | isa = PBXGroup;
127 | children = (
128 | 0D8CF35E1BDE776500A50266 /* libsqlite3.0.tbd */,
129 | 8E0B67291AAC7F880020FD73 /* SQLitePersistentObject.podspec */,
130 | 8E76A7091A81CBEC00352063 /* DDSQLiteKit */,
131 | 8E76A7231A81CBEC00352063 /* DDSQLiteKitTests */,
132 | 8E76A7081A81CBEC00352063 /* Products */,
133 | );
134 | sourceTree = "";
135 | };
136 | 8E76A7081A81CBEC00352063 /* Products */ = {
137 | isa = PBXGroup;
138 | children = (
139 | 8E76A7071A81CBEC00352063 /* DDSQLiteKit.app */,
140 | 8E76A7201A81CBEC00352063 /* DDSQLiteKitTests.xctest */,
141 | );
142 | name = Products;
143 | sourceTree = "";
144 | };
145 | 8E76A7091A81CBEC00352063 /* DDSQLiteKit */ = {
146 | isa = PBXGroup;
147 | children = (
148 | 8E76A7301A81CD5000352063 /* SQLitePersistentObject */,
149 | 8E76A70E1A81CBEC00352063 /* AppDelegate.h */,
150 | 8E76A70F1A81CBEC00352063 /* AppDelegate.m */,
151 | 8E76A7631A81CE6400352063 /* TableViewController.h */,
152 | 8E76A7641A81CE6400352063 /* TableViewController.m */,
153 | 8E76A7111A81CBEC00352063 /* AddViewController.h */,
154 | 8E76A7121A81CBEC00352063 /* AddViewController.m */,
155 | 8E334A291A84709C0076C92B /* DDSqliteViewController.h */,
156 | 8E334A2A1A84709C0076C92B /* DDSqliteViewController.m */,
157 | 8E76A7141A81CBEC00352063 /* Main.storyboard */,
158 | 8E76A7171A81CBEC00352063 /* Images.xcassets */,
159 | 8E76A7191A81CBEC00352063 /* LaunchScreen.xib */,
160 | 8E76A70A1A81CBEC00352063 /* Supporting Files */,
161 | 8E76A7661A81CF9D00352063 /* Device.h */,
162 | 8E76A7671A81CF9D00352063 /* Device.m */,
163 | );
164 | path = DDSQLiteKit;
165 | sourceTree = "";
166 | };
167 | 8E76A70A1A81CBEC00352063 /* Supporting Files */ = {
168 | isa = PBXGroup;
169 | children = (
170 | 8E76A70B1A81CBEC00352063 /* Info.plist */,
171 | 8E76A70C1A81CBEC00352063 /* main.m */,
172 | );
173 | name = "Supporting Files";
174 | sourceTree = "";
175 | };
176 | 8E76A7231A81CBEC00352063 /* DDSQLiteKitTests */ = {
177 | isa = PBXGroup;
178 | children = (
179 | 8E76A7261A81CBEC00352063 /* DDSQLiteKitTests.m */,
180 | 8E76A7241A81CBEC00352063 /* Supporting Files */,
181 | );
182 | path = DDSQLiteKitTests;
183 | sourceTree = "";
184 | };
185 | 8E76A7241A81CBEC00352063 /* Supporting Files */ = {
186 | isa = PBXGroup;
187 | children = (
188 | 8E76A7251A81CBEC00352063 /* Info.plist */,
189 | );
190 | name = "Supporting Files";
191 | sourceTree = "";
192 | };
193 | 8E76A7301A81CD5000352063 /* SQLitePersistentObject */ = {
194 | isa = PBXGroup;
195 | children = (
196 | 8E76A7311A81CD5000352063 /* NSData-SQLitePersistence.h */,
197 | 8E76A7321A81CD5000352063 /* NSData-SQLitePersistence.m */,
198 | 8E76A7331A81CD5000352063 /* NSDate-SQLitePersistence.h */,
199 | 8E76A7341A81CD5000352063 /* NSDate-SQLitePersistence.m */,
200 | 8E76A7351A81CD5000352063 /* NSMutableArray-MultipleSort.h */,
201 | 8E76A7361A81CD5000352063 /* NSMutableArray-MultipleSort.m */,
202 | 8E76A7371A81CD5000352063 /* NSMutableData-SQLitePersistence.h */,
203 | 8E76A7381A81CD5000352063 /* NSMutableData-SQLitePersistence.m */,
204 | 8E76A7391A81CD5000352063 /* NSNumber-SQLitePersistence.h */,
205 | 8E76A73A1A81CD5000352063 /* NSNumber-SQLitePersistence.m */,
206 | 8E76A73B1A81CD5000352063 /* NSObject-ClassName.h */,
207 | 8E76A73C1A81CD5000352063 /* NSObject-ClassName.m */,
208 | 8E76A73D1A81CD5000352063 /* NSObject-MissingKV.h */,
209 | 8E76A73E1A81CD5000352063 /* NSObject-MissingKV.m */,
210 | 8E76A73F1A81CD5000352063 /* NSObject-SQLitePersistence.h */,
211 | 8E76A7401A81CD5000352063 /* NSObject-SQLitePersistence.m */,
212 | 8E76A7411A81CD5000352063 /* NSString-NumberStuff.h */,
213 | 8E76A7421A81CD5000352063 /* NSString-NumberStuff.m */,
214 | 8E76A7431A81CD5000352063 /* NSString-SQLiteColumnName.h */,
215 | 8E76A7441A81CD5000352063 /* NSString-SQLiteColumnName.m */,
216 | 8E76A7451A81CD5000352063 /* NSString-SQLitePersistence.h */,
217 | 8E76A7461A81CD5000352063 /* NSString-SQLitePersistence.m */,
218 | 8E76A7471A81CD5000352063 /* NSString-UppercaseFirst.h */,
219 | 8E76A7481A81CD5000352063 /* NSString-UppercaseFirst.m */,
220 | 8E76A7491A81CD5000352063 /* SQLiteInstanceManager.h */,
221 | 8E76A74A1A81CD5000352063 /* SQLiteInstanceManager.m */,
222 | 8E76A74B1A81CD5000352063 /* SQLitePersistentObject.h */,
223 | 8E76A74C1A81CD5000352063 /* SQLitePersistentObject.m */,
224 | 8E76A74D1A81CD5000352063 /* UIColor-SQLitePersistentObject.h */,
225 | 8E76A74E1A81CD5000352063 /* UIColor-SQLitePersistentObject.m */,
226 | 8E76A74F1A81CD5000352063 /* UIImage-SQLitePersistence.h */,
227 | 8E76A7501A81CD5000352063 /* UIImage-SQLitePersistence.m */,
228 | );
229 | path = SQLitePersistentObject;
230 | sourceTree = "";
231 | };
232 | /* End PBXGroup section */
233 |
234 | /* Begin PBXNativeTarget section */
235 | 8E76A7061A81CBEC00352063 /* DDSQLiteKit */ = {
236 | isa = PBXNativeTarget;
237 | buildConfigurationList = 8E76A72A1A81CBEC00352063 /* Build configuration list for PBXNativeTarget "DDSQLiteKit" */;
238 | buildPhases = (
239 | 8E76A7031A81CBEC00352063 /* Sources */,
240 | 8E76A7041A81CBEC00352063 /* Frameworks */,
241 | 8E76A7051A81CBEC00352063 /* Resources */,
242 | );
243 | buildRules = (
244 | );
245 | dependencies = (
246 | );
247 | name = DDSQLiteKit;
248 | productName = DDSQLiteKit;
249 | productReference = 8E76A7071A81CBEC00352063 /* DDSQLiteKit.app */;
250 | productType = "com.apple.product-type.application";
251 | };
252 | 8E76A71F1A81CBEC00352063 /* DDSQLiteKitTests */ = {
253 | isa = PBXNativeTarget;
254 | buildConfigurationList = 8E76A72D1A81CBEC00352063 /* Build configuration list for PBXNativeTarget "DDSQLiteKitTests" */;
255 | buildPhases = (
256 | 8E76A71C1A81CBEC00352063 /* Sources */,
257 | 8E76A71D1A81CBEC00352063 /* Frameworks */,
258 | 8E76A71E1A81CBEC00352063 /* Resources */,
259 | );
260 | buildRules = (
261 | );
262 | dependencies = (
263 | 8E76A7221A81CBEC00352063 /* PBXTargetDependency */,
264 | );
265 | name = DDSQLiteKitTests;
266 | productName = DDSQLiteKitTests;
267 | productReference = 8E76A7201A81CBEC00352063 /* DDSQLiteKitTests.xctest */;
268 | productType = "com.apple.product-type.bundle.unit-test";
269 | };
270 | /* End PBXNativeTarget section */
271 |
272 | /* Begin PBXProject section */
273 | 8E76A6FF1A81CBEC00352063 /* Project object */ = {
274 | isa = PBXProject;
275 | attributes = {
276 | LastUpgradeCheck = 0710;
277 | ORGANIZATIONNAME = DDKit;
278 | TargetAttributes = {
279 | 8E76A7061A81CBEC00352063 = {
280 | CreatedOnToolsVersion = 6.1.1;
281 | DevelopmentTeam = F76XM9QFY9;
282 | };
283 | 8E76A71F1A81CBEC00352063 = {
284 | CreatedOnToolsVersion = 6.1.1;
285 | DevelopmentTeam = F76XM9QFY9;
286 | TestTargetID = 8E76A7061A81CBEC00352063;
287 | };
288 | };
289 | };
290 | buildConfigurationList = 8E76A7021A81CBEC00352063 /* Build configuration list for PBXProject "DDSQLiteKit" */;
291 | compatibilityVersion = "Xcode 3.2";
292 | developmentRegion = English;
293 | hasScannedForEncodings = 0;
294 | knownRegions = (
295 | en,
296 | Base,
297 | );
298 | mainGroup = 8E76A6FE1A81CBEC00352063;
299 | productRefGroup = 8E76A7081A81CBEC00352063 /* Products */;
300 | projectDirPath = "";
301 | projectRoot = "";
302 | targets = (
303 | 8E76A7061A81CBEC00352063 /* DDSQLiteKit */,
304 | 8E76A71F1A81CBEC00352063 /* DDSQLiteKitTests */,
305 | );
306 | };
307 | /* End PBXProject section */
308 |
309 | /* Begin PBXResourcesBuildPhase section */
310 | 8E76A7051A81CBEC00352063 /* Resources */ = {
311 | isa = PBXResourcesBuildPhase;
312 | buildActionMask = 2147483647;
313 | files = (
314 | 8E0B672A1AAC7F880020FD73 /* SQLitePersistentObject.podspec in Resources */,
315 | 8E76A7161A81CBEC00352063 /* Main.storyboard in Resources */,
316 | 8E76A71B1A81CBEC00352063 /* LaunchScreen.xib in Resources */,
317 | 8E76A7181A81CBEC00352063 /* Images.xcassets in Resources */,
318 | );
319 | runOnlyForDeploymentPostprocessing = 0;
320 | };
321 | 8E76A71E1A81CBEC00352063 /* Resources */ = {
322 | isa = PBXResourcesBuildPhase;
323 | buildActionMask = 2147483647;
324 | files = (
325 | );
326 | runOnlyForDeploymentPostprocessing = 0;
327 | };
328 | /* End PBXResourcesBuildPhase section */
329 |
330 | /* Begin PBXSourcesBuildPhase section */
331 | 8E76A7031A81CBEC00352063 /* Sources */ = {
332 | isa = PBXSourcesBuildPhase;
333 | buildActionMask = 2147483647;
334 | files = (
335 | 8E76A7511A81CD5000352063 /* NSData-SQLitePersistence.m in Sources */,
336 | 8E76A75B1A81CD5000352063 /* NSString-SQLitePersistence.m in Sources */,
337 | 8E334A2B1A84709C0076C92B /* DDSqliteViewController.m in Sources */,
338 | 8E76A7601A81CD5000352063 /* UIImage-SQLitePersistence.m in Sources */,
339 | 8E76A7651A81CE6400352063 /* TableViewController.m in Sources */,
340 | 8E76A7131A81CBEC00352063 /* AddViewController.m in Sources */,
341 | 8E76A7541A81CD5000352063 /* NSMutableData-SQLitePersistence.m in Sources */,
342 | 8E76A75D1A81CD5000352063 /* SQLiteInstanceManager.m in Sources */,
343 | 8E76A7571A81CD5000352063 /* NSObject-MissingKV.m in Sources */,
344 | 8E76A7101A81CBEC00352063 /* AppDelegate.m in Sources */,
345 | 8E76A7561A81CD5000352063 /* NSObject-ClassName.m in Sources */,
346 | 8E76A75E1A81CD5000352063 /* SQLitePersistentObject.m in Sources */,
347 | 8E76A70D1A81CBEC00352063 /* main.m in Sources */,
348 | 8E76A7681A81CF9D00352063 /* Device.m in Sources */,
349 | 8E76A7551A81CD5000352063 /* NSNumber-SQLitePersistence.m in Sources */,
350 | 8E76A7581A81CD5000352063 /* NSObject-SQLitePersistence.m in Sources */,
351 | 8E76A7521A81CD5000352063 /* NSDate-SQLitePersistence.m in Sources */,
352 | 8E76A75A1A81CD5000352063 /* NSString-SQLiteColumnName.m in Sources */,
353 | 8E76A7531A81CD5000352063 /* NSMutableArray-MultipleSort.m in Sources */,
354 | 8E76A75C1A81CD5000352063 /* NSString-UppercaseFirst.m in Sources */,
355 | 8E76A75F1A81CD5000352063 /* UIColor-SQLitePersistentObject.m in Sources */,
356 | 8E76A7591A81CD5000352063 /* NSString-NumberStuff.m in Sources */,
357 | );
358 | runOnlyForDeploymentPostprocessing = 0;
359 | };
360 | 8E76A71C1A81CBEC00352063 /* Sources */ = {
361 | isa = PBXSourcesBuildPhase;
362 | buildActionMask = 2147483647;
363 | files = (
364 | 8E76A7271A81CBEC00352063 /* DDSQLiteKitTests.m in Sources */,
365 | );
366 | runOnlyForDeploymentPostprocessing = 0;
367 | };
368 | /* End PBXSourcesBuildPhase section */
369 |
370 | /* Begin PBXTargetDependency section */
371 | 8E76A7221A81CBEC00352063 /* PBXTargetDependency */ = {
372 | isa = PBXTargetDependency;
373 | target = 8E76A7061A81CBEC00352063 /* DDSQLiteKit */;
374 | targetProxy = 8E76A7211A81CBEC00352063 /* PBXContainerItemProxy */;
375 | };
376 | /* End PBXTargetDependency section */
377 |
378 | /* Begin PBXVariantGroup section */
379 | 8E76A7141A81CBEC00352063 /* Main.storyboard */ = {
380 | isa = PBXVariantGroup;
381 | children = (
382 | 8E76A7151A81CBEC00352063 /* Base */,
383 | );
384 | name = Main.storyboard;
385 | sourceTree = "";
386 | };
387 | 8E76A7191A81CBEC00352063 /* LaunchScreen.xib */ = {
388 | isa = PBXVariantGroup;
389 | children = (
390 | 8E76A71A1A81CBEC00352063 /* Base */,
391 | );
392 | name = LaunchScreen.xib;
393 | sourceTree = "";
394 | };
395 | /* End PBXVariantGroup section */
396 |
397 | /* Begin XCBuildConfiguration section */
398 | 8E76A7281A81CBEC00352063 /* Debug */ = {
399 | isa = XCBuildConfiguration;
400 | buildSettings = {
401 | ALWAYS_SEARCH_USER_PATHS = NO;
402 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
403 | CLANG_CXX_LIBRARY = "libc++";
404 | CLANG_ENABLE_MODULES = YES;
405 | CLANG_ENABLE_OBJC_ARC = YES;
406 | CLANG_WARN_BOOL_CONVERSION = YES;
407 | CLANG_WARN_CONSTANT_CONVERSION = YES;
408 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
409 | CLANG_WARN_EMPTY_BODY = YES;
410 | CLANG_WARN_ENUM_CONVERSION = YES;
411 | CLANG_WARN_INT_CONVERSION = YES;
412 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
413 | CLANG_WARN_UNREACHABLE_CODE = YES;
414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
415 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
416 | COPY_PHASE_STRIP = NO;
417 | ENABLE_STRICT_OBJC_MSGSEND = YES;
418 | ENABLE_TESTABILITY = YES;
419 | GCC_C_LANGUAGE_STANDARD = gnu99;
420 | GCC_DYNAMIC_NO_PIC = NO;
421 | GCC_OPTIMIZATION_LEVEL = 0;
422 | GCC_PREPROCESSOR_DEFINITIONS = (
423 | "DEBUG=1",
424 | "$(inherited)",
425 | );
426 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
429 | GCC_WARN_UNDECLARED_SELECTOR = YES;
430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
431 | GCC_WARN_UNUSED_FUNCTION = YES;
432 | GCC_WARN_UNUSED_VARIABLE = YES;
433 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
434 | MTL_ENABLE_DEBUG_INFO = YES;
435 | ONLY_ACTIVE_ARCH = YES;
436 | SDKROOT = iphoneos;
437 | };
438 | name = Debug;
439 | };
440 | 8E76A7291A81CBEC00352063 /* Release */ = {
441 | isa = XCBuildConfiguration;
442 | buildSettings = {
443 | ALWAYS_SEARCH_USER_PATHS = NO;
444 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
445 | CLANG_CXX_LIBRARY = "libc++";
446 | CLANG_ENABLE_MODULES = YES;
447 | CLANG_ENABLE_OBJC_ARC = YES;
448 | CLANG_WARN_BOOL_CONVERSION = YES;
449 | CLANG_WARN_CONSTANT_CONVERSION = YES;
450 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
451 | CLANG_WARN_EMPTY_BODY = YES;
452 | CLANG_WARN_ENUM_CONVERSION = YES;
453 | CLANG_WARN_INT_CONVERSION = YES;
454 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
455 | CLANG_WARN_UNREACHABLE_CODE = YES;
456 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
457 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
458 | COPY_PHASE_STRIP = YES;
459 | ENABLE_NS_ASSERTIONS = NO;
460 | ENABLE_STRICT_OBJC_MSGSEND = YES;
461 | GCC_C_LANGUAGE_STANDARD = gnu99;
462 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
463 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
464 | GCC_WARN_UNDECLARED_SELECTOR = YES;
465 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
466 | GCC_WARN_UNUSED_FUNCTION = YES;
467 | GCC_WARN_UNUSED_VARIABLE = YES;
468 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
469 | MTL_ENABLE_DEBUG_INFO = NO;
470 | SDKROOT = iphoneos;
471 | VALIDATE_PRODUCT = YES;
472 | };
473 | name = Release;
474 | };
475 | 8E76A72B1A81CBEC00352063 /* Debug */ = {
476 | isa = XCBuildConfiguration;
477 | buildSettings = {
478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
479 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
480 | DEVELOPMENT_TEAM = F76XM9QFY9;
481 | INFOPLIST_FILE = DDSQLiteKit/Info.plist;
482 | IPHONEOS_DEPLOYMENT_TARGET = 6.0;
483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
484 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)";
485 | PRODUCT_NAME = "$(TARGET_NAME)";
486 | };
487 | name = Debug;
488 | };
489 | 8E76A72C1A81CBEC00352063 /* Release */ = {
490 | isa = XCBuildConfiguration;
491 | buildSettings = {
492 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
493 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
494 | DEVELOPMENT_TEAM = F76XM9QFY9;
495 | INFOPLIST_FILE = DDSQLiteKit/Info.plist;
496 | IPHONEOS_DEPLOYMENT_TARGET = 6.0;
497 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
498 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)";
499 | PRODUCT_NAME = "$(TARGET_NAME)";
500 | };
501 | name = Release;
502 | };
503 | 8E76A72E1A81CBEC00352063 /* Debug */ = {
504 | isa = XCBuildConfiguration;
505 | buildSettings = {
506 | BUNDLE_LOADER = "$(TEST_HOST)";
507 | DEVELOPMENT_TEAM = F76XM9QFY9;
508 | FRAMEWORK_SEARCH_PATHS = (
509 | "$(SDKROOT)/Developer/Library/Frameworks",
510 | "$(inherited)",
511 | );
512 | GCC_PREPROCESSOR_DEFINITIONS = (
513 | "DEBUG=1",
514 | "$(inherited)",
515 | );
516 | INFOPLIST_FILE = DDSQLiteKitTests/Info.plist;
517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
518 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)";
519 | PRODUCT_NAME = "$(TARGET_NAME)";
520 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DDSQLiteKit.app/DDSQLiteKit";
521 | };
522 | name = Debug;
523 | };
524 | 8E76A72F1A81CBEC00352063 /* Release */ = {
525 | isa = XCBuildConfiguration;
526 | buildSettings = {
527 | BUNDLE_LOADER = "$(TEST_HOST)";
528 | DEVELOPMENT_TEAM = F76XM9QFY9;
529 | FRAMEWORK_SEARCH_PATHS = (
530 | "$(SDKROOT)/Developer/Library/Frameworks",
531 | "$(inherited)",
532 | );
533 | INFOPLIST_FILE = DDSQLiteKitTests/Info.plist;
534 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
535 | PRODUCT_BUNDLE_IDENTIFIER = "com.ddkit.$(PRODUCT_NAME:rfc1034identifier)";
536 | PRODUCT_NAME = "$(TARGET_NAME)";
537 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DDSQLiteKit.app/DDSQLiteKit";
538 | };
539 | name = Release;
540 | };
541 | /* End XCBuildConfiguration section */
542 |
543 | /* Begin XCConfigurationList section */
544 | 8E76A7021A81CBEC00352063 /* Build configuration list for PBXProject "DDSQLiteKit" */ = {
545 | isa = XCConfigurationList;
546 | buildConfigurations = (
547 | 8E76A7281A81CBEC00352063 /* Debug */,
548 | 8E76A7291A81CBEC00352063 /* Release */,
549 | );
550 | defaultConfigurationIsVisible = 0;
551 | defaultConfigurationName = Release;
552 | };
553 | 8E76A72A1A81CBEC00352063 /* Build configuration list for PBXNativeTarget "DDSQLiteKit" */ = {
554 | isa = XCConfigurationList;
555 | buildConfigurations = (
556 | 8E76A72B1A81CBEC00352063 /* Debug */,
557 | 8E76A72C1A81CBEC00352063 /* Release */,
558 | );
559 | defaultConfigurationIsVisible = 0;
560 | defaultConfigurationName = Release;
561 | };
562 | 8E76A72D1A81CBEC00352063 /* Build configuration list for PBXNativeTarget "DDSQLiteKitTests" */ = {
563 | isa = XCConfigurationList;
564 | buildConfigurations = (
565 | 8E76A72E1A81CBEC00352063 /* Debug */,
566 | 8E76A72F1A81CBEC00352063 /* Release */,
567 | );
568 | defaultConfigurationIsVisible = 0;
569 | defaultConfigurationName = Release;
570 | };
571 | /* End XCConfigurationList section */
572 | };
573 | rootObject = 8E76A6FF1A81CBEC00352063 /* Project object */;
574 | }
575 |
--------------------------------------------------------------------------------