-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support unsigned int32/64 types for columns. UInt64 is stored as a Bl…
…ob type
- Loading branch information
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,9 @@ class SelectTests: SQLiteTestCase { | |
CREATE TABLE users_name ( | ||
id INTEGER, | ||
user_id INTEGER REFERENCES users(id), | ||
name TEXT | ||
name TEXT, | ||
step_count BLOB, | ||
stair_count INTEGER | ||
) | ||
""" | ||
) | ||
|
@@ -27,18 +29,27 @@ class SelectTests: SQLiteTestCase { | |
let name = Expression<String>("name") | ||
let id = Expression<Int64>("id") | ||
let userID = Expression<Int64>("user_id") | ||
let stepCount = Expression<UInt64>("step_count") | ||
let stairCount = Expression<UInt32>("stair_count") | ||
let email = Expression<String>("email") | ||
// use UInt64.max - 1 to test Endianness - it should store/load as big endian | ||
let reallyBigNumber = UInt64.max - 1 | ||
let prettyBigNumber = UInt32.max - 1 | ||
|
||
try! insertUser("Joey") | ||
try! db.run(usersData.insert( | ||
id <- 1, | ||
userID <- 1, | ||
name <- "Joey" | ||
name <- "Joey", | ||
stepCount <- reallyBigNumber, | ||
stairCount <- prettyBigNumber | ||
)) | ||
|
||
try! db.prepare(users.select(name, email).join(usersData, on: userID == users[id])).forEach { | ||
try! db.prepare(users.select(name, email, stepCount, stairCount).join(usersData, on: userID == users[id])).forEach { | ||
XCTAssertEqual($0[name], "Joey") | ||
XCTAssertEqual($0[email], "[email protected]") | ||
XCTAssertEqual($0[stepCount], reallyBigNumber) | ||
XCTAssertEqual($0[stairCount], prettyBigNumber) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters