Comment On Sql.Config

Rick Olson gives us a peek into a rather interesting system that he developed a while back Here's a snippet from the web.config file. And yes, that is custom parameter handling that you see ... [expand full text]
« PrevPage 1Next »

re: Sql.Config

2004-08-20 15:03 • by Greg
It seems there is nothing more WTF than looking back at your own old code bits...
;)

re: Sql.Config

2004-08-20 15:15 • by Ralph
Thank god we didn't see this

<add key="sp_hi" value="exec hi;"" />

re: Sql.Config

2004-08-20 15:46 • by The Jeff
Stored Procedures would be way too logical of a replacement for that code.

re: Sql.Config

2004-08-20 15:48 • by Ayende
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?

re: Sql.Config

2004-08-20 16:00 • by Ron
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.

re: Sql.Config

2004-08-20 18:40 • by rick
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.

re: Sql.Config

2004-08-20 19:36 • by Eric M. Wilson
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?

re: Sql.Config

2004-08-20 20:25 • by fogelman
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..

re: Sql.Config

2004-08-20 21:00 • by Ryan
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.

RE: Sql.Config

2004-08-20 22:38 • by don@ghostdev.ca (Don Newman)
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.

re: Sql.Config

2004-11-10 11:36 • by Sebastien Lambla
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.
« PrevPage 1Next »

Add Comment