SELECT * + datareader.getstring(0...100) = Nightmare
-
Someone just gave a database example on the forum using select * and I needed to drop in here and do a brief rant. I realize it was just an example and was unrelated to what they were showing, but still... I just got through fixing an application where this caused problems. I needed to make a small change to the application which required me to to add a few database columns. I added the columns in between related columns in the table. This of coarse broke everything because in addition to select * they also used datareader.getstring(0) ect. for the 60+ fields returned from the table. My additions put the columns in a new order when retrieved with select *. Of course this wasn't the only problem... the whole thing was a nightmare. MS access backend, which of course means tons of bad inline sql (not paramitized). One big God class that handled everything and no database layer. Every small change I made broke 5 unrelated things. I ended up refactoring the whole thing. I pulled out related functionality into static helper classes, bad coding practice I know, but there wasn't time for proper class design. But I did implement some interfaces and decoupled significant sections of the code so that I could make changes without breaking everything. Any way that's my coding horror rant... thanks I feel better.
topcoderjax - Remember, Google is your friend.
-
Someone just gave a database example on the forum using select * and I needed to drop in here and do a brief rant. I realize it was just an example and was unrelated to what they were showing, but still... I just got through fixing an application where this caused problems. I needed to make a small change to the application which required me to to add a few database columns. I added the columns in between related columns in the table. This of coarse broke everything because in addition to select * they also used datareader.getstring(0) ect. for the 60+ fields returned from the table. My additions put the columns in a new order when retrieved with select *. Of course this wasn't the only problem... the whole thing was a nightmare. MS access backend, which of course means tons of bad inline sql (not paramitized). One big God class that handled everything and no database layer. Every small change I made broke 5 unrelated things. I ended up refactoring the whole thing. I pulled out related functionality into static helper classes, bad coding practice I know, but there wasn't time for proper class design. But I did implement some interfaces and decoupled significant sections of the code so that I could make changes without breaking everything. Any way that's my coding horror rant... thanks I feel better.
topcoderjax - Remember, Google is your friend.
Ohhhhh, so it's your fault. :-D
-
Ohhhhh, so it's your fault. :-D
PIEBALDconsult wrote:
Ohhhhh, so it's your fault.
Almost always is... still haven't quite figured out how, but I've come to accept it. :sigh:
topcoderjax - Remember, Google is your friend. Try this Custom Google Code Search
-
Someone just gave a database example on the forum using select * and I needed to drop in here and do a brief rant. I realize it was just an example and was unrelated to what they were showing, but still... I just got through fixing an application where this caused problems. I needed to make a small change to the application which required me to to add a few database columns. I added the columns in between related columns in the table. This of coarse broke everything because in addition to select * they also used datareader.getstring(0) ect. for the 60+ fields returned from the table. My additions put the columns in a new order when retrieved with select *. Of course this wasn't the only problem... the whole thing was a nightmare. MS access backend, which of course means tons of bad inline sql (not paramitized). One big God class that handled everything and no database layer. Every small change I made broke 5 unrelated things. I ended up refactoring the whole thing. I pulled out related functionality into static helper classes, bad coding practice I know, but there wasn't time for proper class design. But I did implement some interfaces and decoupled significant sections of the code so that I could make changes without breaking everything. Any way that's my coding horror rant... thanks I feel better.
topcoderjax - Remember, Google is your friend.
I know this routine… decipher, decouple, rewrite (portions), and etcetera. Then may be you can make a minor change without breaking something else. Remember this mantra: “Life is wonderful”, just keep repeating through your gritted teeth until your jaw unclenches and you can concentrate once more.
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra