• Mr Keith (unregistered)

    It's not quite a Rosetta stone of fail

  • XXXXX (unregistered)

    It's Genius. When the system malfunctions, no one will ever need to search for the failure point as the whole program is a single line of SQL.

  • (cs)

    I think we've found the "SQL God".

  • (cs) in reply to XXXXX
    XXXXX:
    It's Genius. When the system malfunctions, no one will ever need to search for the failure point as the whole program is a single line of SQL.
    It's a "representative line" that is also the entire program.

    Very Zen.

  • Jack (unregistered)

    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

  • (cs)
    (left(Tickets.Description,512) + '...')
    Apparently all descriptions require an appended ellipsis....
  • Oneway (unregistered)

    Someone please tell me there is a caching mechanism (mysql query caching) that makes sure poor mysql doesn't have to endure this at every request.

    I'd like to sleep peacefully tonight.

    Captcha: wisi I wish i knew

  • Procedural (unregistered)

    !(MVC separation is this thing you do when you are not busy with real work)

  • (cs)

    It amazes me that anyone would ever bother writing their own bug/ticket system when there are much better and often, free versions available. Of course, we currently use one of these at work, whipped together in a weekend by the "Development Manager". I could see using a homebrew solution if you wanted to use it as a simple "proof of concept" for some new technology you were evaluating (say, NHibernate), but if you're going to write it the same crappy way as the rest of your code, you might as well use a more polished solution; there's absolutely NO reason to write your own in a situation like this except ignorance or a perceived "But we need oddball Feature X that no other bug tracking system has, and that we probably won't use either! We MUST write our own, customized solution!"

    Also, let's see here:

    • Classic ASP: Check
    • Stored Procedure: Check (granted, best solution with Classic ASP)
    • Sproc mixing HTML and Javascript: Check

    Result: My eyes, the goggles do nothing!

  • Danniel (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    It amazes me that anyone would ever bother writing their own bug/ticket system when there are much better and often, free versions available.

    Does any of those provide the functionality in one very Zen line?

  • Robert "Anaerin" Johnston (unregistered)

    Well, string concatenation in "Classic" ASP is extremely slow (time, and memory use, goes up expoentially with each concatenation, rather than linearly as you'd expect), so getting something else to do the concatenation for you certainly helps. The most common way, however, was to use arrays, as the Join() function created the final string directly, rather than using the concatenation functions within VBScript. Of course, if this is then read from the sproc using rs.movenext, it's a massive time sink there, too (The better way would be to use getrows() to return an array, or even better, getstring() to just dump it directly into a string)!

  • Robert "Anaerin" Johnston (unregistered) in reply to Oneway
    Oneway:
    Someone please tell me there is a caching mechanism (mysql query caching) that makes sure poor mysql doesn't have to endure this at every request.

    I'd like to sleep peacefully tonight.

    Given that it's ASP, it's not MySql, it's MSSQL, which makes that a stored procedure, which is precompiled for speed. So while it's not "Cached", it is precompiled rather than being interpreted every time.

  • (cs) in reply to Jack

    I worked at such a beast where a team wrote VB.Net like code that adhered to an interface, compiled and placed it in a database (binary data in a blob field) using a intermediate tool. These business rules were pulled out of the blob field, loaded into memory, and executed. Just another way to introduce dependency injection I suppose, but I'd never purposely design such a beast.

  • empire (unregistered) in reply to Robert "Anaerin" Johnston

    I'd still be willing to bet that they don't cache the results of this monster of a query, even though the query never changes and the results probably will only change occasionally (whenever there's a new query).

  • (cs)

    I can just imagine the developer thinking,

    "I can't believe this is the only way to build a dynamic HTML page!"

  • Eric (unregistered) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    You've inspired me. In DB2 for the iSeries (and probably others, but I'm most familiar with it) you can define external procedures for use with SQL stored procedures for all your C, RPG and CLP programs as long as their entry parameters are all compatible with SQL types.

    There has to be a way I can save a program object's binary data into a database table as BLOB type, select the appropriate code with SQL call a CLP from a stored procedure that creates a new *PGM object and streams in the binary data call the program object and then delete the program when it finishes

  • (cs)

    Tragically, I've written code like that in my early days directed by my mentor to do so. What a fool I was to listen.

  • (cs) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    I'm led to believe you can do something like that with .NET and SQL Server 2008. Not something I can be bothered to try though....
  • (cs) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    It amazes me that anyone would ever bother writing their own bug/ticket system when there are much better and often, free versions available.

    You've never installed Bugzilla. It's the regex of ticket systems.

  • (cs) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    Before or after it's compiled?
  • (cs)

    Mommy, Mommy, look what I can DO!!! It's SQL, HTML, and JavaScript all at once!"

    "Yes dear, but just because you can, doesn't mean you should. Now put that tool away before you go blind... or make us go blind."

  • phleabo (unregistered)

    Pffft. The stored proc doesn't even build SQL strings to dynamically execute.

    Amateurs.

  • phleabo (unregistered) in reply to Eric
    Eric:
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    You've inspired me. In DB2 for the iSeries (and probably others, but I'm most familiar with it)

    I believe you can use also Java (in addition to C and DB2's SQL dialect) to defined stored procs on the x86 Linux and Windows versions, at least as of 8.2.

    And, my favorite part, all SQL stored procs in DB2 (at least, the non-Mainframe versions that I've seen). really are just C programs. They get translated to C server side, compiled, and installed into the db instance. I discovered this when I wasn't able to get stored proc compilation working correctly on my laptop instance.

  • phleabo (unregistered) in reply to phleabo

    I mean, all SQL based ones. Not the Java ones. Though that'd be an entertaining form of evil.

  • Jay (unregistered)

    This solution is obviously incomplete. I don't see any CSS in the select statement.

    Captcha: "acsi" A character encoding scheme used by dyslexia researchers.

  • sam (unregistered)

    του code è die merde.

  • (cs) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    DECLARE @assembly_bits varbinary(max) SET @assembly_bits = 0x4D5A90000300000004000000FFFF0000 ...

    CREATE ASSEMBLY CLRinDB AUTHORIZATION dbo FROM @assembly_bits WITH PERMISSION_SET = EXTERNAL_ACCESS

  • Larry (unregistered) in reply to Jay
    Jay:
    This solution is obviously incomplete. I don't see any CSS in the select statement.

    Captcha: "acsi" A character encoding scheme used by dyslexia researchers.

    And no XML. Clearly not enterprisey enough.

  • (cs)

    OK, the 'php god' one was obviously fake. But this... this one might actually be legitimate. I can't tell.

  • (cs) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    Can't quite recall ever seeing that, but the inverse - SQL code in a compiled language - makes me shudder at the memories of working with Oracle SQL embedded in C++. A marriage made in hell, especially given the hideousness of Oracle's C++ headers and the widely varying support for C++ in compilers at the time (2000 - 2001).

  • (cs) in reply to Jaime
    Jaime:
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    DECLARE @assembly_bits varbinary(max) SET @assembly_bits = 0x4D5A90000300000004000000FFFF0000 ...

    CREATE ASSEMBLY CLRinDB AUTHORIZATION dbo FROM @assembly_bits WITH PERMISSION_SET = EXTERNAL_ACCESS

    Yeah, but I'd like to see your query generate dynamic assembly using values queried from the database, like the article does with HTML/Javascript.
  • (cs) in reply to Power Troll
    Power Troll:
    OK, the 'php god' one was obviously fake. But this... this one might actually be legitimate. I can't tell.

    The PHP God article seemed perfectly plausible to me. I once worked with a self proclaimed Perl God who wrote similar monstrosities. All of them were packaged up in a single, many thousand line Perl module named after the developer in question. This at least made it easy to replace the bulk of his idiocy with sane code by either searching and replacing the truly bogus function calls (the guy loved reinventing the wheel), then replacing the rest by replacing "use BobLib" with a bunch of more modular (ahem) modules.

  • Anon (unregistered)

    I have actually had to fix code like this before. And this code came from a Sr. positioned person who was very proud of the elegant solution. Ughhh, slapping my forehead.

  • (cs) in reply to Robert "Anaerin" Johnston
    Robert "Anaerin" Johnston:
    Oneway:
    Someone please tell me there is a caching mechanism (mysql query caching) that makes sure poor mysql doesn't have to endure this at every request.

    I'd like to sleep peacefully tonight.

    Given that it's ASP, it's not MySql, it's MSSQL, which makes that a stored procedure, which is precompiled for speed. So while it's not "Cached", it is precompiled rather than being interpreted every time.
    I highly doubt that the time to compile this monstrosity comes close to the time to execute it. Having the stored procedure pre-compiled probably saves about 0.00001% of the total time of a single execution. Caching, on the other hand, could legitimately bypass the execution of the procedure under certain circumstances and may actually help.

  • Vincent (unregistered)

    Embedded SQL inside COBOL/RPG/C is so passé. Let's do it the other way around, way of the future !

  • (cs) in reply to boog
    boog:
    Jaime:
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    DECLARE @assembly_bits varbinary(max) SET @assembly_bits = 0x4D5A90000300000004000000FFFF0000 ...

    CREATE ASSEMBLY CLRinDB AUTHORIZATION dbo FROM @assembly_bits WITH PERMISSION_SET = EXTERNAL_ACCESS

    Yeah, but I'd like to see your query generate dynamic assembly using values queried from the database, like the article does with HTML/Javascript.
    No problem. Simply generate a C# function as a varchar in SQL, use CodeDom to compile it into a binary and then create an assembly from the resulting bits. Here is an example.
  • Childish (unregistered) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    You can store Java stored procedures as bytecode in a BLOB column. It has been done.

  • Yam (unregistered) in reply to Jaime
    Jaime:
    No problem. Simply generate a C# function as a varchar in SQL, use CodeDom to compile it into a binary and then create an assembly from the resulting bits. Here is an example.

    I want to make programs that only do what you want them to if they are given the ability to compile and run themselves. Preferably using two different languages.

  • Vaca Loca (unregistered) in reply to Jack
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    WinFS was half way there.

  • (cs) in reply to Jaime
    Jaime:
    boog:
    Jaime:
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.
    DECLARE @assembly_bits varbinary(max) SET @assembly_bits = 0x4D5A90000300000004000000FFFF0000 ...

    CREATE ASSEMBLY CLRinDB AUTHORIZATION dbo FROM @assembly_bits WITH PERMISSION_SET = EXTERNAL_ACCESS

    Yeah, but I'd like to see your query generate dynamic assembly using values queried from the database, like the article does with HTML/Javascript.
    No problem. Simply generate a C# function as a varchar in SQL, use CodeDom to compile it into a binary and then create an assembly from the resulting bits. Here is an example.
    Wait, you're saying generate the code with table values as a varchar in SQL, then compile it? No no no, that's not what I was saying at all.

    Why would you do that when you can generate the dynamic binary with the table values (converted to hex, of course) already embedded? Compiling just seems like an extra step to me.

  • Some damn Yank (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    It amazes me that anyone would ever bother writing their own bug/ticket system when there are much better and often, free versions available.
    I have never worked where they didn't use a homebrew system. One place I contracted at twice, and the second time they gave me a new email address. Their homebrew bug tracker complained that I already had an account and offered to let me update my email address, but first it would have to send confirmation of the change to my old (no longer active) email. Even the bug tracker administrator couldn't straighten things out, so I never did get access to it on that second contract. I'd have filed a bug report, but...
  • (cs)

    Boy, at our site, that would be a PAGE!!! We're currently at 1.2 million requests.

  • (cs) in reply to Some damn Yank
    Some damn Yank:
    Even the bug tracker administrator couldn't straighten things out

    No one had access to the DB, or did it use some sort of transdimensional, unicorn magic storage system...

    Here's a start:

    UPDATE dbo.Users SET EmailAddress = @NewAddress WHERE UserId = @YourUserId

  • Ed (unregistered)

    And yet still not as much of a WTF as FogBugz. Classic ASP? Nah, let's WRITE OUR OWN LANGUAGE BWAHAHAHAHAHA

  • Which is it? (unregistered) in reply to Coyne
    Coyne:
    Boy, at our site, that would be a PAGE!!! We're currently at 1.2 million requests.
    For one product? Then it's either a steaming pile or a gigantic success. Statistically, the former is more probable.
  • (cs) in reply to Ed
    Ed:
    And yet still not as much of a WTF as FogBugz. Classic ASP? Nah, let's WRITE OUR OWN LANGUAGE BWAHAHAHAHAHA

    Meh, as much as it pains me to say, this kind of makes sense that they did it this way... Rather than trying to maintain two or more seperate code bases in two different languages which have to look and behave identically, they just created their own red-headed step child of a language (which nobody loves of course) to be interpreted into different languages depending on the env (Unix or windows).

  • Obli (unregistered) in reply to java.lang.Chris;
    java.lang.Chris;:
    Jack:
    I'd like to see code from a compiled language in an SQL query. That would be enterprisey.

    Can't quite recall ever seeing that, but the inverse - SQL code in a compiled language - makes me shudder at the memories of working with Oracle SQL embedded in C++. A marriage made in hell, especially given the hideousness of Oracle's C++ headers and the widely varying support for C++ in compilers at the time (2000 - 2001).

    I quite enjoy Pro*C++

  • (cs) in reply to boog
    boog:
    (left(Tickets.Description,512) + '...')
    Apparently all descriptions require an appended ellipsis....

    This is the entirety of my comment!...

  • MK (unregistered)

    See, I always wondered why they said learning more than one language would help me get a job...

    It's for bits of genius like this!

  • qbolec (unregistered)
    Tech.TechUserName LIKE '%' + ISNULL(@TechFilter,Tech.TechUserName) + '%')

    i LIKE this pattern of conditional conditional.

Leave a comment on “Trilingual Query Language”

Log In or post as a guest

Replying to comment #:

« Return to Article