jjv360 / nim-simpledb

A simple NoSQL database for Nim
13 stars 0 forks source link

db.remove() / unhandled exception #1

Open marwal-88 opened 12 months ago

marwal-88 commented 12 months ago

import pkg/simpledb, json import std/strutils

var db = SimpleDB.init("test.db")

let txt = """
  Some rows
  of text
  end.""".dedent

db.put(%* {"id": "one@two", "cursor_line": 4, "text": txt}) # ok

let res = db.get("one@two")
echo res["text"].str #ok

db.remove("one@two") # error

/home/mw/.choosenim/toolchains/nim-1.6.12/lib/impure/db_sqlite.nim(727) execAffectedRows /home/mw/.choosenim/toolchains/nim-1.6.12/lib/impure/db_sqlite.nim(271) exec /home/mw/.choosenim/toolchains/nim-1.6.12/lib/impure/db_sqlite.nim(198) dbError Error: unhandled exception: near "LIMIT": syntax error [DbError]

db.close()


db.remove("one@two") is not working.

but this is working: db.query() .where("id", "==", "one@two") .remove()

v0.1.0

marwal-88 commented 12 months ago

nimble test:

[mw@stat nim-simpledb]$ nimble test Verifying dependencies for simpledb@0.1.0 Info: Dependency on classes@>= 0.2.13 already satisfied Verifying dependencies for classes@0.3.17 Compiling /home/mw/nim/WORK/nim-simpledb/tests/tests (from package simpledb) using c backend /home/mw/.choosenim/toolchains/nim-1.6.12/lib/impure/db_sqlite.nim(184, 1) Warning: Circular dependency detected. codeReordering pragma may not be able to reorder some nodes properly [User] /home/mw/nim/WORK/nim-simpledb/src/simpledb.nim(106, 7) template/generic instantiation of class from here /home/mw/nim/WORK/nim-simpledb/src/simpledb.nim(171, 9) Warning: The bare except clause is deprecated; use except CatchableError: instead [BareExcept]