diff --git a/.gitignore b/.gitignore index 8615121..584fa14 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ DerivedData # Carthage/Checkouts Carthage/Build +bin diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 26e3d1e..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "SQLite.swift"] - path = SQLite.swift - url = https://github.com/stephencelis/SQLite.swift diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..200686f --- /dev/null +++ b/Cartfile @@ -0,0 +1 @@ +github "stephencelis/SQLite.swift" ~> 0.10.1 diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 0000000..c9806da --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1 @@ +github "stephencelis/SQLite.swift" "0.10.1" diff --git a/Carthage/Checkouts/SQLite.swift b/Carthage/Checkouts/SQLite.swift new file mode 160000 index 0000000..b43a31f --- /dev/null +++ b/Carthage/Checkouts/SQLite.swift @@ -0,0 +1 @@ +Subproject commit b43a31f9020c42790d763a2cbf4af0b57aed5ab9 diff --git a/Podfile b/Podfile deleted file mode 100644 index cafd687..0000000 --- a/Podfile +++ /dev/null @@ -1,17 +0,0 @@ -# Uncomment this line to define a global platform for your project -platform :ios, '8.0' - -use_frameworks! - -target 'SQLiteModel' do - -pod 'SQLite.swift', '~> 0.9.0' - -end - -target 'SQLiteModelTests' do - -pod 'SQLite.swift', '~> 0.9.0' - -end - diff --git a/Podfile.lock b/Podfile.lock deleted file mode 100644 index a56e146..0000000 --- a/Podfile.lock +++ /dev/null @@ -1,10 +0,0 @@ -PODS: - - SQLite.swift (0.9.2) - -DEPENDENCIES: - - SQLite.swift (~> 0.9.0) - -SPEC CHECKSUMS: - SQLite.swift: 5dca22dbf6634fdb9c3270fae9491830804e9b2d - -COCOAPODS: 0.39.0 diff --git a/Pods/Headers/Private/SQLite.swift/SQLite-Bridging.h b/Pods/Headers/Private/SQLite.swift/SQLite-Bridging.h deleted file mode 120000 index 40d5794..0000000 --- a/Pods/Headers/Private/SQLite.swift/SQLite-Bridging.h +++ /dev/null @@ -1 +0,0 @@ -../../../SQLite.swift/SQLite/Core/SQLite-Bridging.h \ No newline at end of file diff --git a/Pods/Headers/Private/SQLite.swift/SQLite.h b/Pods/Headers/Private/SQLite.swift/SQLite.h deleted file mode 120000 index f7269ce..0000000 --- a/Pods/Headers/Private/SQLite.swift/SQLite.h +++ /dev/null @@ -1 +0,0 @@ -../../../SQLite.swift/SQLite/SQLite.h \ No newline at end of file diff --git a/Pods/Headers/Private/SQLite.swift/fts3_tokenizer.h b/Pods/Headers/Private/SQLite.swift/fts3_tokenizer.h deleted file mode 120000 index feece60..0000000 --- a/Pods/Headers/Private/SQLite.swift/fts3_tokenizer.h +++ /dev/null @@ -1 +0,0 @@ -../../../SQLite.swift/SQLite/Core/fts3_tokenizer.h \ No newline at end of file diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock deleted file mode 100644 index a56e146..0000000 --- a/Pods/Manifest.lock +++ /dev/null @@ -1,10 +0,0 @@ -PODS: - - SQLite.swift (0.9.2) - -DEPENDENCIES: - - SQLite.swift (~> 0.9.0) - -SPEC CHECKSUMS: - SQLite.swift: 5dca22dbf6634fdb9c3270fae9491830804e9b2d - -COCOAPODS: 0.39.0 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj deleted file mode 100644 index 4c4a66b..0000000 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ /dev/null @@ -1,738 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0ABBFD89F4F3F6FD9947D62E7DAB7060 /* Collation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB7E95C04642D158F282695646E0243A /* Collation.swift */; }; - 109B0A4457D47809461A1E4588FB18C7 /* CustomFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6480A7C26FCA2FC039952AD856AA6943 /* CustomFunctions.swift */; }; - 236AB4667C99F475FE550AB90CB4EB5B /* Pods-SQLiteModelTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B07D08A76CA9098CF8A62A15E3666D1A /* Pods-SQLiteModelTests-dummy.m */; }; - 25CC572510BC09CE53F84E6D3D05613B /* AggregateFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF395AF75CE9C4F00465D575DF59CB3 /* AggregateFunctions.swift */; }; - 2E222028E4C7E29EF909AB245AC726A2 /* CoreFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CFD1B334C6D91CA0FBC1B356314A97 /* CoreFunctions.swift */; }; - 2F3B12E532B2F25DE8F86D3DC245ECEB /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CC79165663BB8B97229A42F4CA8C8EC /* Query.swift */; }; - 35E6D1429099700819DBCDEDA25B2262 /* Setter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF26F01D79D8526882E804A3BEF0B30A /* Setter.swift */; }; - 3C02B6FF9A17EC7D6C16CD398CFDD7CA /* Pods-SQLiteModel-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D87E8283383553FB5AB7124AB65E5B3B /* Pods-SQLiteModel-dummy.m */; }; - 4B8DC7B3385AA470995E4F9E6B1517CD /* R*Tree.swift in Sources */ = {isa = PBXBuildFile; fileRef = E648D070BEC06D181DFCFA23A0E62069 /* R*Tree.swift */; }; - 521840D01F42CBF6C127DD233C9881CD /* SQLite-Bridging.m in Sources */ = {isa = PBXBuildFile; fileRef = 238B21EDB32146A6E0D895D7C8A2FABF /* SQLite-Bridging.m */; }; - 5D1E4B7B9A7E9C8E31316C74B79BB91B /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C6E82843A51928990A3BFAFDA4D3447 /* Helpers.swift */; }; - 5F77FEE2222906EFE2EE294EB9D18C86 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9C15FED564ED3022AB68D3411C75D2 /* Statement.swift */; }; - 6081CA51D3EF99929650BE77D4935F06 /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = B83DADDA89C4433C6701DED9587CB55B /* Blob.swift */; }; - 7A4E0436239E02A70487A03BD5E51C11 /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA27E4FFACC341F5FD5ADB0C24CEAA3E /* Schema.swift */; }; - 81ADCF5623BCB86327751B30D4C4A3B6 /* fts3_tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D45308996D3D9DF1120173249D1005AD /* fts3_tokenizer.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 82E70916120A45E22D833F51A93FBC96 /* Pods-SQLiteModelTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FFD57101C12F56A656D29E396A37670 /* Pods-SQLiteModelTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 85C5D76843AA40F877AD2A455D15A815 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; }; - 9319B880E55290A9287C73FDC0BEE592 /* SQLite.swift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E0217566D1AD276ADDE7D2CC1925391F /* SQLite.swift-dummy.m */; }; - AEA8B7301B4924731D6365F58493483E /* Value.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A6ACFCD8C5A5E897E0C2FA94803B54 /* Value.swift */; }; - BFF0CA3F8EF63324C9EA9F4F9AEE3D5C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; }; - C20EA99BD9EA2E17B5313B3A13FD0C27 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1DEB85C813E2B64F1103C0F226B5A6D /* Expression.swift */; }; - CC9FDC262833E0AF06FC0D167260334C /* Connection.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72225B9C83F1B51AA5D205E8001CD8A /* Connection.swift */; }; - CF490089747EB38D256ECA6853DFC90D /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A22EC6C8E158914B71D59D55ABC76E /* Operators.swift */; }; - D8395E6182A3DBCD5BB05A4F505D0200 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F88CBEC007EB190508BC4E467C83CBC /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E71787738F69819B24972149CDA230DC /* Pods-SQLiteModel-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E470532BEA7BD6CF2EB82A6D57AE79 /* Pods-SQLiteModel-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EF071F6A7300B48808969A446D374244 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; }; - F84D09A26CB149E0DDB80EEC64E5E21D /* FTS4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 111ECBB34993E4D1E285DA3443F7293E /* FTS4.swift */; }; - FC80CA0F1C833659E67AA1FC50F9B87B /* Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E4944BEDA928C7D63606EE3DDACC1B /* Foundation.swift */; }; - FE11284DBF2C43B23861AD0BC342E02B /* SQLite-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = 244E36380B4B3465B8F7B761894265FC /* SQLite-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 992B5E8C0526B6428FA491A24BC4E18E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 679739EFB51229067CE618F7A172E6BF; - remoteInfo = SQLite.swift; - }; - BD2E58ABF472CCE9340729FDFD3EA9F0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 679739EFB51229067CE618F7A172E6BF; - remoteInfo = SQLite.swift; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0B1118E07883A29296CD94A55D4A6D80 /* SQLite.swift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = SQLite.swift.modulemap; sourceTree = ""; }; - 0D7718C82D802F1F3D1A53B02AE92C0A /* Pods-SQLiteModelTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SQLiteModelTests.debug.xcconfig"; sourceTree = ""; }; - 0E0FBB8656A627959B4E26A51F2777ED /* Pods-SQLiteModelTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-SQLiteModelTests-acknowledgements.markdown"; sourceTree = ""; }; - 111ECBB34993E4D1E285DA3443F7293E /* FTS4.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FTS4.swift; path = SQLite/Extensions/FTS4.swift; sourceTree = ""; }; - 147F525DC42E5F93E30DB23040709655 /* Pods-SQLiteModelTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SQLiteModelTests-resources.sh"; sourceTree = ""; }; - 1F88CBEC007EB190508BC4E467C83CBC /* SQLite.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SQLite.h; path = SQLite/SQLite.h; sourceTree = ""; }; - 1FFD57101C12F56A656D29E396A37670 /* Pods-SQLiteModelTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-SQLiteModelTests-umbrella.h"; sourceTree = ""; }; - 21A6ACFCD8C5A5E897E0C2FA94803B54 /* Value.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Value.swift; path = SQLite/Core/Value.swift; sourceTree = ""; }; - 238B21EDB32146A6E0D895D7C8A2FABF /* SQLite-Bridging.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "SQLite-Bridging.m"; path = "SQLite/Core/SQLite-Bridging.m"; sourceTree = ""; }; - 244E36380B4B3465B8F7B761894265FC /* SQLite-Bridging.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SQLite-Bridging.h"; path = "SQLite/Core/SQLite-Bridging.h"; sourceTree = ""; }; - 2A9C15FED564ED3022AB68D3411C75D2 /* Statement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Statement.swift; path = SQLite/Core/Statement.swift; sourceTree = ""; }; - 2AC0D1D54DA56ADC91F1362092002B03 /* Pods_SQLiteModelTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SQLiteModelTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 3A34D016670CFBAC51E9591BF7B788B4 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 3EF395AF75CE9C4F00465D575DF59CB3 /* AggregateFunctions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AggregateFunctions.swift; path = SQLite/Typed/AggregateFunctions.swift; sourceTree = ""; }; - 413E8CD4B6CCF1B5CB2A4D1C9F620049 /* Pods-SQLiteModelTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-SQLiteModelTests-acknowledgements.plist"; sourceTree = ""; }; - 45380D5DB5A0BE51434881FE0F5F0468 /* SQLite.swift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SQLite.swift.xcconfig; sourceTree = ""; }; - 45B1E2DB13FC35F2ED19CFCB0E9737FC /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4D9E196ED2F33844F0444D2F73985E72 /* SQLite.swift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SQLite.swift-prefix.pch"; sourceTree = ""; }; - 517F846550E64CC15268737F8A0545BE /* Pods-SQLiteModel.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-SQLiteModel.modulemap"; sourceTree = ""; }; - 52B9867D464C6D12009760DE997C73E5 /* Pods-SQLiteModelTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SQLiteModelTests.release.xcconfig"; sourceTree = ""; }; - 56C18C0C45AFCD6A4BD5734E320B24A5 /* Pods-SQLiteModel-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SQLiteModel-resources.sh"; sourceTree = ""; }; - 5922C7454D347667B7439E5319B1FE7D /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 6480A7C26FCA2FC039952AD856AA6943 /* CustomFunctions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CustomFunctions.swift; path = SQLite/Typed/CustomFunctions.swift; sourceTree = ""; }; - 6C6E82843A51928990A3BFAFDA4D3447 /* Helpers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Helpers.swift; path = SQLite/Helpers.swift; sourceTree = ""; }; - 7560247622C6199FE126CB677972737A /* Pods-SQLiteModel.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SQLiteModel.release.xcconfig"; sourceTree = ""; }; - 852A1E855FD64C6FD0DBDC7062BB6F24 /* Pods-SQLiteModel-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SQLiteModel-frameworks.sh"; sourceTree = ""; }; - 95CFD1B334C6D91CA0FBC1B356314A97 /* CoreFunctions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CoreFunctions.swift; path = SQLite/Typed/CoreFunctions.swift; sourceTree = ""; }; - 9CC79165663BB8B97229A42F4CA8C8EC /* Query.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Query.swift; path = SQLite/Typed/Query.swift; sourceTree = ""; }; - A72225B9C83F1B51AA5D205E8001CD8A /* Connection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Connection.swift; path = SQLite/Core/Connection.swift; sourceTree = ""; }; - A9E4944BEDA928C7D63606EE3DDACC1B /* Foundation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Foundation.swift; path = SQLite/Foundation.swift; sourceTree = ""; }; - AF26F01D79D8526882E804A3BEF0B30A /* Setter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Setter.swift; path = SQLite/Typed/Setter.swift; sourceTree = ""; }; - AF33E3820D1ECBEC35B42525320F4E52 /* Pods-SQLiteModel.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SQLiteModel.debug.xcconfig"; sourceTree = ""; }; - B03F1849D824EEAE9EEDE511EE0E7FBD /* Pods-SQLiteModelTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SQLiteModelTests-frameworks.sh"; sourceTree = ""; }; - B07D08A76CA9098CF8A62A15E3666D1A /* Pods-SQLiteModelTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-SQLiteModelTests-dummy.m"; sourceTree = ""; }; - B7261B4B477B4BD700BE324E9BB5F7A4 /* Pods-SQLiteModel-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-SQLiteModel-acknowledgements.plist"; sourceTree = ""; }; - B83DADDA89C4433C6701DED9587CB55B /* Blob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Blob.swift; path = SQLite/Core/Blob.swift; sourceTree = ""; }; - BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - BBA57F467F05A2E017CF4F835B465F62 /* Pods-SQLiteModel-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-SQLiteModel-acknowledgements.markdown"; sourceTree = ""; }; - C1E470532BEA7BD6CF2EB82A6D57AE79 /* Pods-SQLiteModel-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-SQLiteModel-umbrella.h"; sourceTree = ""; }; - C8E0C06486E89CA49474F3137FA5FD32 /* Pods-SQLiteModelTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-SQLiteModelTests.modulemap"; sourceTree = ""; }; - CB7E95C04642D158F282695646E0243A /* Collation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Collation.swift; path = SQLite/Typed/Collation.swift; sourceTree = ""; }; - D1DEB85C813E2B64F1103C0F226B5A6D /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = SQLite/Typed/Expression.swift; sourceTree = ""; }; - D45308996D3D9DF1120173249D1005AD /* fts3_tokenizer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = fts3_tokenizer.h; path = SQLite/Core/fts3_tokenizer.h; sourceTree = ""; }; - D87E8283383553FB5AB7124AB65E5B3B /* Pods-SQLiteModel-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-SQLiteModel-dummy.m"; sourceTree = ""; }; - DD3EF99816FF0DF12D9B980562A89612 /* Pods_SQLiteModel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SQLiteModel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E0217566D1AD276ADDE7D2CC1925391F /* SQLite.swift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SQLite.swift-dummy.m"; sourceTree = ""; }; - E0708B335611216152123BE495CCFD08 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E648D070BEC06D181DFCFA23A0E62069 /* R*Tree.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "R*Tree.swift"; path = "SQLite/Extensions/R*Tree.swift"; sourceTree = ""; }; - E9A22EC6C8E158914B71D59D55ABC76E /* Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Operators.swift; path = SQLite/Typed/Operators.swift; sourceTree = ""; }; - EA27E4FFACC341F5FD5ADB0C24CEAA3E /* Schema.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Schema.swift; path = SQLite/Typed/Schema.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 39E81A4ECA808E3E89B86D315BA0B363 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - EF071F6A7300B48808969A446D374244 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 401E617043EA731A433C0A2347E7BD8F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 85C5D76843AA40F877AD2A455D15A815 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EBE0636FD628AEF07AB7DBBCFC402781 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BFF0CA3F8EF63324C9EA9F4F9AEE3D5C /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 3EE4A3B3097CFDE53B2672E6BD4B8546 /* Products */ = { - isa = PBXGroup; - children = ( - DD3EF99816FF0DF12D9B980562A89612 /* Pods_SQLiteModel.framework */, - 2AC0D1D54DA56ADC91F1362092002B03 /* Pods_SQLiteModelTests.framework */, - E0708B335611216152123BE495CCFD08 /* SQLite.framework */, - ); - name = Products; - sourceTree = ""; - }; - 55EC1D21DBE2EBBA621774D9A2A5A684 /* Pods */ = { - isa = PBXGroup; - children = ( - FC62FBA1B2BC11E38EAC77C6A3EB3109 /* SQLite.swift */, - ); - name = Pods; - sourceTree = ""; - }; - 7025084B569D4E91DC8495370191DF0A /* Pods-SQLiteModel */ = { - isa = PBXGroup; - children = ( - 45B1E2DB13FC35F2ED19CFCB0E9737FC /* Info.plist */, - 517F846550E64CC15268737F8A0545BE /* Pods-SQLiteModel.modulemap */, - BBA57F467F05A2E017CF4F835B465F62 /* Pods-SQLiteModel-acknowledgements.markdown */, - B7261B4B477B4BD700BE324E9BB5F7A4 /* Pods-SQLiteModel-acknowledgements.plist */, - D87E8283383553FB5AB7124AB65E5B3B /* Pods-SQLiteModel-dummy.m */, - 852A1E855FD64C6FD0DBDC7062BB6F24 /* Pods-SQLiteModel-frameworks.sh */, - 56C18C0C45AFCD6A4BD5734E320B24A5 /* Pods-SQLiteModel-resources.sh */, - C1E470532BEA7BD6CF2EB82A6D57AE79 /* Pods-SQLiteModel-umbrella.h */, - AF33E3820D1ECBEC35B42525320F4E52 /* Pods-SQLiteModel.debug.xcconfig */, - 7560247622C6199FE126CB677972737A /* Pods-SQLiteModel.release.xcconfig */, - ); - name = "Pods-SQLiteModel"; - path = "Target Support Files/Pods-SQLiteModel"; - sourceTree = ""; - }; - 7DB346D0F39D3F0E887471402A8071AB = { - isa = PBXGroup; - children = ( - BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */, - BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, - 55EC1D21DBE2EBBA621774D9A2A5A684 /* Pods */, - 3EE4A3B3097CFDE53B2672E6BD4B8546 /* Products */, - A35F0518404719E6D3CA19F8FA7B982A /* Targets Support Files */, - ); - sourceTree = ""; - }; - 7E9A95936B872316DE12FA3F16CCF6EC /* Pods-SQLiteModelTests */ = { - isa = PBXGroup; - children = ( - 5922C7454D347667B7439E5319B1FE7D /* Info.plist */, - C8E0C06486E89CA49474F3137FA5FD32 /* Pods-SQLiteModelTests.modulemap */, - 0E0FBB8656A627959B4E26A51F2777ED /* Pods-SQLiteModelTests-acknowledgements.markdown */, - 413E8CD4B6CCF1B5CB2A4D1C9F620049 /* Pods-SQLiteModelTests-acknowledgements.plist */, - B07D08A76CA9098CF8A62A15E3666D1A /* Pods-SQLiteModelTests-dummy.m */, - B03F1849D824EEAE9EEDE511EE0E7FBD /* Pods-SQLiteModelTests-frameworks.sh */, - 147F525DC42E5F93E30DB23040709655 /* Pods-SQLiteModelTests-resources.sh */, - 1FFD57101C12F56A656D29E396A37670 /* Pods-SQLiteModelTests-umbrella.h */, - 0D7718C82D802F1F3D1A53B02AE92C0A /* Pods-SQLiteModelTests.debug.xcconfig */, - 52B9867D464C6D12009760DE997C73E5 /* Pods-SQLiteModelTests.release.xcconfig */, - ); - name = "Pods-SQLiteModelTests"; - path = "Target Support Files/Pods-SQLiteModelTests"; - sourceTree = ""; - }; - 8655E4D3F1F68636357A41F48297CE15 /* Support Files */ = { - isa = PBXGroup; - children = ( - 3A34D016670CFBAC51E9591BF7B788B4 /* Info.plist */, - 0B1118E07883A29296CD94A55D4A6D80 /* SQLite.swift.modulemap */, - 45380D5DB5A0BE51434881FE0F5F0468 /* SQLite.swift.xcconfig */, - E0217566D1AD276ADDE7D2CC1925391F /* SQLite.swift-dummy.m */, - 4D9E196ED2F33844F0444D2F73985E72 /* SQLite.swift-prefix.pch */, - ); - name = "Support Files"; - path = "../Target Support Files/SQLite.swift"; - sourceTree = ""; - }; - A35F0518404719E6D3CA19F8FA7B982A /* Targets Support Files */ = { - isa = PBXGroup; - children = ( - 7025084B569D4E91DC8495370191DF0A /* Pods-SQLiteModel */, - 7E9A95936B872316DE12FA3F16CCF6EC /* Pods-SQLiteModelTests */, - ); - name = "Targets Support Files"; - sourceTree = ""; - }; - BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { - isa = PBXGroup; - children = ( - BF6342C8B29F4CEEA088EFF7AB4DE362 /* iOS */, - ); - name = Frameworks; - sourceTree = ""; - }; - BF6342C8B29F4CEEA088EFF7AB4DE362 /* iOS */ = { - isa = PBXGroup; - children = ( - 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */, - ); - name = iOS; - sourceTree = ""; - }; - FC62FBA1B2BC11E38EAC77C6A3EB3109 /* SQLite.swift */ = { - isa = PBXGroup; - children = ( - 3EF395AF75CE9C4F00465D575DF59CB3 /* AggregateFunctions.swift */, - B83DADDA89C4433C6701DED9587CB55B /* Blob.swift */, - CB7E95C04642D158F282695646E0243A /* Collation.swift */, - A72225B9C83F1B51AA5D205E8001CD8A /* Connection.swift */, - 95CFD1B334C6D91CA0FBC1B356314A97 /* CoreFunctions.swift */, - 6480A7C26FCA2FC039952AD856AA6943 /* CustomFunctions.swift */, - D1DEB85C813E2B64F1103C0F226B5A6D /* Expression.swift */, - A9E4944BEDA928C7D63606EE3DDACC1B /* Foundation.swift */, - D45308996D3D9DF1120173249D1005AD /* fts3_tokenizer.h */, - 111ECBB34993E4D1E285DA3443F7293E /* FTS4.swift */, - 6C6E82843A51928990A3BFAFDA4D3447 /* Helpers.swift */, - E9A22EC6C8E158914B71D59D55ABC76E /* Operators.swift */, - 9CC79165663BB8B97229A42F4CA8C8EC /* Query.swift */, - E648D070BEC06D181DFCFA23A0E62069 /* R*Tree.swift */, - EA27E4FFACC341F5FD5ADB0C24CEAA3E /* Schema.swift */, - AF26F01D79D8526882E804A3BEF0B30A /* Setter.swift */, - 1F88CBEC007EB190508BC4E467C83CBC /* SQLite.h */, - 244E36380B4B3465B8F7B761894265FC /* SQLite-Bridging.h */, - 238B21EDB32146A6E0D895D7C8A2FABF /* SQLite-Bridging.m */, - 2A9C15FED564ED3022AB68D3411C75D2 /* Statement.swift */, - 21A6ACFCD8C5A5E897E0C2FA94803B54 /* Value.swift */, - 8655E4D3F1F68636357A41F48297CE15 /* Support Files */, - ); - path = SQLite.swift; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 4812714776EB29894E092D579ABE8B4B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 81ADCF5623BCB86327751B30D4C4A3B6 /* fts3_tokenizer.h in Headers */, - FE11284DBF2C43B23861AD0BC342E02B /* SQLite-Bridging.h in Headers */, - D8395E6182A3DBCD5BB05A4F505D0200 /* SQLite.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 870DF7D5AB7CC2836420D8202662BDC1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - E71787738F69819B24972149CDA230DC /* Pods-SQLiteModel-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - CC4140C599A7FEBD41C70947C37B5031 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 82E70916120A45E22D833F51A93FBC96 /* Pods-SQLiteModelTests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 679739EFB51229067CE618F7A172E6BF /* SQLite.swift */ = { - isa = PBXNativeTarget; - buildConfigurationList = A23C97C0CC61EC5EF6B21CECBC1BE308 /* Build configuration list for PBXNativeTarget "SQLite.swift" */; - buildPhases = ( - 156BD0950ECB178263117F21DA3BD6C0 /* Sources */, - 401E617043EA731A433C0A2347E7BD8F /* Frameworks */, - 4812714776EB29894E092D579ABE8B4B /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SQLite.swift; - productName = SQLite.swift; - productReference = E0708B335611216152123BE495CCFD08 /* SQLite.framework */; - productType = "com.apple.product-type.framework"; - }; - D5373B6ECA6CEF786EA63EB4FA64EB2F /* Pods-SQLiteModel */ = { - isa = PBXNativeTarget; - buildConfigurationList = C1105907D7BD472980F26F9697B7F085 /* Build configuration list for PBXNativeTarget "Pods-SQLiteModel" */; - buildPhases = ( - 89F9FB581281F4F4BB8D9DDA38CE37A0 /* Sources */, - 39E81A4ECA808E3E89B86D315BA0B363 /* Frameworks */, - 870DF7D5AB7CC2836420D8202662BDC1 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 1FFF7FF89630B5DE04F45F306297906D /* PBXTargetDependency */, - ); - name = "Pods-SQLiteModel"; - productName = "Pods-SQLiteModel"; - productReference = DD3EF99816FF0DF12D9B980562A89612 /* Pods_SQLiteModel.framework */; - productType = "com.apple.product-type.framework"; - }; - EB123978272B8B05E048B29047D94FDB /* Pods-SQLiteModelTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = C59A3D7D5BC1F0005926C559FD99922F /* Build configuration list for PBXNativeTarget "Pods-SQLiteModelTests" */; - buildPhases = ( - 3E5A08BB3CE0F65C535C441E62673F51 /* Sources */, - EBE0636FD628AEF07AB7DBBCFC402781 /* Frameworks */, - CC4140C599A7FEBD41C70947C37B5031 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 75CB3958E0090C5A986135CCD83A0EDE /* PBXTargetDependency */, - ); - name = "Pods-SQLiteModelTests"; - productName = "Pods-SQLiteModelTests"; - productReference = 2AC0D1D54DA56ADC91F1362092002B03 /* Pods_SQLiteModelTests.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; - }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 7DB346D0F39D3F0E887471402A8071AB; - productRefGroup = 3EE4A3B3097CFDE53B2672E6BD4B8546 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D5373B6ECA6CEF786EA63EB4FA64EB2F /* Pods-SQLiteModel */, - EB123978272B8B05E048B29047D94FDB /* Pods-SQLiteModelTests */, - 679739EFB51229067CE618F7A172E6BF /* SQLite.swift */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 156BD0950ECB178263117F21DA3BD6C0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25CC572510BC09CE53F84E6D3D05613B /* AggregateFunctions.swift in Sources */, - 6081CA51D3EF99929650BE77D4935F06 /* Blob.swift in Sources */, - 0ABBFD89F4F3F6FD9947D62E7DAB7060 /* Collation.swift in Sources */, - CC9FDC262833E0AF06FC0D167260334C /* Connection.swift in Sources */, - 2E222028E4C7E29EF909AB245AC726A2 /* CoreFunctions.swift in Sources */, - 109B0A4457D47809461A1E4588FB18C7 /* CustomFunctions.swift in Sources */, - C20EA99BD9EA2E17B5313B3A13FD0C27 /* Expression.swift in Sources */, - FC80CA0F1C833659E67AA1FC50F9B87B /* Foundation.swift in Sources */, - F84D09A26CB149E0DDB80EEC64E5E21D /* FTS4.swift in Sources */, - 5D1E4B7B9A7E9C8E31316C74B79BB91B /* Helpers.swift in Sources */, - CF490089747EB38D256ECA6853DFC90D /* Operators.swift in Sources */, - 2F3B12E532B2F25DE8F86D3DC245ECEB /* Query.swift in Sources */, - 4B8DC7B3385AA470995E4F9E6B1517CD /* R*Tree.swift in Sources */, - 7A4E0436239E02A70487A03BD5E51C11 /* Schema.swift in Sources */, - 35E6D1429099700819DBCDEDA25B2262 /* Setter.swift in Sources */, - 521840D01F42CBF6C127DD233C9881CD /* SQLite-Bridging.m in Sources */, - 9319B880E55290A9287C73FDC0BEE592 /* SQLite.swift-dummy.m in Sources */, - 5F77FEE2222906EFE2EE294EB9D18C86 /* Statement.swift in Sources */, - AEA8B7301B4924731D6365F58493483E /* Value.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3E5A08BB3CE0F65C535C441E62673F51 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 236AB4667C99F475FE550AB90CB4EB5B /* Pods-SQLiteModelTests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 89F9FB581281F4F4BB8D9DDA38CE37A0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3C02B6FF9A17EC7D6C16CD398CFDD7CA /* Pods-SQLiteModel-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 1FFF7FF89630B5DE04F45F306297906D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = SQLite.swift; - target = 679739EFB51229067CE618F7A172E6BF /* SQLite.swift */; - targetProxy = 992B5E8C0526B6428FA491A24BC4E18E /* PBXContainerItemProxy */; - }; - 75CB3958E0090C5A986135CCD83A0EDE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = SQLite.swift; - target = 679739EFB51229067CE618F7A172E6BF /* SQLite.swift */; - targetProxy = BD2E58ABF472CCE9340729FDFD3EA9F0 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 0CEE9C07C4A36A6D17B65F678892D2D5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0D7718C82D802F1F3D1A53B02AE92C0A /* Pods-SQLiteModelTests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - INFOPLIST_FILE = "Target Support Files/Pods-SQLiteModelTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_NAME = Pods_SQLiteModelTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 3449110A828E99CAD0730AC781D07F42 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 52B9867D464C6D12009760DE997C73E5 /* Pods-SQLiteModelTests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - INFOPLIST_FILE = "Target Support Files/Pods-SQLiteModelTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_NAME = Pods_SQLiteModelTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 5942778AF48C1B9104AE73B0554E44C9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AF33E3820D1ECBEC35B42525320F4E52 /* Pods-SQLiteModel.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - INFOPLIST_FILE = "Target Support Files/Pods-SQLiteModel/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_NAME = Pods_SQLiteModel; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 83E565E45CAC7CA1591AE8A500FFC35A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 45380D5DB5A0BE51434881FE0F5F0468 /* SQLite.swift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_PREFIX_HEADER = "Target Support Files/SQLite.swift/SQLite.swift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/SQLite.swift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/SQLite.swift/SQLite.swift.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = SQLite; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 972117F111159206241030E56C0C676A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 45380D5DB5A0BE51434881FE0F5F0468 /* SQLite.swift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_PREFIX_HEADER = "Target Support Files/SQLite.swift/SQLite.swift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/SQLite.swift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/SQLite.swift/SQLite.swift.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = SQLite; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - A70CDAD61F90AC503C7D04CC22DA2923 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - E78C77DB7A25CE821EAE596FFF95EEBC /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7560247622C6199FE126CB677972737A /* Pods-SQLiteModel.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - INFOPLIST_FILE = "Target Support Files/Pods-SQLiteModel/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_NAME = Pods_SQLiteModel; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - FB45FFD90572718D82AB9092B750F0CA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A70CDAD61F90AC503C7D04CC22DA2923 /* Debug */, - FB45FFD90572718D82AB9092B750F0CA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A23C97C0CC61EC5EF6B21CECBC1BE308 /* Build configuration list for PBXNativeTarget "SQLite.swift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 972117F111159206241030E56C0C676A /* Debug */, - 83E565E45CAC7CA1591AE8A500FFC35A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C1105907D7BD472980F26F9697B7F085 /* Build configuration list for PBXNativeTarget "Pods-SQLiteModel" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5942778AF48C1B9104AE73B0554E44C9 /* Debug */, - E78C77DB7A25CE821EAE596FFF95EEBC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C59A3D7D5BC1F0005926C559FD99922F /* Build configuration list for PBXNativeTarget "Pods-SQLiteModelTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0CEE9C07C4A36A6D17B65F678892D2D5 /* Debug */, - 3449110A828E99CAD0730AC781D07F42 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; -} diff --git a/Pods/SQLite.swift/LICENSE.txt b/Pods/SQLite.swift/LICENSE.txt deleted file mode 100644 index 13303c1..0000000 --- a/Pods/SQLite.swift/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2014-2015 Stephen Celis () - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Pods/SQLite.swift/README.md b/Pods/SQLite.swift/README.md deleted file mode 100644 index 7f40538..0000000 --- a/Pods/SQLite.swift/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# SQLite.swift - -[![Build Status][Badge]][Travis] [![CocoaPods Version](https://cocoapod-badges.herokuapp.com/v/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Platform](https://cocoapod-badges.herokuapp.com/p/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) - -A type-safe, [Swift][]-language layer over [SQLite3][]. - -[SQLite.swift][] provides compile-time confidence in SQL statement -syntax _and_ intent. - -[Badge]: https://img.shields.io/travis/stephencelis/SQLite.swift/master.svg?style=flat -[Travis]: https://travis-ci.org/stephencelis/SQLite.swift -[Swift]: https://developer.apple.com/swift/ -[SQLite3]: http://www.sqlite.org -[SQLite.swift]: https://github.com/stephencelis/SQLite.swift - - -## Features - - - A pure-Swift interface - - A type-safe, optional-aware SQL expression builder - - A flexible, chainable, lazy-executing query layer - - Automatically-typed data access - - A lightweight, uncomplicated query and parameter binding interface - - Developer-friendly error handling and debugging - - [Full-text search][] support - - [Well-documented][See Documentation] - - Extensively tested - - SQLCipher support will be available again soon (see #311) - -[Full-text search]: Documentation/Index.md#full-text-search -[See Documentation]: Documentation/Index.md#sqliteswift-documentation - - -## Usage - -``` swift -import SQLite - -let db = try Connection("path/to/db.sqlite3") - -let users = Table("users") -let id = Expression("id") -let name = Expression("name") -let email = Expression("email") - -try db.run(users.create { t in - t.column(id, primaryKey: true) - t.column(name) - t.column(email, unique: true) -}) -// CREATE TABLE "users" ( -// "id" INTEGER PRIMARY KEY NOT NULL, -// "name" TEXT, -// "email" TEXT NOT NULL UNIQUE -// ) - -let insert = users.insert(name <- "Alice", email <- "alice@mac.com") -let rowid = try db.run(insert) -// INSERT INTO "users" ("name", "email") VALUES ('Alice', 'alice@mac.com') - -for user in try db.prepare(users) { - print("id: \(user[id]), name: \(user[name]), email: \(user[email])") - // id: 1, name: Optional("Alice"), email: alice@mac.com -} -// SELECT * FROM "users" - -let alice = users.filter(id == rowid) - -try db.run(alice.update(email <- email.replace("mac.com", with: "me.com"))) -// UPDATE "users" SET "email" = replace("email", 'mac.com', 'me.com') -// WHERE ("id" = 1) - -try db.run(alice.delete()) -// DELETE FROM "users" WHERE ("id" = 1) - -db.scalar(users.count) // 0 -// SELECT count(*) FROM "users" -``` - -SQLite.swift also works as a lightweight, Swift-friendly wrapper over the C -API. - -``` swift -let stmt = try db.prepare("INSERT INTO users (email) VALUES (?)") -for email in ["betty@icloud.com", "cathy@icloud.com"] { - try stmt.run(email) -} - -db.totalChanges // 3 -db.changes // 1 -db.lastInsertRowid // 3 - -for row in try db.prepare("SELECT id, email FROM users") { - print("id: \(row[0]), email: \(row[1])") - // id: Optional(2), email: Optional("betty@icloud.com") - // id: Optional(3), email: Optional("cathy@icloud.com") -} - -db.scalar("SELECT count(*) FROM users") // 2 -``` - -[Read the documentation][See Documentation] or explore more, -interactively, from the Xcode project’s playground. - -![SQLite.playground Screen Shot](Documentation/Resources/playground@2x.png) - -For a more comprehensive example, see [this article](http://masteringswift.blogspot.com/2015/09/create-data-access-layer-with.html) and the [companion repository](https://github.com/hoffmanjon/SQLiteDataAccessLayer2/tree/master). - -## Installation - -> _Note:_ SQLite.swift requires Swift 2 (and [Xcode][] 7) or greater. -> -> The following instructions apply to targets that support embedded -> Swift frameworks. To use SQLite.swift in iOS 7 or an OS X command line -> tool, please read the [Frameworkless Targets][] section of the -> documentation. - - -### Carthage - -[Carthage][] is a simple, decentralized dependency manager for Cocoa. To -install SQLite.swift with Carthage: - - 1. Make sure Carthage is [installed][Carthage Installation]. - - 2. Update your Cartfile to include the following: - - ``` - github "stephencelis/SQLite.swift" ~> 0.9.2 - ``` - - 3. Run `carthage update` and [add the appropriate framework][Carthage Usage]. - - -[Carthage]: https://github.com/Carthage/Carthage -[Carthage Installation]: https://github.com/Carthage/Carthage#installing-carthage -[Carthage Usage]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application - - -### CocoaPods - -[CocoaPods][] is a dependency manager for Cocoa projects. To install -SQLite.swift with CocoaPods: - - 1. Make sure CocoaPods is [installed][CocoaPods Installation]. (SQLite.swift - requires version 0.37 or greater.) - - 2. Update your Podfile to include the following: - - ``` ruby - use_frameworks! - - pod 'SQLite.swift', '~> 0.9.2' - ``` - - 3. Run `pod install`. - -[CocoaPods]: https://cocoapods.org -[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started - - -### Manual - -To install SQLite.swift as an Xcode sub-project: - - 1. Drag the **SQLite.xcodeproj** file into your own project. - ([Submodule][], clone, or [download][] the project first.) - - ![Installation Screen Shot](Documentation/Resources/installation@2x.png) - - 2. In your target’s **General** tab, click the **+** button under **Linked - Frameworks and Libraries**. - - 3. Select the appropriate **SQLite.framework** for your platform. - - 4. **Add**. - -[Frameworkless Targets]: Documentation/Index.md#frameworkless-targets -[Xcode]: https://developer.apple.com/xcode/downloads/ -[Submodule]: http://git-scm.com/book/en/Git-Tools-Submodules -[download]: https://github.com/stephencelis/SQLite.swift/archive/master.zip - - -## Communication - -[See the planning document] for a roadmap and existing feature requests. - -[Read the contributing guidelines][]. The _TL;DR_ (but please; _R_): - - - Need **help** or have a **general question**? [Ask on Stack - Overflow][] (tag `sqlite.swift`). - - Found a **bug** or have a **feature request**? [Open an issue][]. - - Want to **contribute**? [Submit a pull request][]. - -[See the planning document]: /Documentation/Planning.md -[Read the contributing guidelines]: ./CONTRIBUTING.md#contributing -[Ask on Stack Overflow]: http://stackoverflow.com/questions/tagged/sqlite.swift -[Open an issue]: https://github.com/stephencelis/SQLite.swift/issues/new -[Submit a pull request]: https://github.com/stephencelis/SQLite.swift/fork - - -## Author - - - [Stephen Celis](mailto:stephen@stephencelis.com) - ([@stephencelis](https://twitter.com/stephencelis)) - - -## License - -SQLite.swift is available under the MIT license. See [the LICENSE -file](./LICENSE.txt) for more information. - - -## Alternatives - -Looking for something else? Try another Swift wrapper (or [FMDB][]): - - - [Camembert](https://github.com/remirobert/Camembert) - - [EonilSQLite3](https://github.com/Eonil/SQLite3) - - [SQLiteDB](https://github.com/FahimF/SQLiteDB) - - [Squeal](https://github.com/nerdyc/Squeal) - - [SwiftData](https://github.com/ryanfowler/SwiftData) - - [SwiftSQLite](https://github.com/chrismsimpson/SwiftSQLite) - -[FMDB]: https://github.com/ccgus/fmdb diff --git a/Pods/SQLite.swift/SQLite/Core/Blob.swift b/Pods/SQLite.swift/SQLite/Core/Blob.swift deleted file mode 100644 index 1b30ffa..0000000 --- a/Pods/SQLite.swift/SQLite/Core/Blob.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -public struct Blob { - - public let bytes: [UInt8] - - public init(bytes: [UInt8]) { - self.bytes = bytes - } - - public init(bytes: UnsafePointer, length: Int) { - self.init(bytes: [UInt8](UnsafeBufferPointer( - start: UnsafePointer(bytes), count: length - ))) - } - - public func toHex() -> String { - return bytes.map { - ($0 < 16 ? "0" : "") + String($0, radix: 16, uppercase: false) - }.joinWithSeparator("") - } - -} - -extension Blob : CustomStringConvertible { - - public var description: String { - return "x'\(toHex())'" - } - -} - -extension Blob : Equatable { - -} - -public func ==(lhs: Blob, rhs: Blob) -> Bool { - return lhs.bytes == rhs.bytes -} diff --git a/Pods/SQLite.swift/SQLite/Core/Connection.swift b/Pods/SQLite.swift/SQLite/Core/Connection.swift deleted file mode 100644 index 0243317..0000000 --- a/Pods/SQLite.swift/SQLite/Core/Connection.swift +++ /dev/null @@ -1,684 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Dispatch - -/// A connection to SQLite. -public final class Connection { - - /// The location of a SQLite database. - public enum Location { - - /// An in-memory database (equivalent to `.URI(":memory:")`). - /// - /// See: - case InMemory - - /// A temporary, file-backed database (equivalent to `.URI("")`). - /// - /// See: - case Temporary - - /// A database located at the given URI filename (or path). - /// - /// See: - /// - /// - Parameter filename: A URI filename - case URI(String) - } - - public var handle: COpaquePointer { return _handle } - - private var _handle: COpaquePointer = nil - - /// Initializes a new SQLite connection. - /// - /// - Parameters: - /// - /// - location: The location of the database. Creates a new database if it - /// doesn’t already exist (unless in read-only mode). - /// - /// Default: `.InMemory`. - /// - /// - readonly: Whether or not to open the database in a read-only state. - /// - /// Default: `false`. - /// - /// - Returns: A new database connection. - public init(_ location: Location = .InMemory, readonly: Bool = false) throws { - let flags = readonly ? SQLITE_OPEN_READONLY : SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE - try check(sqlite3_open_v2(location.description, &_handle, flags | SQLITE_OPEN_FULLMUTEX, nil)) - dispatch_queue_set_specific(queue, Connection.queueKey, queueContext, nil) - } - - /// Initializes a new connection to a database. - /// - /// - Parameters: - /// - /// - filename: The location of the database. Creates a new database if - /// it doesn’t already exist (unless in read-only mode). - /// - /// - readonly: Whether or not to open the database in a read-only state. - /// - /// Default: `false`. - /// - /// - Throws: `Result.Error` iff a connection cannot be established. - /// - /// - Returns: A new database connection. - public convenience init(_ filename: String, readonly: Bool = false) throws { - try self.init(.URI(filename), readonly: readonly) - } - - deinit { - sqlite3_close(handle) - } - - // MARK: - - - /// Whether or not the database was opened in a read-only state. - public var readonly: Bool { return sqlite3_db_readonly(handle, nil) == 1 } - - /// The last rowid inserted into the database via this connection. - public var lastInsertRowid: Int64? { - let rowid = sqlite3_last_insert_rowid(handle) - return rowid > 0 ? rowid : nil - } - - /// The last number of changes (inserts, updates, or deletes) made to the - /// database via this connection. - public var changes: Int { - return Int(sqlite3_changes(handle)) - } - - /// The total number of changes (inserts, updates, or deletes) made to the - /// database via this connection. - public var totalChanges: Int { - return Int(sqlite3_total_changes(handle)) - } - - // MARK: - Execute - - /// Executes a batch of SQL statements. - /// - /// - Parameter SQL: A batch of zero or more semicolon-separated SQL - /// statements. - /// - /// - Throws: `Result.Error` if query execution fails. - public func execute(SQL: String) throws { - try sync { try self.check(sqlite3_exec(self.handle, SQL, nil, nil, nil)) } - } - - // MARK: - Prepare - - /// Prepares a single SQL statement (with optional parameter bindings). - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Returns: A prepared statement. - @warn_unused_result public func prepare(statement: String, _ bindings: Binding?...) throws -> Statement { - if !bindings.isEmpty { return try prepare(statement, bindings) } - return try Statement(self, statement) - } - - /// Prepares a single SQL statement and binds parameters to it. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Returns: A prepared statement. - @warn_unused_result public func prepare(statement: String, _ bindings: [Binding?]) throws -> Statement { - return try prepare(statement).bind(bindings) - } - - /// Prepares a single SQL statement and binds parameters to it. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A dictionary of named parameters to bind to the statement. - /// - /// - Returns: A prepared statement. - @warn_unused_result public func prepare(statement: String, _ bindings: [String: Binding?]) throws -> Statement { - return try prepare(statement).bind(bindings) - } - - // MARK: - Run - - /// Runs a single SQL statement (with optional parameter bindings). - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement. - public func run(statement: String, _ bindings: Binding?...) throws -> Statement { - return try run(statement, bindings) - } - - /// Prepares, binds, and runs a single SQL statement. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement. - public func run(statement: String, _ bindings: [Binding?]) throws -> Statement { - return try prepare(statement).run(bindings) - } - - /// Prepares, binds, and runs a single SQL statement. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A dictionary of named parameters to bind to the statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement. - public func run(statement: String, _ bindings: [String: Binding?]) throws -> Statement { - return try prepare(statement).run(bindings) - } - - // MARK: - Scalar - - /// Runs a single SQL statement (with optional parameter bindings), - /// returning the first value of the first row. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(statement: String, _ bindings: Binding?...) -> Binding? { - return scalar(statement, bindings) - } - - /// Runs a single SQL statement (with optional parameter bindings), - /// returning the first value of the first row. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A list of parameters to bind to the statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(statement: String, _ bindings: [Binding?]) -> Binding? { - return try! prepare(statement).scalar(bindings) - } - - /// Runs a single SQL statement (with optional parameter bindings), - /// returning the first value of the first row. - /// - /// - Parameters: - /// - /// - statement: A single SQL statement. - /// - /// - bindings: A dictionary of named parameters to bind to the statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(statement: String, _ bindings: [String: Binding?]) -> Binding? { - return try! prepare(statement).scalar(bindings) - } - - // MARK: - Transactions - - /// The mode in which a transaction acquires a lock. - public enum TransactionMode : String { - - /// Defers locking the database till the first read/write executes. - case Deferred = "DEFERRED" - - /// Immediately acquires a reserved lock on the database. - case Immediate = "IMMEDIATE" - - /// Immediately acquires an exclusive lock on all databases. - case Exclusive = "EXCLUSIVE" - - } - - // TODO: Consider not requiring a throw to roll back? - /// Runs a transaction with the given mode. - /// - /// - Note: Transactions cannot be nested. To nest transactions, see - /// `savepoint()`, instead. - /// - /// - Parameters: - /// - /// - mode: The mode in which a transaction acquires a lock. - /// - /// Default: `.Deferred` - /// - /// - block: A closure to run SQL statements within the transaction. - /// The transaction will be committed when the block returns. The block - /// must throw to roll the transaction back. - /// - /// - Throws: `Result.Error`, and rethrows. - public func transaction(mode: TransactionMode = .Deferred, block: () throws -> Void) throws { - try transaction("BEGIN \(mode.rawValue) TRANSACTION", block, "COMMIT TRANSACTION", or: "ROLLBACK TRANSACTION") - } - - // TODO: Consider not requiring a throw to roll back? - // TODO: Consider removing ability to set a name? - /// Runs a transaction with the given savepoint name (if omitted, it will - /// generate a UUID). - /// - /// - SeeAlso: `transaction()`. - /// - /// - Parameters: - /// - /// - savepointName: A unique identifier for the savepoint (optional). - /// - /// - block: A closure to run SQL statements within the transaction. - /// The savepoint will be released (committed) when the block returns. - /// The block must throw to roll the savepoint back. - /// - /// - Throws: `SQLite.Result.Error`, and rethrows. - public func savepoint(name: String = NSUUID().UUIDString, block: () throws -> Void) throws { - let name = name.quote("'") - let savepoint = "SAVEPOINT \(name)" - - try transaction(savepoint, block, "RELEASE \(savepoint)", or: "ROLLBACK TO \(savepoint)") - } - - private func transaction(begin: String, _ block: () throws -> Void, _ commit: String, or rollback: String) throws { - return try sync { - try self.run(begin) - do { - try block() - } catch { - try self.run(rollback) - throw error - } - try self.run(commit) - } - } - - /// Interrupts any long-running queries. - public func interrupt() { - sqlite3_interrupt(handle) - } - - // MARK: - Handlers - - /// The number of seconds a connection will attempt to retry a statement - /// after encountering a busy signal (lock). - public var busyTimeout: Double = 0 { - didSet { - sqlite3_busy_timeout(handle, Int32(busyTimeout * 1_000)) - } - } - - /// Sets a handler to call after encountering a busy signal (lock). - /// - /// - Parameter callback: This block is executed during a lock in which a - /// busy error would otherwise be returned. It’s passed the number of - /// times it’s been called for this lock. If it returns `true`, it will - /// try again. If it returns `false`, no further attempts will be made. - public func busyHandler(callback: ((tries: Int) -> Bool)?) { - guard let callback = callback else { - sqlite3_busy_handler(handle, nil, nil) - busyHandler = nil - return - } - - let box: BusyHandler = { callback(tries: Int($0)) ? 1 : 0 } - sqlite3_busy_handler(handle, { callback, tries in - unsafeBitCast(callback, BusyHandler.self)(tries) - }, unsafeBitCast(box, UnsafeMutablePointer.self)) - busyHandler = box - } - private typealias BusyHandler = @convention(block) Int32 -> Int32 - private var busyHandler: BusyHandler? - - /// Sets a handler to call when a statement is executed with the compiled - /// SQL. - /// - /// - Parameter callback: This block is invoked when a statement is executed - /// with the compiled SQL as its argument. - /// - /// db.trace { SQL in print(SQL) } - public func trace(callback: (String -> Void)?) { - guard let callback = callback else { - sqlite3_trace(handle, nil, nil) - trace = nil - return - } - - let box: Trace = { callback(String.fromCString($0)!) } - sqlite3_trace(handle, { callback, SQL in - unsafeBitCast(callback, Trace.self)(SQL) - }, unsafeBitCast(box, UnsafeMutablePointer.self)) - trace = box - } - private typealias Trace = @convention(block) UnsafePointer -> Void - private var trace: Trace? - - /// Registers a callback to be invoked whenever a row is inserted, updated, - /// or deleted in a rowid table. - /// - /// - Parameter callback: A callback invoked with the `Operation` (one of - /// `.Insert`, `.Update`, or `.Delete`), database name, table name, and - /// rowid. - public func updateHook(callback: ((operation: Operation, db: String, table: String, rowid: Int64) -> Void)?) { - guard let callback = callback else { - sqlite3_update_hook(handle, nil, nil) - updateHook = nil - return - } - - let box: UpdateHook = { - callback( - operation: Operation(rawValue: $0), - db: String.fromCString($1)!, - table: String.fromCString($2)!, - rowid: $3 - ) - } - sqlite3_update_hook(handle, { callback, operation, db, table, rowid in - unsafeBitCast(callback, UpdateHook.self)(operation, db, table, rowid) - }, unsafeBitCast(box, UnsafeMutablePointer.self)) - updateHook = box - } - private typealias UpdateHook = @convention(block) (Int32, UnsafePointer, UnsafePointer, Int64) -> Void - private var updateHook: UpdateHook? - - /// Registers a callback to be invoked whenever a transaction is committed. - /// - /// - Parameter callback: A callback invoked whenever a transaction is - /// committed. If this callback throws, the transaction will be rolled - /// back. - public func commitHook(callback: (() throws -> Void)?) { - guard let callback = callback else { - sqlite3_commit_hook(handle, nil, nil) - commitHook = nil - return - } - - let box: CommitHook = { - do { - try callback() - } catch { - return 1 - } - return 0 - } - sqlite3_commit_hook(handle, { callback in - unsafeBitCast(callback, CommitHook.self)() - }, unsafeBitCast(box, UnsafeMutablePointer.self)) - commitHook = box - } - private typealias CommitHook = @convention(block) () -> Int32 - private var commitHook: CommitHook? - - /// Registers a callback to be invoked whenever a transaction rolls back. - /// - /// - Parameter callback: A callback invoked when a transaction is rolled - /// back. - public func rollbackHook(callback: (() -> Void)?) { - guard let callback = callback else { - sqlite3_rollback_hook(handle, nil, nil) - rollbackHook = nil - return - } - - let box: RollbackHook = { callback() } - sqlite3_rollback_hook(handle, { callback in - unsafeBitCast(callback, RollbackHook.self)() - }, unsafeBitCast(box, UnsafeMutablePointer.self)) - rollbackHook = box - } - private typealias RollbackHook = @convention(block) () -> Void - private var rollbackHook: RollbackHook? - - /// Creates or redefines a custom SQL function. - /// - /// - Parameters: - /// - /// - function: The name of the function to create or redefine. - /// - /// - argumentCount: The number of arguments that the function takes. If - /// `nil`, the function may take any number of arguments. - /// - /// Default: `nil` - /// - /// - deterministic: Whether or not the function is deterministic (_i.e._ - /// the function always returns the same result for a given input). - /// - /// Default: `false` - /// - /// - block: A block of code to run when the function is called. The block - /// is called with an array of raw SQL values mapped to the function’s - /// parameters and should return a raw SQL value (or nil). - public func createFunction(function: String, argumentCount: UInt? = nil, deterministic: Bool = false, _ block: (args: [Binding?]) -> Binding?) { - let argc = argumentCount.map { Int($0) } ?? -1 - let box: Function = { context, argc, argv in - let arguments: [Binding?] = (0...self), { context, argc, value in - unsafeBitCast(sqlite3_user_data(context), Function.self)(context, argc, value) - }, nil, nil, nil) - if functions[function] == nil { self.functions[function] = [:] } - functions[function]?[argc] = box - } - private typealias Function = @convention(block) (COpaquePointer, Int32, UnsafeMutablePointer) -> Void - private var functions = [String: [Int: Function]]() - - /// The return type of a collation comparison function. - public typealias ComparisonResult = NSComparisonResult - - /// Defines a new collating sequence. - /// - /// - Parameters: - /// - /// - collation: The name of the collation added. - /// - /// - block: A collation function that takes two strings and returns the - /// comparison result. - public func createCollation(collation: String, _ block: (lhs: String, rhs: String) -> ComparisonResult) { - let box: Collation = { lhs, rhs in - Int32(block(lhs: String.fromCString(UnsafePointer(lhs))!, rhs: String.fromCString(UnsafePointer(rhs))!).rawValue) - } - try! check(sqlite3_create_collation_v2(handle, collation, SQLITE_UTF8, unsafeBitCast(box, UnsafeMutablePointer.self), { callback, _, lhs, _, rhs in - unsafeBitCast(callback, Collation.self)(lhs, rhs) - }, nil)) - collations[collation] = box - } - private typealias Collation = @convention(block) (UnsafePointer, UnsafePointer) -> Int32 - private var collations = [String: Collation]() - - // MARK: - Error Handling - - func sync(block: () throws -> T) rethrows -> T { - var success: T? - var failure: ErrorType? - - let box: () -> Void = { - do { - success = try block() - } catch { - failure = error - } - } - - if dispatch_get_specific(Connection.queueKey) == queueContext { - box() - } else { - dispatch_sync(queue, box) // FIXME: rdar://problem/21389236 - } - - if let failure = failure { - try { () -> Void in throw failure }() - } - - return success! - } - - func check(resultCode: Int32, statement: Statement? = nil) throws -> Int32 { - guard let error = Result(errorCode: resultCode, connection: self, statement: statement) else { - return resultCode - } - - throw error - } - - private var queue = dispatch_queue_create("SQLite.Database", DISPATCH_QUEUE_SERIAL) - - private static let queueKey = unsafeBitCast(Connection.self, UnsafePointer.self) - - private lazy var queueContext: UnsafeMutablePointer = unsafeBitCast(self, UnsafeMutablePointer.self) - -} - -extension Connection : CustomStringConvertible { - - public var description: String { - return String.fromCString(sqlite3_db_filename(handle, nil))! - } - -} - -extension Connection.Location : CustomStringConvertible { - - public var description: String { - switch self { - case .InMemory: - return ":memory:" - case .Temporary: - return "" - case .URI(let URI): - return URI - } - } - -} - -/// An SQL operation passed to update callbacks. -public enum Operation { - - /// An INSERT operation. - case Insert - - /// An UPDATE operation. - case Update - - /// A DELETE operation. - case Delete - - private init(rawValue: Int32) { - switch rawValue { - case SQLITE_INSERT: - self = .Insert - case SQLITE_UPDATE: - self = .Update - case SQLITE_DELETE: - self = .Delete - default: - fatalError("unhandled operation code: \(rawValue)") - } - } - -} - -public enum Result : ErrorType { - - private static let successCodes: Set = [SQLITE_OK, SQLITE_ROW, SQLITE_DONE] - - case Error(message: String, code: Int32, statement: Statement?) - - init?(errorCode: Int32, connection: Connection, statement: Statement? = nil) { - guard !Result.successCodes.contains(errorCode) else { return nil } - - let message = String.fromCString(sqlite3_errmsg(connection.handle))! - self = Error(message: message, code: errorCode, statement: statement) - } - -} - -extension Result : CustomStringConvertible { - - public var description: String { - switch self { - case let .Error(message, _, statement): - guard let statement = statement else { return message } - - return "\(message) (\(statement))" - } - } - -} diff --git a/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.h b/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.h deleted file mode 100644 index d15e8d5..0000000 --- a/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -@import Foundation; - -#ifndef COCOAPODS -#import "sqlite3.h" -#endif - -typedef struct SQLiteHandle SQLiteHandle; // CocoaPods workaround - -NS_ASSUME_NONNULL_BEGIN -typedef NSString * _Nullable (^_SQLiteTokenizerNextCallback)(const char * input, int * inputOffset, int * inputLength); -int _SQLiteRegisterTokenizer(SQLiteHandle * db, const char * module, const char * tokenizer, _Nullable _SQLiteTokenizerNextCallback callback); -NS_ASSUME_NONNULL_END - diff --git a/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.m b/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.m deleted file mode 100644 index a5702cc..0000000 --- a/Pods/SQLite.swift/SQLite/Core/SQLite-Bridging.m +++ /dev/null @@ -1,139 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#import "SQLite-Bridging.h" -#import "sqlite3.h" -#import "fts3_tokenizer.h" - -#pragma mark - FTS - -typedef struct __SQLiteTokenizer { - sqlite3_tokenizer base; - __unsafe_unretained _SQLiteTokenizerNextCallback callback; -} __SQLiteTokenizer; - -typedef struct __SQLiteTokenizerCursor { - void * base; - const char * input; - int inputOffset; - int inputLength; - int idx; -} __SQLiteTokenizerCursor; - -static NSMutableDictionary * __SQLiteTokenizerMap; - -static int __SQLiteTokenizerCreate(int argc, const char * const * argv, sqlite3_tokenizer ** ppTokenizer) { - __SQLiteTokenizer * tokenizer = (__SQLiteTokenizer *)sqlite3_malloc(sizeof(__SQLiteTokenizer)); - if (!tokenizer) { - return SQLITE_NOMEM; - } - memset(tokenizer, 0, sizeof(* tokenizer)); - - NSString * key = [NSString stringWithUTF8String:argv[0]]; - tokenizer->callback = [__SQLiteTokenizerMap objectForKey:key]; - if (!tokenizer->callback) { - return SQLITE_ERROR; - } - - *ppTokenizer = &tokenizer->base; - return SQLITE_OK; -} - -static int __SQLiteTokenizerDestroy(sqlite3_tokenizer * pTokenizer) { - sqlite3_free(pTokenizer); - return SQLITE_OK; -} - -static int __SQLiteTokenizerOpen(sqlite3_tokenizer * pTokenizer, const char * pInput, int nBytes, sqlite3_tokenizer_cursor ** ppCursor) { - __SQLiteTokenizerCursor * cursor = (__SQLiteTokenizerCursor *)sqlite3_malloc(sizeof(__SQLiteTokenizerCursor)); - if (!cursor) { - return SQLITE_NOMEM; - } - - cursor->input = pInput; - cursor->inputOffset = 0; - cursor->inputLength = 0; - cursor->idx = 0; - - *ppCursor = (sqlite3_tokenizer_cursor *)cursor; - return SQLITE_OK; -} - -static int __SQLiteTokenizerClose(sqlite3_tokenizer_cursor * pCursor) { - sqlite3_free(pCursor); - return SQLITE_OK; -} - -static int __SQLiteTokenizerNext(sqlite3_tokenizer_cursor * pCursor, const char ** ppToken, int * pnBytes, int * piStartOffset, int * piEndOffset, int * piPosition) { - __SQLiteTokenizerCursor * cursor = (__SQLiteTokenizerCursor *)pCursor; - __SQLiteTokenizer * tokenizer = (__SQLiteTokenizer *)cursor->base; - - cursor->inputOffset += cursor->inputLength; - const char * input = cursor->input + cursor->inputOffset; - const char * token = [tokenizer->callback(input, &cursor->inputOffset, &cursor->inputLength) cStringUsingEncoding:NSUTF8StringEncoding]; - if (!token) { - return SQLITE_DONE; - } - - *ppToken = token; - *pnBytes = (int)strlen(token); - *piStartOffset = cursor->inputOffset; - *piEndOffset = cursor->inputOffset + cursor->inputLength; - *piPosition = cursor->idx++; - return SQLITE_OK; -} - -static const sqlite3_tokenizer_module __SQLiteTokenizerModule = { - 0, - __SQLiteTokenizerCreate, - __SQLiteTokenizerDestroy, - __SQLiteTokenizerOpen, - __SQLiteTokenizerClose, - __SQLiteTokenizerNext -}; - -int _SQLiteRegisterTokenizer(SQLiteHandle * db, const char * moduleName, const char * submoduleName, _SQLiteTokenizerNextCallback callback) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - __SQLiteTokenizerMap = [NSMutableDictionary new]; - }); - - sqlite3_stmt * stmt; - int status = sqlite3_prepare_v2((sqlite3 *)db, "SELECT fts3_tokenizer(?, ?)", -1, &stmt, 0); - if (status != SQLITE_OK ){ - return status; - } - const sqlite3_tokenizer_module * pModule = &__SQLiteTokenizerModule; - sqlite3_bind_text(stmt, 1, moduleName, -1, SQLITE_STATIC); - sqlite3_bind_blob(stmt, 2, &pModule, sizeof(pModule), SQLITE_STATIC); - sqlite3_step(stmt); - status = sqlite3_finalize(stmt); - if (status != SQLITE_OK ){ - return status; - } - - [__SQLiteTokenizerMap setObject:[callback copy] forKey:[NSString stringWithUTF8String:submoduleName]]; - - return SQLITE_OK; -} diff --git a/Pods/SQLite.swift/SQLite/Core/Statement.swift b/Pods/SQLite.swift/SQLite/Core/Statement.swift deleted file mode 100644 index 1143ee7..0000000 --- a/Pods/SQLite.swift/SQLite/Core/Statement.swift +++ /dev/null @@ -1,279 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -/// A single SQL statement. -public final class Statement { - - private var handle: COpaquePointer = nil - - private let connection: Connection - - init(_ connection: Connection, _ SQL: String) throws { - self.connection = connection - try connection.check(sqlite3_prepare_v2(connection.handle, SQL, -1, &handle, nil)) - } - - deinit { - sqlite3_finalize(handle) - } - - public lazy var columnCount: Int = Int(sqlite3_column_count(self.handle)) - - public lazy var columnNames: [String] = (0.. Statement { - return bind(values) - } - - /// Binds a list of parameters to a statement. - /// - /// - Parameter values: A list of parameters to bind to the statement. - /// - /// - Returns: The statement object (useful for chaining). - public func bind(values: [Binding?]) -> Statement { - if values.isEmpty { return self } - reset() - guard values.count == Int(sqlite3_bind_parameter_count(handle)) else { - fatalError("\(sqlite3_bind_parameter_count(handle)) values expected, \(values.count) passed") - } - for idx in 1...values.count { bind(values[idx - 1], atIndex: idx) } - return self - } - - /// Binds a dictionary of named parameters to a statement. - /// - /// - Parameter values: A dictionary of named parameters to bind to the - /// statement. - /// - /// - Returns: The statement object (useful for chaining). - public func bind(values: [String: Binding?]) -> Statement { - reset() - for (name, value) in values { - let idx = sqlite3_bind_parameter_index(handle, name) - guard idx > 0 else { - fatalError("parameter not found: \(name)") - } - bind(value, atIndex: Int(idx)) - } - return self - } - - private func bind(value: Binding?, atIndex idx: Int) { - if value == nil { - sqlite3_bind_null(handle, Int32(idx)) - } else if let value = value as? Blob { - sqlite3_bind_blob(handle, Int32(idx), value.bytes, Int32(value.bytes.count), SQLITE_TRANSIENT) - } else if let value = value as? Double { - sqlite3_bind_double(handle, Int32(idx), value) - } else if let value = value as? Int64 { - sqlite3_bind_int64(handle, Int32(idx), value) - } else if let value = value as? String { - sqlite3_bind_text(handle, Int32(idx), value, -1, SQLITE_TRANSIENT) - } else if let value = value as? Int { - self.bind(value.datatypeValue, atIndex: idx) - } else if let value = value as? Bool { - self.bind(value.datatypeValue, atIndex: idx) - } else if let value = value { - fatalError("tried to bind unexpected value \(value)") - } - } - - /// - Parameter bindings: A list of parameters to bind to the statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement object (useful for chaining). - public func run(bindings: Binding?...) throws -> Statement { - guard bindings.isEmpty else { - return try run(bindings) - } - - reset(clearBindings: false) - repeat {} while try step() - return self - } - - /// - Parameter bindings: A list of parameters to bind to the statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement object (useful for chaining). - public func run(bindings: [Binding?]) throws -> Statement { - return try bind(bindings).run() - } - - /// - Parameter bindings: A dictionary of named parameters to bind to the - /// statement. - /// - /// - Throws: `Result.Error` if query execution fails. - /// - /// - Returns: The statement object (useful for chaining). - public func run(bindings: [String: Binding?]) throws -> Statement { - return try bind(bindings).run() - } - - /// - Parameter bindings: A list of parameters to bind to the statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(bindings: Binding?...) -> Binding? { - guard bindings.isEmpty else { - return scalar(bindings) - } - - reset(clearBindings: false) - try! step() - return row[0] - } - - /// - Parameter bindings: A list of parameters to bind to the statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(bindings: [Binding?]) -> Binding? { - return bind(bindings).scalar() - } - - - /// - Parameter bindings: A dictionary of named parameters to bind to the - /// statement. - /// - /// - Returns: The first value of the first row returned. - @warn_unused_result public func scalar(bindings: [String: Binding?]) -> Binding? { - return bind(bindings).scalar() - } - - public func step() throws -> Bool { - return try connection.sync { try self.connection.check(sqlite3_step(self.handle)) == SQLITE_ROW } - } - - private func reset(clearBindings shouldClear: Bool = true) { - sqlite3_reset(handle) - if (shouldClear) { sqlite3_clear_bindings(handle) } - } - -} - -extension Statement : SequenceType { - - public func generate() -> Statement { - reset(clearBindings: false) - return self - } - -} - -extension Statement : GeneratorType { - - public func next() -> [Binding?]? { - return try! step() ? Array(row) : nil - } - -} - -extension Statement : CustomStringConvertible { - - public var description: String { - return String.fromCString(sqlite3_sql(handle))! - } - -} - -public struct Cursor { - - private let handle: COpaquePointer - - private let columnCount: Int - - private init(_ statement: Statement) { - handle = statement.handle - columnCount = statement.columnCount - } - - public subscript(idx: Int) -> Double { - return sqlite3_column_double(handle, Int32(idx)) - } - - public subscript(idx: Int) -> Int64 { - return sqlite3_column_int64(handle, Int32(idx)) - } - - public subscript(idx: Int) -> String { - return String.fromCString(UnsafePointer(sqlite3_column_text(handle, Int32(idx)))) ?? "" - } - - public subscript(idx: Int) -> Blob { - let bytes = sqlite3_column_blob(handle, Int32(idx)) - let length = Int(sqlite3_column_bytes(handle, Int32(idx))) - return Blob(bytes: bytes, length: length) - } - - // MARK: - - - public subscript(idx: Int) -> Bool { - return Bool.fromDatatypeValue(self[idx]) - } - - public subscript(idx: Int) -> Int { - return Int.fromDatatypeValue(self[idx]) - } - -} - -/// Cursors provide direct access to a statement’s current row. -extension Cursor : SequenceType { - - public subscript(idx: Int) -> Binding? { - switch sqlite3_column_type(handle, Int32(idx)) { - case SQLITE_BLOB: - return self[idx] as Blob - case SQLITE_FLOAT: - return self[idx] as Double - case SQLITE_INTEGER: - return self[idx] as Int64 - case SQLITE_NULL: - return nil - case SQLITE_TEXT: - return self[idx] as String - case let type: - fatalError("unsupported column type: \(type)") - } - } - - public func generate() -> AnyGenerator { - var idx = 0 - return anyGenerator { - idx >= self.columnCount ? Optional.None : self[idx++] - } - } - -} diff --git a/Pods/SQLite.swift/SQLite/Core/Value.swift b/Pods/SQLite.swift/SQLite/Core/Value.swift deleted file mode 100644 index 96e8037..0000000 --- a/Pods/SQLite.swift/SQLite/Core/Value.swift +++ /dev/null @@ -1,132 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -/// - Warning: `Binding` is a protocol that SQLite.swift uses internally to -/// directly map SQLite types to Swift types. -/// -/// Do not conform custom types to the Binding protocol. See the `Value` -/// protocol, instead. -public protocol Binding {} - -public protocol Number : Binding {} - -public protocol Value : Expressible { // extensions cannot have inheritance clauses - - typealias ValueType = Self - - typealias Datatype : Binding - - static var declaredDatatype: String { get } - - static func fromDatatypeValue(datatypeValue: Datatype) -> ValueType - - var datatypeValue: Datatype { get } - -} - -extension Double : Number, Value { - - public static let declaredDatatype = "REAL" - - public static func fromDatatypeValue(datatypeValue: Double) -> Double { - return datatypeValue - } - - public var datatypeValue: Double { - return self - } - -} - -extension Int64 : Number, Value { - - public static let declaredDatatype = "INTEGER" - - public static func fromDatatypeValue(datatypeValue: Int64) -> Int64 { - return datatypeValue - } - - public var datatypeValue: Int64 { - return self - } - -} - -extension String : Binding, Value { - - public static let declaredDatatype = "TEXT" - - public static func fromDatatypeValue(datatypeValue: String) -> String { - return datatypeValue - } - - public var datatypeValue: String { - return self - } - -} - -extension Blob : Binding, Value { - - public static let declaredDatatype = "BLOB" - - public static func fromDatatypeValue(datatypeValue: Blob) -> Blob { - return datatypeValue - } - - public var datatypeValue: Blob { - return self - } - -} - -// MARK: - - -extension Bool : Binding, Value { - - public static var declaredDatatype = Int64.declaredDatatype - - public static func fromDatatypeValue(datatypeValue: Int64) -> Bool { - return datatypeValue != 0 - } - - public var datatypeValue: Int64 { - return self ? 1 : 0 - } - -} - -extension Int : Number, Value { - - public static var declaredDatatype = Int64.declaredDatatype - - public static func fromDatatypeValue(datatypeValue: Int64) -> Int { - return Int(datatypeValue) - } - - public var datatypeValue: Int64 { - return Int64(self) - } - -} diff --git a/Pods/SQLite.swift/SQLite/Core/fts3_tokenizer.h b/Pods/SQLite.swift/SQLite/Core/fts3_tokenizer.h deleted file mode 100644 index d8a1e44..0000000 --- a/Pods/SQLite.swift/SQLite/Core/fts3_tokenizer.h +++ /dev/null @@ -1,161 +0,0 @@ -/* -** 2006 July 10 -** -** The author disclaims copyright to this source code. -** -************************************************************************* -** Defines the interface to tokenizers used by fulltext-search. There -** are three basic components: -** -** sqlite3_tokenizer_module is a singleton defining the tokenizer -** interface functions. This is essentially the class structure for -** tokenizers. -** -** sqlite3_tokenizer is used to define a particular tokenizer, perhaps -** including customization information defined at creation time. -** -** sqlite3_tokenizer_cursor is generated by a tokenizer to generate -** tokens from a particular input. -*/ -#ifndef _FTS3_TOKENIZER_H_ -#define _FTS3_TOKENIZER_H_ - -/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time. -** If tokenizers are to be allowed to call sqlite3_*() functions, then -** we will need a way to register the API consistently. -*/ -#import "sqlite3.h" - -/* -** Structures used by the tokenizer interface. When a new tokenizer -** implementation is registered, the caller provides a pointer to -** an sqlite3_tokenizer_module containing pointers to the callback -** functions that make up an implementation. -** -** When an fts3 table is created, it passes any arguments passed to -** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the -** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer -** implementation. The xCreate() function in turn returns an -** sqlite3_tokenizer structure representing the specific tokenizer to -** be used for the fts3 table (customized by the tokenizer clause arguments). -** -** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen() -** method is called. It returns an sqlite3_tokenizer_cursor object -** that may be used to tokenize a specific input buffer based on -** the tokenization rules supplied by a specific sqlite3_tokenizer -** object. -*/ -typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module; -typedef struct sqlite3_tokenizer sqlite3_tokenizer; -typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor; - -struct sqlite3_tokenizer_module { - - /* - ** Structure version. Should always be set to 0 or 1. - */ - int iVersion; - - /* - ** Create a new tokenizer. The values in the argv[] array are the - ** arguments passed to the "tokenizer" clause of the CREATE VIRTUAL - ** TABLE statement that created the fts3 table. For example, if - ** the following SQL is executed: - ** - ** CREATE .. USING fts3( ... , tokenizer arg1 arg2) - ** - ** then argc is set to 2, and the argv[] array contains pointers - ** to the strings "arg1" and "arg2". - ** - ** This method should return either SQLITE_OK (0), or an SQLite error - ** code. If SQLITE_OK is returned, then *ppTokenizer should be set - ** to point at the newly created tokenizer structure. The generic - ** sqlite3_tokenizer.pModule variable should not be initialized by - ** this callback. The caller will do so. - */ - int (*xCreate)( - int argc, /* Size of argv array */ - const char *const*argv, /* Tokenizer argument strings */ - sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ - ); - - /* - ** Destroy an existing tokenizer. The fts3 module calls this method - ** exactly once for each successful call to xCreate(). - */ - int (*xDestroy)(sqlite3_tokenizer *pTokenizer); - - /* - ** Create a tokenizer cursor to tokenize an input buffer. The caller - ** is responsible for ensuring that the input buffer remains valid - ** until the cursor is closed (using the xClose() method). - */ - int (*xOpen)( - sqlite3_tokenizer *pTokenizer, /* Tokenizer object */ - const char *pInput, int nBytes, /* Input buffer */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Created tokenizer cursor */ - ); - - /* - ** Destroy an existing tokenizer cursor. The fts3 module calls this - ** method exactly once for each successful call to xOpen(). - */ - int (*xClose)(sqlite3_tokenizer_cursor *pCursor); - - /* - ** Retrieve the next token from the tokenizer cursor pCursor. This - ** method should either return SQLITE_OK and set the values of the - ** "OUT" variables identified below, or SQLITE_DONE to indicate that - ** the end of the buffer has been reached, or an SQLite error code. - ** - ** *ppToken should be set to point at a buffer containing the - ** normalized version of the token (i.e. after any case-folding and/or - ** stemming has been performed). *pnBytes should be set to the length - ** of this buffer in bytes. The input text that generated the token is - ** identified by the byte offsets returned in *piStartOffset and - ** *piEndOffset. *piStartOffset should be set to the index of the first - ** byte of the token in the input buffer. *piEndOffset should be set - ** to the index of the first byte just past the end of the token in - ** the input buffer. - ** - ** The buffer *ppToken is set to point at is managed by the tokenizer - ** implementation. It is only required to be valid until the next call - ** to xNext() or xClose(). - */ - /* TODO(shess) current implementation requires pInput to be - ** nul-terminated. This should either be fixed, or pInput/nBytes - ** should be converted to zInput. - */ - int (*xNext)( - sqlite3_tokenizer_cursor *pCursor, /* Tokenizer cursor */ - const char **ppToken, int *pnBytes, /* OUT: Normalized text for token */ - int *piStartOffset, /* OUT: Byte offset of token in input buffer */ - int *piEndOffset, /* OUT: Byte offset of end of token in input buffer */ - int *piPosition /* OUT: Number of tokens returned before this one */ - ); - - /*********************************************************************** - ** Methods below this point are only available if iVersion>=1. - */ - - /* - ** Configure the language id of a tokenizer cursor. - */ - int (*xLanguageid)(sqlite3_tokenizer_cursor *pCsr, int iLangid); -}; - -struct sqlite3_tokenizer { - const sqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ - /* Tokenizer implementations will typically add additional fields */ -}; - -struct sqlite3_tokenizer_cursor { - sqlite3_tokenizer *pTokenizer; /* Tokenizer for this cursor. */ - /* Tokenizer implementations will typically add additional fields */ -}; - -int fts3_global_term_cnt(int iTerm, int iCol); -int fts3_term_cnt(int iTerm, int iCol); - - -#endif /* _FTS3_TOKENIZER_H_ */ diff --git a/Pods/SQLite.swift/SQLite/Extensions/FTS4.swift b/Pods/SQLite.swift/SQLite/Extensions/FTS4.swift deleted file mode 100644 index a755f96..0000000 --- a/Pods/SQLite.swift/SQLite/Extensions/FTS4.swift +++ /dev/null @@ -1,156 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension Module { - - @warn_unused_result public static func FTS4(column: Expressible, _ more: Expressible...) -> Module { - return FTS4([column] + more) - } - - @warn_unused_result public static func FTS4(var columns: [Expressible] = [], tokenize tokenizer: Tokenizer? = nil) -> Module { - if let tokenizer = tokenizer { - columns.append("=".join([Expression(literal: "tokenize"), Expression(literal: tokenizer.description)])) - } - return Module(name: "fts4", arguments: columns) - } - -} - -extension VirtualTable { - - /// Builds an expression appended with a `MATCH` query against the given - /// pattern. - /// - /// let emails = VirtualTable("emails") - /// - /// emails.filter(emails.match("Hello")) - /// // SELECT * FROM "emails" WHERE "emails" MATCH 'Hello' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: An expression appended with a `MATCH` query against the given - /// pattern. - @warn_unused_result public func match(pattern: String) -> Expression { - return "MATCH".infix(tableName(), pattern) - } - - @warn_unused_result public func match(pattern: Expression) -> Expression { - return "MATCH".infix(tableName(), pattern) - } - - @warn_unused_result public func match(pattern: Expression) -> Expression { - return "MATCH".infix(tableName(), pattern) - } - - /// Builds a copy of the query with a `WHERE … MATCH` clause. - /// - /// let emails = VirtualTable("emails") - /// - /// emails.match("Hello") - /// // SELECT * FROM "emails" WHERE "emails" MATCH 'Hello' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A query with the given `WHERE … MATCH` clause applied. - @warn_unused_result public func match(pattern: String) -> QueryType { - return filter(match(pattern)) - } - - @warn_unused_result public func match(pattern: Expression) -> QueryType { - return filter(match(pattern)) - } - - @warn_unused_result public func match(pattern: Expression) -> QueryType { - return filter(match(pattern)) - } - -} - -public struct Tokenizer { - - public static let Simple = Tokenizer("simple") - - public static let Porter = Tokenizer("porter") - - @warn_unused_result public static func Unicode61(removeDiacritics removeDiacritics: Bool? = nil, tokenchars: Set = [], separators: Set = []) -> Tokenizer { - var arguments = [String]() - - if let removeDiacritics = removeDiacritics { - arguments.append("removeDiacritics=\(removeDiacritics ? 1 : 0)".quote()) - } - - if !tokenchars.isEmpty { - let joined = tokenchars.map { String($0) }.joinWithSeparator("") - arguments.append("tokenchars=\(joined)".quote()) - } - - if !separators.isEmpty { - let joined = separators.map { String($0) }.joinWithSeparator("") - arguments.append("separators=\(joined)".quote()) - } - - return Tokenizer("unicode61", arguments) - } - - @warn_unused_result public static func Custom(name: String) -> Tokenizer { - return Tokenizer(Tokenizer.moduleName.quote(), [name.quote()]) - } - - public let name: String - - public let arguments: [String] - - private init(_ name: String, _ arguments: [String] = []) { - self.name = name - self.arguments = arguments - } - - private static let moduleName = "SQLite.swift" - -} - -extension Tokenizer : CustomStringConvertible { - - public var description: String { - return ([name] + arguments).joinWithSeparator(" ") - } - -} - -extension Connection { - - public func registerTokenizer(submoduleName: String, next: String -> (String, Range)?) throws { - try check(_SQLiteRegisterTokenizer(handle, Tokenizer.moduleName, submoduleName) { input, offset, length in - let string = String.fromCString(input)! - - guard let (token, range) = next(string) else { return nil } - - let view = string.utf8 - offset.memory += string.substringToIndex(range.startIndex).utf8.count - length.memory = Int32(range.startIndex.samePositionIn(view).distanceTo(range.endIndex.samePositionIn(view))) - return token - }) - } - -} diff --git a/Pods/SQLite.swift/SQLite/Extensions/R*Tree.swift b/Pods/SQLite.swift/SQLite/Extensions/R*Tree.swift deleted file mode 100644 index a5571ea..0000000 --- a/Pods/SQLite.swift/SQLite/Extensions/R*Tree.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension Module { - - @warn_unused_result public static func RTree(primaryKey: Expression, _ pairs: (Expression, Expression)...) -> Module { - var arguments: [Expressible] = [primaryKey] - - for pair in pairs { - arguments.appendContentsOf([pair.0, pair.1] as [Expressible]) - } - - return Module(name: "rtree", arguments: arguments) - } - -} diff --git a/Pods/SQLite.swift/SQLite/Foundation.swift b/Pods/SQLite.swift/SQLite/Foundation.swift deleted file mode 100644 index ef39d3b..0000000 --- a/Pods/SQLite.swift/SQLite/Foundation.swift +++ /dev/null @@ -1,104 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension NSData : Value { - - public class var declaredDatatype: String { - return Blob.declaredDatatype - } - - public class func fromDatatypeValue(dataValue: Blob) -> NSData { - return NSData(bytes: dataValue.bytes, length: dataValue.bytes.count) - } - - public var datatypeValue: Blob { - return Blob(bytes: bytes, length: length) - } - -} - -extension NSDate : Value { - - public class var declaredDatatype: String { - return String.declaredDatatype - } - - public class func fromDatatypeValue(stringValue: String) -> NSDate { - return dateFormatter.dateFromString(stringValue)! - } - - public var datatypeValue: String { - return dateFormatter.stringFromDate(self) - } - -} - -/// A global date formatter used to serialize and deserialize `NSDate` objects. -/// If multiple date formats are used in an application’s database(s), use a -/// custom `Value` type per additional format. -public var dateFormatter: NSDateFormatter = { - let formatter = NSDateFormatter() - formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS" - formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") - formatter.timeZone = NSTimeZone(forSecondsFromGMT: 0) - return formatter -}() - -// FIXME: rdar://problem/18673897 // subscript… - -extension QueryType { - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - -} - -extension Row { - - public subscript(column: Expression) -> NSData { - return get(column) - } - public subscript(column: Expression) -> NSData? { - return get(column) - } - - public subscript(column: Expression) -> NSDate { - return get(column) - } - public subscript(column: Expression) -> NSDate? { - return get(column) - } - -} \ No newline at end of file diff --git a/Pods/SQLite.swift/SQLite/Helpers.swift b/Pods/SQLite.swift/SQLite/Helpers.swift deleted file mode 100644 index c1775e6..0000000 --- a/Pods/SQLite.swift/SQLite/Helpers.swift +++ /dev/null @@ -1,122 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -public typealias Star = (Expression?, Expression?) -> Expression - -public func *(_: Expression?, _: Expression?) -> Expression { - return Expression(literal: "*") -} - -public protocol _OptionalType { - - typealias WrappedType - -} - -extension Optional : _OptionalType { - - public typealias WrappedType = Wrapped - -} - -// let SQLITE_STATIC = unsafeBitCast(0, sqlite3_destructor_type.self) -let SQLITE_TRANSIENT = unsafeBitCast(-1, sqlite3_destructor_type.self) - -extension String { - - @warn_unused_result func quote(mark: Character = "\"") -> String { - let escaped = characters.reduce("") { string, character in - string + (character == mark ? "\(mark)\(mark)" : "\(character)") - } - return "\(mark)\(escaped)\(mark)" - } - - @warn_unused_result func join(expressions: [Expressible]) -> Expressible { - var (template, bindings) = ([String](), [Binding?]()) - for expressible in expressions { - let expression = expressible.expression - template.append(expression.template) - bindings.appendContentsOf(expression.bindings) - } - return Expression(template.joinWithSeparator(self), bindings) - } - - @warn_unused_result func infix(lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression { - let expression = Expression(" \(self) ".join([lhs, rhs]).expression) - guard wrap else { - return expression - } - return "".wrap(expression) - } - - @warn_unused_result func prefix(expressions: Expressible) -> Expressible { - return "\(self) ".wrap(expressions) as Expression - } - - @warn_unused_result func prefix(expressions: [Expressible]) -> Expressible { - return "\(self) ".wrap(expressions) as Expression - } - - @warn_unused_result func wrap(expression: Expressible) -> Expression { - return Expression("\(self)(\(expression.expression.template))", expression.expression.bindings) - } - - @warn_unused_result func wrap(expressions: [Expressible]) -> Expression { - return wrap(", ".join(expressions)) - } - -} - -@warn_unused_result func infix(lhs: Expressible, _ rhs: Expressible, wrap: Bool = true, function: String = __FUNCTION__) -> Expression { - return function.infix(lhs, rhs, wrap: wrap) -} - -@warn_unused_result func wrap(expression: Expressible, function: String = __FUNCTION__) -> Expression { - return function.wrap(expression) -} - -@warn_unused_result func wrap(expressions: [Expressible], function: String = __FUNCTION__) -> Expression { - return function.wrap(", ".join(expressions)) -} - -@warn_unused_result func transcode(literal: Binding?) -> String { - guard let literal = literal else { return "NULL" } - - switch literal { - case let blob as Blob: - return blob.description - case let string as String: - return string.quote("'") - case let binding: - return "\(binding)" - } -} - -@warn_unused_result func value(v: Binding) -> A { - return A.fromDatatypeValue(v as! A.Datatype) as! A -} - -@warn_unused_result func value(v: Binding?) -> A { - return value(v!) -} diff --git a/Pods/SQLite.swift/SQLite/SQLite.h b/Pods/SQLite.swift/SQLite/SQLite.h deleted file mode 100644 index 693ce32..0000000 --- a/Pods/SQLite.swift/SQLite/SQLite.h +++ /dev/null @@ -1,6 +0,0 @@ -@import Foundation; - -FOUNDATION_EXPORT double SQLiteVersionNumber; -FOUNDATION_EXPORT const unsigned char SQLiteVersionString[]; - -#import diff --git a/Pods/SQLite.swift/SQLite/Typed/AggregateFunctions.swift b/Pods/SQLite.swift/SQLite/Typed/AggregateFunctions.swift deleted file mode 100644 index 5775e0f..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/AggregateFunctions.swift +++ /dev/null @@ -1,251 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension ExpressionType where UnderlyingType : Value { - - /// Builds a copy of the expression prefixed with the `DISTINCT` keyword. - /// - /// let name = Expression("name") - /// name.distinct - /// // DISTINCT "name" - /// - /// - Returns: A copy of the expression prefixed with the `DISTINCT` - /// keyword. - public var distinct: Expression { - return Expression("DISTINCT \(template)", bindings) - } - - /// Builds a copy of the expression wrapped with the `count` aggregate - /// function. - /// - /// let name = Expression("name") - /// name.count - /// // count("name") - /// name.distinct.count - /// // count(DISTINCT "name") - /// - /// - Returns: A copy of the expression wrapped with the `count` aggregate - /// function. - public var count: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value { - - /// Builds a copy of the expression prefixed with the `DISTINCT` keyword. - /// - /// let name = Expression("name") - /// name.distinct - /// // DISTINCT "name" - /// - /// - Returns: A copy of the expression prefixed with the `DISTINCT` - /// keyword. - public var distinct: Expression { - return Expression("DISTINCT \(template)", bindings) - } - - /// Builds a copy of the expression wrapped with the `count` aggregate - /// function. - /// - /// let name = Expression("name") - /// name.count - /// // count("name") - /// name.distinct.count - /// // count(DISTINCT "name") - /// - /// - Returns: A copy of the expression wrapped with the `count` aggregate - /// function. - public var count: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : Value, UnderlyingType.Datatype : Comparable { - - /// Builds a copy of the expression wrapped with the `max` aggregate - /// function. - /// - /// let age = Expression("age") - /// age.max - /// // max("age") - /// - /// - Returns: A copy of the expression wrapped with the `max` aggregate - /// function. - public var max: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `min` aggregate - /// function. - /// - /// let age = Expression("age") - /// age.min - /// // min("age") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var min: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value, UnderlyingType.WrappedType.Datatype : Comparable { - - /// Builds a copy of the expression wrapped with the `max` aggregate - /// function. - /// - /// let age = Expression("age") - /// age.max - /// // max("age") - /// - /// - Returns: A copy of the expression wrapped with the `max` aggregate - /// function. - public var max: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `min` aggregate - /// function. - /// - /// let age = Expression("age") - /// age.min - /// // min("age") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var min: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : Value, UnderlyingType.Datatype : Number { - - /// Builds a copy of the expression wrapped with the `avg` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.average - /// // avg("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var average: Expression { - return "avg".wrap(self) - } - - /// Builds a copy of the expression wrapped with the `sum` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.sum - /// // sum("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var sum: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `total` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.total - /// // total("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var total: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value, UnderlyingType.WrappedType.Datatype : Number { - - /// Builds a copy of the expression wrapped with the `avg` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.average - /// // avg("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var average: Expression { - return "avg".wrap(self) - } - - /// Builds a copy of the expression wrapped with the `sum` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.sum - /// // sum("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var sum: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `total` aggregate - /// function. - /// - /// let salary = Expression("salary") - /// salary.total - /// // total("salary") - /// - /// - Returns: A copy of the expression wrapped with the `min` aggregate - /// function. - public var total: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType == Int { - - @warn_unused_result static func count(star: Star) -> Expression { - return wrap(star(nil, nil)) - } - -} - -/// Builds an expression representing `count(*)` (when called with the `*` -/// function literal). -/// -/// count(*) -/// // count(*) -/// -/// - Returns: An expression returning `count(*)` (when called with the `*` -/// function literal). -@warn_unused_result public func count(star: Star) -> Expression { - return Expression.count(star) -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Collation.swift b/Pods/SQLite.swift/SQLite/Typed/Collation.swift deleted file mode 100644 index 5a63205..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Collation.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -/// A collating function used to compare to strings. -/// -/// - SeeAlso: -public enum Collation { - - /// Compares string by raw data. - case Binary - - /// Like binary, but folds uppercase ASCII letters into their lowercase - /// equivalents. - case Nocase - - /// Like binary, but strips trailing space. - case Rtrim - - /// A custom collating sequence identified by the given string, registered - /// using `Database.create(collation:…)` - case Custom(String) - -} - -extension Collation : Expressible { - - public var expression: Expression { - return Expression(literal: description) - } - -} - -extension Collation : CustomStringConvertible { - - public var description : String { - switch self { - case Binary: - return "BINARY" - case Nocase: - return "NOCASE" - case Rtrim: - return "RTRIM" - case Custom(let collation): - return collation.quote() - } - } - -} diff --git a/Pods/SQLite.swift/SQLite/Typed/CoreFunctions.swift b/Pods/SQLite.swift/SQLite/Typed/CoreFunctions.swift deleted file mode 100644 index b929e40..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/CoreFunctions.swift +++ /dev/null @@ -1,680 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension ExpressionType where UnderlyingType : Number { - - /// Builds a copy of the expression wrapped with the `abs` function. - /// - /// let x = Expression("x") - /// x.absoluteValue - /// // abs("x") - /// - /// - Returns: A copy of the expression wrapped with the `abs` function. - public var absoluteValue : Expression { - return "abs".wrap(self) - } - -} - -extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Number { - - /// Builds a copy of the expression wrapped with the `abs` function. - /// - /// let x = Expression("x") - /// x.absoluteValue - /// // abs("x") - /// - /// - Returns: A copy of the expression wrapped with the `abs` function. - public var absoluteValue : Expression { - return "abs".wrap(self) - } - -} - -extension ExpressionType where UnderlyingType == Double { - - /// Builds a copy of the expression wrapped with the `round` function. - /// - /// let salary = Expression("salary") - /// salary.round() - /// // round("salary") - /// salary.round(2) - /// // round("salary", 2) - /// - /// - Returns: A copy of the expression wrapped with the `round` function. - @warn_unused_result public func round(precision: Int? = nil) -> Expression { - guard let precision = precision else { - return wrap([self]) - } - return wrap([self, Int(precision)]) - } - -} - -extension ExpressionType where UnderlyingType == Double? { - - /// Builds a copy of the expression wrapped with the `round` function. - /// - /// let salary = Expression("salary") - /// salary.round() - /// // round("salary") - /// salary.round(2) - /// // round("salary", 2) - /// - /// - Returns: A copy of the expression wrapped with the `round` function. - @warn_unused_result public func round(precision: Int? = nil) -> Expression { - guard let precision = precision else { - return wrap(self) - } - return wrap([self, Int(precision)]) - } - -} - -extension ExpressionType where UnderlyingType : Value, UnderlyingType.Datatype == Int64 { - - /// Builds an expression representing the `random` function. - /// - /// Expression.random() - /// // random() - /// - /// - Returns: An expression calling the `random` function. - @warn_unused_result public static func random() -> Expression { - return "random".wrap([]) - } - -} - -extension ExpressionType where UnderlyingType == NSData { - - /// Builds an expression representing the `randomblob` function. - /// - /// Expression.random(16) - /// // randomblob(16) - /// - /// - Parameter length: Length in bytes. - /// - /// - Returns: An expression calling the `randomblob` function. - @warn_unused_result public static func random(length: Int) -> Expression { - return "randomblob".wrap([]) - } - - /// Builds an expression representing the `zeroblob` function. - /// - /// Expression.allZeros(16) - /// // zeroblob(16) - /// - /// - Parameter length: Length in bytes. - /// - /// - Returns: An expression calling the `zeroblob` function. - @warn_unused_result public static func allZeros(length: Int) -> Expression { - return "zeroblob".wrap([]) - } - - /// Builds a copy of the expression wrapped with the `length` function. - /// - /// let data = Expression("data") - /// data.length - /// // length("data") - /// - /// - Returns: A copy of the expression wrapped with the `length` function. - public var length: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType == NSData? { - - /// Builds a copy of the expression wrapped with the `length` function. - /// - /// let data = Expression("data") - /// data.length - /// // length("data") - /// - /// - Returns: A copy of the expression wrapped with the `length` function. - public var length: Expression { - return wrap(self) - } - -} - -extension ExpressionType where UnderlyingType == String { - - /// Builds a copy of the expression wrapped with the `length` function. - /// - /// let name = Expression("name") - /// name.length - /// // length("name") - /// - /// - Returns: A copy of the expression wrapped with the `length` function. - public var length: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `lower` function. - /// - /// let name = Expression("name") - /// name.lowercaseString - /// // lower("name") - /// - /// - Returns: A copy of the expression wrapped with the `lower` function. - public var lowercaseString: Expression { - return "lower".wrap(self) - } - - /// Builds a copy of the expression wrapped with the `upper` function. - /// - /// let name = Expression("name") - /// name.uppercaseString - /// // lower("name") - /// - /// - Returns: A copy of the expression wrapped with the `upper` function. - public var uppercaseString: Expression { - return "upper".wrap(self) - } - - /// Builds a copy of the expression appended with a `LIKE` query against the - /// given pattern. - /// - /// let email = Expression("email") - /// email.like("%@example.com") - /// // "email" LIKE '%@example.com' - /// email.like("99\\%@%", escape: "\\") - /// // "email" LIKE '99\%@%' ESCAPE '\' - /// - /// - Parameters: - /// - /// - pattern: A pattern to match. - /// - /// - escape: An (optional) character designated for escaping - /// pattern-matching characters (*i.e.*, the `%` and `_` characters). - /// - /// - Returns: A copy of the expression appended with a `LIKE` query against - /// the given pattern. - @warn_unused_result public func like(pattern: String, escape character: Character? = nil) -> Expression { - guard let character = character else { - return "LIKE".infix(self, pattern) - } - return Expression("(\(template) LIKE ? ESCAPE ?)", bindings + [pattern, String(character)]) - } - - /// Builds a copy of the expression appended with a `GLOB` query against the - /// given pattern. - /// - /// let path = Expression("path") - /// path.glob("*.png") - /// // "path" GLOB '*.png' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `GLOB` query against - /// the given pattern. - @warn_unused_result public func glob(pattern: String) -> Expression { - return "GLOB".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `MATCH` query against - /// the given pattern. - /// - /// let title = Expression("title") - /// title.match("swift AND programming") - /// // "title" MATCH 'swift AND programming' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `MATCH` query - /// against the given pattern. - @warn_unused_result public func match(pattern: String) -> Expression { - return "MATCH".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `REGEXP` query against - /// the given pattern. - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `REGEXP` query - /// against the given pattern. - @warn_unused_result public func regexp(pattern: String) -> Expression { - return "REGEXP".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `COLLATE` clause with - /// the given sequence. - /// - /// let name = Expression("name") - /// name.collate(.Nocase) - /// // "name" COLLATE NOCASE - /// - /// - Parameter collation: A collating sequence. - /// - /// - Returns: A copy of the expression appended with a `COLLATE` clause - /// with the given sequence. - @warn_unused_result public func collate(collation: Collation) -> Expression { - return "COLLATE".infix(self, collation) - } - - /// Builds a copy of the expression wrapped with the `ltrim` function. - /// - /// let name = Expression("name") - /// name.ltrim() - /// // ltrim("name") - /// name.ltrim([" ", "\t"]) - /// // ltrim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `ltrim` function. - @warn_unused_result public func ltrim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap(self) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `rtrim` function. - /// - /// let name = Expression("name") - /// name.rtrim() - /// // rtrim("name") - /// name.rtrim([" ", "\t"]) - /// // rtrim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `rtrim` function. - @warn_unused_result public func rtrim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap(self) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `trim` function. - /// - /// let name = Expression("name") - /// name.trim() - /// // trim("name") - /// name.trim([" ", "\t"]) - /// // trim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `trim` function. - @warn_unused_result public func trim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap([self]) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `replace` function. - /// - /// let email = Expression("email") - /// email.replace("@mac.com", with: "@icloud.com") - /// // replace("email", '@mac.com', '@icloud.com') - /// - /// - Parameters: - /// - /// - pattern: A pattern to match. - /// - /// - replacement: The replacement string. - /// - /// - Returns: A copy of the expression wrapped with the `replace` function. - @warn_unused_result public func replace(pattern: String, with replacement: String) -> Expression { - return "replace".wrap([self, pattern, replacement]) - } - - @warn_unused_result public func substring(location: Int, length: Int? = nil) -> Expression { - guard let length = length else { - return "substr".wrap([self, location]) - } - return "substr".wrap([self, location, length]) - } - - public subscript(range: Range) -> Expression { - return substring(range.startIndex, length: range.endIndex - range.startIndex) - } - -} - -extension ExpressionType where UnderlyingType == String? { - - /// Builds a copy of the expression wrapped with the `length` function. - /// - /// let name = Expression("name") - /// name.length - /// // length("name") - /// - /// - Returns: A copy of the expression wrapped with the `length` function. - public var length: Expression { - return wrap(self) - } - - /// Builds a copy of the expression wrapped with the `lower` function. - /// - /// let name = Expression("name") - /// name.lowercaseString - /// // lower("name") - /// - /// - Returns: A copy of the expression wrapped with the `lower` function. - public var lowercaseString: Expression { - return "lower".wrap(self) - } - - /// Builds a copy of the expression wrapped with the `upper` function. - /// - /// let name = Expression("name") - /// name.uppercaseString - /// // lower("name") - /// - /// - Returns: A copy of the expression wrapped with the `upper` function. - public var uppercaseString: Expression { - return "upper".wrap(self) - } - - /// Builds a copy of the expression appended with a `LIKE` query against the - /// given pattern. - /// - /// let email = Expression("email") - /// email.like("%@example.com") - /// // "email" LIKE '%@example.com' - /// email.like("99\\%@%", escape: "\\") - /// // "email" LIKE '99\%@%' ESCAPE '\' - /// - /// - Parameters: - /// - /// - pattern: A pattern to match. - /// - /// - escape: An (optional) character designated for escaping - /// pattern-matching characters (*i.e.*, the `%` and `_` characters). - /// - /// - Returns: A copy of the expression appended with a `LIKE` query against - /// the given pattern. - @warn_unused_result public func like(pattern: String, escape character: Character? = nil) -> Expression { - guard let character = character else { - return "LIKE".infix(self, pattern) - } - return Expression("(\(template) LIKE ? ESCAPE ?)", bindings + [pattern, String(character)]) - } - - /// Builds a copy of the expression appended with a `GLOB` query against the - /// given pattern. - /// - /// let path = Expression("path") - /// path.glob("*.png") - /// // "path" GLOB '*.png' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `GLOB` query against - /// the given pattern. - @warn_unused_result public func glob(pattern: String) -> Expression { - return "GLOB".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `MATCH` query against - /// the given pattern. - /// - /// let title = Expression("title") - /// title.match("swift AND programming") - /// // "title" MATCH 'swift AND programming' - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `MATCH` query - /// against the given pattern. - @warn_unused_result public func match(pattern: String) -> Expression { - return "MATCH".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `REGEXP` query against - /// the given pattern. - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression appended with a `REGEXP` query - /// against the given pattern. - @warn_unused_result public func regexp(pattern: String) -> Expression { - return "REGEXP".infix(self, pattern) - } - - /// Builds a copy of the expression appended with a `COLLATE` clause with - /// the given sequence. - /// - /// let name = Expression("name") - /// name.collate(.Nocase) - /// // "name" COLLATE NOCASE - /// - /// - Parameter collation: A collating sequence. - /// - /// - Returns: A copy of the expression appended with a `COLLATE` clause - /// with the given sequence. - @warn_unused_result public func collate(collation: Collation) -> Expression { - return "COLLATE".infix(self, collation) - } - - /// Builds a copy of the expression wrapped with the `ltrim` function. - /// - /// let name = Expression("name") - /// name.ltrim() - /// // ltrim("name") - /// name.ltrim([" ", "\t"]) - /// // ltrim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `ltrim` function. - @warn_unused_result public func ltrim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap(self) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `rtrim` function. - /// - /// let name = Expression("name") - /// name.rtrim() - /// // rtrim("name") - /// name.rtrim([" ", "\t"]) - /// // rtrim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `rtrim` function. - @warn_unused_result public func rtrim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap(self) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `trim` function. - /// - /// let name = Expression("name") - /// name.trim() - /// // trim("name") - /// name.trim([" ", "\t"]) - /// // trim("name", ' \t') - /// - /// - Parameter characters: A set of characters to trim. - /// - /// - Returns: A copy of the expression wrapped with the `trim` function. - @warn_unused_result public func trim(characters: Set? = nil) -> Expression { - guard let characters = characters else { - return wrap(self) - } - return wrap([self, String(characters)]) - } - - /// Builds a copy of the expression wrapped with the `replace` function. - /// - /// let email = Expression("email") - /// email.replace("@mac.com", with: "@icloud.com") - /// // replace("email", '@mac.com', '@icloud.com') - /// - /// - Parameters: - /// - /// - pattern: A pattern to match. - /// - /// - replacement: The replacement string. - /// - /// - Returns: A copy of the expression wrapped with the `replace` function. - @warn_unused_result public func replace(pattern: String, with replacement: String) -> Expression { - return "replace".wrap([self, pattern, replacement]) - } - - /// Builds a copy of the expression wrapped with the `substr` function. - /// - /// let title = Expression("title") - /// title.substr(-100) - /// // substr("title", -100) - /// title.substr(0, length: 100) - /// // substr("title", 0, 100) - /// - /// - Parameters: - /// - /// - location: The substring’s start index. - /// - /// - length: An optional substring length. - /// - /// - Returns: A copy of the expression wrapped with the `substr` function. - @warn_unused_result public func substring(location: Int, length: Int? = nil) -> Expression { - guard let length = length else { - return "substr".wrap([self, location]) - } - return "substr".wrap([self, location, length]) - } - - /// Builds a copy of the expression wrapped with the `substr` function. - /// - /// let title = Expression("title") - /// title[0..<100] - /// // substr("title", 0, 100) - /// - /// - Parameter range: The character index range of the substring. - /// - /// - Returns: A copy of the expression wrapped with the `substr` function. - public subscript(range: Range) -> Expression { - return substring(range.startIndex, length: range.endIndex - range.startIndex) - } - -} - -extension CollectionType where Generator.Element : Value, Index.Distance == Int { - - /// Builds a copy of the expression prepended with an `IN` check against the - /// collection. - /// - /// let name = Expression("name") - /// ["alice", "betty"].contains(name) - /// // "name" IN ('alice', 'betty') - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression prepended with an `IN` check against - /// the collection. - @warn_unused_result public func contains(expression: Expression) -> Expression { - let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ") - return "IN".infix(expression, Expression("(\(templates))", map { $0.datatypeValue })) - } - - /// Builds a copy of the expression prepended with an `IN` check against the - /// collection. - /// - /// let name = Expression("name") - /// ["alice", "betty"].contains(name) - /// // "name" IN ('alice', 'betty') - /// - /// - Parameter pattern: A pattern to match. - /// - /// - Returns: A copy of the expression prepended with an `IN` check against - /// the collection. - @warn_unused_result public func contains(expression: Expression) -> Expression { - let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ") - return "IN".infix(expression, Expression("(\(templates))", map { $0.datatypeValue })) - } - -} - -/// Builds a copy of the given expressions wrapped with the `ifnull` function. -/// -/// let name = Expression("name") -/// name ?? "An Anonymous Coward" -/// // ifnull("name", 'An Anonymous Coward') -/// -/// - Parameters: -/// -/// - optional: An optional expression. -/// -/// - defaultValue: A fallback value for when the optional expression is -/// `nil`. -/// -/// - Returns: A copy of the given expressions wrapped with the `ifnull` -/// function. -public func ??(optional: Expression, defaultValue: V) -> Expression { - return "ifnull".wrap([optional, defaultValue]) -} - -/// Builds a copy of the given expressions wrapped with the `ifnull` function. -/// -/// let nick = Expression("nick") -/// let name = Expression("name") -/// nick ?? name -/// // ifnull("nick", "name") -/// -/// - Parameters: -/// -/// - optional: An optional expression. -/// -/// - defaultValue: A fallback expression for when the optional expression is -/// `nil`. -/// -/// - Returns: A copy of the given expressions wrapped with the `ifnull` -/// function. -public func ??(optional: Expression, defaultValue: Expression) -> Expression { - return "ifnull".wrap([optional, defaultValue]) -} - -/// Builds a copy of the given expressions wrapped with the `ifnull` function. -/// -/// let nick = Expression("nick") -/// let name = Expression("name") -/// nick ?? name -/// // ifnull("nick", "name") -/// -/// - Parameters: -/// -/// - optional: An optional expression. -/// -/// - defaultValue: A fallback expression for when the optional expression is -/// `nil`. -/// -/// - Returns: A copy of the given expressions wrapped with the `ifnull` -/// function. -public func ??(optional: Expression, defaultValue: Expression) -> Expression { - return "ifnull".wrap([optional, defaultValue]) -} diff --git a/Pods/SQLite.swift/SQLite/Typed/CustomFunctions.swift b/Pods/SQLite.swift/SQLite/Typed/CustomFunctions.swift deleted file mode 100644 index 068d034..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/CustomFunctions.swift +++ /dev/null @@ -1,136 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -public extension Connection { - - /// Creates or redefines a custom SQL function. - /// - /// - Parameters: - /// - /// - function: The name of the function to create or redefine. - /// - /// - deterministic: Whether or not the function is deterministic (_i.e._ - /// the function always returns the same result for a given input). - /// - /// Default: `false` - /// - /// - block: A block of code to run when the function is called. - /// The assigned types must be explicit. - /// - /// - Returns: A closure returning an SQL expression to call the function. - public func createFunction(function: String, deterministic: Bool = false, _ block: () -> Z) throws -> (() -> Expression) { - let fn = try createFunction(function, 0, deterministic) { _ in block() } - return { fn([]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: () -> Z?) throws -> (() -> Expression) { - let fn = try createFunction(function, 0, deterministic) { _ in block() } - return { fn([]) } - } - - // MARK: - - - public func createFunction(function: String, deterministic: Bool = false, _ block: A -> Z) throws -> (Expression -> Expression) { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0])) } - return { arg in fn([arg]) } - } - - public func createFunction(function function: String, deterministic: Bool = false, _ block: A? -> Z) throws -> (Expression -> Expression) { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value)) } - return { arg in fn([arg]) } - } - - public func createFunction(function function: String, deterministic: Bool = false, _ block: A -> Z?) throws -> (Expression -> Expression) { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0])) } - return { arg in fn([arg]) } - } - - public func createFunction(function function: String, deterministic: Bool = false, _ block: A? -> Z?) throws -> (Expression -> Expression) { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value)) } - return { arg in fn([arg]) } - } - - // MARK: - - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A, B) -> Z) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0]), value(args[1])) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A?, B) -> Z) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value), value(args[1])) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A, B?) -> Z) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0]), args[1].map(value)) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A, B) -> Z?) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0]), value(args[1])) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A?, B?) -> Z) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value), args[1].map(value)) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A?, B) -> Z?) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value), value(args[1])) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A, B?) -> Z?) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(value(args[0]), args[1].map(value)) } - return { a, b in fn([a, b]) } - } - - public func createFunction(function: String, deterministic: Bool = false, _ block: (A?, B?) -> Z?) throws -> (Expression, Expression) -> Expression { - let fn = try createFunction(function, 1, deterministic) { args in block(args[0].map(value), args[1].map(value)) } - return { a, b in fn([a, b]) } - } - - // MARK: - - - private func createFunction(function: String, _ argumentCount: UInt, _ deterministic: Bool, _ block: [Binding?] -> Z) throws -> ([Expressible] -> Expression) { - createFunction(function, argumentCount: argumentCount, deterministic: deterministic) { arguments in - block(arguments).datatypeValue - } - return { arguments in - function.quote().wrap(", ".join(arguments)) - } - } - - private func createFunction(function: String, _ argumentCount: UInt, _ deterministic: Bool, _ block: [Binding?] -> Z?) throws -> ([Expressible] -> Expression) { - createFunction(function, argumentCount: argumentCount, deterministic: deterministic) { arguments in - block(arguments)?.datatypeValue - } - return { arguments in - function.quote().wrap(", ".join(arguments)) - } - } - -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Expression.swift b/Pods/SQLite.swift/SQLite/Typed/Expression.swift deleted file mode 100644 index 551831d..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Expression.swift +++ /dev/null @@ -1,139 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -public protocol ExpressionType : Expressible { // extensions cannot have inheritance clauses - - typealias UnderlyingType = Void - - var template: String { get } - var bindings: [Binding?] { get } - - init(_ template: String, _ bindings: [Binding?]) - -} - -extension ExpressionType { - - public init(literal: String) { - self.init(literal, []) - } - - public init(_ identifier: String) { - self.init(literal: identifier.quote()) - } - - public init(_ expression: U) { - self.init(expression.template, expression.bindings) - } - -} - -/// An `Expression` represents a raw SQL fragment and any associated bindings. -public struct Expression : ExpressionType { - - public typealias UnderlyingType = Datatype - - public var template: String - public var bindings: [Binding?] - - public init(_ template: String, _ bindings: [Binding?]) { - self.template = template - self.bindings = bindings - } - -} - -public protocol Expressible { - - var expression: Expression { get } - -} - -extension Expressible { - - // naïve compiler for statements that can’t be bound, e.g., CREATE TABLE - // FIXME: use @testable and make internal - public func asSQL() -> String { - let expressed = expression - var idx = 0 - return expressed.template.characters.reduce("") { template, character in - return template + (character == "?" ? transcode(expressed.bindings[idx++]) : String(character)) - } - } - -} - -extension ExpressionType { - - public var expression: Expression { - return Expression(template, bindings) - } - - public var asc: Expressible { - return " ".join([self, Expression(literal: "ASC")]) - } - - public var desc: Expressible { - return " ".join([self, Expression(literal: "DESC")]) - } - -} - -extension ExpressionType where UnderlyingType : Value { - - public init(value: UnderlyingType) { - self.init("?", [value.datatypeValue]) - } - -} - -extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value { - - public static var null: Self { - return self.init(value: nil) - } - - public init(value: UnderlyingType.WrappedType?) { - self.init("?", [value?.datatypeValue]) - } - -} - -extension Value { - - public var expression: Expression { - return Expression(value: self).expression - } - -} - -public let rowid = Expression("ROWID") - -public func cast(expression: Expression) -> Expression { - return Expression("CAST (\(expression.template) AS \(U.declaredDatatype))", expression.bindings) -} - -public func cast(expression: Expression) -> Expression { - return Expression("CAST (\(expression.template) AS \(U.declaredDatatype))", expression.bindings) -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Operators.swift b/Pods/SQLite.swift/SQLite/Typed/Operators.swift deleted file mode 100644 index 816560a..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Operators.swift +++ /dev/null @@ -1,541 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -// TODO: use `@warn_unused_result` by the time operator functions support it - -public func +(lhs: Expression, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} - -public func +(lhs: Expression, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: String) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: String) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: String, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} -public func +(lhs: String, rhs: Expression) -> Expression { - return "||".infix(lhs, rhs) -} - -// MARK: - - -public func +(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func +(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func -(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func -(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func *(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func *(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func /(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func /(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public prefix func -(rhs: Expression) -> Expression { - return wrap(rhs) -} -public prefix func -(rhs: Expression) -> Expression { - return wrap(rhs) -} - -// MARK: - - -public func %(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func %(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func <<(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <<(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func >>(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >>(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func &(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func &(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func |(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func |(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func ^(lhs: Expression, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: Expression, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: Expression, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: Expression, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: Expression, rhs: V) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: Expression, rhs: V) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: V, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} -public func ^(lhs: V, rhs: Expression) -> Expression { - return (~(lhs & rhs)) & (lhs | rhs) -} - -public prefix func ~(rhs: Expression) -> Expression { - return wrap(rhs) -} -public prefix func ~(rhs: Expression) -> Expression { - return wrap(rhs) -} - -// MARK: - - -public func ==(lhs: Expression, rhs: Expression) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: Expression, rhs: Expression) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: Expression, rhs: Expression) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: Expression, rhs: Expression) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: Expression, rhs: V) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: Expression, rhs: V?) -> Expression { - guard let rhs = rhs else { return "IS".infix(lhs, Expression(value: nil)) } - return "=".infix(lhs, rhs) -} -public func ==(lhs: V, rhs: Expression) -> Expression { - return "=".infix(lhs, rhs) -} -public func ==(lhs: V?, rhs: Expression) -> Expression { - guard let lhs = lhs else { return "IS".infix(Expression(value: nil), rhs) } - return "=".infix(lhs, rhs) -} - -public func !=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: Expression, rhs: V?) -> Expression { - guard let rhs = rhs else { return "IS NOT".infix(lhs, Expression(value: nil)) } - return infix(lhs, rhs) -} -public func !=(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func !=(lhs: V?, rhs: Expression) -> Expression { - guard let lhs = lhs else { return "IS NOT".infix(Expression(value: nil), rhs) } - return infix(lhs, rhs) -} - -public func >(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func >=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func >=(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func <(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func <=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: Expression, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: Expression, rhs: V) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} -public func <=(lhs: V, rhs: Expression) -> Expression { - return infix(lhs, rhs) -} - -public func ~=, V.Datatype == I.Bound>(lhs: I, rhs: Expression) -> Expression { - return Expression("\(rhs.template) BETWEEN ? AND ?", rhs.bindings + [lhs.start, lhs.end]) -} -public func ~=, V.Datatype == I.Bound>(lhs: I, rhs: Expression) -> Expression { - return Expression("\(rhs.template) BETWEEN ? AND ?", rhs.bindings + [lhs.start, lhs.end]) -} - -// MARK: - - -public func &&(lhs: Expression, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Expression, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Expression, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Expression, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Expression, rhs: Bool) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Expression, rhs: Bool) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Bool, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} -public func &&(lhs: Bool, rhs: Expression) -> Expression { - return "AND".infix(lhs, rhs) -} - -public func ||(lhs: Expression, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Expression, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Expression, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Expression, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Expression, rhs: Bool) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Expression, rhs: Bool) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Bool, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} -public func ||(lhs: Bool, rhs: Expression) -> Expression { - return "OR".infix(lhs, rhs) -} - -public prefix func !(rhs: Expression) -> Expression { - return "NOT ".wrap(rhs) -} -public prefix func !(rhs: Expression) -> Expression { - return "NOT ".wrap(rhs) -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Query.swift b/Pods/SQLite.swift/SQLite/Typed/Query.swift deleted file mode 100644 index 634b1b6..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Query.swift +++ /dev/null @@ -1,1142 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -public protocol QueryType : Expressible { - - var clauses: QueryClauses { get set } - - init(_ name: String, database: String?) - -} - -public protocol SchemaType : QueryType { - - static var identifier: String { get } - -} - -extension SchemaType { - - /// Builds a copy of the query with the `SELECT` clause applied. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let email = Expression("email") - /// - /// users.select(id, email) - /// // SELECT "id", "email" FROM "users" - /// - /// - Parameter all: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT` clause applied. - public func select(column1: Expressible, _ column2: Expressible, _ more: Expressible...) -> Self { - return select(false, [column1, column2] + more) - } - - /// Builds a copy of the query with the `SELECT DISTINCT` clause applied. - /// - /// let users = Table("users") - /// let email = Expression("email") - /// - /// users.select(distinct: email) - /// // SELECT DISTINCT "email" FROM "users" - /// - /// - Parameter columns: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT DISTINCT` clause applied. - public func select(distinct column1: Expressible, _ column2: Expressible, _ more: Expressible...) -> Self { - return select(true, [column1, column2] + more) - } - - /// Builds a copy of the query with the `SELECT` clause applied. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let email = Expression("email") - /// - /// users.select([id, email]) - /// // SELECT "id", "email" FROM "users" - /// - /// - Parameter all: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT` clause applied. - public func select(all: [Expressible]) -> Self { - return select(false, all) - } - - /// Builds a copy of the query with the `SELECT DISTINCT` clause applied. - /// - /// let users = Table("users") - /// let email = Expression("email") - /// - /// users.select(distinct: [email]) - /// // SELECT DISTINCT "email" FROM "users" - /// - /// - Parameter columns: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT DISTINCT` clause applied. - public func select(distinct columns: [Expressible]) -> Self { - return select(true, columns) - } - - /// Builds a copy of the query with the `SELECT *` clause applied. - /// - /// let users = Table("users") - /// - /// users.select(*) - /// // SELECT * FROM "users" - /// - /// - Parameter star: A star literal. - /// - /// - Returns: A query with the given `SELECT *` clause applied. - public func select(star: Star) -> Self { - return select([star(nil, nil)]) - } - - /// Builds a copy of the query with the `SELECT DISTINCT *` clause applied. - /// - /// let users = Table("users") - /// - /// users.select(distinct: *) - /// // SELECT DISTINCT * FROM "users" - /// - /// - Parameter star: A star literal. - /// - /// - Returns: A query with the given `SELECT DISTINCT *` clause applied. - public func select(distinct star: Star) -> Self { - return select(distinct: [star(nil, nil)]) - } - - /// Builds a scalar copy of the query with the `SELECT` clause applied. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// - /// users.select(id) - /// // SELECT "id" FROM "users" - /// - /// - Parameter all: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT` clause applied. - public func select(column: Expression) -> ScalarQuery { - return select(false, [column]) - } - public func select(column: Expression) -> ScalarQuery { - return select(false, [column]) - } - - /// Builds a scalar copy of the query with the `SELECT DISTINCT` clause - /// applied. - /// - /// let users = Table("users") - /// let email = Expression("email") - /// - /// users.select(distinct: email) - /// // SELECT DISTINCT "email" FROM "users" - /// - /// - Parameter column: A list of expressions to select. - /// - /// - Returns: A query with the given `SELECT DISTINCT` clause applied. - public func select(distinct column: Expression) -> ScalarQuery { - return select(true, [column]) - } - public func select(distinct column: Expression) -> ScalarQuery { - return select(true, [column]) - } - - public var count: ScalarQuery { - return select(Expression.count(*)) - } - -} - -extension QueryType { - - private func select(distinct: Bool, _ columns: [Expressible]) -> Q { - var query = Q.init(clauses.from.name, database: clauses.from.database) - query.clauses = clauses - query.clauses.select = (distinct, columns) - return query - } - - // MARK: JOIN - - /// Adds a `JOIN` clause to the query. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let posts = Table("posts") - /// let userId = Expression("user_id") - /// - /// users.join(posts, on: posts[userId] == users[id]) - /// // SELECT * FROM "users" INNER JOIN "posts" ON ("posts"."user_id" = "users"."id") - /// - /// - Parameters: - /// - /// - table: A query representing the other table. - /// - /// - condition: A boolean expression describing the join condition. - /// - /// - Returns: A query with the given `JOIN` clause applied. - public func join(table: QueryType, on condition: Expression) -> Self { - return join(table, on: Expression(condition)) - } - - /// Adds a `JOIN` clause to the query. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let posts = Table("posts") - /// let userId = Expression("user_id") - /// - /// users.join(posts, on: posts[userId] == users[id]) - /// // SELECT * FROM "users" INNER JOIN "posts" ON ("posts"."user_id" = "users"."id") - /// - /// - Parameters: - /// - /// - table: A query representing the other table. - /// - /// - condition: A boolean expression describing the join condition. - /// - /// - Returns: A query with the given `JOIN` clause applied. - public func join(table: QueryType, on condition: Expression) -> Self { - return join(.Inner, table, on: condition) - } - - /// Adds a `JOIN` clause to the query. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let posts = Table("posts") - /// let userId = Expression("user_id") - /// - /// users.join(.LeftOuter, posts, on: posts[userId] == users[id]) - /// // SELECT * FROM "users" LEFT OUTER JOIN "posts" ON ("posts"."user_id" = "users"."id") - /// - /// - Parameters: - /// - /// - type: The `JOIN` operator. - /// - /// - table: A query representing the other table. - /// - /// - condition: A boolean expression describing the join condition. - /// - /// - Returns: A query with the given `JOIN` clause applied. - public func join(type: JoinType, _ table: QueryType, on condition: Expression) -> Self { - return join(type, table, on: Expression(condition)) - } - - /// Adds a `JOIN` clause to the query. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// let posts = Table("posts") - /// let userId = Expression("user_id") - /// - /// users.join(.LeftOuter, posts, on: posts[userId] == users[id]) - /// // SELECT * FROM "users" LEFT OUTER JOIN "posts" ON ("posts"."user_id" = "users"."id") - /// - /// - Parameters: - /// - /// - type: The `JOIN` operator. - /// - /// - table: A query representing the other table. - /// - /// - condition: A boolean expression describing the join condition. - /// - /// - Returns: A query with the given `JOIN` clause applied. - public func join(type: JoinType, _ table: QueryType, on condition: Expression) -> Self { - var query = self - query.clauses.join.append((type: type, query: table, condition: table.clauses.filters.map { condition && $0 } ?? condition as Expressible)) - return query - } - - // MARK: WHERE - - /// Adds a condition to the query’s `WHERE` clause. - /// - /// let users = Table("users") - /// let id = Expression("id") - /// - /// users.filter(id == 1) - /// // SELECT * FROM "users" WHERE ("id" = 1) - /// - /// - Parameter condition: A boolean expression to filter on. - /// - /// - Returns: A query with the given `WHERE` clause applied. - public func filter(predicate: Expression) -> Self { - return filter(Expression(predicate)) - } - - /// Adds a condition to the query’s `WHERE` clause. - /// - /// let users = Table("users") - /// let age = Expression("age") - /// - /// users.filter(age >= 35) - /// // SELECT * FROM "users" WHERE ("age" >= 35) - /// - /// - Parameter condition: A boolean expression to filter on. - /// - /// - Returns: A query with the given `WHERE` clause applied. - public func filter(predicate: Expression) -> Self { - var query = self - query.clauses.filters = query.clauses.filters.map { $0 && predicate } ?? predicate - return query - } - - // MARK: GROUP BY - - /// Sets a `GROUP BY` clause on the query. - /// - /// - Parameter by: A list of columns to group by. - /// - /// - Returns: A query with the given `GROUP BY` clause applied. - public func group(by: Expressible...) -> Self { - return group(by) - } - - /// Sets a `GROUP BY` clause on the query. - /// - /// - Parameter by: A list of columns to group by. - /// - /// - Returns: A query with the given `GROUP BY` clause applied. - public func group(by: [Expressible]) -> Self { - return group(by, nil) - } - - /// Sets a `GROUP BY`-`HAVING` clause on the query. - /// - /// - Parameters: - /// - /// - by: A column to group by. - /// - /// - having: A condition determining which groups are returned. - /// - /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied. - public func group(by: Expressible, having: Expression) -> Self { - return group([by], having: having) - } - - /// Sets a `GROUP BY`-`HAVING` clause on the query. - /// - /// - Parameters: - /// - /// - by: A column to group by. - /// - /// - having: A condition determining which groups are returned. - /// - /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied. - public func group(by: Expressible, having: Expression) -> Self { - return group([by], having: having) - } - - /// Sets a `GROUP BY`-`HAVING` clause on the query. - /// - /// - Parameters: - /// - /// - by: A list of columns to group by. - /// - /// - having: A condition determining which groups are returned. - /// - /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied. - public func group(by: [Expressible], having: Expression) -> Self { - return group(by, Expression(having)) - } - - /// Sets a `GROUP BY`-`HAVING` clause on the query. - /// - /// - Parameters: - /// - /// - by: A list of columns to group by. - /// - /// - having: A condition determining which groups are returned. - /// - /// - Returns: A query with the given `GROUP BY`–`HAVING` clause applied. - public func group(by: [Expressible], having: Expression) -> Self { - return group(by, having) - } - - private func group(by: [Expressible], _ having: Expression?) -> Self { - var query = self - query.clauses.group = (by, having) - return query - } - - // MARK: ORDER BY - - /// Sets an `ORDER BY` clause on the query. - /// - /// let users = Table("users") - /// let email = Expression("email") - /// let name = Expression("name") - /// - /// users.order(email.desc, name.asc) - /// // SELECT * FROM "users" ORDER BY "email" DESC, "name" ASC - /// - /// - Parameter by: An ordered list of columns and directions to sort by. - /// - /// - Returns: A query with the given `ORDER BY` clause applied. - public func order(by: Expressible...) -> Self { - return order(by) - } - - /// Sets an `ORDER BY` clause on the query. - /// - /// let users = Table("users") - /// let email = Expression("email") - /// let name = Expression("name") - /// - /// users.order([email.desc, name.asc]) - /// // SELECT * FROM "users" ORDER BY "email" DESC, "name" ASC - /// - /// - Parameter by: An ordered list of columns and directions to sort by. - /// - /// - Returns: A query with the given `ORDER BY` clause applied. - public func order(by: [Expressible]) -> Self { - var query = self - query.clauses.order = by - return query - } - - // MARK: LIMIT/OFFSET - - /// Sets the LIMIT clause (and resets any OFFSET clause) on the query. - /// - /// let users = Table("users") - /// - /// users.limit(20) - /// // SELECT * FROM "users" LIMIT 20 - /// - /// - Parameter length: The maximum number of rows to return (or `nil` to - /// return unlimited rows). - /// - /// - Returns: A query with the given LIMIT clause applied. - public func limit(length: Int?) -> Self { - return limit(length, nil) - } - - /// Sets LIMIT and OFFSET clauses on the query. - /// - /// let users = Table("users") - /// - /// users.limit(20, offset: 20) - /// // SELECT * FROM "users" LIMIT 20 OFFSET 20 - /// - /// - Parameters: - /// - /// - length: The maximum number of rows to return. - /// - /// - offset: The number of rows to skip. - /// - /// - Returns: A query with the given LIMIT and OFFSET clauses applied. - public func limit(length: Int, offset: Int) -> Self { - return limit(length, offset) - } - - // prevents limit(nil, offset: 5) - private func limit(length: Int?, _ offset: Int?) -> Self { - var query = self - query.clauses.limit = length.map { ($0, offset) } - return query - } - - // MARK: - Clauses - // - // MARK: SELECT - - // MARK: - - - private var selectClause: Expressible { - return " ".join([ - Expression(literal: clauses.select.distinct ? "SELECT DISTINCT" : "SELECT"), - ", ".join(clauses.select.columns), - Expression(literal: "FROM"), - tableName(alias: true) - ]) - } - - private var joinClause: Expressible? { - guard !clauses.join.isEmpty else { - return nil - } - - return " ".join(clauses.join.map { type, query, condition in - " ".join([ - Expression(literal: "\(type.rawValue) JOIN"), - query.tableName(alias: true), - Expression(literal: "ON"), - condition - ]) - }) - } - - private var whereClause: Expressible? { - guard let filters = clauses.filters else { - return nil - } - - return " ".join([ - Expression(literal: "WHERE"), - filters - ]) - } - - private var groupByClause: Expressible? { - guard let group = clauses.group else { - return nil - } - - let groupByClause = " ".join([ - Expression(literal: "GROUP BY"), - ", ".join(group.by) - ]) - - guard let having = group.having else { - return groupByClause - } - - return " ".join([ - groupByClause, - " ".join([ - Expression(literal: "HAVING"), - having - ]) - ]) - } - - private var orderClause: Expressible? { - guard !clauses.order.isEmpty else { - return nil - } - - return " ".join([ - Expression(literal: "ORDER BY"), - ", ".join(clauses.order) - ]) - } - - private var limitOffsetClause: Expressible? { - guard let limit = clauses.limit else { - return nil - } - - let limitClause = Expression(literal: "LIMIT \(limit.length)") - - guard let offset = limit.offset else { - return limitClause - } - - return " ".join([ - limitClause, - Expression(literal: "OFFSET \(offset)") - ]) - } - - // MARK: - - - public func alias(aliasName: String) -> Self { - var query = self - query.clauses.from = (clauses.from.name, aliasName, clauses.from.database) - return query - } - - // MARK: - Operations - // - // MARK: INSERT - - public func insert(value: Setter, _ more: Setter...) -> Insert { - return insert([value] + more) - } - - public func insert(values: [Setter]) -> Insert { - return insert(nil, values) - } - - public func insert(or onConflict: OnConflict, _ values: Setter...) -> Insert { - return insert(or: onConflict, values) - } - - public func insert(or onConflict: OnConflict, _ values: [Setter]) -> Insert { - return insert(onConflict, values) - } - - private func insert(or: OnConflict?, _ values: [Setter]) -> Insert { - let insert = values.reduce((columns: [Expressible](), values: [Expressible]())) { insert, setter in - (insert.columns + [setter.column], insert.values + [setter.value]) - } - - let clauses: [Expressible?] = [ - Expression(literal: "INSERT"), - or.map { Expression(literal: "OR \($0.rawValue)") }, - Expression(literal: "INTO"), - tableName(), - "".wrap(insert.columns) as Expression, - Expression(literal: "VALUES"), - "".wrap(insert.values) as Expression, - whereClause - ] - - return Insert(" ".join(clauses.flatMap { $0 }).expression) - } - - /// Runs an `INSERT` statement against the query with `DEFAULT VALUES`. - public func insert() -> Insert { - return Insert(" ".join([ - Expression(literal: "INSERT INTO"), - tableName(), - Expression(literal: "DEFAULT VALUES") - ]).expression) - } - - /// Runs an `INSERT` statement against the query with the results of another - /// query. - /// - /// - Parameter query: A query to `SELECT` results from. - /// - /// - Returns: The number of updated rows and statement. - public func insert(query: QueryType) -> Update { - return Update(" ".join([ - Expression(literal: "INSERT INTO"), - tableName(), - query.expression - ]).expression) - } - - // MARK: UPDATE - - public func update(values: Setter...) -> Update { - return update(values) - } - - public func update(values: [Setter]) -> Update { - let clauses: [Expressible?] = [ - Expression(literal: "UPDATE"), - tableName(), - Expression(literal: "SET"), - ", ".join(values.map { " = ".join([$0.column, $0.value]) }), - whereClause - ] - - return Update(" ".join(clauses.flatMap { $0 }).expression) - } - - // MARK: DELETE - - public func delete() -> Delete { - let clauses: [Expressible?] = [ - Expression(literal: "DELETE FROM"), - tableName(), - whereClause - ] - - return Delete(" ".join(clauses.flatMap { $0 }).expression) - } - - // MARK: EXISTS - - public var exists: Select { - return Select(" ".join([ - Expression(literal: "SELECT EXISTS"), - "".wrap(expression) as Expression - ]).expression) - } - - // MARK: - - - /// Prefixes a column expression with the query’s table name or alias. - /// - /// - Parameter column: A column expression. - /// - /// - Returns: A column expression namespaced with the query’s table name or - /// alias. - public func namespace(column: Expression) -> Expression { - return Expression(".".join([tableName(), column]).expression) - } - - // FIXME: rdar://problem/18673897 // subscript… - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - public subscript(column: Expression) -> Expression { - return namespace(column) - } - public subscript(column: Expression) -> Expression { - return namespace(column) - } - - /// Prefixes a star with the query’s table name or alias. - /// - /// - Parameter star: A literal `*`. - /// - /// - Returns: A `*` expression namespaced with the query’s table name or - /// alias. - public subscript(star: Star) -> Expression { - return namespace(star(nil, nil)) - } - - // MARK: - - - // TODO: alias support - func tableName(alias aliased: Bool = false) -> Expressible { - guard let alias = clauses.from.alias where aliased else { - return database(namespace: clauses.from.alias ?? clauses.from.name) - } - - return " ".join([ - database(namespace: clauses.from.name), - Expression(literal: "AS"), - Expression(alias) - ]) - } - - func database(namespace name: String) -> Expressible { - let name = Expression(name) - - guard let database = clauses.from.database else { - return name - } - - return ".".join([Expression(database), name]) - } - - public var expression: Expression { - let clauses: [Expressible?] = [ - selectClause, - joinClause, - whereClause, - groupByClause, - orderClause, - limitOffsetClause - ] - - return " ".join(clauses.flatMap { $0 }).expression - } - -} - -// TODO: decide: simplify the below with a boxed type instead - -/// Queries a collection of chainable helper functions and expressions to build -/// executable SQL statements. -public struct Table : SchemaType { - - public static let identifier = "TABLE" - - public var clauses: QueryClauses - - public init(_ name: String, database: String? = nil) { - clauses = QueryClauses(name, alias: nil, database: database) - } - -} - -public struct View : SchemaType { - - public static let identifier = "VIEW" - - public var clauses: QueryClauses - - public init(_ name: String, database: String? = nil) { - clauses = QueryClauses(name, alias: nil, database: database) - } - -} - -public struct VirtualTable : SchemaType { - - public static let identifier = "VIRTUAL TABLE" - - public var clauses: QueryClauses - - public init(_ name: String, database: String? = nil) { - clauses = QueryClauses(name, alias: nil, database: database) - } - -} - -// TODO: make `ScalarQuery` work in `QueryType.select()`, `.filter()`, etc. - -public struct ScalarQuery : QueryType { - - public var clauses: QueryClauses - - public init(_ name: String, database: String? = nil) { - clauses = QueryClauses(name, alias: nil, database: database) - } - -} - -// TODO: decide: simplify the below with a boxed type instead - -public struct Select : ExpressionType { - - public var template: String - public var bindings: [Binding?] - - public init(_ template: String, _ bindings: [Binding?]) { - self.template = template - self.bindings = bindings - } - -} - -public struct Insert : ExpressionType { - - public var template: String - public var bindings: [Binding?] - - public init(_ template: String, _ bindings: [Binding?]) { - self.template = template - self.bindings = bindings - } - -} - -public struct Update : ExpressionType { - - public var template: String - public var bindings: [Binding?] - - public init(_ template: String, _ bindings: [Binding?]) { - self.template = template - self.bindings = bindings - } - -} - -public struct Delete : ExpressionType { - - public var template: String - public var bindings: [Binding?] - - public init(_ template: String, _ bindings: [Binding?]) { - self.template = template - self.bindings = bindings - } - -} - -extension Connection { - - public func prepare(query: QueryType) throws -> AnySequence { - let expression = query.expression - let statement = try prepare(expression.template, expression.bindings) - - let columnNames: [String: Int] = try { - var (columnNames, idx) = ([String: Int](), 0) - column: for each in query.clauses.select.columns ?? [Expression(literal: "*")] { - var names = each.expression.template.characters.split { $0 == "." }.map(String.init) - let column = names.removeLast() - let namespace = names.joinWithSeparator(".") - - func expandGlob(namespace: Bool) -> (QueryType throws -> Void) { - return { (query: QueryType) throws -> (Void) in - var q = query.dynamicType.init(query.clauses.from.name, database: query.clauses.from.database) - q.clauses.select = query.clauses.select - let e = q.expression - var names = try self.prepare(e.template, e.bindings).columnNames.map { $0.quote() } - if namespace { names = names.map { "\(query.tableName().expression.template).\($0)" } } - for name in names { columnNames[name] = idx++ } - } - } - - if column == "*" { - var select = query - select.clauses.select = (false, [Expression(literal: "*") as Expressible]) - let queries = [select] + query.clauses.join.map { $0.query } - if !namespace.isEmpty { - for q in queries { - if q.tableName().expression.template == namespace { - try expandGlob(true)(q) - continue column - } - } - fatalError("no such table: \(namespace)") - } - for q in queries { - try expandGlob(query.clauses.join.count > 0)(q) - } - continue - } - - columnNames[each.expression.template] = idx++ - } - return columnNames - }() - - return AnySequence { - anyGenerator { statement.next().map { Row(columnNames, $0) } } - } - } - - public func scalar(query: ScalarQuery) -> V { - let expression = query.expression - return value(scalar(expression.template, expression.bindings)) - } - - public func scalar(query: ScalarQuery) -> V.ValueType? { - let expression = query.expression - guard let value = scalar(expression.template, expression.bindings) as? V.Datatype else { return nil } - return V.fromDatatypeValue(value) - } - - public func scalar(query: Select) -> V { - let expression = query.expression - return value(scalar(expression.template, expression.bindings)) - } - - public func scalar(query: Select) -> V.ValueType? { - let expression = query.expression - guard let value = scalar(expression.template, expression.bindings) as? V.Datatype else { return nil } - return V.fromDatatypeValue(value) - } - - public func pluck(query: QueryType) -> Row? { - return try! prepare(query.limit(1, query.clauses.limit?.offset)).generate().next() - } - - /// Runs an `Insert` query. - /// - /// - SeeAlso: `QueryType.insert(value:_:)` - /// - SeeAlso: `QueryType.insert(values:)` - /// - SeeAlso: `QueryType.insert(or:_:)` - /// - SeeAlso: `QueryType.insert()` - /// - /// - Parameter query: An insert query. - /// - /// - Returns: The insert’s rowid. - public func run(query: Insert) throws -> Int64 { - let expression = query.expression - return try sync { - try self.run(expression.template, expression.bindings) - return self.lastInsertRowid! - } - } - - /// Runs an `Update` query. - /// - /// - SeeAlso: `QueryType.insert(query:)` - /// - SeeAlso: `QueryType.update(values:)` - /// - /// - Parameter query: An update query. - /// - /// - Returns: The number of updated rows. - public func run(query: Update) throws -> Int { - let expression = query.expression - return try sync { - try self.run(expression.template, expression.bindings) - return self.changes - } - } - - /// Runs a `Delete` query. - /// - /// - SeeAlso: `QueryType.delete()` - /// - /// - Parameter query: A delete query. - /// - /// - Returns: The number of deleted rows. - public func run(query: Delete) throws -> Int { - let expression = query.expression - return try sync { - try self.run(expression.template, expression.bindings) - return self.changes - } - } - -} - -public struct Row { - - private let columnNames: [String: Int] - - private let values: [Binding?] - - private init(_ columnNames: [String: Int], _ values: [Binding?]) { - self.columnNames = columnNames - self.values = values - } - - /// Returns a row’s value for the given column. - /// - /// - Parameter column: An expression representing a column selected in a Query. - /// - /// - Returns: The value for the given column. - public func get(column: Expression) -> V { - return get(Expression(column))! - } - public func get(column: Expression) -> V? { - func valueAtIndex(idx: Int) -> V? { - guard let value = values[idx] as? V.Datatype else { return nil } - return (V.fromDatatypeValue(value) as? V)! - } - - guard let idx = columnNames[column.template] else { - let similar = Array(columnNames.keys).filter { $0.hasSuffix(".\(column.template)") } - - switch similar.count { - case 0: - fatalError("no such column '\(column.template)' in columns: \(columnNames.keys.sort())") - case 1: - return valueAtIndex(columnNames[similar[0]]!) - default: - fatalError("ambiguous column '\(column.template)' (please disambiguate: \(similar))") - } - } - - return valueAtIndex(idx) - } - - // FIXME: rdar://problem/18673897 // subscript… - - public subscript(column: Expression) -> Blob { - return get(column) - } - public subscript(column: Expression) -> Blob? { - return get(column) - } - - public subscript(column: Expression) -> Bool { - return get(column) - } - public subscript(column: Expression) -> Bool? { - return get(column) - } - - public subscript(column: Expression) -> Double { - return get(column) - } - public subscript(column: Expression) -> Double? { - return get(column) - } - - public subscript(column: Expression) -> Int { - return get(column) - } - public subscript(column: Expression) -> Int? { - return get(column) - } - - public subscript(column: Expression) -> Int64 { - return get(column) - } - public subscript(column: Expression) -> Int64? { - return get(column) - } - - public subscript(column: Expression) -> String { - return get(column) - } - public subscript(column: Expression) -> String? { - return get(column) - } - -} - -/// Determines the join operator for a query’s `JOIN` clause. -public enum JoinType : String { - - /// A `CROSS` join. - case Cross = "CROSS" - - /// An `INNER` join. - case Inner = "INNER" - - /// A `LEFT OUTER` join. - case LeftOuter = "LEFT OUTER" - -} - -/// ON CONFLICT resolutions. -public enum OnConflict: String { - - case Replace = "REPLACE" - - case Rollback = "ROLLBACK" - - case Abort = "ABORT" - - case Fail = "FAIL" - - case Ignore = "IGNORE" - -} - -// MARK: - Private - -public struct QueryClauses { - - var select = (distinct: false, columns: [Expression(literal: "*") as Expressible]) - - var from: (name: String, alias: String?, database: String?) - - var join = [(type: JoinType, query: QueryType, condition: Expressible)]() - - var filters: Expression? - - var group: (by: [Expressible], having: Expression?)? - - var order = [Expressible]() - - var limit: (length: Int, offset: Int?)? - - private init(_ name: String, alias: String?, database: String?) { - self.from = (name, alias, database) - } - -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Schema.swift b/Pods/SQLite.swift/SQLite/Typed/Schema.swift deleted file mode 100644 index f1f0287..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Schema.swift +++ /dev/null @@ -1,519 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -extension SchemaType { - - // MARK: - DROP TABLE / VIEW / VIRTUAL TABLE - - public func drop(ifExists ifExists: Bool = false) -> String { - return drop("TABLE", tableName(), ifExists) - } - -} - -extension Table { - - // MARK: - CREATE TABLE - - public func create(temporary temporary: Bool = false, ifNotExists: Bool = false, @noescape block: TableBuilder -> Void) -> String { - let builder = TableBuilder() - - block(builder) - - let clauses: [Expressible?] = [ - create(Table.identifier, tableName(), temporary ? .Temporary : nil, ifNotExists), - "".wrap(builder.definitions) as Expression - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - - public func create(query: QueryType, temporary: Bool = false, ifNotExists: Bool = false) -> String { - let clauses: [Expressible?] = [ - create(Table.identifier, tableName(), temporary ? .Temporary : nil, ifNotExists), - Expression(literal: "AS"), - query - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - - // MARK: - ALTER TABLE … ADD COLUMN - - public func addColumn(name: Expression, check: Expression? = nil, defaultValue: V) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, nil)) - } - - public func addColumn(name: Expression, check: Expression, defaultValue: V) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, nil)) - } - - public func addColumn(name: Expression, check: Expression? = nil, defaultValue: V? = nil) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, nil)) - } - - public func addColumn(name: Expression, check: Expression, defaultValue: V? = nil) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, nil)) - } - - public func addColumn(name: Expression, unique: Bool = false, check: Expression? = nil, references table: QueryType, _ other: Expression) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil)) - } - - public func addColumn(name: Expression, unique: Bool = false, check: Expression, references table: QueryType, _ other: Expression) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil)) - } - - public func addColumn(name: Expression, unique: Bool = false, check: Expression? = nil, references table: QueryType, _ other: Expression) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil)) - } - - public func addColumn(name: Expression, unique: Bool = false, check: Expression, references table: QueryType, _ other: Expression) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil)) - } - - public func addColumn(name: Expression, check: Expression? = nil, defaultValue: V, collate: Collation) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, collate)) - } - - public func addColumn(name: Expression, check: Expression, defaultValue: V, collate: Collation) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, false, false, check, defaultValue, nil, collate)) - } - - public func addColumn(name: Expression, check: Expression? = nil, defaultValue: V? = nil, collate: Collation) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, collate)) - } - - public func addColumn(name: Expression, check: Expression, defaultValue: V? = nil, collate: Collation) -> String { - return addColumn(definition(name, V.declaredDatatype, nil, true, false, check, defaultValue, nil, collate)) - } - - private func addColumn(expression: Expressible) -> String { - return " ".join([ - Expression(literal: "ALTER TABLE"), - tableName(), - Expression(literal: "ADD COLUMN"), - expression - ]).asSQL() - } - - // MARK: - ALTER TABLE … RENAME TO - - public func rename(to: Table) -> String { - return rename(to: to) - } - - // MARK: - CREATE INDEX - - public func createIndex(columns: Expressible...) -> String { - return createIndex(columns) - } - - public func createIndex(columns: [Expressible], unique: Bool = false, ifNotExists: Bool = false) -> String { - let clauses: [Expressible?] = [ - create("INDEX", indexName(columns), unique ? .Unique : nil, ifNotExists), - Expression(literal: "ON"), - tableName(), - "".wrap(columns) as Expression - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - - // MARK: - DROP INDEX - - public func dropIndex(columns: Expressible...) -> String { - return dropIndex(columns) - } - - public func dropIndex(columns: [Expressible], ifExists: Bool = false) -> String { - return drop("INDEX", indexName(columns), ifExists) - } - - private func indexName(columns: [Expressible]) -> Expressible { - let string = (["index", clauses.from.name, "on"] + columns.map { $0.expression.template }).joinWithSeparator(" ").lowercaseString - - let index = string.characters.reduce("") { underscored, character in - guard character != "\"" else { - return underscored - } - guard "a"..."z" ~= character || "0"..."9" ~= character else { - return underscored + "_" - } - return underscored + String(character) - } - - return database(namespace: index) - } - -} - -extension View { - - // MARK: - CREATE VIEW - - public func create(query: QueryType, temporary: Bool = false, ifNotExists: Bool = false) -> String { - let clauses: [Expressible?] = [ - create(View.identifier, tableName(), temporary ? .Temporary : nil, ifNotExists), - Expression(literal: "AS"), - query - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - - // MARK: - DROP VIEW - - public func drop(ifExists ifExists: Bool = false) -> String { - return drop("VIEW", tableName(), ifExists) - } - -} - -extension VirtualTable { - - // MARK: - CREATE VIRTUAL TABLE - - public func create(using: Module, ifNotExists: Bool = false) -> String { - let clauses: [Expressible?] = [ - create(VirtualTable.identifier, tableName(), nil, ifNotExists), - Expression(literal: "USING"), - using - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - - // MARK: - ALTER TABLE … RENAME TO - - public func rename(to: VirtualTable) -> String { - return rename(to: to) - } - -} - -public final class TableBuilder { - - private var definitions = [Expressible]() - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: V) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: V) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: V) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: V) { - column(name, V.declaredDatatype, nil, true, unique, check, defaultValue, nil, nil) - } - - public func column(name: Expression, primaryKey: Bool, check: Expression? = nil, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, primaryKey ? .Default : nil, false, false, check, defaultValue, nil, nil) - } - - public func column(name: Expression, primaryKey: Bool, check: Expression, defaultValue: Expression? = nil) { - column(name, V.declaredDatatype, primaryKey ? .Default : nil, false, false, check, defaultValue, nil, nil) - } - - public func column(name: Expression, primaryKey: PrimaryKey, check: Expression? = nil) { - column(name, V.declaredDatatype, primaryKey, false, false, check, nil, nil, nil) - } - - public func column(name: Expression, primaryKey: PrimaryKey, check: Expression) { - column(name, V.declaredDatatype, primaryKey, false, false, check, nil, nil, nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, references table: QueryType, _ other: Expression) { - column(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, references table: QueryType, _ other: Expression) { - column(name, V.declaredDatatype, nil, false, unique, check, nil, (table, other), nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, references table: QueryType, _ other: Expression) { - column(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, references table: QueryType, _ other: Expression) { - column(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression? = nil, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: V, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression? = nil, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: V, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression? = nil, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: Expression, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression? = nil, defaultValue: V, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression? = nil, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: Expression, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - public func column(name: Expression, unique: Bool = false, check: Expression, defaultValue: V, collate: Collation) { - column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate) - } - - private func column(name: Expressible, _ datatype: String, _ primaryKey: PrimaryKey?, _ null: Bool, _ unique: Bool, _ check: Expressible?, _ defaultValue: Expressible?, _ references: (QueryType, Expressible)?, _ collate: Collation?) { - definitions.append(definition(name, datatype, primaryKey, null, unique, check, defaultValue, references, collate)) - } - - // MARK: - - - public func primaryKey(column: Expression) { - primaryKey([column]) - } - - public func primaryKey(compositeA: Expression, _ b: Expression) { - primaryKey([compositeA, b]) - } - - public func primaryKey(compositeA: Expression, _ b: Expression, _ c: Expression) { - primaryKey([compositeA, b, c]) - } - - private func primaryKey(composite: [Expressible]) { - definitions.append("PRIMARY KEY".prefix(composite)) - } - - public func unique(columns: Expressible...) { - unique(columns) - } - - public func unique(columns: [Expressible]) { - definitions.append("UNIQUE".prefix(columns)) - } - - public func check(condition: Expression) { - check(Expression(condition)) - } - - public func check(condition: Expression) { - definitions.append("CHECK".prefix(condition)) - } - - public enum Dependency: String { - - case NoAction = "NO ACTION" - - case Restrict = "RESTRICT" - - case SetNull = "SET NULL" - - case SetDefault = "SET DEFAULT" - - case Cascade = "CASCADE" - - } - - public func foreignKey(column: Expression, references table: QueryType, _ other: Expression, update: Dependency? = nil, delete: Dependency? = nil) { - foreignKey(column, (table, other), update, delete) - } - - public func foreignKey(column: Expression, references table: QueryType, _ other: Expression, update: Dependency? = nil, delete: Dependency? = nil) { - foreignKey(column, (table, other), update, delete) - } - - public func foreignKey(composite: (Expression, Expression), references table: QueryType, _ other: (Expression, Expression), update: Dependency? = nil, delete: Dependency? = nil) { - let composite = ", ".join([composite.0, composite.1]) - let references = (table, ", ".join([other.0, other.1])) - - foreignKey(composite, references, update, delete) - } - - public func foreignKey(composite: (Expression, Expression, Expression), references table: QueryType, _ other: (Expression, Expression, Expression), update: Dependency? = nil, delete: Dependency? = nil) { - let composite = ", ".join([composite.0, composite.1, composite.2]) - let references = (table, ", ".join([other.0, other.1, other.2])) - - foreignKey(composite, references, update, delete) - } - - private func foreignKey(column: Expressible, _ references: (QueryType, Expressible), _ update: Dependency?, _ delete: Dependency?) { - let clauses: [Expressible?] = [ - "FOREIGN KEY".prefix(column), - reference(references), - update.map { Expression(literal: "ON UPDATE \($0.rawValue)") }, - delete.map { Expression(literal: "ON DELETE \($0.rawValue)") } - ] - - definitions.append(" ".join(clauses.flatMap { $0 })) - } - -} - -public enum PrimaryKey { - - case Default - - case Autoincrement - -} - -public struct Module { - - private let name: String - - private let arguments: [Expressible] - - public init(_ name: String, _ arguments: [Expressible]) { - self.init(name: name.quote(), arguments: arguments) - } - - init(name: String, arguments: [Expressible]) { - self.name = name - self.arguments = arguments - } - -} - -extension Module : Expressible { - - public var expression: Expression { - return name.wrap(arguments) - } - -} - -// MARK: - Private - -private extension QueryType { - - func create(identifier: String, _ name: Expressible, _ modifier: Modifier?, _ ifNotExists: Bool) -> Expressible { - let clauses: [Expressible?] = [ - Expression(literal: "CREATE"), - modifier.map { Expression(literal: $0.rawValue) }, - Expression(literal: identifier), - ifNotExists ? Expression(literal: "IF NOT EXISTS") : nil, - name - ] - - return " ".join(clauses.flatMap { $0 }) - } - - func rename(to to: Self) -> String { - return " ".join([ - Expression(literal: "ALTER TABLE"), - tableName(), - Expression(literal: "RENAME TO"), - Expression(to.clauses.from.name) - ]).asSQL() - } - - func drop(identifier: String, _ name: Expressible, _ ifExists: Bool) -> String { - let clauses: [Expressible?] = [ - Expression(literal: "DROP \(identifier)"), - ifExists ? Expression(literal: "IF EXISTS") : nil, - name - ] - - return " ".join(clauses.flatMap { $0 }).asSQL() - } - -} - -private func definition(column: Expressible, _ datatype: String, _ primaryKey: PrimaryKey?, _ null: Bool, _ unique: Bool, _ check: Expressible?, _ defaultValue: Expressible?, _ references: (QueryType, Expressible)?, _ collate: Collation?) -> Expressible { - let clauses: [Expressible?] = [ - column, - Expression(literal: datatype), - primaryKey.map { Expression(literal: $0 == .Autoincrement ? "PRIMARY KEY AUTOINCREMENT" : "PRIMARY KEY") }, - null ? nil : Expression(literal: "NOT NULL"), - unique ? Expression(literal: "UNIQUE") : nil, - check.map { " ".join([Expression(literal: "CHECK"), $0]) }, - defaultValue.map { "DEFAULT".prefix($0) }, - references.map(reference), - collate.map { " ".join([Expression(literal: "COLLATE"), $0]) } - ] - - return " ".join(clauses.flatMap { $0 }) -} - -private func reference(primary: (QueryType, Expressible)) -> Expressible { - return " ".join([ - Expression(literal: "REFERENCES"), - primary.0.tableName(), - "".wrap(primary.1) as Expression - ]) -} - -private enum Modifier : String { - - case Unique = "UNIQUE" - - case Temporary = "TEMPORARY" - -} diff --git a/Pods/SQLite.swift/SQLite/Typed/Setter.swift b/Pods/SQLite.swift/SQLite/Typed/Setter.swift deleted file mode 100644 index d8bf775..0000000 --- a/Pods/SQLite.swift/SQLite/Typed/Setter.swift +++ /dev/null @@ -1,275 +0,0 @@ -// -// SQLite.swift -// https://github.com/stephencelis/SQLite.swift -// Copyright © 2014-2015 Stephen Celis. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -infix operator <- { - associativity left - precedence 135 - assignment -} - -public struct Setter { - - let column: Expressible - let value: Expressible - - private init(column: Expression, value: Expression) { - self.column = column - self.value = value - } - - private init(column: Expression, value: V) { - self.column = column - self.value = value - } - - private init(column: Expression, value: Expression) { - self.column = column - self.value = value - } - - private init(column: Expression, value: Expression) { - self.column = column - self.value = value - } - - private init(column: Expression, value: V?) { - self.column = column - self.value = Expression(value: value) - } - -} - -extension Setter : Expressible { - - public var expression: Expression { - return "=".infix(column, value, wrap: false) - } - -} - -public func <-(column: Expression, value: Expression) -> Setter { - return Setter(column: column, value: value) -} -public func <-(column: Expression, value: V) -> Setter { - return Setter(column: column, value: value) -} -public func <-(column: Expression, value: Expression) -> Setter { - return Setter(column: column, value: value) -} -public func <-(column: Expression, value: Expression) -> Setter { - return Setter(column: column, value: value) -} -public func <-(column: Expression, value: V?) -> Setter { - return Setter(column: column, value: value) -} - -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: String) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: String) -> Setter { - return column <- column + value -} - -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: V) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: Expression) -> Setter { - return column <- column + value -} -public func +=(column: Expression, value: V) -> Setter { - return column <- column + value -} - -public func -=(column: Expression, value: Expression) -> Setter { - return column <- column - value -} -public func -=(column: Expression, value: V) -> Setter { - return column <- column - value -} -public func -=(column: Expression, value: Expression) -> Setter { - return column <- column - value -} -public func -=(column: Expression, value: Expression) -> Setter { - return column <- column - value -} -public func -=(column: Expression, value: V) -> Setter { - return column <- column - value -} - -public func *=(column: Expression, value: Expression) -> Setter { - return column <- column * value -} -public func *=(column: Expression, value: V) -> Setter { - return column <- column * value -} -public func *=(column: Expression, value: Expression) -> Setter { - return column <- column * value -} -public func *=(column: Expression, value: Expression) -> Setter { - return column <- column * value -} -public func *=(column: Expression, value: V) -> Setter { - return column <- column * value -} - -public func /=(column: Expression, value: Expression) -> Setter { - return column <- column / value -} -public func /=(column: Expression, value: V) -> Setter { - return column <- column / value -} -public func /=(column: Expression, value: Expression) -> Setter { - return column <- column / value -} -public func /=(column: Expression, value: Expression) -> Setter { - return column <- column / value -} -public func /=(column: Expression, value: V) -> Setter { - return column <- column / value -} - -public func %=(column: Expression, value: Expression) -> Setter { - return column <- column % value -} -public func %=(column: Expression, value: V) -> Setter { - return column <- column % value -} -public func %=(column: Expression, value: Expression) -> Setter { - return column <- column % value -} -public func %=(column: Expression, value: Expression) -> Setter { - return column <- column % value -} -public func %=(column: Expression, value: V) -> Setter { - return column <- column % value -} - -public func <<=(column: Expression, value: Expression) -> Setter { - return column <- column << value -} -public func <<=(column: Expression, value: V) -> Setter { - return column <- column << value -} -public func <<=(column: Expression, value: Expression) -> Setter { - return column <- column << value -} -public func <<=(column: Expression, value: Expression) -> Setter { - return column <- column << value -} -public func <<=(column: Expression, value: V) -> Setter { - return column <- column << value -} - -public func >>=(column: Expression, value: Expression) -> Setter { - return column <- column >> value -} -public func >>=(column: Expression, value: V) -> Setter { - return column <- column >> value -} -public func >>=(column: Expression, value: Expression) -> Setter { - return column <- column >> value -} -public func >>=(column: Expression, value: Expression) -> Setter { - return column <- column >> value -} -public func >>=(column: Expression, value: V) -> Setter { - return column <- column >> value -} - -public func &=(column: Expression, value: Expression) -> Setter { - return column <- column & value -} -public func &=(column: Expression, value: V) -> Setter { - return column <- column & value -} -public func &=(column: Expression, value: Expression) -> Setter { - return column <- column & value -} -public func &=(column: Expression, value: Expression) -> Setter { - return column <- column & value -} -public func &=(column: Expression, value: V) -> Setter { - return column <- column & value -} - -public func |=(column: Expression, value: Expression) -> Setter { - return column <- column | value -} -public func |=(column: Expression, value: V) -> Setter { - return column <- column | value -} -public func |=(column: Expression, value: Expression) -> Setter { - return column <- column | value -} -public func |=(column: Expression, value: Expression) -> Setter { - return column <- column | value -} -public func |=(column: Expression, value: V) -> Setter { - return column <- column | value -} - -public func ^=(column: Expression, value: Expression) -> Setter { - return column <- column ^ value -} -public func ^=(column: Expression, value: V) -> Setter { - return column <- column ^ value -} -public func ^=(column: Expression, value: Expression) -> Setter { - return column <- column ^ value -} -public func ^=(column: Expression, value: Expression) -> Setter { - return column <- column ^ value -} -public func ^=(column: Expression, value: V) -> Setter { - return column <- column ^ value -} - -public postfix func ++(column: Expression) -> Setter { - return Expression(column) += 1 -} -public postfix func ++(column: Expression) -> Setter { - return Expression(column) += 1 -} - -public postfix func --(column: Expression) -> Setter { - return Expression(column) -= 1 -} -public postfix func --(column: Expression) -> Setter { - return Expression(column) -= 1 -} diff --git a/Pods/SQLite.swift/podstuff/module.modulemap b/Pods/SQLite.swift/podstuff/module.modulemap deleted file mode 100644 index 122acd2..0000000 --- a/Pods/SQLite.swift/podstuff/module.modulemap +++ /dev/null @@ -1,12 +0,0 @@ -framework module SQLite { - umbrella header "SQLite.h" - - // Load the SDK header alongside SQLite.swift. Alternate headers: - // - // header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sqlite3.h" - // header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sqlite3.h" - header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sqlite3.h" - - export * - module * { export * } -} diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Info.plist b/Pods/Target Support Files/Pods-SQLiteModel/Info.plist deleted file mode 100644 index 6974542..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.cocoapods.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.markdown b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.markdown deleted file mode 100644 index 1e24a0c..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.markdown +++ /dev/null @@ -1,28 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## SQLite.swift - -(The MIT License) - -Copyright (c) 2014-2015 Stephen Celis () - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Generated by CocoaPods - http://cocoapods.org diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.plist b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.plist deleted file mode 100644 index 2ca01f6..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-acknowledgements.plist +++ /dev/null @@ -1,58 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - (The MIT License) - -Copyright (c) 2014-2015 Stephen Celis (<stephen@stephencelis.com>) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - Title - SQLite.swift - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - http://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-dummy.m b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-dummy.m deleted file mode 100644 index ce4438b..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_SQLiteModel : NSObject -@end -@implementation PodsDummy_Pods_SQLiteModel -@end diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-frameworks.sh b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-frameworks.sh deleted file mode 100755 index 6d1d315..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-frameworks.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -set -e - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" - -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink "${source}")" - fi - - # use filter instead of exclude so missing patterns dont' throw errors - echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identitiy - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" - /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" - fi -} - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - # Get architectures for current file - archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" - stripped="" - for arch in $archs; do - if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" || exit 1 - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi -} - - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "Pods-SQLiteModel/SQLite.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "Pods-SQLiteModel/SQLite.framework" -fi diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-resources.sh b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-resources.sh deleted file mode 100755 index 16774fb..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-resources.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -set -e - -mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - -RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt -> "$RESOURCES_TO_COPY" - -XCASSET_FILES=() - -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - -install_resource() -{ - case $1 in - *.storyboard) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" - ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" - ;; - *.xib) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" - ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" - ;; - *.framework) - echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - ;; - *.xcdatamodel) - echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" - xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" - ;; - *.xcdatamodeld) - echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" - xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" - ;; - *.xcmappingmodel) - echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" - xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" - ;; - *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") - XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") - ;; - /*) - echo "$1" - echo "$1" >> "$RESOURCES_TO_COPY" - ;; - *) - echo "${PODS_ROOT}/$1" - echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" - ;; - esac -} - -mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then - mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi -rm -f "$RESOURCES_TO_COPY" - -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] -then - case "${TARGETED_DEVICE_FAMILY}" in - 1,2) - TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" - ;; - 1) - TARGET_DEVICE_ARGS="--target-device iphone" - ;; - 2) - TARGET_DEVICE_ARGS="--target-device ipad" - ;; - *) - TARGET_DEVICE_ARGS="--target-device mac" - ;; - esac - - # Find all other xcassets (this unfortunately includes those of path pods and other targets). - OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) - while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then - XCASSET_FILES+=("$line") - fi - done <<<"$OTHER_XCASSETS" - - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-umbrella.h b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-umbrella.h deleted file mode 100644 index 5db67c2..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double Pods_SQLiteModelVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_SQLiteModelVersionString[]; - diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.debug.xcconfig b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.debug.xcconfig deleted file mode 100644 index 327a900..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.debug.xcconfig +++ /dev/null @@ -1,8 +0,0 @@ -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SQLite.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "SQLite" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-SQLiteModel -PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.modulemap b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.modulemap deleted file mode 100644 index 0feaf35..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_SQLiteModel { - umbrella header "Pods-SQLiteModel-umbrella.h" - - export * - module * { export * } -} diff --git a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.release.xcconfig b/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.release.xcconfig deleted file mode 100644 index 327a900..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.release.xcconfig +++ /dev/null @@ -1,8 +0,0 @@ -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SQLite.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "SQLite" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-SQLiteModel -PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Info.plist b/Pods/Target Support Files/Pods-SQLiteModelTests/Info.plist deleted file mode 100644 index 6974542..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.cocoapods.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.markdown b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.markdown deleted file mode 100644 index 1e24a0c..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.markdown +++ /dev/null @@ -1,28 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## SQLite.swift - -(The MIT License) - -Copyright (c) 2014-2015 Stephen Celis () - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Generated by CocoaPods - http://cocoapods.org diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.plist b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.plist deleted file mode 100644 index 2ca01f6..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-acknowledgements.plist +++ /dev/null @@ -1,58 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - (The MIT License) - -Copyright (c) 2014-2015 Stephen Celis (<stephen@stephencelis.com>) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - Title - SQLite.swift - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - http://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-dummy.m b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-dummy.m deleted file mode 100644 index 5112b02..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_SQLiteModelTests : NSObject -@end -@implementation PodsDummy_Pods_SQLiteModelTests -@end diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-frameworks.sh b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-frameworks.sh deleted file mode 100755 index 928128a..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-frameworks.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -set -e - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" - -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink "${source}")" - fi - - # use filter instead of exclude so missing patterns dont' throw errors - echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identitiy - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" - /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" - fi -} - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - # Get architectures for current file - archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" - stripped="" - for arch in $archs; do - if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" || exit 1 - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi -} - - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "Pods-SQLiteModelTests/SQLite.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "Pods-SQLiteModelTests/SQLite.framework" -fi diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-resources.sh b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-resources.sh deleted file mode 100755 index 16774fb..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-resources.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -set -e - -mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - -RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt -> "$RESOURCES_TO_COPY" - -XCASSET_FILES=() - -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - -install_resource() -{ - case $1 in - *.storyboard) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" - ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" - ;; - *.xib) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" - ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" - ;; - *.framework) - echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - ;; - *.xcdatamodel) - echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" - xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" - ;; - *.xcdatamodeld) - echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" - xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" - ;; - *.xcmappingmodel) - echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" - xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" - ;; - *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") - XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") - ;; - /*) - echo "$1" - echo "$1" >> "$RESOURCES_TO_COPY" - ;; - *) - echo "${PODS_ROOT}/$1" - echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" - ;; - esac -} - -mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then - mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi -rm -f "$RESOURCES_TO_COPY" - -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] -then - case "${TARGETED_DEVICE_FAMILY}" in - 1,2) - TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" - ;; - 1) - TARGET_DEVICE_ARGS="--target-device iphone" - ;; - 2) - TARGET_DEVICE_ARGS="--target-device ipad" - ;; - *) - TARGET_DEVICE_ARGS="--target-device mac" - ;; - esac - - # Find all other xcassets (this unfortunately includes those of path pods and other targets). - OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) - while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then - XCASSET_FILES+=("$line") - fi - done <<<"$OTHER_XCASSETS" - - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-umbrella.h b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-umbrella.h deleted file mode 100644 index d72e33b..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double Pods_SQLiteModelTestsVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_SQLiteModelTestsVersionString[]; - diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.debug.xcconfig b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.debug.xcconfig deleted file mode 100644 index db1c96e..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.debug.xcconfig +++ /dev/null @@ -1,8 +0,0 @@ -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SQLite.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "SQLite" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-SQLiteModelTests -PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.modulemap b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.modulemap deleted file mode 100644 index 44cde3e..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_SQLiteModelTests { - umbrella header "Pods-SQLiteModelTests-umbrella.h" - - export * - module * { export * } -} diff --git a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.release.xcconfig b/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.release.xcconfig deleted file mode 100644 index db1c96e..0000000 --- a/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.release.xcconfig +++ /dev/null @@ -1,8 +0,0 @@ -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SQLite.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "SQLite" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-SQLiteModelTests -PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Pods/Target Support Files/SQLite.swift/Info.plist b/Pods/Target Support Files/SQLite.swift/Info.plist deleted file mode 100644 index 638b960..0000000 --- a/Pods/Target Support Files/SQLite.swift/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.cocoapods.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 0.9.2 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Pods/Target Support Files/SQLite.swift/SQLite.swift-dummy.m b/Pods/Target Support Files/SQLite.swift/SQLite.swift-dummy.m deleted file mode 100644 index bc09ade..0000000 --- a/Pods/Target Support Files/SQLite.swift/SQLite.swift-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_SQLite_swift : NSObject -@end -@implementation PodsDummy_SQLite_swift -@end diff --git a/Pods/Target Support Files/SQLite.swift/SQLite.swift-prefix.pch b/Pods/Target Support Files/SQLite.swift/SQLite.swift-prefix.pch deleted file mode 100644 index aa992a4..0000000 --- a/Pods/Target Support Files/SQLite.swift/SQLite.swift-prefix.pch +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef __OBJC__ -#import -#endif - diff --git a/Pods/Target Support Files/SQLite.swift/SQLite.swift.modulemap b/Pods/Target Support Files/SQLite.swift/SQLite.swift.modulemap deleted file mode 100644 index 122acd2..0000000 --- a/Pods/Target Support Files/SQLite.swift/SQLite.swift.modulemap +++ /dev/null @@ -1,12 +0,0 @@ -framework module SQLite { - umbrella header "SQLite.h" - - // Load the SDK header alongside SQLite.swift. Alternate headers: - // - // header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sqlite3.h" - // header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sqlite3.h" - header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sqlite3.h" - - export * - module * { export * } -} diff --git a/Pods/Target Support Files/SQLite.swift/SQLite.swift.xcconfig b/Pods/Target Support Files/SQLite.swift/SQLite.swift.xcconfig deleted file mode 100644 index 04e7a5c..0000000 --- a/Pods/Target Support Files/SQLite.swift/SQLite.swift.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SQLite.swift" "${PODS_ROOT}/Headers/Public" -OTHER_LDFLAGS = -l"sqlite3" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_ROOT = ${SRCROOT} -SKIP_INSTALL = YES \ No newline at end of file diff --git a/README.md b/README.md index 0f1fe23..23bbe13 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,192 @@ -# SQLiteModel -Easiest way to persist data in Swift + +

+ +
+A developer friendly Object Relational Model for [SQLite3](http://www.sqlite.org/), wrapped over [SQLite.swift](https://github.com/stephencelis/SQLite.swift) + +```swift +struct Person: SQLiteModel { + + // Required by SQLiteModel protocol + var localID: SQLiteModelID = -1 + + static let Name = Expression("name") + static let Age = Expression("age") + static let BFF = Relationship("best_friend") + + // Required by SQLiteModel protocol + static func buildTable(tableBuilder: TableBuilder) { + tableBuilder.column(Name) + tableBuilder.column(Age, defaultValue: 0) + tableBuilder.relationship(BFF, mappedFrom: self) + } +} + +``` + +```swift + +let jack = try Person.new([ + Person.Age <- 10, + Person.Name <- "Jack" + ]) + +let jill = try Person.new([ + Person.Age <- 12, + Person.Name <- "Jill" + ]) + +// Set age +// same as jack.set(Person.Age, 11) +jack <| Person.Age |> 11 +// Get age +// same as jack.get(Person.Age) +let age = jack => Person.Age + +// Set Best Friend +// same as jack.set(Person.BFF, jill) +jack <| Person.BFF |> jill + +let people = try Person.fetchAll() + +``` + +## Features +* Easy set up 👌 +* Database functionality 💾 (*Create / Drop Table, Insert, Update, Delete, Fetch*) +* Relationships 👫 (*One to One, Many to One, Many to Many*) +* Schema alterations 🛠 +* Sync and Async execution 🏁🚀 +* Thread safety 👮☢️ +* Easy to read and write syntax 🙌 +* Verbose error handling and logging ❗️🖨 +* [Thoroughly documented](https://github.com/jhurray/SQLiteModel/wiki) 🤓🗂 +* Well tested 📉📊📈 +* iOS, OSX, tvOS support 📱💻📺 +* [Example projects](https://github.com/jhurray/SQLiteModel-Example-Project)🔍 +* Pure Swift 💞😻 + +## Installation + +SQLiteModel requires Swift 2 (and Xcode 7) or greater. + +###CocoaPods +If you are unfamiliar with [CocoaPods](https://cocoapods.org/) please read these guides before proceeding: + +* [Getting Started](https://guides.cocoapods.org/using/getting-started.html) +* [Using CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) + +Add the following to your Podfile: + +```ruby +use_frameworks! + +pod 'SQLiteModel', '~>0.3.3' +``` + +###Carthage +[Carthage][] is a simple, decentralized dependency manager for Cocoa. To +install SQLite.swift with Carthage: + + 1. Make sure Carthage is [installed][Carthage Installation]. + + 2. Update your Cartfile to include the following: + + ``` + github "jhurray/SQLiteModel" ~> 0.3.3 + ``` + + 3. Run `carthage update` and [add the appropriate framework][Carthage Usage]. + + +[Carthage]: https://github.com/Carthage/Carthage +[Carthage Installation]: https://github.com/Carthage/Carthage#installing-carthage +[Carthage Usage]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application + +###Manual + +To install SQLite.swift as an Xcode sub-project: + + 1. Drag the **SQLite.xcodeproj** file into your own project. + ([Submodule][], clone, or [download][] the project first.) + + 2. In your target’s **General** tab, click the **+** button under **Linked + Frameworks and Libraries**. + + 3. Select the appropriate **SQLite.framework** for your platform. + + 4. **Add**. + +[Submodule]: http://git-scm.com/book/en/Git-Tools-Submodules +[download]: https://github.com/stephencelis/SQLite.swift/archive/master.zip + +##Documentation + +The [wiki](https://github.com/jhurray/SQLiteModel/wiki) for this repo contains extensive documentation. + +##Why SQLiteModel + +####ORM's +There are a lot of good data storage solutions out there, **Realm** and **CoreData** being the most popular. The biggest issue with these solutions is that they force your models be reference types (classes) instead of value types (structs). + +Apple's documentation lists a couple conditions where if true, a struct is probably a better choice than a class [here](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html). The following condition is especially relevant: + +>The structure’s primary purpose is to encapsulate a few relatively simple data values. + +Sounds like a database row fits that description. Ideally if one are trying to model a database row, one should use structs, which **SQLiteModel** supports. + +That being said, structs arent always the answer. **SQLiteModel** also supports using classes, but as of now they have to be `final`. + + +####SQLite Wrappers +There are also a lot of wrappers over SQLite that exist, but aren't object relational models. **SQLite.swift** and **FMDB** are 2 great libraries that serve this functionality. These are very powerful and flexible, but they take a while to set up the right way as they require a lot of boilerplate code. + +With **SQLiteModel**, the boilerplate code is already written. Obviously you are sacrificing flexibility for ease of use, but for most data storage needs this is acceptable (IMO). + +####TL;DR +* **SQLiteModel** supports structs which are probably better than classes for modeling database tables and rows. +* **SQLiteModel** provides extensive functionality with minimum boilerplate code. + +##Example Projects +There a couple good examples of how to use SQLiteModel + +###Playground +Included in this repo is a playground that you can use to fool around with the syntax and features of SQLiteModel. Make sure you open `SQLiteModel.xcodeproject` since this playgrounf imports the `SQLiteModel` framework, and make sure you are using the `SQLiteModel-iOS` scheme. + +###Example Applications +There is a repo with example applications for **iOS**, **TVOS**, AND **OSX** that can be found [here](https://github.com/jhurray/SQLiteModel-Example-Project). These projects all use CocoaPods, so make sure to open the `.xcworkspace` to get them running. + +The iOS example that is provided is the best and most thorough example of how to use SQLiteModel. The app is a blog platform that allows users create, delete, and save blog posts. Users can also add images to blogs using relationships, and view all images on another tab. + +##Moving Forward +- [x] ~~Carthage support~~ +- [x] ~~Complex relationship queries~~ +- [x] ~~Reading in pre-existing databases~~ +- [ ] More scalar queries +- [ ] More table alteration options +- [ ] Improved data pipeline between db and value types +- [ ] Performance improvements for relationships + +##Contact Info +Feel free to email me at [jhurray33@gmail.com](mailto:jhurray33@gmail.com?subject=SQLiteModel). I'd love to hear your thoughts on this, or see examples where this has been used. + +You can also hit me up on twitter [@JeffHurray](https://twitter.com/JeffHurray). + +##Contributing +If you want to add functionality please open an issue and/or create a pull request. + +##Shoutout +Big thank you to [Stephen Celis](https://github.com/stephencelis) for writing `SQLite.swift` which (IMHO) is one of the best Swift open source libraries that exists today. + +##License +SQLiteModel is available under the MIT license. See the LICENSE file for more information. diff --git a/Resources/SQLiteModel_logo.png b/Resources/SQLiteModel_logo.png new file mode 100644 index 0000000..3b2e761 Binary files /dev/null and b/Resources/SQLiteModel_logo.png differ diff --git a/SQLiteModel.playground/Contents.swift b/SQLiteModel.playground/Contents.swift new file mode 100644 index 0000000..ceab3f3 --- /dev/null +++ b/SQLiteModel.playground/Contents.swift @@ -0,0 +1,87 @@ +//: Playground - noun: a place where people can play + +import UIKit +import SQLiteModel +import SQLite + +struct Person: SQLiteModel { + + var localID: SQLiteModelID = -1 + + static let Name = Expression("name") + static let Age = Expression("age") + static let BFF = Relationship("best_friend") + + static func buildTable(tableBuilder: TableBuilder) { + tableBuilder.column(Name) + tableBuilder.column(Age, defaultValue: 0) + tableBuilder.relationship(BFF, mappedFrom: self) + } +} + +do { + + try Person.createTable() + + var jack = try Person.new([ + Person.Age <- 10, + Person.Name <- "Jack" + ]) + + let jill = try Person.new([ + Person.Age <- 12, + Person.Name <- "Jill" + ]) + + // Each Model has localID, localCreatedAt, and localUpdatedAt properties + jack.localID + jill.localID + jack.localCreatedAt + + // Set age + jack <| Person.Age |> 11 + // Get age + let age = jack => Person.Age + + // Save an instance + try jack.save() + jack.localUpdatedAt + + // Simple Fetch + let peopleWhoRanUpTheHill = try Person.fetchAll() + + // Filtered Fetch + let jackQuery = Person.query.filter(Person.Name == "Jack") + let personWhoBrokeHisCrown = try Person.fetch(jackQuery).first! + personWhoBrokeHisCrown => Person.Name + + // Update all rows the table + try Person.updateAll([Person.Age += 10]) + let grownups = try Person.fetchAll() + jill => Person.Age + jack => Person.Age + personWhoBrokeHisCrown => Person.Age + let ages = grownups.flatMap({ $0 => Person.Age }) + print(ages) + + // Relationships set + get + jack <| Person.BFF |> jill + let jacksBestFriend = jack => Person.BFF + jacksBestFriend! => Person.Name + + // Delete instance + try jill.delete() + let lastManOnEarth = try Person.fetchAll().first! + lastManOnEarth => Person.Name + // Relationships will cascade uppon deletion + jack => Person.BFF + + // Delete all rows + try Person.deleteAll() + // Drop Table + try Person.dropTable() + +} +catch let error { + print("SQLiteModel Error: \(error).") +} diff --git a/SQLiteModel.playground/contents.xcplayground b/SQLiteModel.playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/SQLiteModel.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SQLiteModel.playground/playground.xcworkspace/contents.xcworkspacedata b/SQLiteModel.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/SQLiteModel.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SQLiteModel.podspec b/SQLiteModel.podspec index 81d6c9e..eab2abe 100644 --- a/SQLiteModel.podspec +++ b/SQLiteModel.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "SQLiteModel" - s.version = "0.1.7" + s.version = "0.3.3" s.summary = "The easiest way to persist data in Swift" s.description = <<-DESC @@ -28,5 +28,5 @@ Pod::Spec.new do |s| s.source_files = 'SQLiteModel/*.{h,swift}' s.libraries = 'sqlite3' - s.dependency 'SQLite.swift', '~> 0.9.0' + s.dependency 'SQLite.swift', '~> 0.10.1' end diff --git a/SQLiteModel.xcodeproj/project.pbxproj b/SQLiteModel.xcodeproj/project.pbxproj index ce45135..1df7458 100644 --- a/SQLiteModel.xcodeproj/project.pbxproj +++ b/SQLiteModel.xcodeproj/project.pbxproj @@ -7,7 +7,62 @@ objects = { /* Begin PBXBuildFile section */ - 1CA268BAA15F253F132BA36E /* Pods_SQLiteModelTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAFC1C94575FB2D36D592B9B /* Pods_SQLiteModelTests.framework */; }; + 260562CB1CD80EBC00006DAD /* SQLiteModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26E0FCB41C2C9CEB00C192F7 /* SQLiteModel.framework */; }; + 260563301CD818D800006DAD /* SQLite.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2605632F1CD818D800006DAD /* SQLite.framework.dSYM */; }; + 260563341CD81A4C00006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563331CD81A4C00006DAD /* SQLite.framework */; }; + 260563361CD81A5900006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563351CD81A5900006DAD /* SQLite.framework */; }; + 260563381CD81A6400006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563371CD81A6400006DAD /* SQLite.framework */; }; + 2605633F1CD81B3200006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563331CD81A4C00006DAD /* SQLite.framework */; }; + 260563411CD81B5700006DAD /* SQLite.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 260563331CD81A4C00006DAD /* SQLite.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 260563421CD81B7000006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563371CD81A6400006DAD /* SQLite.framework */; }; + 260563441CD81B7700006DAD /* SQLite.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 260563371CD81A6400006DAD /* SQLite.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 260563451CD81B9100006DAD /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260563351CD81A5900006DAD /* SQLite.framework */; }; + 260563481CD81B9C00006DAD /* SQLite.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 260563351CD81A5900006DAD /* SQLite.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 2615E6D01CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2615E6CF1CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift */; }; + 262604021CD5699900E663CA /* SQLiteModelTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3C1C31EFA200C192F7 /* SQLiteModelTestCase.swift */; }; + 262604031CD5699900E663CA /* SQLiteModelFunctionalitySmokeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FCC31C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift */; }; + 262604041CD5699900E663CA /* SQLiteModelSingularRelationshipTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2646B8451C3CAC010010592A /* SQLiteModelSingularRelationshipTest.swift */; }; + 262604051CD5699900E663CA /* SQLiteModelMultipleRelationshipTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA91CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift */; }; + 262604061CD5699900E663CA /* SQLiteModelSchemaUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C3A1CB7788D000C8B3A /* SQLiteModelSchemaUpdaterTests.swift */; }; + 262604071CD5699900E663CA /* SQLiteModelAsyncTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2511CBB1E5300063B12 /* SQLiteModelAsyncTest.swift */; }; + 262604081CD5699900E663CA /* SQLiteModelScalarQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26CB69941CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift */; }; + 262604091CD5699900E663CA /* SQLiteModelThreadSafetyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2697215F1CCC07D6003471D4 /* SQLiteModelThreadSafetyTests.swift */; }; + 2626040A1CD5699900E663CA /* SQLiteModelDatabaseTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2615E6CF1CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift */; }; + 2626040B1CD56A0E00E663CA /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD341C2F301200C192F7 /* Database.swift */; }; + 2626040C1CD56A0E00E663CA /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2646B84F1C3CB3880010592A /* Extensions.swift */; }; + 2626040D1CD56A0E00E663CA /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2531CBB7A5100063B12 /* LogManager.swift */; }; + 2626040E1CD56A0E00E663CA /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA51CAB6F3B004B3DDC /* Operators.swift */; }; + 2626040F1CD56A0E00E663CA /* Relationship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264599FF1C4C3EFE00BD4D80 /* Relationship.swift */; }; + 262604101CD56A0E00E663CA /* RelationshipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26540D9E1C98ECC4000CE346 /* RelationshipModel.swift */; }; + 262604111CD56A0E00E663CA /* SchemaUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C381CB4D84F000C8B3A /* SchemaUpdater.swift */; }; + 262604121CD56A0E00E663CA /* SQLiteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD0F1C2CA3CD00C192F7 /* SQLiteModel.swift */; }; + 262604131CD56A0E00E663CA /* SQLiteModel+Implementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D0E1A21CB06AB200CA93BC /* SQLiteModel+Implementation.swift */; }; + 262604141CD56A0E00E663CA /* SQLiteModelContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3A1C2F44B600C192F7 /* SQLiteModelContextManager.swift */; }; + 262604151CD56A0E00E663CA /* SQLiteModelError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD301C2CA65900C192F7 /* SQLiteModelError.swift */; }; + 262604161CD56A0E00E663CA /* SyncManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C3C1CB89332000C8B3A /* SyncManager.swift */; }; + 262604171CD56A1900E663CA /* SQLiteModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E0FCB71C2C9CEB00C192F7 /* SQLiteModel.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 262604361CD56EA500E663CA /* SQLiteModelTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3C1C31EFA200C192F7 /* SQLiteModelTestCase.swift */; }; + 262604371CD56EA500E663CA /* SQLiteModelFunctionalitySmokeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FCC31C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift */; }; + 262604381CD56EA500E663CA /* SQLiteModelSingularRelationshipTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2646B8451C3CAC010010592A /* SQLiteModelSingularRelationshipTest.swift */; }; + 262604391CD56EA500E663CA /* SQLiteModelMultipleRelationshipTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA91CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift */; }; + 2626043A1CD56EA500E663CA /* SQLiteModelSchemaUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C3A1CB7788D000C8B3A /* SQLiteModelSchemaUpdaterTests.swift */; }; + 2626043B1CD56EA500E663CA /* SQLiteModelAsyncTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2511CBB1E5300063B12 /* SQLiteModelAsyncTest.swift */; }; + 2626043C1CD56EA500E663CA /* SQLiteModelScalarQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26CB69941CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift */; }; + 2626043D1CD56EA500E663CA /* SQLiteModelThreadSafetyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2697215F1CCC07D6003471D4 /* SQLiteModelThreadSafetyTests.swift */; }; + 2626043E1CD56EA500E663CA /* SQLiteModelDatabaseTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2615E6CF1CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift */; }; + 2626043F1CD56F0800E663CA /* SQLiteModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E0FCB71C2C9CEB00C192F7 /* SQLiteModel.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 262604401CD56F8300E663CA /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD341C2F301200C192F7 /* Database.swift */; }; + 262604411CD56F8300E663CA /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2646B84F1C3CB3880010592A /* Extensions.swift */; }; + 262604421CD56F8300E663CA /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2531CBB7A5100063B12 /* LogManager.swift */; }; + 262604431CD56F8300E663CA /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA51CAB6F3B004B3DDC /* Operators.swift */; }; + 262604441CD56F8300E663CA /* Relationship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264599FF1C4C3EFE00BD4D80 /* Relationship.swift */; }; + 262604451CD56F8300E663CA /* RelationshipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26540D9E1C98ECC4000CE346 /* RelationshipModel.swift */; }; + 262604461CD56F8300E663CA /* SchemaUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C381CB4D84F000C8B3A /* SchemaUpdater.swift */; }; + 262604471CD56F8300E663CA /* SQLiteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD0F1C2CA3CD00C192F7 /* SQLiteModel.swift */; }; + 262604481CD56F8300E663CA /* SQLiteModel+Implementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D0E1A21CB06AB200CA93BC /* SQLiteModel+Implementation.swift */; }; + 262604491CD56F8300E663CA /* SQLiteModelContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3A1C2F44B600C192F7 /* SQLiteModelContextManager.swift */; }; + 2626044A1CD56F8300E663CA /* SQLiteModelError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD301C2CA65900C192F7 /* SQLiteModelError.swift */; }; + 2626044B1CD56F8300E663CA /* SyncManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26700C3C1CB89332000C8B3A /* SyncManager.swift */; }; 263E9DA61CAB6F3B004B3DDC /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA51CAB6F3B004B3DDC /* Operators.swift */; }; 263E9DAA1CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263E9DA91CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift */; }; 26459A001C4C3EFE00BD4D80 /* Relationship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264599FF1C4C3EFE00BD4D80 /* Relationship.swift */; }; @@ -21,20 +76,31 @@ 26CB69951CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26CB69941CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift */; }; 26D0E1A31CB06AB200CA93BC /* SQLiteModel+Implementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D0E1A21CB06AB200CA93BC /* SQLiteModel+Implementation.swift */; }; 26E0FCB81C2C9CEB00C192F7 /* SQLiteModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E0FCB71C2C9CEB00C192F7 /* SQLiteModel.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 26E0FCBF1C2C9CEB00C192F7 /* SQLiteModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26E0FCB41C2C9CEB00C192F7 /* SQLiteModel.framework */; }; 26E0FCC41C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FCC31C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift */; }; 26E0FD101C2CA3CD00C192F7 /* SQLiteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD0F1C2CA3CD00C192F7 /* SQLiteModel.swift */; }; - 26E0FD121C2CA42A00C192F7 /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 26E0FD111C2CA42A00C192F7 /* libsqlite3.0.tbd */; }; 26E0FD311C2CA65900C192F7 /* SQLiteModelError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD301C2CA65900C192F7 /* SQLiteModelError.swift */; }; - 26E0FD351C2F301200C192F7 /* SQLiteDatabaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD341C2F301200C192F7 /* SQLiteDatabaseManager.swift */; }; + 26E0FD351C2F301200C192F7 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD341C2F301200C192F7 /* Database.swift */; }; 26E0FD3B1C2F44B600C192F7 /* SQLiteModelContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3A1C2F44B600C192F7 /* SQLiteModelContextManager.swift */; }; 26E0FD3D1C31EFA200C192F7 /* SQLiteModelTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E0FD3C1C31EFA200C192F7 /* SQLiteModelTestCase.swift */; }; 26E4B2521CBB1E5300063B12 /* SQLiteModelAsyncTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2511CBB1E5300063B12 /* SQLiteModelAsyncTest.swift */; }; 26E4B2541CBB7A5100063B12 /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26E4B2531CBB7A5100063B12 /* LogManager.swift */; }; - EF718CA658D766879091629E /* Pods_SQLiteModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D3053848CF104B03AFD02F /* Pods_SQLiteModel.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 262603F41CD5691A00E663CA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 26E0FCAB1C2C9CEB00C192F7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 262603E81CD5691A00E663CA; + remoteInfo = "SQLiteModel Mac"; + }; + 262604281CD56E2A00E663CA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 26E0FCAB1C2C9CEB00C192F7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2626041C1CD56E2A00E663CA; + remoteInfo = "SQLiteModel tvOS"; + }; 26E0FCC01C2C9CEB00C192F7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 26E0FCAB1C2C9CEB00C192F7 /* Project object */; @@ -44,8 +110,59 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 2605632E1CD818A100006DAD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 16; + files = ( + 260563301CD818D800006DAD /* SQLite.framework.dSYM in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 260563401CD81B5100006DAD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 260563411CD81B5700006DAD /* SQLite.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 260563431CD81B7400006DAD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 260563441CD81B7700006DAD /* SQLite.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 260563461CD81B9400006DAD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 260563481CD81B9C00006DAD /* SQLite.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ - 25D3053848CF104B03AFD02F /* Pods_SQLiteModel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SQLiteModel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2605632F1CD818D800006DAD /* SQLite.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = SQLite.framework.dSYM; path = Carthage/Build/Mac/SQLite.framework.dSYM; sourceTree = ""; }; + 260563331CD81A4C00006DAD /* SQLite.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SQLite.framework; path = Carthage/Build/iOS/SQLite.framework; sourceTree = ""; }; + 260563351CD81A5900006DAD /* SQLite.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SQLite.framework; path = Carthage/Build/Mac/SQLite.framework; sourceTree = ""; }; + 260563371CD81A6400006DAD /* SQLite.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SQLite.framework; path = Carthage/Build/tvOS/SQLite.framework; sourceTree = ""; }; + 2615E6CF1CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelDatabaseTest.swift; sourceTree = ""; }; + 262603E91CD5691A00E663CA /* SQLiteModel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLiteModel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 262603F21CD5691A00E663CA /* SQLiteModelTests-Mac.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SQLiteModelTests-Mac.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2626041D1CD56E2A00E663CA /* SQLiteModel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLiteModel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 262604261CD56E2A00E663CA /* SQLiteModelTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SQLiteModelTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 263E9DA51CAB6F3B004B3DDC /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = ""; }; 263E9DA91CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelMultipleRelationshipTest.swift; sourceTree = ""; }; 264599FF1C4C3EFE00BD4D80 /* Relationship.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Relationship.swift; sourceTree = ""; }; @@ -56,36 +173,62 @@ 26700C3A1CB7788D000C8B3A /* SQLiteModelSchemaUpdaterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelSchemaUpdaterTests.swift; sourceTree = ""; }; 26700C3C1CB89332000C8B3A /* SyncManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncManager.swift; sourceTree = ""; }; 2697215F1CCC07D6003471D4 /* SQLiteModelThreadSafetyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelThreadSafetyTests.swift; sourceTree = ""; }; + 26AB3EFA1CCD5E1000F05D11 /* SQLiteModel.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = SQLiteModel.playground; sourceTree = ""; }; 26CB69941CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelScalarQueryTests.swift; sourceTree = ""; }; 26D0E1A21CB06AB200CA93BC /* SQLiteModel+Implementation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SQLiteModel+Implementation.swift"; sourceTree = ""; }; 26E0FCB41C2C9CEB00C192F7 /* SQLiteModel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLiteModel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26E0FCB71C2C9CEB00C192F7 /* SQLiteModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SQLiteModel.h; sourceTree = ""; }; 26E0FCB91C2C9CEB00C192F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SQLiteModelTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SQLiteModelTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 26E0FCC31C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteModelFunctionalitySmokeTests.swift; sourceTree = ""; }; 26E0FCC51C2C9CEB00C192F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26E0FD0F1C2CA3CD00C192F7 /* SQLiteModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModel.swift; sourceTree = ""; }; - 26E0FD111C2CA42A00C192F7 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; }; 26E0FD301C2CA65900C192F7 /* SQLiteModelError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelError.swift; sourceTree = ""; }; - 26E0FD341C2F301200C192F7 /* SQLiteDatabaseManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteDatabaseManager.swift; sourceTree = ""; }; + 26E0FD341C2F301200C192F7 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = ""; }; 26E0FD3A1C2F44B600C192F7 /* SQLiteModelContextManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelContextManager.swift; sourceTree = ""; }; 26E0FD3C1C31EFA200C192F7 /* SQLiteModelTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelTestCase.swift; sourceTree = ""; }; 26E4B2511CBB1E5300063B12 /* SQLiteModelAsyncTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteModelAsyncTest.swift; sourceTree = ""; }; 26E4B2531CBB7A5100063B12 /* LogManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogManager.swift; sourceTree = ""; }; - 8DA9958DF4A2D1A4831EFE2B /* Pods-SQLiteModelTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SQLiteModelTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.release.xcconfig"; sourceTree = ""; }; - A599D6FFE7D890DD851B7489 /* Pods-SQLiteModel.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SQLiteModel.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.debug.xcconfig"; sourceTree = ""; }; - A63C0CA19060264B1C951FA7 /* Pods-SQLiteModelTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SQLiteModelTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests.debug.xcconfig"; sourceTree = ""; }; - D3364234C8619CEF0EC35D00 /* Pods-SQLiteModel.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SQLiteModel.release.xcconfig"; path = "Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel.release.xcconfig"; sourceTree = ""; }; - DAFC1C94575FB2D36D592B9B /* Pods_SQLiteModelTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SQLiteModelTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 262603E51CD5691A00E663CA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 260563361CD81A5900006DAD /* SQLite.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 262603EF1CD5691A00E663CA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 260563451CD81B9100006DAD /* SQLite.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 262604191CD56E2A00E663CA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 260563381CD81A6400006DAD /* SQLite.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 262604231CD56E2A00E663CA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 260563421CD81B7000006DAD /* SQLite.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 26E0FCB01C2C9CEB00C192F7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26E0FD121C2CA42A00C192F7 /* libsqlite3.0.tbd in Frameworks */, - EF718CA658D766879091629E /* Pods_SQLiteModel.framework in Frameworks */, + 260563341CD81A4C00006DAD /* SQLite.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -93,24 +236,34 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26E0FCBF1C2C9CEB00C192F7 /* SQLiteModel.framework in Frameworks */, - 1CA268BAA15F253F132BA36E /* Pods_SQLiteModelTests.framework in Frameworks */, + 260562CB1CD80EBC00006DAD /* SQLiteModel.framework in Frameworks */, + 2605633F1CD81B3200006DAD /* SQLite.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 260563391CD81A6E00006DAD /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2605632F1CD818D800006DAD /* SQLite.framework.dSYM */, + 260563331CD81A4C00006DAD /* SQLite.framework */, + 260563371CD81A6400006DAD /* SQLite.framework */, + 260563351CD81A5900006DAD /* SQLite.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 26E0FCAA1C2C9CEB00C192F7 = { isa = PBXGroup; children = ( - 26E0FD111C2CA42A00C192F7 /* libsqlite3.0.tbd */, + 26AB3EFA1CCD5E1000F05D11 /* SQLiteModel.playground */, 26E0FCB61C2C9CEB00C192F7 /* SQLiteModel */, 26E0FCEF1C2CA2D500C192F7 /* Supporting Files */, 26E0FCC21C2C9CEB00C192F7 /* SQLiteModelTests */, 26E0FCB51C2C9CEB00C192F7 /* Products */, - C76388D93BC1A63CB06D5835 /* Pods */, - 63B9871C30DD419B28BF2CBC /* Frameworks */, + 260563391CD81A6E00006DAD /* Frameworks */, ); sourceTree = ""; }; @@ -118,7 +271,11 @@ isa = PBXGroup; children = ( 26E0FCB41C2C9CEB00C192F7 /* SQLiteModel.framework */, - 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests.xctest */, + 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests-iOS.xctest */, + 262603E91CD5691A00E663CA /* SQLiteModel.framework */, + 262603F21CD5691A00E663CA /* SQLiteModelTests-Mac.xctest */, + 2626041D1CD56E2A00E663CA /* SQLiteModel.framework */, + 262604261CD56E2A00E663CA /* SQLiteModelTests-tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -142,6 +299,7 @@ 26E4B2511CBB1E5300063B12 /* SQLiteModelAsyncTest.swift */, 26CB69941CC138D500FBE712 /* SQLiteModelScalarQueryTests.swift */, 2697215F1CCC07D6003471D4 /* SQLiteModelThreadSafetyTests.swift */, + 2615E6CF1CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift */, 26E0FCC51C2C9CEB00C192F7 /* Info.plist */, ); path = SQLiteModelTests; @@ -150,13 +308,13 @@ 26E0FCEE1C2CA24700C192F7 /* Source */ = { isa = PBXGroup; children = ( + 26E0FD341C2F301200C192F7 /* Database.swift */, 2646B84F1C3CB3880010592A /* Extensions.swift */, 26E4B2531CBB7A5100063B12 /* LogManager.swift */, 263E9DA51CAB6F3B004B3DDC /* Operators.swift */, 264599FF1C4C3EFE00BD4D80 /* Relationship.swift */, 26540D9E1C98ECC4000CE346 /* RelationshipModel.swift */, 26700C381CB4D84F000C8B3A /* SchemaUpdater.swift */, - 26E0FD341C2F301200C192F7 /* SQLiteDatabaseManager.swift */, 26E0FD0F1C2CA3CD00C192F7 /* SQLiteModel.swift */, 26D0E1A21CB06AB200CA93BC /* SQLiteModel+Implementation.swift */, 26E0FD3A1C2F44B600C192F7 /* SQLiteModelContextManager.swift */, @@ -176,29 +334,25 @@ path = SQLiteModel; sourceTree = ""; }; - 63B9871C30DD419B28BF2CBC /* Frameworks */ = { - isa = PBXGroup; - children = ( - 25D3053848CF104B03AFD02F /* Pods_SQLiteModel.framework */, - DAFC1C94575FB2D36D592B9B /* Pods_SQLiteModelTests.framework */, +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 262603E61CD5691A00E663CA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 262604171CD56A1900E663CA /* SQLiteModel.h in Headers */, ); - name = Frameworks; - sourceTree = ""; + runOnlyForDeploymentPostprocessing = 0; }; - C76388D93BC1A63CB06D5835 /* Pods */ = { - isa = PBXGroup; - children = ( - A599D6FFE7D890DD851B7489 /* Pods-SQLiteModel.debug.xcconfig */, - D3364234C8619CEF0EC35D00 /* Pods-SQLiteModel.release.xcconfig */, - A63C0CA19060264B1C951FA7 /* Pods-SQLiteModelTests.debug.xcconfig */, - 8DA9958DF4A2D1A4831EFE2B /* Pods-SQLiteModelTests.release.xcconfig */, + 2626041A1CD56E2A00E663CA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2626043F1CD56F0800E663CA /* SQLiteModel.h in Headers */, ); - name = Pods; - sourceTree = ""; + runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ 26E0FCB11C2C9CEB00C192F7 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -210,45 +364,118 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel */ = { + 262603E81CD5691A00E663CA /* SQLiteModel-Mac */ = { + isa = PBXNativeTarget; + buildConfigurationList = 262603FA1CD5691A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModel-Mac" */; + buildPhases = ( + 262603E41CD5691A00E663CA /* Sources */, + 262603E51CD5691A00E663CA /* Frameworks */, + 262603E61CD5691A00E663CA /* Headers */, + 262603E71CD5691A00E663CA /* Resources */, + 2605632E1CD818A100006DAD /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SQLiteModel-Mac"; + productName = "SQLiteModel Mac"; + productReference = 262603E91CD5691A00E663CA /* SQLiteModel.framework */; + productType = "com.apple.product-type.framework"; + }; + 262603F11CD5691A00E663CA /* SQLiteModelTests-Mac */ = { + isa = PBXNativeTarget; + buildConfigurationList = 262603FD1CD5691A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModelTests-Mac" */; + buildPhases = ( + 262603EE1CD5691A00E663CA /* Sources */, + 262603EF1CD5691A00E663CA /* Frameworks */, + 262603F01CD5691A00E663CA /* Resources */, + 260563461CD81B9400006DAD /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 262603F51CD5691A00E663CA /* PBXTargetDependency */, + ); + name = "SQLiteModelTests-Mac"; + productName = "SQLiteModel MacTests"; + productReference = 262603F21CD5691A00E663CA /* SQLiteModelTests-Mac.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 2626041C1CD56E2A00E663CA /* SQLiteModel-tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 26E0FCC81C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModel" */; + buildConfigurationList = 2626042E1CD56E2A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModel-tvOS" */; + buildPhases = ( + 262604181CD56E2A00E663CA /* Sources */, + 262604191CD56E2A00E663CA /* Frameworks */, + 2626041A1CD56E2A00E663CA /* Headers */, + 2626041B1CD56E2A00E663CA /* Resources */, + 260563321CD8192A00006DAD /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SQLiteModel-tvOS"; + productName = "SQLiteModel tvOS"; + productReference = 2626041D1CD56E2A00E663CA /* SQLiteModel.framework */; + productType = "com.apple.product-type.framework"; + }; + 262604251CD56E2A00E663CA /* SQLiteModelTests-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 262604311CD56E2A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModelTests-tvOS" */; + buildPhases = ( + 262604221CD56E2A00E663CA /* Sources */, + 262604231CD56E2A00E663CA /* Frameworks */, + 262604241CD56E2A00E663CA /* Resources */, + 260563431CD81B7400006DAD /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 262604291CD56E2A00E663CA /* PBXTargetDependency */, + ); + name = "SQLiteModelTests-tvOS"; + productName = "SQLiteModel tvOSTests"; + productReference = 262604261CD56E2A00E663CA /* SQLiteModelTests-tvOS.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 26E0FCC81C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModel-iOS" */; buildPhases = ( - 81153A309AF9DF1CB21B2878 /* Check Pods Manifest.lock */, 26E0FCAF1C2C9CEB00C192F7 /* Sources */, 26E0FCB01C2C9CEB00C192F7 /* Frameworks */, 26E0FCB11C2C9CEB00C192F7 /* Headers */, 26E0FCB21C2C9CEB00C192F7 /* Resources */, - DD9A35B9E7B6793B2D841569 /* Copy Pods Resources */, + 260563311CD818FE00006DAD /* ShellScript */, ); buildRules = ( ); dependencies = ( ); - name = SQLiteModel; + name = "SQLiteModel-iOS"; productName = SQLiteModel; productReference = 26E0FCB41C2C9CEB00C192F7 /* SQLiteModel.framework */; productType = "com.apple.product-type.framework"; }; - 26E0FCBD1C2C9CEB00C192F7 /* SQLiteModelTests */ = { + 26E0FCBD1C2C9CEB00C192F7 /* SQLiteModelTests-iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 26E0FCCB1C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModelTests" */; + buildConfigurationList = 26E0FCCB1C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModelTests-iOS" */; buildPhases = ( - BA938870741CF413EBB4D322 /* Check Pods Manifest.lock */, 26E0FCBA1C2C9CEB00C192F7 /* Sources */, 26E0FCBB1C2C9CEB00C192F7 /* Frameworks */, 26E0FCBC1C2C9CEB00C192F7 /* Resources */, - D98BD37F4FEFD3BBCEA4E797 /* Embed Pods Frameworks */, - F084E186EBE140E2B7C53005 /* Copy Pods Resources */, + 260563401CD81B5100006DAD /* CopyFiles */, ); buildRules = ( ); dependencies = ( 26E0FCC11C2C9CEB00C192F7 /* PBXTargetDependency */, ); - name = SQLiteModelTests; + name = "SQLiteModelTests-iOS"; productName = SQLiteModelTests; - productReference = 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests.xctest */; + productReference = 26E0FCBE1C2C9CEB00C192F7 /* SQLiteModelTests-iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -257,10 +484,23 @@ 26E0FCAB1C2C9CEB00C192F7 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0720; + LastSwiftUpdateCheck = 0730; LastUpgradeCheck = 0720; ORGANIZATIONNAME = jhurray; TargetAttributes = { + 262603E81CD5691A00E663CA = { + CreatedOnToolsVersion = 7.3; + }; + 262603F11CD5691A00E663CA = { + CreatedOnToolsVersion = 7.3; + }; + 2626041C1CD56E2A00E663CA = { + CreatedOnToolsVersion = 7.3; + DevelopmentTeam = 43LEM8BQ2H; + }; + 262604251CD56E2A00E663CA = { + CreatedOnToolsVersion = 7.3; + }; 26E0FCB31C2C9CEB00C192F7 = { CreatedOnToolsVersion = 7.2; }; @@ -281,13 +521,45 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel */, - 26E0FCBD1C2C9CEB00C192F7 /* SQLiteModelTests */, + 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel-iOS */, + 26E0FCBD1C2C9CEB00C192F7 /* SQLiteModelTests-iOS */, + 262603E81CD5691A00E663CA /* SQLiteModel-Mac */, + 262603F11CD5691A00E663CA /* SQLiteModelTests-Mac */, + 2626041C1CD56E2A00E663CA /* SQLiteModel-tvOS */, + 262604251CD56E2A00E663CA /* SQLiteModelTests-tvOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 262603E71CD5691A00E663CA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 262603F01CD5691A00E663CA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2626041B1CD56E2A00E663CA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 262604241CD56E2A00E663CA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 26E0FCB21C2C9CEB00C192F7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -305,91 +577,114 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 81153A309AF9DF1CB21B2878 /* Check Pods Manifest.lock */ = { + 260563311CD818FE00006DAD /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/SQLite.framework", ); - name = "Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; + shellScript = "/usr/local/bin/carthage copy-frameworks"; }; - BA938870741CF413EBB4D322 /* Check Pods Manifest.lock */ = { + 260563321CD8192A00006DAD /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/SQLite.framework", ); - name = "Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; + shellScript = "/usr/local/bin/carthage copy-frameworks"; }; - D98BD37F4FEFD3BBCEA4E797 /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 262603E41CD5691A00E663CA /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - ); - name = "Embed Pods Frameworks"; - outputPaths = ( + 2626040B1CD56A0E00E663CA /* Database.swift in Sources */, + 2626040C1CD56A0E00E663CA /* Extensions.swift in Sources */, + 2626040D1CD56A0E00E663CA /* LogManager.swift in Sources */, + 2626040E1CD56A0E00E663CA /* Operators.swift in Sources */, + 2626040F1CD56A0E00E663CA /* Relationship.swift in Sources */, + 262604101CD56A0E00E663CA /* RelationshipModel.swift in Sources */, + 262604111CD56A0E00E663CA /* SchemaUpdater.swift in Sources */, + 262604121CD56A0E00E663CA /* SQLiteModel.swift in Sources */, + 262604131CD56A0E00E663CA /* SQLiteModel+Implementation.swift in Sources */, + 262604141CD56A0E00E663CA /* SQLiteModelContextManager.swift in Sources */, + 262604151CD56A0E00E663CA /* SQLiteModelError.swift in Sources */, + 262604161CD56A0E00E663CA /* SyncManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; }; - DD9A35B9E7B6793B2D841569 /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; + 262603EE1CD5691A00E663CA /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( + 262604021CD5699900E663CA /* SQLiteModelTestCase.swift in Sources */, + 262604031CD5699900E663CA /* SQLiteModelFunctionalitySmokeTests.swift in Sources */, + 262604041CD5699900E663CA /* SQLiteModelSingularRelationshipTest.swift in Sources */, + 262604051CD5699900E663CA /* SQLiteModelMultipleRelationshipTest.swift in Sources */, + 262604061CD5699900E663CA /* SQLiteModelSchemaUpdaterTests.swift in Sources */, + 262604071CD5699900E663CA /* SQLiteModelAsyncTest.swift in Sources */, + 262604081CD5699900E663CA /* SQLiteModelScalarQueryTests.swift in Sources */, + 262604091CD5699900E663CA /* SQLiteModelThreadSafetyTests.swift in Sources */, + 2626040A1CD5699900E663CA /* SQLiteModelDatabaseTest.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SQLiteModel/Pods-SQLiteModel-resources.sh\"\n"; - showEnvVarsInLog = 0; }; - F084E186EBE140E2B7C53005 /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; + 262604181CD56E2A00E663CA /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 262604401CD56F8300E663CA /* Database.swift in Sources */, + 262604411CD56F8300E663CA /* Extensions.swift in Sources */, + 262604421CD56F8300E663CA /* LogManager.swift in Sources */, + 262604431CD56F8300E663CA /* Operators.swift in Sources */, + 262604441CD56F8300E663CA /* Relationship.swift in Sources */, + 262604451CD56F8300E663CA /* RelationshipModel.swift in Sources */, + 262604461CD56F8300E663CA /* SchemaUpdater.swift in Sources */, + 262604471CD56F8300E663CA /* SQLiteModel.swift in Sources */, + 262604481CD56F8300E663CA /* SQLiteModel+Implementation.swift in Sources */, + 262604491CD56F8300E663CA /* SQLiteModelContextManager.swift in Sources */, + 2626044A1CD56F8300E663CA /* SQLiteModelError.swift in Sources */, + 2626044B1CD56F8300E663CA /* SyncManager.swift in Sources */, ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( + runOnlyForDeploymentPostprocessing = 0; + }; + 262604221CD56E2A00E663CA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 262604361CD56EA500E663CA /* SQLiteModelTestCase.swift in Sources */, + 262604371CD56EA500E663CA /* SQLiteModelFunctionalitySmokeTests.swift in Sources */, + 262604381CD56EA500E663CA /* SQLiteModelSingularRelationshipTest.swift in Sources */, + 262604391CD56EA500E663CA /* SQLiteModelMultipleRelationshipTest.swift in Sources */, + 2626043A1CD56EA500E663CA /* SQLiteModelSchemaUpdaterTests.swift in Sources */, + 2626043B1CD56EA500E663CA /* SQLiteModelAsyncTest.swift in Sources */, + 2626043C1CD56EA500E663CA /* SQLiteModelScalarQueryTests.swift in Sources */, + 2626043D1CD56EA500E663CA /* SQLiteModelThreadSafetyTests.swift in Sources */, + 2626043E1CD56EA500E663CA /* SQLiteModelDatabaseTest.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SQLiteModelTests/Pods-SQLiteModelTests-resources.sh\"\n"; - showEnvVarsInLog = 0; }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ 26E0FCAF1C2C9CEB00C192F7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 26700C3D1CB89332000C8B3A /* SyncManager.swift in Sources */, 26459A001C4C3EFE00BD4D80 /* Relationship.swift in Sources */, - 26E0FD351C2F301200C192F7 /* SQLiteDatabaseManager.swift in Sources */, + 26E0FD351C2F301200C192F7 /* Database.swift in Sources */, 2646B8501C3CB3880010592A /* Extensions.swift in Sources */, 26E0FD311C2CA65900C192F7 /* SQLiteModelError.swift in Sources */, 26E0FD3B1C2F44B600C192F7 /* SQLiteModelContextManager.swift in Sources */, @@ -407,6 +702,7 @@ buildActionMask = 2147483647; files = ( 26E0FCC41C2C9CEB00C192F7 /* SQLiteModelFunctionalitySmokeTests.swift in Sources */, + 2615E6D01CD04EC7002FE695 /* SQLiteModelDatabaseTest.swift in Sources */, 263E9DAA1CAB79A0004B3DDC /* SQLiteModelMultipleRelationshipTest.swift in Sources */, 26E4B2521CBB1E5300063B12 /* SQLiteModelAsyncTest.swift in Sources */, 269721601CCC07D6003471D4 /* SQLiteModelThreadSafetyTests.swift in Sources */, @@ -420,14 +716,214 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 262603F51CD5691A00E663CA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 262603E81CD5691A00E663CA /* SQLiteModel-Mac */; + targetProxy = 262603F41CD5691A00E663CA /* PBXContainerItemProxy */; + }; + 262604291CD56E2A00E663CA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2626041C1CD56E2A00E663CA /* SQLiteModel-tvOS */; + targetProxy = 262604281CD56E2A00E663CA /* PBXContainerItemProxy */; + }; 26E0FCC11C2C9CEB00C192F7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel */; + target = 26E0FCB31C2C9CEB00C192F7 /* SQLiteModel-iOS */; targetProxy = 26E0FCC01C2C9CEB00C192F7 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 262603FB1CD5691A00E663CA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = SQLiteModel/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-Mac"; + PRODUCT_NAME = SQLiteModel; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = macosx; + }; + name = Debug; + }; + 262603FC1CD5691A00E663CA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = SQLiteModel/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-Mac"; + PRODUCT_NAME = SQLiteModel; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = macosx; + }; + name = Release; + }; + 262603FE1CD5691A00E663CA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + INFOPLIST_FILE = SQLiteModelTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-MacTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = macosx; + }; + name = Debug; + }; + 262603FF1CD5691A00E663CA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); + INFOPLIST_FILE = SQLiteModelTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-MacTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = macosx; + }; + name = Release; + }; + 2626042F1CD56E2A00E663CA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = SQLiteModel/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-tvOS"; + PRODUCT_NAME = SQLiteModel; + PROVISIONING_PROFILE = ""; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.1; + }; + name = Debug; + }; + 262604301CD56E2A00E663CA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = SQLiteModel/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-tvOS"; + PRODUCT_NAME = SQLiteModel; + PROVISIONING_PROFILE = ""; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.1; + }; + name = Release; + }; + 262604321CD56E2A00E663CA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = SQLiteModelTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Debug; + }; + 262604331CD56E2A00E663CA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); + INFOPLIST_FILE = SQLiteModelTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Release; + }; 26E0FCC61C2C9CEB00C192F7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -449,6 +945,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -465,10 +962,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -497,6 +996,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -507,9 +1007,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; + ONLY_ACTIVE_ARCH = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -519,18 +1022,22 @@ }; 26E0FCC91C2C9CEB00C192F7 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A599D6FFE7D890DD851B7489 /* Pods-SQLiteModel.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = SQLiteModel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.guarenteed.SQLiteModel; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-iOS"; + PRODUCT_NAME = SQLiteModel; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -538,26 +1045,34 @@ }; 26E0FCCA1C2C9CEB00C192F7 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D3364234C8619CEF0EC35D00 /* Pods-SQLiteModel.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = SQLiteModel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.guarenteed.SQLiteModel; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.guarenteed.SQLiteModel-iOS"; + PRODUCT_NAME = SQLiteModel; SKIP_INSTALL = YES; }; name = Release; }; 26E0FCCC1C2C9CEB00C192F7 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A63C0CA19060264B1C951FA7 /* Pods-SQLiteModelTests.debug.xcconfig */; buildSettings = { + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = SQLiteModelTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.guarenteed.SQLiteModelTests; @@ -567,8 +1082,12 @@ }; 26E0FCCD1C2C9CEB00C192F7 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8DA9958DF4A2D1A4831EFE2B /* Pods-SQLiteModelTests.release.xcconfig */; buildSettings = { + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = SQLiteModelTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.guarenteed.SQLiteModelTests; @@ -579,6 +1098,42 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 262603FA1CD5691A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModel-Mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 262603FB1CD5691A00E663CA /* Debug */, + 262603FC1CD5691A00E663CA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 262603FD1CD5691A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModelTests-Mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 262603FE1CD5691A00E663CA /* Debug */, + 262603FF1CD5691A00E663CA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2626042E1CD56E2A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModel-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2626042F1CD56E2A00E663CA /* Debug */, + 262604301CD56E2A00E663CA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 262604311CD56E2A00E663CA /* Build configuration list for PBXNativeTarget "SQLiteModelTests-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 262604321CD56E2A00E663CA /* Debug */, + 262604331CD56E2A00E663CA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 26E0FCAE1C2C9CEB00C192F7 /* Build configuration list for PBXProject "SQLiteModel" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -588,7 +1143,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 26E0FCC81C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModel" */ = { + 26E0FCC81C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModel-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 26E0FCC91C2C9CEB00C192F7 /* Debug */, @@ -597,7 +1152,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 26E0FCCB1C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModelTests" */ = { + 26E0FCCB1C2C9CEB00C192F7 /* Build configuration list for PBXNativeTarget "SQLiteModelTests-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 26E0FCCC1C2C9CEB00C192F7 /* Debug */, diff --git a/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-Mac.xcscheme b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-Mac.xcscheme new file mode 100644 index 0000000..8fc5dbb --- /dev/null +++ b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-Mac.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-iOS.xcscheme b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-iOS.xcscheme new file mode 100644 index 0000000..06a0b16 --- /dev/null +++ b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-iOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-tvOS.xcscheme b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-tvOS.xcscheme new file mode 100644 index 0000000..63907fe --- /dev/null +++ b/SQLiteModel.xcodeproj/xcshareddata/xcschemes/SQLiteModel-tvOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SQLiteModel.xcworkspace/contents.xcworkspacedata b/SQLiteModel.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 36de0a4..0000000 --- a/SQLiteModel.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/SQLiteModel/Database.swift b/SQLiteModel/Database.swift new file mode 100644 index 0000000..751dcfe --- /dev/null +++ b/SQLiteModel/Database.swift @@ -0,0 +1,97 @@ +// +// SQLiteDatabaseManager.swift +// SQLiteModel +// +// Created by Jeff Hurray on 12/26/15. +// Copyright © 2015 jhurray. All rights reserved. +// + +import Foundation +import SQLite + +public enum DatabaseType { + case Disk(name: String) + case TemporaryDisk + case InMemory + case ReadOnly(name: String) + + internal func database() throws -> Connection { + let path = try self.path() + print(path) + let db = try Connection(path) + db.trace {LogManager.log("SQLiteModel: \n\($0)\n")} + db.busyTimeout = 5 + db.busyHandler({ tries in + if tries >= 3 { + return false + } + return true + }) + return db + } + + private func path() throws -> Connection.Location { + switch self { + case .Disk(let name): + #if os(iOS) + guard let path = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first else { + throw SQLiteModelError.InitializeDatabase + } + return Connection.Location.URI("\(path)/\(name).sqlite3") + #elseif os(OSX) + guard let appSupportPath = NSSearchPathForDirectoriesInDomains( + .ApplicationSupportDirectory, .UserDomainMask, true + ).first else { + throw SQLiteModelError.InitializeDatabase + } + let bundlePath = NSBundle.mainBundle().bundlePath + let applicationName = NSFileManager.defaultManager().displayNameAtPath(bundlePath) + let path = appSupportPath + "/" + applicationName + try NSFileManager.defaultManager().createDirectoryAtPath( + path, withIntermediateDirectories: true, attributes: nil + ) + return Connection.Location.URI("\(path)/\(name).sqlite3") + #elseif os(tvOS) + // Caveat: tvOS does not yet support persistent storage on disk. + // You must depend on the relatively low cache wipe frequencyof the OS + // Or use an InMemory database. + guard let path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true).first else { + throw SQLiteModelError.InitializeDatabase + } + return Connection.Location.URI("\(path)/\(name).sqlite3") + #endif + case .TemporaryDisk: + return Connection.Location.Temporary + case .InMemory: + return Connection.Location.InMemory + case .ReadOnly(let name): + guard let path = NSBundle.mainBundle().pathForResource(name, ofType: "sqlite3") else { + throw SQLiteModelError.InitializeDatabase + } + return Connection.Location.URI(path) + } + } +} + +public class Database { + + private(set) static var sharedDatabase: Database = Database() + + private let type: DatabaseType + private let database: Connection + private(set) var cache: SQLiteModelContextManager = SQLiteModelContextManager() + + public init(databaseType: DatabaseType = DatabaseType.Disk(name: "sqlite_model_default_database")) { + self.type = databaseType + do { + self.database = try type.database() + } + catch let error { + fatalError("SQLiteModel Fatal Error - Could not initialize database correctly. Error: \(error).") + } + } + + public func connection() -> Connection { + return self.database + } +} diff --git a/SQLiteModel/Extensions.swift b/SQLiteModel/Extensions.swift index 1c8e548..40c49dc 100644 --- a/SQLiteModel/Extensions.swift +++ b/SQLiteModel/Extensions.swift @@ -57,10 +57,10 @@ extension TableBuilder { } public func relationship(column: Relationship, mappedFrom model: U.Type) { - Meta.createRelationshipForModel(model, relationship: column) + model.connection.cache.createRelationshipForModel(model, relationship: column) } public func relationship(column: Relationship<[V]>, mappedFrom model: U.Type) { - Meta.createRelationshipForModel(model, relationship: column) + model.connection.cache.createRelationshipForModel(model, relationship: column) } } diff --git a/SQLiteModel/Operators.swift b/SQLiteModel/Operators.swift index 4564d1a..a9143ac 100644 --- a/SQLiteModel/Operators.swift +++ b/SQLiteModel/Operators.swift @@ -176,19 +176,19 @@ ModelType.RelationshipColumn <- value */ public func <- (column: Relationship, value: V) -> RelationshipSetter { - return RelationshipSetter(action: { (model: SQLiteConvertible) -> Void in + return RelationshipSetter(action: { (model: SQLiteSettable) -> Void in model.set(column, value: value) }) } public func <- (column: Relationship, value: V?) -> RelationshipSetter { - return RelationshipSetter(action: { (model: SQLiteConvertible) -> Void in + return RelationshipSetter(action: { (model: SQLiteSettable) -> Void in model.set(column, value: value) }) } public func <- (column: Relationship<[V]>, value: [V]) -> RelationshipSetter { - return RelationshipSetter(action: { (model: SQLiteConvertible) -> Void in + return RelationshipSetter(action: { (model: SQLiteSettable) -> Void in model.set(column, value: value) }) } diff --git a/SQLiteModel/Relationship.swift b/SQLiteModel/Relationship.swift index 800c804..e0088a2 100644 --- a/SQLiteModel/Relationship.swift +++ b/SQLiteModel/Relationship.swift @@ -46,7 +46,7 @@ extension Relationship where DataType : _OptionalType{ } public struct RelationshipSetter { - internal let action: (SQLiteConvertible) -> Void + internal let action: (SQLiteSettable) -> Void } internal struct RelationshipReferenceTracker { diff --git a/SQLiteModel/RelationshipModel.swift b/SQLiteModel/RelationshipModel.swift index b24a0f3..92a7258 100644 --- a/SQLiteModel/RelationshipModel.swift +++ b/SQLiteModel/RelationshipModel.swift @@ -16,8 +16,8 @@ struct RelationshipColumns { internal protocol RelationshipModel : SQLiteModel { - typealias LeftModel: SQLiteModel - typealias RightModel: SQLiteModel + associatedtype LeftModel: SQLiteModel + associatedtype RightModel: SQLiteModel static func initialize() -> Void static func removeLeft(leftID: SQLiteModelID) -> Void @@ -71,15 +71,25 @@ extension SingularRelationshipModel { static func getRelationship(leftID: SQLiteModelID) -> RightModel? { - guard let rightID = Meta.queryCachedValueForSingularRelationship(self, queryColumn: RelationshipColumns.LeftID, queryValue: leftID, returnColumn: RelationshipColumns.RightID) else { - return nil + guard let rightID = contextManager.queryCachedValueForSingularRelationship(self, queryColumn: RelationshipColumns.LeftID, queryValue: leftID, returnColumn: RelationshipColumns.RightID) else { + if let result = try? self.fetch(self.table.filter(RelationshipColumns.LeftID == leftID)) where result.count == 1 { + guard let rightID = result.first?.get(RelationshipColumns.RightID), + let instance = try? RightModel.find(rightID) + else { + return nil + } + return instance + } + else { + return nil + } } return RightModel(localID: rightID) } final static func setRelationship(left: LeftModel, right: RightModel) { - if Meta.hasLocalInstanceContextForSingularRelationhip(self, leftID: left.localID) { + if contextManager.hasLocalInstanceContextForSingularRelationhip(self, leftID: left.localID) { let setters = [ RelationshipColumns.RightID <- right.localID, ] @@ -95,7 +105,7 @@ extension SingularRelationshipModel { RelationshipColumns.LeftID <- left.localID, RelationshipColumns.RightID <- right.localID, ] - let _ = try! self.new(setters).localID + let _ = try! self.new(setters) } } @@ -138,25 +148,40 @@ internal struct UniqueSingularRelationship [RightModel] + static func getRelationship(leftID: SQLiteModelID, query: QueryType?) -> [RightModel] static func setRelationship(left: LeftModel, right: [RightModel]) } extension MultipleRelationshipModel { - static func getRelationship(leftID: SQLiteModelID) -> [RightModel] { + static func getRelationship(leftID: SQLiteModelID, query: QueryType?) -> [RightModel] { + let rightIDs = contextManager.queryCachedValueForRelationship(self, queryColumn: RelationshipColumns.LeftID, queryValue: leftID, returnColumn: RelationshipColumns.RightID) - let rightIDs = Meta.queryCachedValueForRelationship(self, queryColumn: RelationshipColumns.LeftID, queryValue: leftID, returnColumn: RelationshipColumns.RightID) - let cachedIDsSplit = Meta.queryCachedInstanceIDsFor(RightModel.self, hashes: rightIDs.sort{ $0 < $1}) - var instances: [RightModel] = cachedIDsSplit.0.map { RightModel(localID: $0) } - if cachedIDsSplit.1.count > 0 { - let query = RightModel.table.filter(rightIDs.contains(RightModel.localIDExpression)) - guard let fetchedInstances = try? RightModel.fetch(query) else { - return instances + if rightIDs.count == 0 || query != nil { // No values have been cached thus far + let mapQuery = self.table.filter(RelationshipColumns.LeftID == leftID) + guard let fetchedMapping = try? self.fetch(mapQuery) else { + return [] + } + let rightIDs = fetchedMapping.map({ $0.get(RelationshipColumns.RightID) }) + let rightQuery = query != nil ? query : RightModel.query + let instanceQuery = rightQuery!.filter(rightIDs.contains(RightModel.localIDExpression)) + guard let fetchedInstances = try? RightModel.fetch(instanceQuery) else { + return [] + } + return fetchedInstances + } + else { + let cachedIDsSplit = contextManager.queryCachedInstanceIDsFor(RightModel.self, hashes: rightIDs.sort{ $0 < $1}) + var instances: [RightModel] = cachedIDsSplit.0.map { RightModel(localID: $0) } + if cachedIDsSplit.1.count > 0 { + let query = RightModel.table.filter(cachedIDsSplit.1.contains(RightModel.localIDExpression)) + guard let fetchedInstances = try? RightModel.fetch(query) else { + return instances + } + instances += fetchedInstances } - instances += fetchedInstances + return instances } - return instances } static func setRelationship(left: LeftModel, right: [RightModel]) { @@ -169,7 +194,7 @@ extension MultipleRelationshipModel { } let now = NSDate() let dateString = dateFormatter.stringFromDate(now) - var statement = "INSERT INTO \(self.tableName) (left_id, right_id, sqlmdl_localCreatedAt, sqlmdl_localUpdatedAt) VALUES" + var statement = "INSERT OR IGNORE INTO \(self.tableName) (left_id, right_id, sqlmdl_localCreatedAt, sqlmdl_localUpdatedAt) VALUES" for rightID in right.map({ $0.localID }) { statement += " (\(left.localID), \(rightID), '\(dateString)', '\(dateString)')," } @@ -180,7 +205,7 @@ extension MultipleRelationshipModel { try connection.execute(statement) let query = self.query.filter(RelationshipColumns.LeftID == left.localID) for row in try connection.prepare(query) { - Meta.createLocalInstanceContextFor(self, row: row) + contextManager.createLocalInstanceContextFor(self, row: row) } }) } diff --git a/SQLiteModel/SQLiteDatabaseManager.swift b/SQLiteModel/SQLiteDatabaseManager.swift deleted file mode 100644 index bd9207a..0000000 --- a/SQLiteModel/SQLiteDatabaseManager.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// SQLiteDatabaseManager.swift -// SQLiteModel -// -// Created by Jeff Hurray on 12/26/15. -// Copyright © 2015 jhurray. All rights reserved. -// - -import Foundation -import SQLite - -public enum DatabaseType { - case Disk - case TemporaryDisk - case InMemory - - func database() throws -> Connection { - let path = try self.path() - let db = try Connection(path) - db.trace {LogManager.log("SQLiteModel: \n\($0)\n")} - db.busyTimeout = 5 - return db - } - - private func path() throws -> Connection.Location { - - switch self { - case .Disk: - #if os(iOS) - let path = NSSearchPathForDirectoriesInDomains( - .DocumentDirectory, .UserDomainMask, true - ).first! - return Connection.Location.URI("\(path)/db.sqlite3") - #elseif os(OSX) - let path = NSSearchPathForDirectoriesInDomains( - .ApplicationSupportDirectory, .UserDomainMask, true - ).first! + NSBundle.mainBundle().bundleIdentifier! - - // create parent directory iff it doesn’t exist - try NSFileManager.defaultManager().createDirectoryAtPath( - path, withIntermediateDirectories: true, attributes: nil - ) - return Connection.Location.URI("\(path)/db.sqlite3") - #elseif os(tvOS) - let path = NSSearchPathForDirectoriesInDomains( - .DocumentDirectory, .UserDomainMask, true - ).first! - return Connection.Location.URI("\(path)/db.sqlite3") - #endif - case .TemporaryDisk: - return Connection.Location.Temporary - case .InMemory: - return Connection.Location.InMemory - } - } -} - -public class SQLiteDatabaseManager { - - private static let _sharedInstance = SQLiteDatabaseManager() - - private var database: Connection? - private var type: DatabaseType = DatabaseType.Disk - - internal static func connection() throws -> Connection { - if let db = self._sharedInstance.database { - return db - } - else { - self._sharedInstance.database = try self._sharedInstance.type.database() - return self._sharedInstance.database! - } - } - - public static func setDataBaseType(type: DatabaseType) { - guard self._sharedInstance.type != type else { - return - } - self._sharedInstance.type = type - self._sharedInstance.database = nil - } -} - diff --git a/SQLiteModel/SQLiteModel+Implementation.swift b/SQLiteModel/SQLiteModel+Implementation.swift index 5178a76..b67ded8 100644 --- a/SQLiteModel/SQLiteModel+Implementation.swift +++ b/SQLiteModel/SQLiteModel+Implementation.swift @@ -13,24 +13,38 @@ import SQLite public extension SQLiteModel { + // MARK: SQLiteConvertible + static var tableName : String { return String(self) } + static var connection: Database { + return Database.sharedDatabase + } + + internal static var contextManager: SQLiteModelContextManager { + return self.connection.cache + } + + internal var contextManager: SQLiteModelContextManager { + return self.dynamicType.contextManager + } + internal static var table : Table { - return Meta.tableForModel(self) + return contextManager.tableForModel(self) } internal static var localIDExpression : Expression { - return Meta.localIDExpressionForModel(self) + return contextManager.localIDExpressionForModel(self) } internal static var localUpdatedAtExpression : Expression { - return Meta.localUpdatedAtExpressionForModel(self) + return contextManager.localUpdatedAtExpressionForModel(self) } internal static var localCreatedAtExpression : Expression { - return Meta.localCreatedAtExpressionForModel(self) + return contextManager.localCreatedAtExpressionForModel(self) } internal static func instanceQueryWithLocalID(localID: SQLiteModelID) -> QueryType { @@ -43,11 +57,11 @@ public extension SQLiteModel { } var localCreatedAt: NSDate? { - return Meta.localCreatedAtForModel(self.dynamicType, hash: self.localID) + return contextManager.localCreatedAtForModel(self.dynamicType, hash: self.localID) } var localUpdatedAt: NSDate? { - return Meta.localUpdatedAtForModel(self.dynamicType, hash: self.localID) + return contextManager.localUpdatedAtForModel(self.dynamicType, hash: self.localID) } static var query: QueryType { @@ -64,8 +78,7 @@ public extension SQLiteModel { internal typealias ConnectionBlock = (connection: Connection) throws -> Void internal static func sqlmdl_connect(error error: SQLiteModelError, instance: Any? = nil, connectionBlock: ConnectionBlock) throws -> Void { do { - let connection = try SQLiteDatabaseManager.connection() - try connectionBlock(connection: connection) + try connectionBlock(connection: connection.connection()) } catch let caughtError { error.logError(self, error: caughtError) @@ -76,8 +89,7 @@ public extension SQLiteModel { internal typealias ConnectionFetchBlock = (connection: Connection) throws -> [Self] internal static func sqlmdl_connect(error error: SQLiteModelError, connectionBlock: ConnectionFetchBlock) throws -> [Self] { do { - let connection = try SQLiteDatabaseManager.connection() - let result = try connectionBlock(connection: connection) + let result = try connectionBlock(connection: connection.connection()) return result } catch let caughtError { @@ -88,8 +100,7 @@ public extension SQLiteModel { internal static func sqlmdl_connect(error error: SQLiteModelError = .ScalarQueryError, connectionBlock: (connection: Connection) throws -> V?) throws -> V? { do { - let connection = try SQLiteDatabaseManager.connection() - let result = try connectionBlock(connection: connection) + let result = try connectionBlock(connection: connection.connection()) return result } catch let caughtError { @@ -169,7 +180,7 @@ public extension SQLiteModel { try self.connect(error: SQLiteModelError.DropError, connectionBlock: { connection in try connection.run(self.table.drop(ifExists: true)) - Meta.removeContextForModel(self) + contextManager.removeContextForModel(self) let schemaUpdater = SchemaUpdater(table: self.table, tableName: self.tableName) self.alterSchema(schemaUpdater) schemaUpdater.invalidateAlterations() @@ -189,7 +200,7 @@ public extension SQLiteModel { final static func deleteAll() throws -> Void { try self.delete(self.query) - Meta.removeAllLocalInstanceContextsFor(self) + contextManager.removeAllLocalInstanceContextsFor(self) } static func deleteAllInBackground(completion: Completion? = nil) -> Void { @@ -201,7 +212,7 @@ public extension SQLiteModel { try self.connect(error: SQLiteModelError.DeleteError, connectionBlock: { connection in for row in try connection.prepare(query) { let ID = row[self.localIDExpression] - Meta.removeLocalInstanceContextFor(self, hash: ID) + contextManager.removeLocalInstanceContextFor(self, hash: ID) } try connection.run(query.delete()) }) @@ -230,7 +241,7 @@ public extension SQLiteModel { } let localID = row[self.localIDExpression] let instance = Self(localID: localID) - Meta.createLocalInstanceContextFor(self, row: row) + contextManager.createLocalInstanceContextFor(self, row: row) for relationshipSetter in relationshipSetters { relationshipSetter.action(instance) } @@ -259,7 +270,7 @@ public extension SQLiteModel { // MARK: SQLiteFetchable final static func find(id: SQLiteModelID) throws -> Self { - if Meta.hasLocalInstanceContextFor(self, hash: id) { + if contextManager.hasLocalInstanceContextFor(self, hash: id) { return Self(localID: id) } @@ -268,8 +279,8 @@ public extension SQLiteModel { throw SQLiteModelError.FetchError } let localID = row[self.localIDExpression] - if let _ = Meta.localInstanceContextForModel(self, hash: localID) {} else { - Meta.createLocalInstanceContextFor(self, row: row) + if let _ = contextManager.localInstanceContextForModel(self, hash: localID) {} else { + contextManager.createLocalInstanceContextFor(self, row: row) } let instance = Self(localID: localID) return [instance] @@ -303,7 +314,7 @@ public extension SQLiteModel { var fetchedInstances: [Self] = [] for row in try connection.prepare(query) { let localID = row[self.localIDExpression] - Meta.createLocalInstanceContextFor(self, row: row) + contextManager.createLocalInstanceContextFor(self, row: row) let instance = Self(localID: localID) fetchedInstances.append(instance) } @@ -343,7 +354,7 @@ public extension SQLiteModel { } } for row in try connection.prepare(query) { - Meta.createLocalInstanceContextFor(self, row: row) + contextManager.createLocalInstanceContextFor(self, row: row) } }) } @@ -379,13 +390,13 @@ public extension SQLiteModel { final mutating func save() throws { try self.connect(error: SQLiteModelError.UpdateError, connectionBlock: { (connection) -> Void in let now = NSDate() - var setters = Meta.settersForModel(self.dynamicType, hash: self.localID) + var setters = self.contextManager.settersForModel(self.dynamicType, hash: self.localID) setters.append(self.dynamicType.localUpdatedAtExpression <- now) try connection.run(self.instanceQuery.update(setters)) guard let row = connection.pluck(self.dynamicType.table.select(distinct: *).filter(self.dynamicType.localIDExpression == self.localID)) else { throw SQLiteModelError.UpdateError } - Meta.createLocalInstanceContextFor(self.dynamicType, row: row) + self.contextManager.createLocalInstanceContextFor(self.dynamicType, row: row) }) } @@ -401,7 +412,7 @@ public extension SQLiteModel { final func delete() throws { try self.connect(error: SQLiteModelError.DeleteError, connectionBlock: { (connection) -> Void in try connection.run(self.instanceQuery.delete()) - Meta.removeLocalInstanceContextFor(self.dynamicType, hash: self.localID) + self.contextManager.removeLocalInstanceContextFor(self.dynamicType, hash: self.localID) }) } @@ -415,7 +426,7 @@ public extension SQLiteModel { } func countForRelationship(column: Relationship<[V]>) -> Int { - return Meta.countForRelationshipForInstance(self, relationship: column) + return contextManager.countForRelationshipForInstance(self, relationship: column) } // MARK: SQLiteModelAbstract @@ -424,16 +435,14 @@ public extension SQLiteModel { // Empty implimentation to make method optional } - // MARK: SQLiteConvertible - - // Set + // MARK: SQLiteGettable final func get(column: Expression) -> V { return self.get(Expression(column))! } final func get(column: Expression) -> V? { - let value = Meta.getValueForModel(self.dynamicType, hash: self.localID, expression: column) + let value = contextManager.getValueForModel(self.dynamicType, hash: self.localID, expression: column) return value } @@ -442,11 +451,11 @@ public extension SQLiteModel { } final func get(column: Relationship) -> V? { - return Meta.getRelationshipForModel(self.dynamicType, hash: self.localID, relationship: column) + return contextManager.getRelationshipForModel(self.dynamicType, hash: self.localID, relationship: column) } - final func get(column: Relationship<[V]>) -> [V] { - return Meta.getRelationshipForModel(self.dynamicType, hash: self.localID, relationship: column) + final func get(column: Relationship<[V]>, query: QueryType? = nil) -> [V] { + return contextManager.getRelationshipForModel(self.dynamicType, hash: self.localID, relationship: column, query: query) } final func getInBackground(column: Relationship, completion: (V) -> Void) { @@ -467,23 +476,23 @@ public extension SQLiteModel { } } - final func getInBackground(column: Relationship<[V]>, completion: ([V]) -> Void) { + final func getInBackground(column: Relationship<[V]>, query: QueryType? = nil, completion: ([V]) -> Void) { SyncManager.async(self.dynamicType) { - let value = self.get(column) + let value = self.get(column, query: query) SyncManager.main({ completion(value) }) } } - // Set + // MARK: SQLiteSettable final func set(column: Expression, value: V) { self.set(Expression(column), value: value) } final func set(column: Expression, value: V?) { - Meta.setValueForModel(self.dynamicType, hash: self.localID, column: column, value: value) + contextManager.setValueForModel(self.dynamicType, hash: self.localID, column: column, value: value) } final func set(column: Relationship, value: V) { @@ -491,11 +500,11 @@ public extension SQLiteModel { } final func set(column: Relationship, value: V?) { - Meta.setRelationshipForModel(self.dynamicType, relationship: column, value: (self, value)) + contextManager.setRelationshipForModel(self.dynamicType, relationship: column, value: (self, value)) } final func set(column: Relationship<[V]>, value: [V]) { - Meta.setRelationshipForModel(self.dynamicType, relationship: column, value: (self, value)) + contextManager.setRelationshipForModel(self.dynamicType, relationship: column, value: (self, value)) } final func setInBackground(column: Relationship, value: V, completion: (Void -> Void)? = nil) { @@ -525,6 +534,16 @@ public extension SQLiteModel { } } + // MARK: SQLiteMemoryManagement + + static func clearCache() { + self.contextManager.removeAllLocalInstanceContextsFor(self) + } + + func clearCache() { + self.contextManager.removeLocalInstanceContextFor(self.dynamicType, hash: self.localID) + } + // MARK: SQLiteScalarQueryable static func count() throws -> Int { diff --git a/SQLiteModel/SQLiteModel.h b/SQLiteModel/SQLiteModel.h index 8c44115..d92e58a 100644 --- a/SQLiteModel/SQLiteModel.h +++ b/SQLiteModel/SQLiteModel.h @@ -8,11 +8,5 @@ @import Foundation; -//! Project version number for SQLiteModel. FOUNDATION_EXPORT double SQLiteModelVersionNumber; - -//! Project version string for SQLiteModel. FOUNDATION_EXPORT const unsigned char SQLiteModelVersionString[]; - -@import SQLite; - diff --git a/SQLiteModel/SQLiteModel.swift b/SQLiteModel/SQLiteModel.swift index 0e3685e..21d1c6f 100644 --- a/SQLiteModel/SQLiteModel.swift +++ b/SQLiteModel/SQLiteModel.swift @@ -21,20 +21,26 @@ public protocol SQLiteModelAbstract { } public protocol SQLiteConvertible: SQLiteModelAbstract { - + static var tableName: String {get} + static var connection: Database {get} +} + +public protocol SQLiteGettable { func get(column: Expression) -> V func get(column: Expression) -> V? func get(column: Relationship) -> V func get(column: Relationship) -> V? // Ordered by localID Ascending - func get(column: Relationship<[V]>) -> [V] + func get(column: Relationship<[V]>, query: QueryType?) -> [V] func getInBackground(column: Relationship, completion: (V) -> Void) func getInBackground(column: Relationship, completion: (V?) -> Void) // Ordered by localID Ascending - func getInBackground(column: Relationship<[V]>, completion: ([V]) -> Void) - + func getInBackground(column: Relationship<[V]>, query: QueryType?, completion: ([V]) -> Void) +} + +public protocol SQLiteSettable { func set(column: Expression, value: V) func set(column: Expression, value: V?) @@ -45,8 +51,6 @@ public protocol SQLiteConvertible: SQLiteModelAbstract { func setInBackground(column: Relationship, value: V, completion: (Void -> Void)?) func setInBackground(column: Relationship, value: V?, completion: (Void -> Void)?) func setInBackground(column: Relationship<[V]>, value: [V], completion: (Void -> Void)?) - - static var tableName : String {get} } public protocol SQLiteTableOperations { @@ -107,6 +111,11 @@ public protocol SQLiteInstance { var localUpdatedAt: NSDate? {get} } +public protocol SQLiteMemoryManagement { + static func clearCache() + func clearCache() +} + public protocol SQLiteQueryable { // Returns a base query /// Select * from @@ -124,11 +133,14 @@ public protocol SQLiteAtomic { public protocol SQLiteModel: SQLiteConvertible, +SQLiteGettable, +SQLiteSettable, SQLiteTableOperations, SQLiteCreatable, SQLiteDeletable, SQLiteFetchable, SQLiteInstance, +SQLiteMemoryManagement, SQLiteQueryable, SQLiteScalarQueryable, SQLiteAtomic, diff --git a/SQLiteModel/SQLiteModelContextManager.swift b/SQLiteModel/SQLiteModelContextManager.swift index 38067bc..5decf87 100644 --- a/SQLiteModel/SQLiteModelContextManager.swift +++ b/SQLiteModel/SQLiteModelContextManager.swift @@ -9,49 +9,46 @@ import Foundation import SQLite -internal typealias Meta = SQLiteModelContextManager - internal class SQLiteModelContextManager { private var internalStates = [String : SQLiteModelContext]() - private static let sharedInstance = SQLiteModelContextManager() - internal static func tableForModel(modelType: V.Type) -> Table { + internal func tableForModel(modelType: V.Type) -> Table { let context = self.internalContextForModel(modelType) return context.table } - internal static func localIDExpressionForModel(modelType: V.Type) -> Expression { + internal func localIDExpressionForModel(modelType: V.Type) -> Expression { let context = self.internalContextForModel(modelType) return context.localIDExpression } - internal static func localCreatedAtExpressionForModel(modelType: V.Type) -> Expression { + internal func localCreatedAtExpressionForModel(modelType: V.Type) -> Expression { let context = self.internalContextForModel(modelType) return context.localCreatedAtExpression } - internal static func localUpdatedAtExpressionForModel(modelType: V.Type) -> Expression { + internal func localUpdatedAtExpressionForModel(modelType: V.Type) -> Expression { let context = self.internalContextForModel(modelType) return context.localUpdatedAtExpression } - internal static func localInstanceContextForModel(modelType: V.Type, hash: SQLiteModelID) -> SQLiteModelInstanceContext? { - var context = self.sharedInstance.internalContextForModel(modelType) + internal func localInstanceContextForModel(modelType: V.Type, hash: SQLiteModelID) -> SQLiteModelInstanceContext? { + var context = self.internalContextForModel(modelType) guard let instanceContext = context.localContextOfInstances[hash] else { return nil } return instanceContext } - internal static func getValueForModel(modelType: U.Type, hash: SQLiteModelID, expression: Expression) -> V? { + internal func getValueForModel(modelType: U.Type, hash: SQLiteModelID, expression: Expression) -> V? { guard let instanceContext = self.localInstanceContextForModel(modelType, hash: hash) else { return nil } return instanceContext.get(expression) } - internal static func setValueForModel(modelType: U.Type, hash: SQLiteModelID, column: Expression, value: V?) { + internal func setValueForModel(modelType: U.Type, hash: SQLiteModelID, column: Expression, value: V?) { guard var instanceContext = self.localInstanceContextForModel(modelType, hash: hash) else { return } @@ -62,84 +59,46 @@ internal class SQLiteModelContextManager { self.setInternalContextForModel(modelType, context: context) } - internal static func localCreatedAtForModel(modelType: V.Type, hash: SQLiteModelID) -> NSDate? { + internal func localCreatedAtForModel(modelType: V.Type, hash: SQLiteModelID) -> NSDate? { guard let instanceContext = self.localInstanceContextForModel(modelType, hash: hash) else { return nil } return instanceContext.localCreatedAt } - internal static func localUpdatedAtForModel(modelType: V.Type, hash: SQLiteModelID) -> NSDate? { + internal func localUpdatedAtForModel(modelType: V.Type, hash: SQLiteModelID) -> NSDate? { guard let instanceContext = self.localInstanceContextForModel(modelType, hash: hash) else { return nil } return instanceContext.localUpdatedAt } - internal static func settersForModel(modelType: V.Type, hash: SQLiteModelID) -> [Setter] { + internal func settersForModel(modelType: V.Type, hash: SQLiteModelID) -> [Setter] { guard let instanceContext = self.localInstanceContextForModel(modelType, hash: hash) else { return [] } return instanceContext.setters } - internal static func hasLocalInstanceContextFor(modelType: V.Type, hash: SQLiteModelID) -> Bool { + internal func hasLocalInstanceContextFor(modelType: V.Type, hash: SQLiteModelID) -> Bool { let context = self.internalContextForModel(modelType) let instanceContext = context.localContextOfInstances[hash] return instanceContext != nil } - internal static func hasLocalInstanceContextForSingularRelationhip(modelType: V.Type, leftID: SQLiteModelID) -> Bool { - let context = self.internalContextForModel(modelType) - let instanceContexts = context.localContextOfInstances.values.filter({ $0.get(RelationshipColumns.LeftID) == leftID }) - assert(instanceContexts.count <= 1) - return instanceContexts.count > 0 - } - - // return value: left = ids that are cached, right = ids that arent cached - internal static func queryCachedInstanceIDsFor(modelType: V.Type, hashes: [SQLiteModelID]) -> ([SQLiteModelID], [SQLiteModelID]) { - let context = self.internalContextForModel(modelType) - var left: [SQLiteModelID] = [], right: [SQLiteModelID] = [] - for hash in hashes { - if let _ = context.localContextOfInstances[hash] { - left.append(hash) - } - else { - right.append(hash) - } - } - return (left, right) - } - - internal static func queryCachedValueForSingularRelationship(modelType: V.Type, queryColumn: Expression, queryValue: SQLiteModelID, returnColumn: Expression) -> SQLiteModelID? { - let context = self.internalContextForModel(modelType) - for instanceContext in context.localContextOfInstances.values { - if instanceContext.get(queryColumn) == queryValue { - return instanceContext.get(returnColumn) - } - } - return nil - } - - internal static func queryCachedValueForRelationship(modelType: V.Type, queryColumn: Expression, queryValue: SQLiteModelID, returnColumn: Expression) -> [SQLiteModelID] { - let context = self.internalContextForModel(modelType) - let instances = context.localContextOfInstances.values.filter{ $0.get(queryColumn) == queryValue } - return instances.map{ $0.get(returnColumn) } - } - - internal static func createLocalInstanceContextFor(modelType: V.Type, row: Row) { + internal func createLocalInstanceContextFor(modelType: V.Type, row: Row) { var context = self.internalContextForModel(modelType) let _ = context.createInstanceContextFromModel(row) self.setInternalContextForModel(modelType, context: context) } - internal static func removeLocalInstanceContextFor(modelType: V.Type, hash: SQLiteModelID) { + internal func removeLocalInstanceContextFor(modelType: V.Type, hash: SQLiteModelID) { var context = self.internalContextForModel(modelType) context.deleteInstanceContextForHash(hash) self.setInternalContextForModel(modelType, context: context) } - internal static func removeAllLocalInstanceContextsFor(modelType: V.Type) { + internal func removeAllLocalInstanceContextsFor(modelType: V.Type) { var context = self.internalContextForModel(modelType) let hashes = context.localContextOfInstances.keys for hash in hashes { @@ -148,23 +107,18 @@ internal class SQLiteModelContextManager { self.setInternalContextForModel(modelType, context: context) } - internal static func removeContextForModel(modelType: V.Type) { - self.removeAllLocalInstanceContextsFor(modelType) - let context = self.internalContextForModel(modelType) - context.deleteLeftModelDependencies() - self.sharedInstance.removeContextForModel(modelType) + internal func removeContextForModel(modelType: V.Type) { + SyncManager.lock(modelType) { + self.removeAllLocalInstanceContextsFor(modelType) + let context = self.internalContextForModel(modelType) + context.deleteLeftModelDependencies() + let key = V.tableName + self.internalStates.removeValueForKey(key) + } } // MARK: Private - private static func internalContextForModel(modelType: V.Type) -> SQLiteModelContext { - return self.sharedInstance.internalContextForModel(modelType) - } - - private static func setInternalContextForModel(modelType: V.Type, context: SQLiteModelContext) { - self.sharedInstance.setInternalContextForModel(modelType, context: context) - } - private func internalContextForModel(modelType: V.Type) -> SQLiteModelContext { var _context: SQLiteModelContext? @@ -188,29 +142,62 @@ internal class SQLiteModelContextManager { self.internalStates[key] = context } } - - private func removeContextForModel(modelType: V.Type) { - SyncManager.lock(modelType) { - let key = V.tableName - self.internalStates.removeValueForKey(key) - } - } } // MARK: Relationships -extension Meta { +extension SQLiteModelContextManager { + + // MARK: Queries + + internal func hasLocalInstanceContextForSingularRelationhip(modelType: V.Type, leftID: SQLiteModelID) -> Bool { + let context = self.internalContextForModel(modelType) + let instanceContexts = context.localContextOfInstances.values.filter({ $0.get(RelationshipColumns.LeftID) == leftID }) + assert(instanceContexts.count <= 1) + return instanceContexts.count > 0 + } + + // return value: left = ids that are cached, right = ids that arent cached + internal func queryCachedInstanceIDsFor(modelType: V.Type, hashes: [SQLiteModelID]) -> ([SQLiteModelID], [SQLiteModelID]) { + let context = self.internalContextForModel(modelType) + var left: [SQLiteModelID] = [], right: [SQLiteModelID] = [] + for hash in hashes { + if let _ = context.localContextOfInstances[hash] { + left.append(hash) + } + else { + right.append(hash) + } + } + return (left, right) + } + + internal func queryCachedValueForSingularRelationship(modelType: V.Type, queryColumn: Expression, queryValue: SQLiteModelID, returnColumn: Expression) -> SQLiteModelID? { + let context = self.internalContextForModel(modelType) + for instanceContext in context.localContextOfInstances.values { + if instanceContext.get(queryColumn) == queryValue { + return instanceContext.get(returnColumn) + } + } + return nil + } + + internal func queryCachedValueForRelationship(modelType: V.Type, queryColumn: Expression, queryValue: SQLiteModelID, returnColumn: Expression) -> [SQLiteModelID] { + let context = self.internalContextForModel(modelType) + let instances = context.localContextOfInstances.values.filter{ $0.get(queryColumn) == queryValue } + return instances.map{ $0.get(returnColumn) } + } // MARK: Count - internal static func countForRelationshipForInstance(model: U, relationship: Relationship<[V]>) -> Int { + internal func countForRelationshipForInstance(model: U, relationship: Relationship<[V]>) -> Int { let count = self.queryCachedValueForRelationship(MultipleRelationship.self, queryColumn: RelationshipColumns.LeftID, queryValue: model.localID, returnColumn: RelationshipColumns.RightID).count return count } // MARK: Create - internal static func createRelationshipForModel(modelType: U.Type, relationship: Relationship) { + internal func createRelationshipForModel(modelType: U.Type, relationship: Relationship) { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) @@ -227,7 +214,7 @@ extension Meta { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) let context = self.internalContextForModel(SingularRelationship.self) let ids = context.localContextOfInstances.filter({ (keyVal : (SQLiteModelID, SQLiteModelInstanceContext)) -> Bool in - if let id = Meta.getValueForModel(SingularRelationship.self, hash: keyVal.0, expression: Expression(column)) { + if let id = self.getValueForModel(SingularRelationship.self, hash: keyVal.0, expression: Expression(column)) { return id == filterValue } return false @@ -265,7 +252,7 @@ extension Meta { self.setInternalContextForModel(V.self, context: rightModelContext) } - internal static func createRelationshipForModel(modelType: U.Type, relationship: Relationship<[V]>) { + internal func createRelationshipForModel(modelType: U.Type, relationship: Relationship<[V]>) { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) @@ -282,7 +269,7 @@ extension Meta { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) let context = self.internalContextForModel(MultipleRelationship.self) let ids = context.localContextOfInstances.filter({ (keyVal : (SQLiteModelID, SQLiteModelInstanceContext)) -> Bool in - if let id = Meta.getValueForModel(MultipleRelationship.self, hash: keyVal.0, expression: Expression(column)) { + if let id = self.getValueForModel(MultipleRelationship.self, hash: keyVal.0, expression: Expression(column)) { return id == filterValue } return false @@ -322,7 +309,7 @@ extension Meta { // MARK: Get - internal static func getRelationshipForModel(modelType: U.Type, hash: SQLiteModelID, relationship: Relationship) -> V? { + internal func getRelationshipForModel(modelType: U.Type, hash: SQLiteModelID, relationship: Relationship) -> V? { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) @@ -338,7 +325,7 @@ extension Meta { } } - internal static func getRelationshipForModel(modelType: U.Type, hash: SQLiteModelID, relationship: Relationship<[V]>) -> [V] { + internal func getRelationshipForModel(modelType: U.Type, hash: SQLiteModelID, relationship: Relationship<[V]>, query: QueryType?) -> [V] { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) @@ -347,16 +334,16 @@ extension Meta { fatalError("SQLiteModel Fatal Error: Dependency not set for relationship: \(relationship). Should never happen!") } if relationship.unique { - return UniqueMultipleRelationship.getRelationship(hash) + return UniqueMultipleRelationship.getRelationship(hash, query: query) } else { - return MultipleRelationship.getRelationship(hash) + return MultipleRelationship.getRelationship(hash, query: query) } } // MARK: Set - internal static func setRelationshipForModel(modelType: U.Type, relationship: Relationship, value: (U,V?)) { + internal func setRelationshipForModel(modelType: U.Type, relationship: Relationship, value: (U,V?)) { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) @@ -387,7 +374,7 @@ extension Meta { } } - internal static func setRelationshipForModel(modelType: U.Type, relationship: Relationship<[V]>, value: (U,[V])) { + internal func setRelationshipForModel(modelType: U.Type, relationship: Relationship<[V]>, value: (U,[V])) { RelationshipReferenceTracker.setTemplate((U.self, V.self), template: relationship.template) diff --git a/SQLiteModel/SQLiteModelError.swift b/SQLiteModel/SQLiteModelError.swift index 030bddb..39fb8a6 100644 --- a/SQLiteModel/SQLiteModelError.swift +++ b/SQLiteModel/SQLiteModelError.swift @@ -10,6 +10,7 @@ import Foundation public enum SQLiteModelError : ErrorType { + case InitializeDatabase case CreateError case DropError case InsertError @@ -24,6 +25,8 @@ public enum SQLiteModelError : ErrorType { var message: String switch self { + case .InitializeDatabase: + message = "SQLiteModel Initialize Database Error: " case .CreateError: message = "SQLiteModel Create Table Error: " case .DropError: diff --git a/SQLiteModelTests/SQLiteModelDatabaseTest.swift b/SQLiteModelTests/SQLiteModelDatabaseTest.swift new file mode 100644 index 0000000..e1ab723 --- /dev/null +++ b/SQLiteModelTests/SQLiteModelDatabaseTest.swift @@ -0,0 +1,104 @@ +// +// DatabaseTest.swift +// SQLiteModel +// +// Created by Jeff Hurray on 4/26/16. +// Copyright © 2016 jhurray. All rights reserved. +// + +import XCTest +import SQLite +@testable import SQLiteModel + +let inMem = Database(databaseType: DatabaseType.InMemory) +let tmpDisk = Database(databaseType: DatabaseType.TemporaryDisk) +let disk = Database(databaseType: DatabaseType.Disk(name: "disk_test")) + +struct InMem : SQLiteModel { + var localID: SQLiteModelID = -1 + + static var connection: Database { + return inMem + } + + static let Value = Expression("val") + + static func buildTable(tableBuilder: TableBuilder) { + tableBuilder.column(Value, defaultValue: "value") + } +} + +struct TmpDisk : SQLiteModel { + var localID: SQLiteModelID = -1 + + static var connection: Database { + return tmpDisk + } + + static let Value = Expression("val") + + static func buildTable(tableBuilder: TableBuilder) { + tableBuilder.column(Value, defaultValue: "value") + } +} + +struct Disk : SQLiteModel { + var localID: SQLiteModelID = -1 + + static var connection: Database { + return disk + } + + static let Value = Expression("val") + + static func buildTable(tableBuilder: TableBuilder) { + tableBuilder.column(Value, defaultValue: "value") + } +} + +class DatabaseTest: SQLiteModelTestCase { + + override func setUp() { + + } + + override func tearDown() { + + } + + func testInMem() { + do { + try InMem.createTable() + let instance = try InMem.new([]) + XCTAssertNotNil(instance) + try InMem.dropTable() + } + catch { + XCTFail() + } + } + + func testTmpDisk() { + do { + try TmpDisk.createTable() + let instance = try TmpDisk.new([]) + XCTAssertNotNil(instance) + try TmpDisk.dropTable() + } + catch { + XCTFail() + } + } + + func testDisk() { + do { + try Disk.createTable() + let instance = try Disk.new([]) + XCTAssertNotNil(instance) + try Disk.dropTable() + } + catch { + XCTFail() + } + } +} diff --git a/SQLiteModelTests/SQLiteModelMultipleRelationshipTest.swift b/SQLiteModelTests/SQLiteModelMultipleRelationshipTest.swift index 615f9cc..e0f3989 100644 --- a/SQLiteModelTests/SQLiteModelMultipleRelationshipTest.swift +++ b/SQLiteModelTests/SQLiteModelMultipleRelationshipTest.swift @@ -195,6 +195,16 @@ class SQLiteModelMultipleRelationshipTest: SQLiteModelTestCase { XCTAssertEqual(student1?.countForRelationship(Student.Teachers), 3) } + func testRelationshipQuery() { + guard let s1 = student1 else { + XCTFail() + return + } + let filteredTeachers = s1.get(Student.Teachers, query: Teacher.query.filter(Teacher.Name == "t2")) + XCTAssertEqual(filteredTeachers.count, 1) + XCTAssertEqual(filteredTeachers.first?.localID, teacher2?.localID) + } + func testUniqueMultipleRelationship() { guard let t4 = teacher4, let t3 = teacher3 else { XCTFail()

+ + + + + + + + + +