Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.remove() / unhandled exception #1

Open
marwal-88 opened this issue Jul 8, 2023 · 1 comment
Open

db.remove() / unhandled exception #1

marwal-88 opened this issue Jul 8, 2023 · 1 comment

Comments

@marwal-88
Copy link

marwal-88 commented Jul 8, 2023

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
Copy link
Author

nimble test:

[mw@stat nim-simpledb]$ nimble test
Verifying dependencies for [email protected]
Info: Dependency on classes@>= 0.2.13 already satisfied
Verifying dependencies for [email protected]
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]

  • Cleanup

    • Remove existing database
  • Database tests

    • Open database
    • Add a document
    • Replace a document
    • Update a document
    • Batch updates
    • Close and reopen database
    • Fetch a document by ID
    • Complex queries
    • Iterator
    • Delete a single document
      /home/mw/nim/WORK/nim-simpledb/tests/tests.nim(154) tests
      /home/mw/nim/WORK/nim-simpledb/src/simpledb.nim(419) remove
      /home/mw/nim/WORK/nim-simpledb/src/simpledb.nim(395) remove
      /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]
      Error: execution of an external program failed: '/home/mw/nim/WORK/nim-simpledb/tests/tests '
      Tip: 4 messages have been suppressed, use --verbose to show them.
      Error: Execution failed with exit code 1
      ... Command: /home/mw/.nimble/bin/nim c --noNimblePath -d:NimblePkgVersion=0.1.0 --path:/home/mw/.nimble/pkgs/classes-0.3.17 --hints:off -r --path:. /home/mw/nim/WORK/nim-simpledb/tests/tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant