Skip to content

Instantly share code, notes, and snippets.

@DanielHeath
Created February 12, 2014 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielHeath/8950079 to your computer and use it in GitHub Desktop.
Save DanielHeath/8950079 to your computer and use it in GitHub Desktop.
Mysql2 bug
source 'https://rubygems.org'
gem 'mysql2'
GEM
remote: https://rubygems.org/
specs:
mysql2 (0.3.15)
PLATFORMS
ruby
DEPENDENCIES
mysql2
require 'bundler'
Bundler.require
$client = Mysql2::Client.new(:host => "localhost", :username => "root", :database => "float_bug")
$client.query("drop table if exists float_bug")
$client.query("create table float_bug (field float)")
$client.query("insert into float_bug (field) values (999.9999)")
def logged_select(string)
puts string
puts $client.query(string).first["field"]
end
logged_select "select field from float_bug"
logged_select "select field * 1.0000000 as field from float_bug"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment