Skip to content

Commit e2633a4

Browse files
authored
Merge pull request stephencelis#531 from stephencelis/prepare-0.11.1
0.11.1
2 parents 9a85a8f + 3472f4e commit e2633a4

File tree

16 files changed

+135
-55
lines changed

16 files changed

+135
-55
lines changed

.cocoadocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
additional_guides:
2+
- Documentation/Index.md

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: objective-c
22
rvm: 2.2
3-
osx_image: xcode8
3+
osx_image: xcode8.2
44
env:
55
global:
6-
- IOS_SIMULATOR="iPhone SE"
6+
- IOS_SIMULATOR="iPhone 6s"
77
matrix:
88
include:
99
- env: BUILD_SCHEME="SQLite iOS"

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
0.11.1 (unreleased, [diff][diff-0.11.1])
2+
========================================
3+
4+
* Made lastInsertRowid consistent with other SQLite wrappers (#532)
5+
* Fix for ~= operator used with Double ranges
6+
* Various documentation updates
7+
8+
0.11.0 (19-10-2016)
9+
===================
10+
11+
* Swift3 migration ([diff][diff-0.11.0])
12+
13+
14+
[diff-0.11.1]: https://github.com/stephencelis/SQLite.swift/compare/0.11.1...0.11.0
15+
[diff-0.11.0]: https://github.com/stephencelis/SQLite.swift/compare/0.10.1...0.11.0

CocoaPodsTests/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

3-
gem 'cocoapods', '~> 1.1.0.rc.3'
3+
gem 'cocoapods', '~> 1.1.0'
44
gem 'minitest'

CocoaPodsTests/Gemfile.lock

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,74 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
CFPropertyList (2.3.3)
45
activesupport (4.2.7.1)
56
i18n (~> 0.7)
67
json (~> 1.7, >= 1.7.7)
78
minitest (~> 5.1)
89
thread_safe (~> 0.3, >= 0.3.4)
910
tzinfo (~> 1.1)
1011
claide (1.0.1)
11-
cocoapods (1.1.0.rc.3)
12+
cocoapods (1.1.1)
1213
activesupport (>= 4.0.2, < 5)
1314
claide (>= 1.0.1, < 2.0)
14-
cocoapods-core (= 1.1.0.rc.3)
15+
cocoapods-core (= 1.1.1)
1516
cocoapods-deintegrate (>= 1.0.1, < 2.0)
16-
cocoapods-downloader (>= 1.1.1, < 2.0)
17+
cocoapods-downloader (>= 1.1.2, < 2.0)
1718
cocoapods-plugins (>= 1.0.0, < 2.0)
1819
cocoapods-search (>= 1.0.0, < 2.0)
1920
cocoapods-stats (>= 1.0.0, < 2.0)
20-
cocoapods-trunk (= 1.1.0.beta.1)
21+
cocoapods-trunk (>= 1.1.1, < 2.0)
2122
cocoapods-try (>= 1.1.0, < 2.0)
2223
colored (~> 1.2)
2324
escape (~> 0.0.4)
24-
fourflusher (~> 2.0)
25+
fourflusher (~> 2.0.1)
2526
gh_inspector (~> 1.0)
2627
molinillo (~> 0.5.1)
2728
nap (~> 1.0)
28-
xcodeproj (>= 1.3.2, < 2.0)
29-
cocoapods-core (1.1.0.rc.3)
29+
xcodeproj (>= 1.3.3, < 2.0)
30+
cocoapods-core (1.1.1)
3031
activesupport (>= 4.0.2, < 5)
3132
fuzzy_match (~> 2.0.4)
3233
nap (~> 1.0)
3334
cocoapods-deintegrate (1.0.1)
34-
cocoapods-downloader (1.1.1)
35+
cocoapods-downloader (1.1.2)
3536
cocoapods-plugins (1.0.0)
3637
nap
3738
cocoapods-search (1.0.0)
3839
cocoapods-stats (1.0.0)
39-
cocoapods-trunk (1.1.0.beta.1)
40+
cocoapods-trunk (1.1.1)
4041
nap (>= 0.8, < 2.0)
4142
netrc (= 0.7.8)
4243
cocoapods-try (1.1.0)
4344
colored (1.2)
4445
escape (0.0.4)
45-
fourflusher (2.0.0)
46+
fourflusher (2.0.1)
4647
fuzzy_match (2.0.4)
4748
gh_inspector (1.0.2)
4849
i18n (0.7.0)
4950
json (1.8.3)
5051
minitest (5.9.1)
51-
molinillo (0.5.1)
52+
molinillo (0.5.4)
53+
nanaimo (0.2.2)
5254
nap (1.1.0)
5355
netrc (0.7.8)
5456
thread_safe (0.3.5)
5557
tzinfo (1.2.2)
5658
thread_safe (~> 0.1)
57-
xcodeproj (1.3.2)
59+
xcodeproj (1.4.1)
60+
CFPropertyList (~> 2.3.3)
5861
activesupport (>= 3)
5962
claide (>= 1.0.1, < 2.0)
6063
colored (~> 1.2)
64+
nanaimo (~> 0.2.0)
6165

6266
PLATFORMS
6367
ruby
6468

6569
DEPENDENCIES
66-
cocoapods (~> 1.1.0.rc.3)
70+
cocoapods (~> 1.1.0)
6771
minitest
6872

6973
BUNDLED WITH
70-
1.13.1
74+
1.13.3

CocoaPodsTests/test_running_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def add_test_target(pod_file)
7979

8080
def run_tests
8181
command = [
82-
'clean', 'test',
82+
'clean', 'build', 'build-for-testing', 'test-without-building',
8383
'-workspace', File.join(validation_dir, "#{APP_TARGET}.xcworkspace"),
8484
'-scheme', TEST_TARGET,
8585
'-configuration', 'Debug'

Documentation/Index.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ install SQLite.swift with Carthage:
7878
2. Update your Cartfile to include the following:
7979

8080
```
81-
github "stephencelis/SQLite.swift" ~> 0.11.0
81+
github "stephencelis/SQLite.swift" ~> 0.11.1
8282
```
8383
8484
3. Run `carthage update` and [add the appropriate framework][Carthage Usage].
@@ -100,32 +100,32 @@ install SQLite.swift with Carthage:
100100
``` sh
101101
# Using the default Ruby install will require you to use sudo when
102102
# installing and updating gems.
103-
sudo gem install cocoapods
103+
[sudo] gem install cocoapods
104104
```
105105
106106
3. Update your Podfile to include the following:
107107
108108
``` ruby
109109
use_frameworks!
110110
111-
pod 'SQLite.swift', '~> 0.11.0'
111+
pod 'SQLite.swift', '~> 0.11.1'
112112
```
113113
114-
4. Run `pod install`.
114+
4. Run `pod install --repo-update`.
115115
116116
117117
#### Requiring a specific version of SQLite
118118
119119
If you want to use a more recent version of SQLite than what is provided with the OS you can require the `standalone` subspec:
120120
121121
``` ruby
122-
pod 'SQLite.swift/standalone', '~> 0.11.0'
122+
pod 'SQLite.swift/standalone', '~> 0.11.1'
123123
```
124124

125125
By default this will use the most recent version of SQLite without any extras. If you want you can further customize this by adding another dependency to sqlite3 or one of its subspecs:
126126

127127
``` ruby
128-
pod 'SQLite.swift/standalone', '~> 0.11.0'
128+
pod 'SQLite.swift/standalone', '~> 0.11.1'
129129
pod 'sqlite3/fts5', '= 3.15.0' # SQLite 3.15.0 with FTS5 enabled
130130
```
131131

@@ -1079,11 +1079,24 @@ try db.run(users.drop(ifExists: true))
10791079
```
10801080

10811081

1082-
<!-- ### Migrations and Schema Versioning
1082+
### Migrations and Schema Versioning
10831083

1084-
SQLite.swift provides a convenience property on `Database` to query and set the [`PRAGMA user_version`](https://sqlite.org/pragma.html#pragma_schema_version). This is a great way to manage your schema’s version over migrations.
1084+
You can add a convenience property on `Connection` to query and set the [`PRAGMA user_version`](https://sqlite.org/pragma.html#pragma_user_version).
1085+
1086+
This is a great way to manage your schema’s version over migrations.
10851087

10861088
``` swift
1089+
extension Connection {
1090+
public var userVersion: Int32 {
1091+
get { return Int32(try! scalar("PRAGMA user_version") as! Int64)}
1092+
set { try! run("PRAGMA user_version = \(newValue)") }
1093+
}
1094+
}
1095+
```
1096+
1097+
Then you can conditionally run your migrations along the lines of:
1098+
1099+
```swift
10871100
if db.userVersion == 0 {
10881101
// handle first migration
10891102
db.userVersion = 1
@@ -1092,8 +1105,10 @@ if db.userVersion == 1 {
10921105
// handle second migration
10931106
db.userVersion = 2
10941107
}
1095-
``` -->
1108+
```
10961109

1110+
For more complex migration requirements check out the schema management system
1111+
[SQLiteMigrationManager.swift][].
10971112

10981113
## Custom Types
10991114

@@ -1429,6 +1444,13 @@ let config = FTS5Config()
14291444

14301445
try db.run(emails.create(.FTS5(config))
14311446
// CREATE VIRTUAL TABLE "emails" USING fts5("subject", "body" UNINDEXED)
1447+
1448+
// Note that FTS5 uses a different syntax to select columns, so we need to rewrite
1449+
// the last FTS4 query above as:
1450+
let replies = emails.filter(emails.match("subject:\"Re:\"*))
1451+
// SELECT * FROM "emails" WHERE "emails" MATCH 'subject:"Re:"*'
1452+
1453+
// https://www.sqlite.org/fts5.html#_changes_to_select_statements_
14321454
```
14331455
14341456
## Executing Arbitrary SQL
@@ -1513,3 +1535,4 @@ We can log SQL using the database’s `trace` function.
15131535
15141536
15151537
[ROWID]: https://sqlite.org/lang_createtable.html#rowid
1538+
[SQLiteMigrationManager.swift]: https://github.com/garriguv/SQLiteMigrationManager.swift

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
BUILD_TOOL = xcodebuild
22
BUILD_SCHEME = SQLite Mac
3-
IOS_SIMULATOR = iPhone SE
3+
IOS_SIMULATOR = iPhone 6s
4+
IOS_VERSION = 9.3
45
ifeq ($(BUILD_SCHEME),SQLite iOS)
5-
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR)"
6+
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)"
67
else
78
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)"
89
endif
910

1011
XCPRETTY := $(shell command -v xcpretty)
1112
SWIFTCOV := $(shell command -v swiftcov)
1213
GCOVR := $(shell command -v gcovr)
14+
TEST_ACTIONS := clean build build-for-testing test-without-building
1315

1416
default: test
1517

@@ -18,9 +20,9 @@ build:
1820

1921
test:
2022
ifdef XCPRETTY
21-
@set -o pipefail && $(BUILD_TOOL) $(BUILD_ARGUMENTS) test | $(XCPRETTY) -c
23+
@set -o pipefail && $(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS) | $(XCPRETTY) -c
2224
else
23-
$(BUILD_TOOL) $(BUILD_ARGUMENTS) test
25+
$(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS)
2426
endif
2527

2628
coverage:

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ install SQLite.swift with Carthage:
129129
2. Update your Cartfile to include the following:
130130

131131
```
132-
github "stephencelis/SQLite.swift" ~> 0.11.0
132+
github "stephencelis/SQLite.swift" ~> 0.11.1
133133
```
134134
135135
3. Run `carthage update` and [add the appropriate framework][Carthage Usage].
@@ -145,24 +145,25 @@ install SQLite.swift with Carthage:
145145
[CocoaPods][] is a dependency manager for Cocoa projects. To install
146146
SQLite.swift with CocoaPods:
147147
148-
1. Make sure the latest CocoaPods beta is [installed][CocoaPods
149-
Installation]. (SQLite.swift requires version 1.0.0.beta.6 or greater.)
148+
1. Verify that your copy of Xcode is installed in the default location (`/Application/Xcode.app`).
149+
150+
2. Make sure the latest CocoaPods beta is [installed][CocoaPods Installation]. (SQLite.swift requires version 1.0.0 or greater.)
150151
151152
``` sh
152153
# Using the default Ruby install will require you to use sudo when
153154
# installing and updating gems.
154155
[sudo] gem install cocoapods
155156
```
156157
157-
2. Update your Podfile to include the following:
158+
3. Update your Podfile to include the following:
158159
159160
``` ruby
160161
use_frameworks!
161162
162-
pod 'SQLite.swift', '~> 0.11.0'
163+
pod 'SQLite.swift', '~> 0.11.1'
163164
```
164165
165-
3. Run `pod install`.
166+
4. Run `pod install --repo-update`.
166167
167168
[CocoaPods]: https://cocoapods.org
168169
[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started

SQLite.swift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SQLite.swift"
3-
s.version = "0.11.0"
3+
s.version = "0.11.1"
44
s.summary = "A type-safe, Swift-language layer over SQLite3 for iOS and OS X."
55

66
s.description = <<-DESC

SQLite/Core/Connection.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ public final class Connection {
132132
public var readonly: Bool { return sqlite3_db_readonly(handle, nil) == 1 }
133133

134134
/// The last rowid inserted into the database via this connection.
135-
public var lastInsertRowid: Int64? {
136-
let rowid = sqlite3_last_insert_rowid(handle)
137-
return rowid != 0 ? rowid : nil
135+
public var lastInsertRowid: Int64 {
136+
return sqlite3_last_insert_rowid(handle)
138137
}
139138

140139
/// The last number of changes (inserts, updates, or deletes) made to the
@@ -675,7 +674,7 @@ public final class Connection {
675674
return success!
676675
}
677676

678-
@discardableResult func check(_ resultCode: Int32, statement: Statement? = nil) throws -> Int32 {
677+
@discardableResult public func check(_ resultCode: Int32, statement: Statement? = nil) throws -> Int32 {
679678
guard let error = Result(errorCode: resultCode, connection: self, statement: statement) else {
680679
return resultCode
681680
}

SQLite/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.0</string>
18+
<string>0.11.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

SQLite/Typed/Operators.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,10 @@ public func <=<V : Value>(lhs: V, rhs: Expression<V?>) -> Expression<Bool?> wher
474474
return infix(lhs, rhs)
475475
}
476476

477-
public func ~=<V : Value>(lhs: CountableClosedRange<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype : Binding & Comparable {
477+
public func ~=<V : Value>(lhs: ClosedRange<V>, rhs: Expression<V>) -> Expression<Bool> where V.Datatype : Binding & Comparable {
478478
return Expression("\(rhs.template) BETWEEN ? AND ?", rhs.bindings + [lhs.lowerBound as? Binding, lhs.upperBound as? Binding])
479479
}
480-
public func ~=<V : Value>(lhs: CountableClosedRange<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype : Binding & Comparable {
480+
public func ~=<V : Value>(lhs: ClosedRange<V>, rhs: Expression<V?>) -> Expression<Bool?> where V.Datatype : Binding & Comparable {
481481
return Expression("\(rhs.template) BETWEEN ? AND ?", rhs.bindings + [lhs.lowerBound as? Binding, lhs.upperBound as? Binding])
482482
}
483483

SQLite/Typed/Query.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,11 @@ extension Connection {
968968
/// - Parameter query: An insert query.
969969
///
970970
/// - Returns: The insert’s rowid.
971-
public func run(_ query: Insert) throws -> Int64 {
971+
@discardableResult public func run(_ query: Insert) throws -> Int64 {
972972
let expression = query.expression
973973
return try sync {
974974
try self.run(expression.template, expression.bindings)
975-
return self.lastInsertRowid!
975+
return self.lastInsertRowid
976976
}
977977
}
978978

@@ -984,7 +984,7 @@ extension Connection {
984984
/// - Parameter query: An update query.
985985
///
986986
/// - Returns: The number of updated rows.
987-
public func run(_ query: Update) throws -> Int {
987+
@discardableResult public func run(_ query: Update) throws -> Int {
988988
let expression = query.expression
989989
return try sync {
990990
try self.run(expression.template, expression.bindings)
@@ -999,7 +999,7 @@ extension Connection {
999999
/// - Parameter query: A delete query.
10001000
///
10011001
/// - Returns: The number of deleted rows.
1002-
public func run(_ query: Delete) throws -> Int {
1002+
@discardableResult public func run(_ query: Delete) throws -> Int {
10031003
let expression = query.expression
10041004
return try sync {
10051005
try self.run(expression.template, expression.bindings)

0 commit comments

Comments
 (0)