status-desktop/sqlite/main.nim

23 lines
462 B
Nim
Raw Normal View History

2020-05-11 20:35:58 +00:00
import tiny_sqlite
import times
import strformat
when isMainModule:
let db: DbConn = openDatabase("./myDatabase")
write(stdout, "Enter the db password> ")
let passwd = readLine(stdin)
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")