nom-sql icon indicating copy to clipboard operation
nom-sql copied to clipboard

Moar unsignedness love

Open alexsnaps opened this issue 6 years ago • 3 comments

Kinda hacked in again… All this would deserve tests, kinda pushing as I go :( Sorry

alexsnaps avatar Aug 21 '19 20:08 alexsnaps

btw, I think this may have not been the best approach… shouldn't a literal wrap a i128? And then let the "downstream" consumer see how it deals with it? wdyt?

alexsnaps avatar Aug 21 '19 21:08 alexsnaps

Yeah, I think that's perhaps the best plan. Literal is never stored in large volumes, so wasting some memory on it is fine (unlike with DataType).

This kind of slightly yucky conversion code is likely best placed where we actually need to convert to sized types (e.g., in noria-mysql).

Another approach would be to represent types properly as enum variants that are part of Literal. This requires a larger change, but will result in a more standard parser datastructure; on the flip side, it will much complicate some code paths in Noria that handle literals.

ms705 avatar Aug 21 '19 21:08 ms705

That's a proposal for Literal::Integer(i128). Let me know if you'd rather have the other approach instead. If so tho, what granularity would you expect?

alexsnaps avatar Aug 22 '19 13:08 alexsnaps