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

Prepared statements should handle booleans properly #871

Merged
merged 1 commit into from
Aug 8, 2017

Conversation

kamipo
Copy link
Contributor

@kamipo kamipo commented Jul 12, 2017

Without this fix, booleans always be bound as 0.0 even if true.

Failures:

  1) Mysql2::Statement should handle booleans
     Failure/Error: expect(result.to_a).to eq(['true' => 1, 'false' => 0])

       expected: [{"true"=>1, "false"=>0}]
            got: [{"true"=>0.0 (#<BigDecimal:7fc532889ba0,'0.0',9(18)>), "false"=>0.0 (#<BigDecimal:7fc532889a88,'0.0',9(18)>)}]

       (compared using ==)

       Diff:
       @@ -1,2 +1,3 @@
       -[{"true"=>1, "false"=>0}]
       +[{"true"=>0.0 (#<BigDecimal:7fc532889ba0,'0.0',9(18)>),
       +  "false"=>0.0 (#<BigDecimal:7fc532889a88,'0.0',9(18)>)}]

     # ./spec/mysql2/statement_spec.rb:67:in `block (2 levels) in <top (required)>'

Without this fix, booleans always be bound as `0.0` even if `true`.

```
Failures:

  1) Mysql2::Statement should handle booleans
     Failure/Error: expect(result.to_a).to eq(['true' => 1, 'false' => 0])

       expected: [{"true"=>1, "false"=>0}]
            got: [{"true"=>0.0 (#<BigDecimal:7fc532889ba0,'0.0',9(18)>), "false"=>0.0 (#<BigDecimal:7fc532889a88,'0.0',9(18)>)}]

       (compared using ==)

       Diff:
       @@ -1,2 +1,3 @@
       -[{"true"=>1, "false"=>0}]
       +[{"true"=>0.0 (#<BigDecimal:7fc532889ba0,'0.0',9(18)>),
       +  "false"=>0.0 (#<BigDecimal:7fc532889a88,'0.0',9(18)>)}]

     # ./spec/mysql2/statement_spec.rb:67:in `block (2 levels) in <top (required)>'
```
@sodabrew sodabrew added this to the 0.4.9 milestone Aug 8, 2017
@sodabrew sodabrew merged commit 7e8f0e1 into brianmario:master Aug 8, 2017
@kamipo kamipo deleted the should_handle_booleans branch August 8, 2017 11:17
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

Successfully merging this pull request may close these issues.

2 participants