Hello, Is there any In-Memory Database project around for Nim ? Or any wrapper available for any of these https://githubreviews.com/explore/databases/popular-in-memory ? TIA2017-07-14 03:36:55
I dont know any of them on that list but are you aware of that you can use sqlite as in-memory database by just using ":memory:" as database name?2017-07-14 06:00:29
nimble search XXXX
There are definately bindings for redis and several others.
I've recently been working with LMDB. While it is not in memory, it is light weight and uses smart btree based memory mapping. Let me know if you want some examples of how to use it or would like to find out more. 2017-07-14 22:26:30
For SQLite, have a look at the doco db_sqlite
import db_sqlite, math let theDb = open(":memory:",nil,nil,nil) # # now do create tables, insert data, select data, .... # using SQL (sqlite flavoured) # theDb.exec(sql"Drop table if exists myTestTbl") theDb.exec(sql("""create table myTestTbl ( Id INTEGER PRIMARY KEY, Name VARCHAR(50) NOT NULL, i INT(11), f DECIMAL(18,10))""")) theDb.exec(sql"BEGIN") for i in 1..1000: theDb.exec(sql"INSERT INTO myTestTbl (name,i,f) VALUES (?,?,?)", "Item#" & $i, i, sqrt(i.float)) theDb.exec(sql"COMMIT") for x in theDb.fastRows(sql"select * from myTestTbl"): echo x theDb.close()