GithubHelp home page GithubHelp logo

Comments (2)

michaelsbradleyjr avatar michaelsbradleyjr commented on June 14, 2024

Investigation ongoing in #25.

What I wrote in discord chat:

What I find on all platforms is that it's fine to create a BOOLEAN column using a bool literal (TRUE, FALSE, true, false).

If you do an insert into that column using Nim bool true or false or int 1 or 0, things work as expected.

However, sqlite will let you insert a string, doing so doesn't cause an error. Then when you get that value back from a query, if you do db.fromValue(..., bool) it will blow up.

While we could add string->boolean logic for fromValue for bool, I think it's better to leave it as. What I'm thinking is that on the Nim side if someone inserts a string into a boolean column, then that's really a mistake on their part, they should have used a Nim bool or int, and the error they get at runtime [when running a query] will signal that mistake.

I'm not sure if/how we could add something on the Nim side that helps to ensure that when you put values into the database you're putting the right types with respect to the column types.

Another thing I'm not sure about is if with various changes to master that landed recently we've solved the problem where the column type itself would be wrong when a column is created as BOOLEAN with a default value that's a bool literal. Or maybe we simply misunderstood what was happening re: what I describe above. @emizzle I'll be grateful if you can poke at this and let me know what you think.

from nim-sqlcipher.

michaelsbradleyjr avatar michaelsbradleyjr commented on June 14, 2024

I was unable to reproduce the problem, i.e. BOOLEAN columns with default value spec'd as a boolean literal are working as expected on all platforms tested, and regardless of whether libsqlcipher is linked as a static or shared library.

from nim-sqlcipher.

Related Issues (5)

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.