GithubHelp home page GithubHelp logo

mysql2-cs-bind's Issues

Argument true/false does not work

With a table as:

CREATE TABLE IF NOT EXISTS tests (
    bool BOOLEAN NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Following xquery

db.xquery('INSERT INTO tests (bool) VALUES (?)', true)

raises an error as:

lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:131:in `_query': Incorrect integer value: 'true' for column 'bool' at row 1 (Mysql2::Error)
        from lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:131:in `block in query'
        from lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:130:in `handle_interrupt'
        from lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:130:in `query'
        from lib/ruby/gems/2.4.0/gems/mysql2-cs-bind-0.0.6/lib/mysql2-cs-bind.rb:14:in `xquery'

because it executes

INSERT INTO tests (bool) VALUES ('true')

Note that

INSERT INTO tests (bool) VALUES (true)

or

INSERT INTO tests (bool) VALUES ('1')

works

Extra set of ' ' added on top of original ones

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ' [xquery parameter] ' ' at line 1 (Mysql2::Error)

Fixed by deleting the appended ' ' in front and after the parameters.
Took my 6 hours to try to get a prepared statement going and then I just decided to try to fix your gem instead. That took 10 seconds. Programmer lyf :)

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.