Skip to content

Commit

Permalink
SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
pro648 committed Apr 8, 2020
1 parent 79d61ce commit 219fb9c
Show file tree
Hide file tree
Showing 15 changed files with 1,164 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ iOS学习进程中的demo汇总
| RunTime | [Runtime从入门到进阶一](https://github.com/pro648/tips/wiki/Runtime%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E8%BF%9B%E9%98%B6%E4%B8%80) |
| ScrollView | [UIScrollView的用法](https://github.com/pro648/tips/wiki/UIScrollView%E7%9A%84%E7%94%A8%E6%B3%95) |
| SimpleFactory | [工厂模式 Factory Pattern](https://github.com/pro648/tips/wiki/%E5%B7%A5%E5%8E%82%E6%A8%A1%E5%BC%8F-Factory-Pattern) |
| SQLite | [SQLite的使用三](https://github.com/pro648/tips/wiki/SQLite%E7%9A%84%E4%BD%BF%E7%94%A8%E4%B8%89) |
| StackView | [Auto Layout中Stack View的使用](https://github.com/pro648/tips/wiki/Auto-Layout%E4%B8%ADStack-View%E7%9A%84%E4%BD%BF%E7%94%A8) |
| StrategyPattern | [策略模式 Strategy Pattern](https://github.com/pro648/tips/wiki/%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F-Design-Pattern) |
| Timer | [Timer的使用](https://github.com/pro648/tips/wiki/Timer%E7%9A%84%E4%BD%BF%E7%94%A8) |
Expand Down
19 changes: 19 additions & 0 deletions SQLite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### SQLite的使用

[SQLite的使用一](https://github.com/pro648/tips/wiki/SQLite%E7%9A%84%E4%BD%BF%E7%94%A8%E4%B8%80)[SQLite的使用二](https://github.com/pro648/tips/wiki/SQLite%E7%9A%84%E4%BD%BF%E7%94%A8%E4%BA%8C)这两篇文章主要介绍了 SQLite 的基本语句。这篇文章将介绍 Swift 中如何使用 SQLite,包含以下操作:

- 创建数据库。
- 创建表。
- 插入。
- 查询。
- 更新。
- 删除。
- 关闭。

完成后运行如下:

![preview](https://raw.githubusercontent.com/wiki/pro648/tips/images/SQLiteSwift.gif)

详细介绍查看下面文章:

<https://github.com/pro648/tips/wiki/SQLite的使用三>
359 changes: 359 additions & 0 deletions SQLite/SQLite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,359 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
0D8590502437142E00BA4E31 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D85904F2437142E00BA4E31 /* AppDelegate.swift */; };
0D8590522437142E00BA4E31 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D8590512437142E00BA4E31 /* SceneDelegate.swift */; };
0D8590542437142E00BA4E31 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D8590532437142E00BA4E31 /* ViewController.swift */; };
0D8590572437142E00BA4E31 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D8590552437142E00BA4E31 /* Main.storyboard */; };
0D8590592437143500BA4E31 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0D8590582437143500BA4E31 /* Assets.xcassets */; };
0D85905C2437143500BA4E31 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D85905A2437143500BA4E31 /* LaunchScreen.storyboard */; };
0D8590642437251600BA4E31 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D8590632437251600BA4E31 /* DetailViewController.swift */; };
0D85906824372D9200BA4E31 /* SQLiteManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D85906724372D9200BA4E31 /* SQLiteManager.swift */; };
0D85906A24373D2F00BA4E31 /* Contact.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D85906924373D2F00BA4E31 /* Contact.swift */; };
0DBAE7B5243DC5C5000E8050 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 0DBAE7B4243DC5C5000E8050 /* README.md */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0D85904C2437142E00BA4E31 /* SQLite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SQLite.app; sourceTree = BUILT_PRODUCTS_DIR; };
0D85904F2437142E00BA4E31 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
0D8590512437142E00BA4E31 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
0D8590532437142E00BA4E31 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
0D8590562437142E00BA4E31 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
0D8590582437143500BA4E31 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
0D85905B2437143500BA4E31 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
0D85905D2437143500BA4E31 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0D8590632437251600BA4E31 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
0D85906724372D9200BA4E31 /* SQLiteManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteManager.swift; sourceTree = "<group>"; };
0D85906924373D2F00BA4E31 /* Contact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contact.swift; sourceTree = "<group>"; };
0DBAE7B4243DC5C5000E8050 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
0D8590492437142E00BA4E31 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
0D8590432437142E00BA4E31 = {
isa = PBXGroup;
children = (
0DBAE7B4243DC5C5000E8050 /* README.md */,
0D85904E2437142E00BA4E31 /* SQLite */,
0D85904D2437142E00BA4E31 /* Products */,
);
sourceTree = "<group>";
};
0D85904D2437142E00BA4E31 /* Products */ = {
isa = PBXGroup;
children = (
0D85904C2437142E00BA4E31 /* SQLite.app */,
);
name = Products;
sourceTree = "<group>";
};
0D85904E2437142E00BA4E31 /* SQLite */ = {
isa = PBXGroup;
children = (
0D85904F2437142E00BA4E31 /* AppDelegate.swift */,
0D8590512437142E00BA4E31 /* SceneDelegate.swift */,
0D8590532437142E00BA4E31 /* ViewController.swift */,
0D8590632437251600BA4E31 /* DetailViewController.swift */,
0D85906724372D9200BA4E31 /* SQLiteManager.swift */,
0D85906924373D2F00BA4E31 /* Contact.swift */,
0D8590552437142E00BA4E31 /* Main.storyboard */,
0D8590582437143500BA4E31 /* Assets.xcassets */,
0D85905A2437143500BA4E31 /* LaunchScreen.storyboard */,
0D85905D2437143500BA4E31 /* Info.plist */,
);
path = SQLite;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
0D85904B2437142E00BA4E31 /* SQLite */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0D8590602437143500BA4E31 /* Build configuration list for PBXNativeTarget "SQLite" */;
buildPhases = (
0D8590482437142E00BA4E31 /* Sources */,
0D8590492437142E00BA4E31 /* Frameworks */,
0D85904A2437142E00BA4E31 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SQLite;
productName = SQLite;
productReference = 0D85904C2437142E00BA4E31 /* SQLite.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
0D8590442437142E00BA4E31 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1140;
LastUpgradeCheck = 1140;
ORGANIZATIONNAME = pro648;
TargetAttributes = {
0D85904B2437142E00BA4E31 = {
CreatedOnToolsVersion = 11.4;
};
};
};
buildConfigurationList = 0D8590472437142E00BA4E31 /* Build configuration list for PBXProject "SQLite" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 0D8590432437142E00BA4E31;
productRefGroup = 0D85904D2437142E00BA4E31 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0D85904B2437142E00BA4E31 /* SQLite */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
0D85904A2437142E00BA4E31 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0D85905C2437143500BA4E31 /* LaunchScreen.storyboard in Resources */,
0D8590592437143500BA4E31 /* Assets.xcassets in Resources */,
0DBAE7B5243DC5C5000E8050 /* README.md in Resources */,
0D8590572437142E00BA4E31 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
0D8590482437142E00BA4E31 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0D85906A24373D2F00BA4E31 /* Contact.swift in Sources */,
0D8590542437142E00BA4E31 /* ViewController.swift in Sources */,
0D8590502437142E00BA4E31 /* AppDelegate.swift in Sources */,
0D85906824372D9200BA4E31 /* SQLiteManager.swift in Sources */,
0D8590522437142E00BA4E31 /* SceneDelegate.swift in Sources */,
0D8590642437251600BA4E31 /* DetailViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
0D8590552437142E00BA4E31 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
0D8590562437142E00BA4E31 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
0D85905A2437143500BA4E31 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
0D85905B2437143500BA4E31 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
0D85905E2437143500BA4E31 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
0D85905F2437143500BA4E31 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
0D8590612437143500BA4E31 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 6GTWBXFMR4;
INFOPLIST_FILE = SQLite/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = pro648.SQLite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
0D8590622437143500BA4E31 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 6GTWBXFMR4;
INFOPLIST_FILE = SQLite/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = pro648.SQLite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
0D8590472437142E00BA4E31 /* Build configuration list for PBXProject "SQLite" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0D85905E2437143500BA4E31 /* Debug */,
0D85905F2437143500BA4E31 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0D8590602437143500BA4E31 /* Build configuration list for PBXNativeTarget "SQLite" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0D8590612437143500BA4E31 /* Debug */,
0D8590622437143500BA4E31 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0D8590442437142E00BA4E31 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 219fb9c

Please sign in to comment.