Git Product home page Git Product logo

lowdb's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ire4ever1190

lowdb's Issues

Fix `lowdb/sqlite.insertID` not adding generated ID to the row that is inserted

Minimal example:

import lowdb/sqlite
import std/unittest

let dbConn = open(":memory:", "", "", "")
dbConn.exec sql"CREATE TABLE t1 (id SERIAL PRIMARY KEY, value TEXT)"

let id = dbConn.insertID sql"INSERT INTO t1(value) VALUES ('a')"
let rows: seq[Row] = dbConn.getAllRows(sql "SELECT * FROM t1")

assert rows.len == 1

let expectedValue: seq[Row] = @[
  @[
    DbValue(kind: dvkInt, i: id),
    DbValue(kind: dvkString, s: "a")
  ]
]
check rows == expectedValue

expectation: This should succeed.
insertID should insert an entry into the table AND add an auto-generated ID.

Currently it does not do that, it only adds the entry, it doesn't set the generated id.

SideInformation:

What's mysterious about this is, that it appears to generally work for norm, which is using lowdb and makes extensive use of it.
It also occurs in both nim 1.6.10 and 1.9.1, so it's not a bug caused by devel.

Implement `tryInsertID` for postgres

tryInsertID is implemented, but not for postgres, leading to various tests for postgres in tPostgres.nim being commented out.

The specification for that proc can be seen in tsqlite.nim - suite "Prepared statement finalization":.

Implement `getValue` for postgres

getValue is implemented, but not for postgres, leading to various tests for postgres in tPostgres.nim being commented out.

The specification for that proc can be seen in tsqlite.nim - suite "getValue()":

Implement `DBBlob` for postgres

DbBlob is implemented, but not for postgres, leading to various tests for postgres in tPostgres.nim being commented out.

The specification for that type is the same as sqlite, check out sqlite.nim and tsqlite.nim for basics of the specification.

Implement `instantRows` for postgres

instantRows is implemented, but not for postgres, leading to various tests for postgres in tPostgres.nim being commented out.

The specification for that iterator can be seen in tsqlite.nim - suite "suite "instantrows-iterator":

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.