nim-sqlcipher/test/db_smoke.nim
Michael Bradley, Jr 96c9d37940 refactor: adjust Makefile, etc. so that static/shared lib linking works as expected
Clean up logic, variables, etc. in the Makefile and related files.

Bump nimterop and sqlcipher in `vendor/` to latest versions.

In addition to tests on GitHub Actions, manually test all static/shared
combinations on Linux, macOS, and Windows. Also, for each combination check
locally that a separately compiled `sqlite3` cli *cannot* read
e.g. `test/build/my.db` even with `PRAGMA key = '[password]';`. Likewise, check
that a separately compiled `sqlcipher` cli *can* read a database if and only if
the correct password is used, e.g. `PRAGMA key = 'qwerty';` for
`test/build/my.db`.
2020-11-12 14:03:37 -06:00

23 lines
443 B
Nim

import ../sqlcipher
from os import parentDir
import strformat
import times
let db: DbConn = openDatabase(currentSourcePath.parentDir() & "/build/my.db")
let passwd = "qwerty"
key(db, passwd)
execScript(db, "create table if not exists Log (theTime text primary key)")
let date = getDateStr(now())
let time = getClockStr(now())
execScript(db, &"""insert into Log values("{date}:{time}")""")
echo rows(db, "select * from Log")
close(db)