mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts: GRDB/Core/Statement.swift
This commit is contained in:
commit
580532aeca
5 files changed
+21
-23
No files matched your search
+8
-8
@@ -9,16 +9,10 @@ Released August 6, 2016
|
||||
|
||||
- Upgrade sqlcipher to v3.4.0 ([announcement](https://discuss.zetetic.net/t/sqlcipher-3-4-0-release/1273), [changelog](https://github.com/sqlcipher/sqlcipher/blob/master/CHANGELOG.md))
|
||||
|
||||
- Row adopts DictionaryLiteralConvertible:
|
||||
|
||||
```swift
|
||||
let row: Row = ["name": "foo", "date": NSDate()]
|
||||
```
|
||||
|
||||
- DSL for table creation and updates (closes [#83](https://github.com/groue/GRDB.swift/issues/83), [documentation](https://github.com/groue/GRDB.swift#database-schema)):
|
||||
|
||||
```swift
|
||||
db.create(table: "pointOfInterests") { t in
|
||||
try db.create(table: "pointOfInterests") { t in
|
||||
t.column("id", .Integer).primaryKey()
|
||||
t.column("title", .Text)
|
||||
t.column("favorite", .Boolean).notNull()
|
||||
@@ -30,11 +24,17 @@ Released August 6, 2016
|
||||
- Support for the `length` SQLite built-in function:
|
||||
|
||||
```swift
|
||||
db.create(table: "persons") { t in
|
||||
try db.create(table: "persons") { t in
|
||||
t.column("name", .Text).check { length($0) > 0 }
|
||||
}
|
||||
```
|
||||
|
||||
- Row adopts DictionaryLiteralConvertible:
|
||||
|
||||
```swift
|
||||
let row: Row = ["name": "foo", "date": NSDate()]
|
||||
```
|
||||
|
||||
|
||||
**Breaking Changes**
|
||||
|
||||
|
||||
+1
-1
@@ -848,7 +848,7 @@ private struct StatementCopyRowImpl : RowImpl {
|
||||
|
||||
init(sqliteStatement: SQLiteStatement, columnNames: [String]) {
|
||||
let sqliteStatement = sqliteStatement
|
||||
self.databaseValues = ContiguousArray((0..<sqlite3_column_count(sqliteStatement)).lazy.map { DatabaseValue(sqliteStatement: sqliteStatement, index: $0) })
|
||||
self.databaseValues = ContiguousArray((0..<sqlite3_column_count(sqliteStatement)).map { DatabaseValue(sqliteStatement: sqliteStatement, index: $0) } as [DatabaseValue])
|
||||
self.columnNames = columnNames
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ public final class SelectStatement : Statement {
|
||||
/// The column names, ordered from left to right.
|
||||
public lazy var columnNames: [String] = {
|
||||
let sqliteStatement = self.sqliteStatement
|
||||
return (0..<self.columnCount).map { String(cString: sqlite3_column_name(sqliteStatement, Int32($0))) }
|
||||
return (0..<self.columnCount).map { (index: Int) -> String in String(cString: sqlite3_column_name(sqliteStatement, Int32(index))) }
|
||||
}()
|
||||
|
||||
/// Cache for indexOfColumn(). Keys are lowercase.
|
||||
|
||||
@@ -2276,19 +2276,7 @@ let idColumn = Column("id")
|
||||
let nameColumn = Column("name")
|
||||
```
|
||||
|
||||
You can now derive requests with the following methods:
|
||||
|
||||
- `all`
|
||||
- `select`
|
||||
- `distinct`
|
||||
- `filter`
|
||||
- `group`
|
||||
- `having`
|
||||
- `order`
|
||||
- `reverse`
|
||||
- `limit`
|
||||
|
||||
All the methods above return another request, which you can further refine by applying another derivation method.
|
||||
You can now build requests with the following methods: `all`, `select`, `distinct`, `filter`, `group`, `having`, `order`, `reverse`, `limit`. All those methods return another request, which you can further refine by applying another method: `Person.select(...).filter(...).order(...)`.
|
||||
|
||||
- `all()`: the request for all rows.
|
||||
|
||||
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#/bin/sh
|
||||
#
|
||||
# Outputs the compilation time of all methods.
|
||||
# To get the 20 slowest methods, run ./slow_methods.sh | head -20
|
||||
set -e
|
||||
|
||||
PROJECT=GRDB.xcodeproj
|
||||
TARGET=GRDBiOS
|
||||
|
||||
OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' xcodebuild -project $PROJECT -target $TARGET 2>&1 clean build | grep '^[0-9][0-9.]*.*\t' | sort -nr
|
||||
Reference in new issue
Block a user