Article W5XD CodeSOD: Databases Done Fresh

CodeSOD: Databases Done Fresh

by
Jane Bailey
from The Daily WTF on (#W5XD)

256px-Wrapped_by_Aluminum_foil_and_clear

Nobody knew how Carl kept his job. Some said he was the boss' boss' nephew, or perhaps knew some dirt on the CEO. Some said he had been threatened with termination before, but his lawyer had advised the company it was cheaper to keep him than to get rid of him. Whatever the case, Carl's eccentricities were legendary.

Seeing Carl's footprints on the SVN logs for his project, Paul decided to brave the trip to his cubicle for an explanation of some rationale that eluded his understanding.

Carl's cube was in a back corner, almost forgotten, half-hidden behind the coffee station-just as Carl liked it. He'd built a top to his cube out of cardboard, to keep the area dark despite the flourescant lights. Tinfoil was wrapped around the signs, to counter the "EF rays" that set off his "electrosensitivity." The air smelled faintly of roses and cough drops.

As Paul knocked, Carl turned, taking off a large pair of noise-cancelling headphones before removing the earbuds nestled underneath. "What brings you to my abode?" he asked, with a wide grin that probably was meant to be casual but instead came off as just a little manic.

"I had some questions about your commit, ah, revision 512?"

Paul tried to keep his tone light, but a shadow passed over Carl's face, and his fingers began to twist against each other, fidgeting.

"Ah, yes. Five twelve. Five hundred and twelve. Five hundred and ten and two. A bad number, very bad."

Paul blinked. "... Right. It's just, I don't understand what you were trying to do here?" Tentatively, he held out the printout for Carl to see:

String[] columns = row.split(",", -1);String field1 = columns[0];String field2 = columns[1];String field3 = columns[2]; String field4 = columns[3]; String field5 = columns[4];String field6 = columns[5];String field7 = columns[6];String field8 = columns[7];//String field9Old = columns[8];String field9 = columns[8];String field10 = columns[9];String field11 = columns[10];//String field13Old = columns[12];sql = "insert into tableName(field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11) " + "values (?,?,?,?,?,?,?,?,?,?,?)";dao.executeSql(sql, new String[]{field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11});

Carl nodded, far too many times for Paul's comfort. "Yes, yes. Very bad. You see, the array was too old. Unusable. Data integrity lost."

"Too ... old?" asked Paul, hesitantly.

"Yes. The data, it was stale, you see. Only fresh data can go into the database. Otherwise it attracts ants."

"... Right. Ants. Got it. Thanks." Paul began to back away, hoping only to extract himself safely.

"Be careful of the EF rays!" Carl replied far too cheerily as he put his earbuds back in his ears.

Technically it's not hurting much, Paul thought desperately to himself as he returned to the lit portion of the office. Maybe he won't notice if I wait a week before ripping it back out? Or a month or two ...?

Still, he couldn't get one last lingering doubt out of his mind: Whatever happened to the old field12?

inedo50.png[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated! TheDailyWtf?d=yIl2AUoC8zABql1_QxWQJk
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments