Today I found a bug that had been vexing me for a long time. Turns out it was a simple bug, but seeing it was hard. I was using SQLite3 to run an update SQL query.
Here’s the corrected code:
sqlite3_bind_double(update_statement, 9, ExecutionTime);
sqlite3_bind_int(update_statement, 10, PrimaryKey);
It’s nice to see this project moving forward a little, even if it is one bugfix at a time…
I had set the Primary key as the 9th element and the Execution Time as the 10. Since the execution time was often 0( which doesn’t exist in the db, FYI ), it would execute the update just fine. SQLite should have errored here — I updated a non-existant record — but it returned no errors. I tried inspecting the bound structure as a memory location, but it made no sense. The debugger indicated it was a pointer to a pointer, and by chance, I noticed the error by cutting and pasting the original SQL into a textedit window, and counting the “?” characters.
Lesson learned — when debugging SQLite, it’s often easier/faster to really examine the query than try to figure out the data structures…
Now on to the more fun stuff. I turned 23 ( in hex ) today! Hahahahaha ( This only is funny if you know hex… ). There’s a store named, “Forever 21” or something like that. I realize that it’s true. If you include imaginary bases and fractional bases, you can literally be forever 21, except when you’re a newborn… You can also be forever one, or forever 100…