- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Literally the first thought was: "Did they use strings?" Either the situation is too common, or I've seen too much shit.
Admin
had this situation also.. even worse where sometimes there was '1' and sometimes '1 '... and everyone could make some changes to the behavior of their GUI, so three people could have three different results from the same query... took a few of us quite some time to figure that out!
Admin
Thanks to MariaDB having ENUMs internally coded as integers.
Admin
At the very least, don't give them stringly numeric values. But if the column was defined as INT this would be a different story
Admin
I once worked somewhere that employed an ENUM with 3 values, 'Y', 'N', and 'NULL'(it wasn't a nullable field, one of the allowed values was the string NULL).
Enums in DBs were a bad idea.
Admin
Coincidentally, I just had to resolve a situation where [a] the customer had added values with trailing spaces to the primary lookup column and [b] my predecessor had not thought to trim user input in either the front or back ends. Jolly good times.
Admin
This seems like one of those cases where, as painful as it may be, you are far better off exorcising it than trying to keep it chained to the boiler. Also, good example case for showing why one should decouple code from database operations.
Admin
Obligatory "FILE_NOT_FOUND" not found message.
Admin
Obligatory "FILE_NOT_FOUND" not found message.
Admin
Maybe if you keep checking it'll appear. :)
Admin
We have a ref data system that doesn't trim input, and users who enter data quite often get data sent to them in Excel sheets. Any guesses as to what kind of data issues we see sometimes?
Admin
Silent data conversions are THE number one reason why I dislike MySQL. I can understand why they do it, but it's the source of so many issues when the conversion it makes is not the one you expected. Hard failures instead of quietly doing something that you think is probably right - it makes for more robust code, and problems that are far easier to figure out and fix.
Admin
I have to deal with such a database here - back in the day when this was developed, ENUMs were probably seen as "not enterprise-y enough", and all these fields were implemented as INTs, normally with 1 standing in for the affirmative, and 0 for negative.
And then there are those privation fields (like "unsuccessful" or "missing"), where of course 1 is bad and 0 is good. Not to worry about it, it is just my brain twisting every time I have to read these.
Apparently, constraints were also not "enterprise-y" enough, so the DB has none of these. And test tables that were set up during the development are also in prod now at least since 15 years, and nobody dares to touch them, because who knows what they are still used for - there is no documentation after all, and the developers have long since moved on to greener pastures.
That has the effect that there are e.g. no less than three different tables that seem to refer to "categories", all with slightly different names, but seriously different categories. When I have to create a report, it took a while to know which of these I should join with the category IDs to get a useful result (I know now, but it took me a while. Spoiler: it is not the one that is just plainly called "categories"...)
So, rage over. I look at it on the bright side: I learned a lot from this DB - even though it is mostly what never to do when setting up a database.
Admin
Silent data conversions and weakly typed languages simply guarantee corner case errors while making the main case slightly quicker / lazier to implement. What a great tradeoff. Not.
If one really uses TDD, and I know way too few do, squishy types that means every single assignment or comparison needs a dozen corner case tests to validate it. Fat chance of that happening in the management environment where squishy languages are in use.