- 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
'intenet' = what you plan to do on the internet
Admin
ok ... ?
Admin
Admin
i don't understand why this is all fine... until we see the table.
?
Admin
This is obviously the more robust choice. Twenty years ago you'd be laughed at for suggesting we might add new genders to our species. We now have male, female, trans-gender, non-actualized, multiple, and "none."
Admin
We did something similar (table of queries) but in shell script (there wasn't enough time to finish the app and this allowed us to short circuit a lot of the as yet uncoded processing). The understanding was that the code still HAD to be written and this hack HAD to go away.
Naturally, nobody considered it urgent after delivery so it lived on... until the auditors came along. Heads rolled, butts were kicked, and suddenly there was time to finish the work.
Every once in a while you win one...
Admin
Where's the WTF?
Admin
Wha-
Nevermind, probably better not to ask.
Admin
It's in the queries themselves.
All those selects from the table "referencedata" with a code mean that not only the queries are softcoded, but the schema as well.
Admin
Hey, wait a second. A bunch of these aren't reports AT ALL!
Admin
So? You can update the codebase for something like that.
Admin
Admin
The real WTF came before the "Well, before firing back in the comments "Where's the WTF?""
Admin
INSERT INTO datacommand (CommandName, Query, QueryDescription) VALUES ('CandyUnicornsAndOMGKittens', 'drop table referencedata;', 'Execute this and wonderful things will happen :)')
Admin
Reinventing the Stored Procedures, eh? ;)
Admin
How about adding a query to show all queries from the query table (or would that be too self-referential)?
Admin
rofl
Admin
Seems like he could have just used stored procedures... and not reinvent wheels.
Admin
I actually worked on a system once that was worse than this. It used XML files to define the stored procs in the system. It worked like this:
Each stored procedure had an XML file that described it. So if I was writing uspGetCustomerOrders, I had to create an xml file GetCustomerOrders.xml that enumerated all the parameters to that proc and their types.
Then each COM component had an XML file that mapped function name to stored procedure name. So if I was writing the getCustomerOrders method in the blOrders component, I had to open blOrders.xml and add an entry to map getCustomerOrders -> GetCustomerOrders.xml.
Really.
So the process of calling a stored proc at runtime from a method was:
That's right, twice to the drive and twice into the XML DOM for every single data call. Did I mention this was a web app?
Admin
Of course the description column should not be nullable. Major WTF!
Admin
The proper colloquialism is "the code to hell is paved with good intentions." - Pete Goodliffe
Admin
Well, it DOES beat recompiling for every query change...
Or do admins here revoke accounts based on saying such things?
Admin
Haven't any of you worked with demon DBAs that will make you fill out forms in triplicate for any and all stored procedure changes, index creations, field additions or modifications or even, horrors, a new table?
I have written whole modules just to get around the stifling bureaucracy. Selecting SQL from a table is small potatoes.
Admin
This is obviously an ingenious solution. By routing every db operation through the same method you decrease the application memory footprint by improving code reuse and assure flexibility to provide future updates and extensions with a minimum of code modifications...
Admin
I just recently did a table of queries. I got sick of running exports for BHB's all the time for ad-hoc queries. These are things that are common enough to bother me, but not used enough to write a report page. So I have a page that displays all the query choices and lets them export the results as html or csv...
Yeah, I know it's probably not the best way to do it, but it's saved me a lot of time.
Admin
@Kempeth: you should apply to that 50000$/yr management positions. how good are you at powerpointing?
Admin
Laugh all you want, but I actually have had to add more genders to a system! It was an appointment system & a veterinary clinic decided to use it. In addition to Unknown, Male & Female, they also needed Neutered Male & Spayed Female.
However in this case, rather than make our hardcoded gender fields enterprisey and extendible, I just misused a different extensible field for this customer.
Admin
you knew someone would say it:
==================== |code |description |
|0 |Yes | |1 |No | |2 |FileNotFound| |3 |true | |4 |false | |5 |ON | |6 |OFF | |7 |<undefined> |
Admin
I hate database WTFs...
Admin
For an English Website I had to add the title options Mr, Mrs, Ms and Other.
Admin
Miss, Dr, Professor, Reverend... :/
What's the problem?
Admin
Yeah, right. The selection 'other' makes the person obviously a professor.
Admin
I've seen signup pages that had over four screens worth of titles available. I barely resisted the temptation to list myself as a Rear Admiral or Pope.
Admin
Actually, it does annoy me when websites don't have an option for Dr. I earn the title and I'd like to use it once in awhile.
Admin
Where is the Internet Complaint Department?
Admin
I feel your pain - I work with something very similar. Everything is defined in XML (and displayed with XSL) for all core DB access. It means you can add a field to the system by simply adding it to the DB, then to the XML (to read/write it) and the XSL (to display it). Now, I'm a programmer... adding a field in code should be too taxing, but whatever. It was fine until I wanted to add a WHERE clause conditionally on something else. There was just no way to do it.
Admin
Clearly this should have been implemented as a table with one column, of datatype LOB, containing XML. That would be totally extensible and enterprisey.
Admin
Admin
Heh.. On my previous work I had an idea, that should help us (developers) to avoid system administrators when we visited the production site. My genius solution was to create a loader, which then connected to the DB, fetches the latest dll for this project, then places it in the memory and after that executes dllmain. I don't know was it good or bad, but i never got time to finish this part. :)
But we implemented a lot of other "cool" stuff in it. I feel sorry for the guy, who is maintaining this project now.
Admin
I agree. TRFTW is that the DBAs even let anyone run queries against a production database. I thought it was pretty much standard practice in any enterprise to restrict applications to only stored procedures, and to disable sp_execsql.
Admin
I can do one better.
OleDbConnection connection = new OleDbConnection(gobjConfig.GetConnectionString()); connection.Open(); program = "select code from program where function = " + szFuncName; OleDbCommand command = new OleDbCommand(cmdText, connection); object obj2 = command.ExecuteScalar();
eval(obj2.ToString());
connection.Close(); connection.Dispose(); command.Dispose();
There. Never need to update the program again. Just change the queries in the database.
Admin
lolwut
Admin
I didn't go to 7 years of evil medical school to be called Mr.!
Admin
cmdText = "select query from datacommand where commandname = " + szText
Is this really the right way to do it on Windows? Constructing query strings by hand is in my world dangerous crap from the 70s.
Admin
This sort of describes my current project ... only it's the harmless version. SQL snippets are stored in Excel templates, then concatenated by the software to one massive statement (7 pages in Word) only to retrieve 1 line of data (with > 100 columns) which is written back to the Excel template and then sent to the client as an Excel sheet - with the original SQL snippets still existing in "hidden" cells. And this is just one major WTF in the whole thing!
Luckily, my task is a total rewrite to get rid of such madness.
Admin
no, it is not the right way, OLE DB / ADO have always supported a parameters collection. Even RDO (the predecessor to ADO) supported some parameterization, and that's going back to the VB 5 days.
Admin
The exact opposite happens in my company. For some reason the DBA's are afraid of Stored Procs, but not afraid of rouge queries in our code.
Admin
s/good\ intentions/cool\ inventions
$0.02 please
Admin
Admin
Poor baby. Sounds like you "earn the title" AMF as well (A = arrogant).