This commit is contained in:
Jaremy Creechley 2023-09-26 20:10:46 -07:00
parent c67b61aa50
commit e2b6005918
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300

View File

@ -28,7 +28,7 @@ suite "Test Open SQLite Datastore DB":
test "Should create and open datastore DB":
let
dsDb = SQLiteDsDb.open(
dsDb = SQLiteDsDb[string, seq[byte]].open(
path = dbPathAbs,
flags = SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE).tryGet()
@ -40,7 +40,7 @@ suite "Test Open SQLite Datastore DB":
test "Should open existing DB":
let
dsDb = SQLiteDsDb.open(
dsDb = SQLiteDsDb[string, seq[byte]].open(
path = dbPathAbs,
flags = SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE).tryGet()
@ -55,7 +55,7 @@ suite "Test Open SQLite Datastore DB":
fileExists(dbPathAbs)
let
dsDb = SQLiteDsDb.open(
dsDb = SQLiteDsDb[string, seq[byte]].open(
path = dbPathAbs,
flags = SQLITE_OPEN_READONLY).tryGet()
@ -66,7 +66,7 @@ suite "Test Open SQLite Datastore DB":
removeDir(basePathAbs)
check:
not fileExists(dbPathAbs)
SQLiteDsDb.open(path = dbPathAbs).isErr
SQLiteDsDb[string, seq[byte]].open(path = dbPathAbs).isErr
suite "Test SQLite Datastore DB operations":
let
@ -81,19 +81,19 @@ suite "Test SQLite Datastore DB operations":
otherData = "some other data".toBytes
var
dsDb: SQLiteDsDb
readOnlyDb: SQLiteDsDb
dsDb: SQLiteDsDb[string, seq[byte]]
readOnlyDb: SQLiteDsDb[string, seq[byte]]
setupAll:
removeDir(basePathAbs)
require(not dirExists(basePathAbs))
createDir(basePathAbs)
dsDb = SQLiteDsDb.open(
dsDb = SQLiteDsDb[string, seq[byte]].open(
path = dbPathAbs,
flags = SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE).tryGet()
readOnlyDb = SQLiteDsDb.open(
readOnlyDb = SQLiteDsDb[string, seq[byte]].open(
path = dbPathAbs,
flags = SQLITE_OPEN_READONLY).tryGet()
@ -114,7 +114,7 @@ suite "Test SQLite Datastore DB operations":
var bytes: seq[byte]
proc onData(s: RawStmtPtr) =
bytes = dataCol(dsDb.getDataCol)
bytes = dataCol[seq[byte]](dsDb.getDataCol)
check:
dsDb.getStmt.query((key.id), onData).tryGet()
@ -130,7 +130,7 @@ suite "Test SQLite Datastore DB operations":
var bytes: seq[byte]
proc onData(s: RawStmtPtr) =
bytes = dataCol(dsDb.getDataCol)
bytes = dataCol[seq[byte]](dsDb.getDataCol)
check:
dsDb.getStmt.query((key.id), onData).tryGet()