17 Sep 2003 dsnopek   » (Journeyer)

Okay folks, this is the way not to do things. Yesterday at work, I managed to erase all of the status information in our database. The status information is how we do all of our accounting and the only way we know where any given item is. Fortunately, we have been able to restore about 98% of the information from the last 6 monthes. All information before that is lost forever.

Here is what happened: I just added the complex where statements to Xmldoom. I tested them, but not very well. There was a bug that essentially stopped complex statements from being passed to the above statement. A simple fix. But while I was looking at the code I made another change that did the opposite of the first bug. Complex wheres worked, but simple where's weren't passed up properly. When looking at the code it seemed like an obvious optimization (one less loop). But anyway, it cause the property Set* methods to ommit the key! So what should have been:

UPDATE table SET data = 'yup' WHERE id = 0

Became:

UPDATE table SET data = 'yup'

Thus setting the value of the data column to 'yup' for EVERY SINGLE ROW. The really sad part is, that if I had simply ran the unit tests before running my script, I would have noticed them fail. I have included as many checks in my code as possible to avoid this EXACT mistake. But alas, my ability to screw up vastly exceeds my ability to double check my work.

I don't think they'll fire me today.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!