Skip to content

Commit e401b44

Browse files
author
ChrisCai
committed
添加Demo
1 parent 8287404 commit e401b44

File tree

12 files changed

+254
-25
lines changed

12 files changed

+254
-25
lines changed

GKDatabase.xcodeproj/project.pbxproj

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
83A148321D3DD925000FA797 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 83A148311D3DD925000FA797 /* Assets.xcassets */; };
1515
83A148351D3DD925000FA797 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 83A148331D3DD925000FA797 /* LaunchScreen.storyboard */; };
1616
83A1483E1D3DD9A9000FA797 /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 83A1483D1D3DD9A9000FA797 /* libsqlite3.0.tbd */; };
17-
83A148491D3DFE44000FA797 /* GKDatabaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A148461D3DFE44000FA797 /* GKDatabaseManager.m */; };
18-
83A1484A1D3DFE44000FA797 /* GKObjcProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A148481D3DFE44000FA797 /* GKObjcProperty.m */; };
17+
83A1484F1D3DFFB7000FA797 /* GKDatabaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1484C1D3DFFB7000FA797 /* GKDatabaseManager.m */; };
18+
83A148501D3DFFB7000FA797 /* GKObjcProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1484E1D3DFFB7000FA797 /* GKObjcProperty.m */; };
19+
83A148561D3E00EE000FA797 /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A148551D3E00EE000FA797 /* Person.m */; };
20+
83A148591D3E0121000FA797 /* Student.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A148581D3E0121000FA797 /* Student.m */; };
1921
/* End PBXBuildFile section */
2022

2123
/* Begin PBXFileReference section */
@@ -30,10 +32,15 @@
3032
83A148341D3DD925000FA797 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
3133
83A148361D3DD925000FA797 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3234
83A1483D1D3DD9A9000FA797 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
33-
83A148451D3DFE44000FA797 /* GKDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GKDatabaseManager.h; path = "GKDatabase/未命名文件夹/GKDatabaseManager.h"; sourceTree = SOURCE_ROOT; };
34-
83A148461D3DFE44000FA797 /* GKDatabaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GKDatabaseManager.m; path = "GKDatabase/未命名文件夹/GKDatabaseManager.m"; sourceTree = SOURCE_ROOT; };
35-
83A148471D3DFE44000FA797 /* GKObjcProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GKObjcProperty.h; path = "GKDatabase/未命名文件夹/GKObjcProperty.h"; sourceTree = SOURCE_ROOT; };
36-
83A148481D3DFE44000FA797 /* GKObjcProperty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GKObjcProperty.m; path = "GKDatabase/未命名文件夹/GKObjcProperty.m"; sourceTree = SOURCE_ROOT; };
35+
83A1484B1D3DFFB7000FA797 /* GKDatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GKDatabaseManager.h; sourceTree = "<group>"; };
36+
83A1484C1D3DFFB7000FA797 /* GKDatabaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GKDatabaseManager.m; sourceTree = "<group>"; };
37+
83A1484D1D3DFFB7000FA797 /* GKObjcProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GKObjcProperty.h; sourceTree = "<group>"; };
38+
83A1484E1D3DFFB7000FA797 /* GKObjcProperty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GKObjcProperty.m; sourceTree = "<group>"; };
39+
83A148511D3DFFD1000FA797 /* GKDatabase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GKDatabase.h; sourceTree = "<group>"; };
40+
83A148541D3E00EE000FA797 /* Person.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Person.h; sourceTree = "<group>"; };
41+
83A148551D3E00EE000FA797 /* Person.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Person.m; sourceTree = "<group>"; };
42+
83A148571D3E0121000FA797 /* Student.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Student.h; sourceTree = "<group>"; };
43+
83A148581D3E0121000FA797 /* Student.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Student.m; sourceTree = "<group>"; };
3744
/* End PBXFileReference section */
3845

