ruby - Mysql2: How do I read a bit column correctly? -


mysql2 reads in bit columns strings default.

my schema:

enter image description here

in ruby:

enter image description here

how read them bytes?

there may better way deal w/it in mysql library, in experience, strings how ruby deals binary data. binary file reader methods same thing.

check out #unpack method. can stuff like:

[16] pry(main)> bytes = "\x00\x01\x02" => "\u0000\u0001\u0002" [17] pry(main)> bytes.unpack('c*') => [0, 1, 2] 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -