Josh was a bit nervous about working with the A-team. No, not the A-Team with Mr. T, but the highly revered team of crack coders at Josh's company that, unlike the B-team, doesn't waste time with things like architecture, design, testing, formal requirements, or any of that other jibba jabba; they just got things done. But, the fact of the matter was, the A-team as falling a bit behind schedule and needed some help with their project.
One of Josh's first tasks was a simple one -- decrease the display size of some of the embedded demonstration videos. Problem was, he couldn't find a single OBJECT or PARAMETER tag anywhere in the source code. But he did find something that he didn't quite expect: Javascript embedded in HTML embedded in a SQL query embedded in an ASP page ...
sqlQuery = "SELECT " & _ " ItemId, ItemPrice, ItemShipStatus, ItemLink = " & _ " '<a href=""JavaScript: window.open(''itemStatus.asp?orderid=" & oid & "' + " & _ " '&itemid=' + CAST(ItemId AS VARCHAR(64)) + ''');"">Info</a>' " & _ " FROM ordereditems WHERE itemorderid=" & intOrderId
This finding naturally led into a conversation with his coworker, Murdock ...
Josh: Javascript in a SQL Query? Seriously?
Murdock: What's wrong with that? It's more efficient that way.
Josh: Okay ... well, any idea where the demo video tags are? I want to change the size but can't find 'em.
Murdock: Oh we put the OBJECT HTML Tags in the ItemMovieUrl column on the items table.
Josh: So this way ... we have to update every item whenever this changes?
Murdock: Well no, you just run an UPDATE statement and it will update them all at once.
Josh: Err ... isn't that just what I ... never mind. thanks ...
... so to wrap it up ... Javascript embedded in HTML embedded in a SQL query embedded in an ASP page to display videos embedded in OBJECT tags embedded in HTML embedded in the database.