blackbeam / rust_mysql_common

Common primitives of MySql protocol.
Apache License 2.0
109 stars 84 forks source link

added: parse integers to bool #134

Closed thed0ct0r closed 6 months ago

thed0ct0r commented 6 months ago

fixes #133

the mysql specification at https://github.com/blackbeam/rust_mysql_common/issues/url states that all TinyInt values between -128 and 127 are valid as the boolean value true (with the exclusion of 0 being false).

other clients have implemented the full range of their respective integer classes (e.g jdbc's Integer) conversions into boolean.

this commit adds that simple logic with either Value::Int(0) and Value::Uint(0) being false and all other Value::Int's and Value::UInt's being true.

proptests for both ranges were also added for sanity/regressions sake.