6 ms·
>The first thing I've come to appreciate about SQLite is its documentation I've told this story before, but the first time I used sqlite, years ago, I needed t
by sbierwagen 3y ago
>The first thing I've come to appreciate about SQLite is its documentation
I've told this story before, but the first time I used sqlite, years ago, I needed to store a floating point value, so I read the documentation: https://www.sqlite.org/datatype3.html https://www.sqlite.org/datatype3.html
>REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number.
I parsed this as "an 8-bit floating point number". Wow, I thought. That's weird as hell. Oh well, I guess it's sql lite, ha ha. I went on to implement storing numeric values as text strings, which worked exactly as well as you'd expect. Only months later did I find out that it's a normal regular IEEE double, 64 bits long.
- sverhagen 3y agoIs the point of the story that no matter how good the documentation is, we don't read well anyhow? Else, I don't get the point.
- seanw444 3y agoJust a funny anecdote. There's not always a point.
- kaoD 3y agoI was confused as well. How you phrased it, it seemed that your funny story was about how cool the docs were and saved your ass or something like that :)
- ilyt 3y agoIt wasn't his, you answered to someone else. It's funny that under "maybe it was an example of nobody reading shit all" there is a comment where someone didn't read the nickname and thought he's answering to the anectdote's poster comment :D
- robertlagrant 3y agoRight now? Almost half past 12.
- Gordonjcp 3y agoWell, I thought it was funny, but I read and understood all of the words.
- scotty79 3y agoThat's a very salient point. And reading well all the time is super hard. I think that's one of the reasons why people don't write documentation. First of all, who's gonna read all that? Second of all, who's gonna read all of that correctly?
- wahahah 3y agoThey're real, fwiw https://www.johndcook.com/blog/2018/04/15/eight-bit-floating-point/ https://www.johndcook.com/blog/2018/04/15/eight-bit-floating...
- joseferben 3y agoFinding out that there are just 5 datatypes and that BIGINT, VARCHAR, BLOB, etc. are just mapped onto those was actually a breath of fresh air.
- cm2187 3y agoWhich I think is fine (though you could make a case for a proper datetime type). What I am a lot less of a fan is the dynamic typing, ie that if you have an int column, sqlite will happy store a string in there. I am not sure why they do that but to me, it lets some bugs go unnoticed.
- config_yml 3y agoThere are STRICT tables in newer versions of Sqlite
- ilyt 3y agoI saw that complaint but for all purposes it's a moot issue If your code allows it you're fucking doomed anyway and will have multiple other type-related problems all over the codebase.
- richbell 3y agoThere are a variety of ways that bugs like that could sneak through a codebase. I was taught to think of a RDMS as the last line of defense against data integrity issues. SQLite, on the other hand, is more than happy to let you shoot yourself in the foot.
- ilyt 3y agoI mean if you write database code in PHP or JS fair enough but you're fucking doomed if you do anyway.
- plugin-baby 3y ago> I went on to implement storing numeric values as text strings, which worked exactly as well as you'd expect. I imagine it went went ok!
- efxhoy 3y agoMy dad knows very little about computers but he likes joking with me whenever i’m struggling with some technical problem: “8 bits is a byte! That’s all you need to know! How hard could it be?”
- extasia 3y agoThat's awesome haha. I aspire to be a dad like that one day xd.
- john-radio 3y agoYou should tell him this story!
- ilyt 3y agoTI C62xx and C64xx DSPs don't understand 8 bit bytes at all and everything was at least 16 bit. There was no uint8_t there, char is 16 bits etc.
- euroderf 3y agoMore advice for a kid contemplating engineering: An EE only needs to know that you don't stick your finger in a socket. A mechanical engineer only needs to know that you can't push a rope. And a civil enginer only needs to know that sh*t rolls downhill.
- abwizz 3y agomight interest you both that not all bytes are equal
- 1323portloo 3y ago>I went on to implement storing numeric values as text strings, which worked exactly as well as you'd expect. It can be made to work. I would've gone with Binary-Coded Decimal if IEEE 754 standard isn't precise enough.