3946
/* Begin PBXFrameworksBuildPhase section */
@@ -69,6 +76,7 @@
6976
isa = PBXGroup;
7077
children = (
7178
83A1483C1D3DD956000FA797 /* GKDatabase */,
79+
83A148521D3E0054000FA797 /* Demo */,
7280
83A148281D3DD925000FA797 /* AppDelegate.h */,
7381
83A148291D3DD925000FA797 /* AppDelegate.m */,
7482
83A1482B1D3DD925000FA797 /* ViewController.h */,
@@ -93,14 +101,34 @@
93101
83A1483C1D3DD956000FA797 /* GKDatabase */ = {
94102
isa = PBXGroup;
95103
children = (
96-
83A148471D3DFE44000FA797 /* GKObjcProperty.h */,
97-
83A148481D3DFE44000FA797 /* GKObjcProperty.m */,
98-
83A148451D3DFE44000FA797 /* GKDatabaseManager.h */,
99-
83A148461D3DFE44000FA797 /* GKDatabaseManager.m */,
104+
83A1484B1D3DFFB7000FA797 /* GKDatabaseManager.h */,
105+
83A1484C1D3DFFB7000FA797 /* GKDatabaseManager.m */,
106+
83A1484D1D3DFFB7000FA797 /* GKObjcProperty.h */,
107+
83A1484E1D3DFFB7000FA797 /* GKObjcProperty.m */,
108+
83A148511D3DFFD1000FA797 /* GKDatabase.h */,
100109
);
101110
path = GKDatabase;
102111
sourceTree = "<group>";
103112
};
113+
83A148521D3E0054000FA797 /* Demo */ = {
114+
isa = PBXGroup;
115+
children = (
116+
83A148531D3E0054000FA797 /* models */,
117+
);
118+
path = Demo;
119+
sourceTree = "<group>";
120+
};
121+
83A148531D3E0054000FA797 /* models */ = {
122+
isa = PBXGroup;
123+
children = (
124+
83A148541D3E00EE000FA797 /* Person.h */,
125+
83A148551D3E00EE000FA797 /* Person.m */,
126+
83A148571D3E0121000FA797 /* Student.h */,
127+
83A148581D3E0121000FA797 /* Student.m */,
128+
);
129+
path = models;
130+
sourceTree = "<group>";
131+
};
104132
/* End PBXGroup section */
105133

106134
/* Begin PBXNativeTarget section */
@@ -171,11 +199,13 @@
171199
isa = PBXSourcesBuildPhase;
172200
buildActionMask = 2147483647;
173201
files = (
202+
83A148561D3E00EE000FA797 /* Person.m in Sources */,
203+
83A1484F1D3DFFB7000FA797 /* GKDatabaseManager.m in Sources */,
174204
83A1482D1D3DD925000FA797 /* ViewController.m in Sources */,
175205
83A1482A1D3DD925000FA797 /* AppDelegate.m in Sources */,
176-
83A148491D3DFE44000FA797 /* GKDatabaseManager.m in Sources */,
206+
83A148591D3E0121000FA797 /* Student.m in Sources */,
177207
83A148271D3DD925000FA797 /* main.m in Sources */,
178-
83A1484A1D3DFE44000FA797 /* GKObjcProperty.m in Sources */,
208+
83A148501D3DFFB7000FA797 /* GKObjcProperty.m in Sources */,
179209
);
180210
runOnlyForDeploymentPostprocessing = 0;
181211
};

