- 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
It seems there is nothing more WTF than looking back at your own old code bits...
;)
Admin
Thank god we didn't see this
<add key="sp_hi" value="exec hi;"" />
Admin
Stored Procedures would be way too logical of a replacement for that code.
Admin
What is wrong with this?
I'm asking seriously.
Assuming that he is using a DB without Stored Procs?
I've used this in the past, although with a resource file and no a config one.
Is this the security implocations?
Admin
It's hard for me to articulate what seems wrong about this particular approach, but I do know that if I had to change an existing query for some reason, it would hurt my brain.
Admin
The worst part for me is I reimplemented database stored procedures and parameters with String.Replace and the web.config file with about 30 queries. Being in the web.config made it a snap to tweak without recompilation, however.
Admin
My question though: would it even have worked the way it's listed? I mean, when I put "select [p.col] as Column from mytable as p" in SQL Server it errors out because it things "p.col" exactly is the column-name, including the "p."... What DBMS was this running against?
Admin
There's a whole bunch of R0ng with this.
Presumably, there's a data reader on some dataset extracted that matches EXACTLY the column names so changing the SQL without recompile seems mostly doomed, unless the change is so trivial it could have been avoided..
Also, the use of config key value lines is kind of crude. If a sytem is to be configured via the config file, wouldn't it be more elegant to create an attributed collection (config group or custom config) to then GetUserBy([This|That|Other], ParamCollection) or something?
This does beg a stored proc, but hey, MySQL doesn't have them..
Admin
And the filewatchers on web.config will restart your application if you change it, so changing it willy nilly will kick out everybody's session variables.
Admin
This seems vaguely familiar from a project I worked on involving Commerce Server. It was classic ASP so it was stored in the global.asa but generally the same idea.
Admin
Well,
sadly in one of my solutions I had to provide such a mechanism, as two requirements were: Support both sql server and oracle, AND no stored procedures. Ended up with a custom configuration file with automatic attribute annotation etc. Nice API, useless but nice.
U got to love your managers decisions sometimes.