Closed alexsnaps closed 5 years ago
wdyt?
Thanks! This is very useful :+1:
I do wonder if we want to use a separate variant of the SqlType
enum for the unsigned and signed types. This has two advantages:
Does SQL have signed/unsigned reals and doubles? I thought doubles (in the IEEE 754 sense) are always signed.
Looking good! The only thing I would change (beyond the literal point raised above) is that Some(sign) if sign.len() == 8
seems like a brittle way to check if sign
is the string "signed" or "unsigned". A better way might be something along the lines of:
match ... {
Some(ref signedness) => {
let signedness = String::from_utf8(signedness).unwrap();
if signedness == "unsigned" {
SqlType::UnsignedInt(len.map(|l|len_as_u16(l)).unwrap_or(32))
} else if signedness == "signed" {
SqlType::Int(len.map(|l|len_as_u16(l)).unwrap_or(32))
} else {
unreachable!()
}
}
}
@alexsnaps I'd love to get this merged. What do you think about the proposed change above?
@alexsnaps I'd love to get this merged. What do you think about the proposed change above?
Yeah, sorry 🤦‍♂ This thing called life came in between and I… lost track of this. Let me recap:
Literal::UnsignedInteger(u64)
and use the sign of literal to use unsigned or signed (I'll look what this the also means for operators et al - thinking out loud)I'll do my best to wrap this up this week! Does that sound good?
Great, sounds good! Let me know if I can help.
@ms705 First, sorry for the long delay again. But I think I implemented what we had discussed. Is that more inline with what you had in mind?
Yes, thank you! Looking great.
I've had a usecase where I needed support for
unsigned
integers. So I've added this. If there is something you'd want me to do differently or whatever, let me know.