GKDatabase/Base.lproj/Main.storyboard

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,23 @@
2323
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dva-1H-xWV">
2424
<rect key="frame" x="33" y="3" width="75" height="30"/>
2525
<state key="normal" title="打开数据库"/>
26+
<connections>
27+
<action selector="openDatabase:" destination="BYZ-38-t0r" eventType="touchUpInside" id="T5T-3g-plk"/>
28+
</connections>
2629
</button>
2730
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E4a-g8-P41">
2831
<rect key="frame" x="158" y="3" width="60" height="30"/>
2932
<state key="normal" title="创建表格"/>
33+
<connections>
34+
<action selector="createTabel:" destination="BYZ-38-t0r" eventType="touchUpInside" id="DnY-wP-YxC"/>
35+
</connections>
3036
</button>
3137
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8wA-O6-OUm">
3238
<rect key="frame" x="268" y="3" width="60" height="30"/>
3339
<state key="normal" title="插入数据"/>
40+
<connections>
41+
<action selector="insertData:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wVr-K5-gAc"/>
42+
</connections>
3443
</button>
3544
</subviews>
3645
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
@@ -50,14 +59,23 @@
5059
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2Wi-vE-yct">
5160
<rect key="frame" x="18" y="3" width="90" height="30"/>
5261
<state key="normal" title="查询所有数据"/>
62+
<connections>
63+
<action selector="selectAllData:" destination="BYZ-38-t0r" eventType="touchUpInside" id="MaW-VD-Y1p"/>
64+
</connections>
5365
</button>
5466
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iOY-ju-GdA">
5567
<rect key="frame" x="158" y="3" width="60" height="30"/>
5668
<state key="normal" title="数据总数"/>
69+
<connections>
70+
<action selector="selectTotalCount:" destination="BYZ-38-t0r" eventType="touchUpInside" id="iGR-fC-sXH"/>
71+
</connections>
5772
</button>
5873
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="m40-KX-jms">
5974
<rect key="frame" x="268" y="3" width="60" height="30"/>
6075
<state key="normal" title="模糊查找"/>
76+
<connections>
77+
<action selector="vagueSelect:" destination="BYZ-38-t0r" eventType="touchUpInside" id="i2F-L3-Hqd"/>
78+
</connections>
6179
</button>
6280
</subviews>
6381
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
@@ -71,20 +89,29 @@
7189
<constraint firstItem="iOY-ju-GdA" firstAttribute="centerY" secondItem="TvT-eV-ccY" secondAttribute="centerY" id="uDA-4A-a2N"/>
7290
</constraints>
7391
</view>
74-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Mhy-eF-UAT" userLabel="查询">
92+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Mhy-eF-UAT">
7593
<rect key="frame" x="0.0" y="401" width="375" height="35"/>
7694
<subviews>
7795
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8d6-bO-mPS">
7896
<rect key="frame" x="48" y="3" width="60" height="30"/>
7997
<state key="normal" title="更新数据"/>
98+
<connections>
99+
<action selector="updateRows:" destination="BYZ-38-t0r" eventType="touchUpInside" id="IU1-RF-I9Q"/>
100+
</connections>
80101
</button>
81102
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WwC-r3-gfw">
82103
<rect key="frame" x="158" y="3" width="60" height="30"/>
83104
<state key="normal" title="清空表格"/>
105+
<connections>
106+
<action selector="clearTable:" destination="BYZ-38-t0r" eventType="touchUpInside" id="0Vi-F0-eAp"/>
107+
</connections>
84108
</button>
85109
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QBM-Or-Xd6">
86110
<rect key="frame" x="268" y="3" width="60" height="30"/>
87111
<state key="normal" title="删除表格"/>
112+
<connections>
113+
<action selector="deleteTabel:" destination="BYZ-38-t0r" eventType="touchUpInside" id="9im-1r-xaf"/>
114+
</connections>
88115
</button>
89116
</subviews>
90117
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
@@ -98,6 +125,20 @@
98125
<constraint firstItem="WwC-r3-gfw" firstAttribute="leading" secondItem="8d6-bO-mPS" secondAttribute="trailing" constant="50" id="xdG-Th-IiD"/>
99126
</constraints>
100127
</view>
128+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dax-K5-FTL">
129+
<rect key="frame" x="50" y="486" width="75" height="30"/>
130+
<state key="normal" title="单条件查询"/>
131+
<connections>
132+
<action selector="singleConditionSearch:" destination="BYZ-38-t0r" eventType="touchUpInside" id="yaw-3b-F5e"/>
133+
</connections>
134+
</button>
135+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yFn-uh-6PY">
136+
<rect key="frame" x="235" y="486" width="90" height="30"/>
137+
<state key="normal" title="指定条件删除"/>
138+
<connections>
139+
<action selector="deleteRow:" destination="BYZ-38-t0r" eventType="touchUpInside" id="9O1-yv-ed7"/>
140+
</connections>
141+
</button>
101142
</subviews>
102143
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
103144
<constraints>
@@ -110,9 +151,13 @@
110151
<constraint firstItem="Mhy-eF-UAT" firstAttribute="top" secondItem="TvT-eV-ccY" secondAttribute="bottom" constant="50" id="LcF-c8-9ft"/>
111152
<constraint firstItem="TvT-eV-ccY" firstAttribute="top" secondItem="P5B-Q7-xfJ" secondAttribute="bottom" constant="50" id="WGb-G2-nvT"/>
112153
<constraint firstItem="P5B-Q7-xfJ" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="Wig-0e-Xi5"/>
154+
<constraint firstItem="Dax-K5-FTL" firstAttribute="top" secondItem="Mhy-eF-UAT" secondAttribute="bottom" constant="50" id="YrM-mT-dCU"/>
113155
<constraint firstAttribute="trailing" secondItem="TvT-eV-ccY" secondAttribute="trailing" id="b2c-kt-wXu"/>
156+
<constraint firstItem="Dax-K5-FTL" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="50" id="itT-gf-Rdu"/>
157+
<constraint firstItem="yFn-uh-6PY" firstAttribute="top" secondItem="Mhy-eF-UAT" secondAttribute="bottom" constant="50" id="jXq-P4-Thg"/>
114158
<constraint firstItem="P5B-Q7-xfJ" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="oU6-K3-QUO"/>
115159
<constraint firstItem="TvT-eV-ccY" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="wah-Zq-Cxf"/>
160+
<constraint firstAttribute="trailing" secondItem="yFn-uh-6PY" secondAttribute="trailing" constant="50" id="x79-nC-yob"/>
116161
<constraint firstAttribute="trailing" secondItem="P5B-Q7-xfJ" secondAttribute="trailing" id="zqi-Cp-IWS"/>
117162
</constraints>
118163
<variation key="default">

GKDatabase/Demo/models/Person.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Person.h
3+
// GKDatabase
4+
//
5+
// Created by 花菜ChrisCai on 2016/7/19.
6+
// Copyright © 2016年 花菜ChrisCai. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface Person : NSObject
12+
@property(nonatomic, copy) NSString *name;
13+
14+
@property(nonatomic, assign) NSInteger age;
15+
@end

GKDatabase/Demo/models/Person.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Person.m
3+
// GKDatabase
4+
//
5+
// Created by 花菜ChrisCai on 2016/7/19.
6+
// Copyright © 2016年 花菜ChrisCai. All rights reserved.
7+
//
8+
9+
#import "Person.h"
10+
11+
@implementation Person
12+
13+
@end

GKDatabase/Demo/models/Student.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Student.h
3+
// GKDatabase
4+
//
5+
// Created by 花菜ChrisCai on 2016/7/19.
6+
// Copyright © 2016年 花菜ChrisCai. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
@interface Student : NSObject
11+
@property(nonatomic, copy) NSString *name;
12+
@property(nonatomic, assign) NSInteger age;
13+
@property(nonatomic, assign) CGFloat score;
14+
@property(nonatomic, strong) NSArray *books;
15+
@end

GKDatabase/Demo/models/Student.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Student.m
3+
// GKDatabase
4+
//
5+
// Created by 花菜ChrisCai on 2016/7/19.
6+
// Copyright © 2016年 花菜ChrisCai. All rights reserved.
7+
//
8+
9+
#import "Student.h"
10+
11+
@implementation Student
12+
13+
@end

GKDatabase/GKDatabase/GKDatabase.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
#import "GKObjcProperty.h"
5+
#import "GKDatabaseManager.h"

0 commit comments

Comments
 (0)