• none (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    Sorry, I think it's a fake. Why should otherwise all the methods be sorted alphabetically by name???

    It's from Microsoft Dynamics Solomon or as it is now called SL. They like to put things in alphabetical order. If this guy is a MS developer then it explains why SL sucks. If he develops 3rd party modules for SL then it explains why most of those suck.

  • grzlbrmft (unregistered) in reply to arty
    arty:
    grzlbrmft:
    SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...

    Apparently your predecessor hadn't met Mr. Join.

    I am not completely sure because it has been a while since I have last seen this code, but obviously he and Mr. Join were not best friends. Also was also not very familiar Mr. N. Form I-III and had something against relationships...

  • Nubis (unregistered) in reply to SenTree

    When the lion is after the monkey, being rapidly-conceived is certainly a requirement for the best solution, being the process of coming up with it part of the solution itself. A solution with a long conceiving process is therefore sub-optimal. But among the solutions that help the monkey be safe, there's probably one that makes the monkey run less, one that ends with a dead lion (assuming that's good), or one where the monkey gets hurt for trying to climb a tree without watching it puts its hands.

    A perfect solution gracefully balances the time taken by the previous planning with the actual execution. Give enough space to the problem and this could be a suboptimal solution to the problem of finding a job, with the guy getting into CS in the first place...

    sorry, just making such fuss about it b/c your reply was overly simplistic and didn't seem to really understand the meaning of 'optimal', but it also serves as a good argument pro-cowboy coding which most people here have to suffer...

  • Gary (unregistered) in reply to SenTree
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.

    "Optimum solution" and "well-fed lion" are mutually exclusive, you berk.

  • Windrider (unregistered)

    This seems to be written in either C# or Java; C# is more likely. It doesn't matter which, though: both of those languages use immutable strings, so every string concatenation is creating a new string and trashing an old one.

    I count 327 string concatenations (with the help of a search in my code editor of choice), and that completely ignores the costs of Trim(), Replace(), and other objects' ToString() calls that could be potentially inefficient as well (given what this code looks like).

    This single statement probably calls the garbage collector on its own. Twice.

  • Nubis (unregistered) in reply to Gary
    Gary:
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.

    "Optimum solution" and "well-fed lion" are mutually exclusive, you berk.

    I also had a reply for mr. Berk, but I forgot to quote him correctly.

    When the lion is after the monkey, being rapidly-conceived is certainly a requirement for the best solution, being the process of coming up with it part of the solution itself. A solution with a long conceiving process is therefore sub-optimal. But among the solutions that help the monkey be safe, there's probably one that makes the monkey run less, one that ends with a dead lion (assuming that's good), or one where the monkey gets hurt for trying to climb a tree without watching it puts its hands.

    A perfect solution gracefully balances the time taken by the previous planning with the actual execution. Give enough space to the problem and this could be a suboptimal solution to the problem of finding a job, with the guy getting into CS in the first place...

    sorry, just making such fuss about it b/c your reply was overly simplistic and didn't seem to really understand the meaning of 'optimal', but it also serves as a good argument pro-cowboy coding which most people here have to endure...

  • (cs) in reply to Anonymous
    Anonymous:
    So was this seriously on one line? It's a good idea for TDWTF editors to add line breaks for clarity but I think that whenever this happens you should also include the original code, exactly as it appeared on submission. Sometimes a great WTF is elevated to the next level by nothing more than its excrutiatingly bad composition.

    Just about the only thing that ever changes on published vs submitted code are whitespace (as was this one) and occasionally domain names (like, "FarmerOwners" to "Customers").

    The fomer is almost always stylistic (tabs vs spaces, etc)... but if it's goofy to begin with (no indentation, backwards indentation, etc), then I'll keep it in. So, like, today's, just picture all the linebreaks removed.

    As for the latter... well, making that avaiable would somewhat defeat the purpose of anonymizing it in the first place.

  • moltonel (unregistered) in reply to grzlbrmft
    grzlbrmft:
    iToad:
    So what is the upper limit on size for a SQL string? Whatever the limit is, this thing looks like it may be approaching it.

    I think on SQL server it is 2^15 characters...

    Huh... that would mean you couldn't insert more than 32k of data into a row using normal insert ? That can't be right.

  • Markku Uttula (unregistered) in reply to Satanicpuppy
    Satanicpuppy:
    It's normal for SQL, but it's weird in general. The backslash is much more commonly used in programming languages, and you'd think that the SQL standard would reflect that.

    I believe the "escaping quotation marks by doubling the quotation mark" stems from the fact that SQL borrows rather heavily from COBOL (the language of choice at the time SQL was originally introduced).

    moltonel:
    grzlbrmft:
    iToad:
    So what is the upper limit on size for a SQL string?

    I think on SQL server it is 2^15 characters...

    Huh... that would mean you couldn't insert more than 32k of data into a row using normal insert ? That can't be right.

    32k ... bff - you wish. In Oracle, the longest text field is 4000 bytes. Of course, like any database I know of that is alive today, there are the "Large Object"-fields, that can store heck of a lot more data.

  • A Muffin (unregistered) in reply to Code Dependent
    Code Dependent:
    Jess:
    In this case, KISS would stand for: Keep It Stupid, Simple!
    How about "KISaS"?
    s/S/SS/

    captcha: uxor. So suxor? Makes sense.

  • SAMO (c) (unregistered)

    MY SENIOR ARCHITECT ASKED ME TO KEEP THINGS SIMPLE, SO I ADDED SOME SIMPLE, SIMPLE STRINGS AND THEN THIS HAPPENED. LONG LIVE LINES BREAKS FOR CLARITY.

  • highphilosopher (unregistered) in reply to ubersoldat

    Seriously,

    What's really stupid, is assigning a measure of intelligence to a non intelligent object. Of course computers will run this code, they don't have a choice.

  • Dan (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    Sorry, I think it's a fake. Why should otherwise all the methods be sorted alphabetically by name???

    Ah, one of those bigots who think that all programmers are sloppy :)

    Just because you avoid the APIs doesn't mean you leave everything unsorted. In fact, if his aim is to "keep things simple", then I can see imposing a logical ordering for maintainability.

  • anonymous (unregistered) in reply to Windrider

    I believe I've read somewhere that Java is optimized to use StringBuilder or some such class behind the scenes when dealing with multiple concatenation operators in a single statement. Can't speak for .NET but I'm sure it has a similar optimization.

  • anonymous (unregistered) in reply to anonymous

    Sorry, forgot to quote, my comment was in response to Windrider's comment about 327 concatenations of immutable strings.

  • (cs) in reply to Windrider
    Windrider:
    This seems to be written in either C# or Java; C# is more likely. It doesn't matter which, though: both of those languages use immutable strings, so every string concatenation is creating a new string and trashing an old one.

    I count 327 string concatenations (with the help of a search in my code editor of choice), and that completely ignores the costs of Trim(), Replace(), and other objects' ToString() calls that could be potentially inefficient as well (given what this code looks like).

    This single statement probably calls the garbage collector on its own. Twice.

    Yes the proper way to do it is use a StringBuilder.

    I remember a long time ago this was the only way to make a SQL call. This kind of thing was rampant back then, and nearly everyone wrote libraries to handle situations like this. Even if you used a stored procedure, the long list of parameters still exists, and you are still going to write some kind of statement for each one. A parameterized query object would actually make this code longer, but it would make it safer and a little more readable. While this code is funny to look at these days, it's not particularly surprising, and not really much of a WTF if you remember the old days.

  • C (unregistered) in reply to grzlbrmft
    grzlbrmft:
    I think on SQL server it is 2^15 characters... I have once maintained a project where this was surprisingly reached. SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...
    Did the project members eventually learn that those were NOT guids?!?
  • ClutchDude (unregistered) in reply to jasmine2501
    jasmine2501:

    Yes the proper way to do it is use a StringBuilder.

    I remember a long time ago this was the only way to make a SQL call. This kind of thing was rampant back then, and nearly everyone wrote libraries to handle situations like this. Even if you used a stored procedure, the long list of parameters still exists, and you are still going to write some kind of statement for each one. A parameterized query object would actually make this code longer, but it would make it safer and a little more readable. While this code is funny to look at these days, it's not particularly surprising, and not really much of a WTF if you remember the old days.

    Funny thing is that on my project, someone started using a StringBuilder to combine strings.

    For instance instead of

    String x = "Select * from table where id = ? and user_id = ?"

    they would use

    StringBuilder x = new StringBuilder(); 
    x.append("Select * ");
    x.append("from table "); 
    x.append("where id = ? ");//1
    x.append("and userid = ?");//2

    Most of the entire code base is like this, but it is a lot easier to identify the parameters this way when you've got 10+ of them.

  • (cs) in reply to arty
    arty:
    grzlbrmft:
    SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...

    Apparently your predecessor hadn't met Mr. IN.

    FTFY

  • wtf! (unregistered) in reply to SenTree
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.

    Task: Escape the lion. Optimum solution: A solution resulting in a well-fed lion?

    SenTree is the real WTF here...

  • Pestulant (unregistered) in reply to wtf!
    wtf!:
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.

    Task: Escape the lion. Optimum solution: A solution resulting in a well-fed lion?

    SenTree is the real WTF here...

    At least the monkey is at piece.

  • RandomUser423657 (unregistered) in reply to campkev
    campkev:
    arty:
    grzlbrmft:
    SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...

    Apparently your predecessor hadn't met Mr. IN.

    FTFY

    Except, that SQL Server (MS, anyway) often expands IN comparisons into normal boolean expressions when used with literals. Just botch the syntax and watch the error show up as many times as you have literals. You get a similar result with BETWEEN. I wonder if the limit is before or after the internal rewrite.

  • (cs) in reply to SenTree
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.
    It's been pointed out before that an elegant optimum solution isn't equivalent to failure, so I'll let that one ride.

    The other point worth making is that monkeys don't practice piano in order to escape lions. Neither do programmers (to escape lions or draw a salary). However, there have been many parallels observed between musicianship and programming ability. The difference is that you can earn money being a crap programmer, while you have to be a world class musician before you can even think about giving up your day job.

    The optimal solution, therefore, is to study piano instead of trying to get the best grades in CS classes.

    Damn.

  • Slicerwizard (unregistered) in reply to Pestulant
    Pestulant:
    At least the monkey is at piece.
    More like in little itty bitty pieces.
  • (cs) in reply to rfsmit
    rfsmit:
    The other point worth making is that monkeys don't practice piano in order to escape lions.
    <offtopic> This reminds me of an advice column I saw once in some health magazine, where a guy had written in saying that he was having a terrible time controlling his road rage in going-home traffic. He said he had taken up playing mandolin as a way of trying to calm himself, but he still kept on getting frustrated and angry in heavy traffic.

    The advisor replied in a snooty (read "snotty") manner that he should consider a class in anger management. Meanwhile, he should continue playing mandolin, and put some Hayden in the CD player during heavy traffic.

    I wrote in reply that the dumbass should put the mandolin down and concentrate on his driving. "And forget Hayden," I said. Instead he should put in Pantera's "Vulgar Display of Power". He would identify so completely with the lyrics and the rage omnipresent in the music that his anger would be dispelled simply by being expressed in such a forceful manner.

    Needless to say, it didn't get printed. :) </offtopic>

  • Gary Olson (unregistered) in reply to iToad
    iToad:
    So what is the upper limit on size for a SQL string? Whatever the limit is, this thing looks like it may be approaching it.
    This statement approaches the upper limit asymptotically with each + operator as a result of the , operators. The parenthis define the upper and lower limits of the statement length.

    CATCHPA -- damnum. Probably what should happen to the example code section.

  • you (unregistered)

    Eh, I've seen worse, and not just on here, either.

  • LiteMan (unregistered) in reply to charlieo

    It certainly is. It's SOShipLine if I'm not mistaken.

    This also explains why everything is in alphabetical order. SL has, since its infancy if I'm not mistaken, always had all its columns in alphabetical order. No column can be Null. AND the primary key of the table HAS to be TableName0. So in this case, the primary key is a unique clusetered index named SOShipLine0.

    I hate myself for knowing this.

  • Peter (unregistered) in reply to Anonymous Coward

    I have a friend to tends to do stuff like this. He writes up a SQL script that walks through the table (or view) and generates code on the fly.

    For a tiny snippet (for SQL Server) that doesn't check datatype or anything like that:

    declare @tableName varchar(255)
    set @tableName = 'YourTableNameHere'
    select c.name + '.ToString().Trim()' from syscolumns c 
    inner join sysobjects o on c.id=o.id 
    where o.name=@tableName order by c.name asc
  • rwessel (unregistered) in reply to Satanicpuppy
    Satanicpuppy:
    Dragnslcr:
    Satanicpuppy:
    In mssql and sybase you escape a single quote by adding...another single quote.

    Not sure if you're trying to imply that escaping a single quote with another single quote is a stupid decision by MSSQL and Sybase, but I'm pretty sure it's because that's what the SQL standard says. Postgres does it the same way, and MySQL at least supports it, even though MySQL seems to prefer using a backslash for the escape character.

    It's normal for SQL, but it's weird in general. The backslash is much more commonly used in programming languages, and you'd think that the SQL standard would reflect that.

    That being said, I don't actually have a preference. I like being able to use backslashes, but the logic for using the single quote as an escape character is easier, and having multiple escape characters, a la MySQL is a bad idea.

    Actually the doubling up of quotes is more an old mainframe sort of thing. And that's what Cobol uses, too. Since that's the environment that SQL came from, it's not unexpected that they used that technique.

  • AshG (unregistered) in reply to Dr. Evil
    Dr. Evil:
    When I read this first thing this morning, I let out an audible long and drawn out UUUUUUUUUUUUUUUUUUGH... Everybody was looking at me so I had to act like I messed something up.
    The real WTF is working at a place where EVERYBODY will look at you. What do they practice there, a zealous agile/extreme methodology up to placing everyone in a room facing each other? Are farts allowed?
  • Geoff (unregistered)

    Yes ladies and gentlemen our system is so robust it can handle 3 - yes 3 transactions per second!

  • MyName.Trim().Trim().Trim() (unregistered)

    Personally I think they should offer a performance enhancement to System.String to store an 'IsTrimmed' boolean and thus prevent a million billion iterations over the same string for the same information, namely, that there are no whitespace on the ends.

    Better yet, create an entirely new string class called the TrimmedString, guaranteed to never have trailing or leading whitespace.

  • Phredrik (unregistered)

    I was visiting the site from a new location, so I didn't have the "Show Full Article" cookie. I clicked to see the whole thing, got ONE glimpse at that monster, and changed my mind...

    Hopping hacksaws, Batman! What is that thing?!

  • Mike5 (unregistered)

    TRWTF is that he's not using a StringBuilder...

  • (cs) in reply to asdf
    asdf:
    static public string SqlList(params object[] values) {
    	StringBuilder sb = new StringBuilder;
    	bool first = true;
    	for (object value in values) {
    		if (!first) sb.Write(", ");
    		first = false;
    		if (value is string) sb.Write("'"+((string)value).Trim().Replace("'","''")+"'");
    		else if (value is decimal || value is int || value is float || value is double) sb.Write(value.ToString());
    		else throw new NotSupportedException("Unexpected value type: " + typeof(value));
    	}
    	return sb.ToString();
    }
    Nooooo! You're doing it wrong.
    if (!first) sb.Write(", ");
    Don't waste time checking this inside the loop. Just ALWAYS add a comma at the END of the string and once you leave the loop, just strip the last one off again.
  • (cs) in reply to Code Dependent
    Code Dependent:
    rfsmit:
    The other point worth making is that monkeys don't practice piano in order to escape lions.
    <offtopic> This reminds me of an advice column I saw once in some health magazine, where a guy had written in saying that he was having a terrible time controlling his road rage in going-home traffic. He said he had taken up playing mandolin as a way of trying to calm himself, but he still kept on getting frustrated and angry in heavy traffic.

    The advisor replied in a snooty (read "snotty") manner that he should consider a class in anger management. Meanwhile, he should continue playing mandolin, and put some Hayden in the CD player during heavy traffic.

    I wrote in reply that the dumbass should put the mandolin down and concentrate on his driving. "And forget Hayden," I said. Instead he should put in Pantera's "Vulgar Display of Power". He would identify so completely with the lyrics and the rage omnipresent in the music that his anger would be dispelled simply by being expressed in such a forceful manner.

    Needless to say, it didn't get printed. :) </offtopic>

    If you'd just left it as the one-liner it would have gotten printed. (And possibly syndicated.)

    Elegant and optimal.

  • Cbuttius (unregistered)

    Assuming you must have a table with 109 columns, getting the data from SQL should be simple enough as you can get columns by index in many APIs.

    Locally if you have some kind of variant type then you can loop through your columns and can always have enums when addressing column names individually.

  • Cbuttius (unregistered)

    Further to my last comment though, if the code being shown in this example was somehow "automatically generated" then it isn't such a big WTF after all, and it may well be they have a device to generate such code.

    Auto code generation systems used to be popular around 10 years ago and can be better than templates / generics at times when those become excessively complicated.

  • (cs) in reply to wtf!
    wtf!:
    Task: Escape the lion.
    OK. Try this:
        the\ lion\.
    It's a bit trivial in SQL though.
  • grzlbrmft (unregistered) in reply to campkev
    campkev:
    arty:
    grzlbrmft:
    SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...

    Apparently your predecessor hadn't met Mr. IN.

    FTFY

    Mr. IN came in to work around this problem temporarily, knowing that he would have to go quite soon and be replaced by something more bizar^Wefficient.

  • grzlbrmft (unregistered) in reply to C
    C:
    grzlbrmft:
    I think on SQL server it is 2^15 characters... I have once maintained a project where this was surprisingly reached. SELECT ... FROM ... WHERE CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E5' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E6' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E7' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E8' OR CustomerID = 'F9168C5E-CEB2-4faa-B6BF-329BF39FA1E9' OR ...
    Did the project members eventually learn that those were NOT guids?!?

    I took one from an MSDN page and modified it a few times. However I'd like to know - why arent't these GUIDs? (besides the facts that they are not globally unique and were stored in varchar(32) columns ;-))

  • Not Dorothy (unregistered) in reply to Gary
    Gary:
    "Optimum solution" and "well-fed lion" are mutually exclusive, you berk.

    Oh no they are not - A. Lion.

  • (cs) in reply to Gary
    Gary:
    SenTree:
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice
    However, a rapidly-conceived intuitive solution which allows the monkey to escape the lion is far more useful than an elegant optimum solution resulting in a well-fed lion.
    "Optimum solution" and "well-fed lion" are mutually exclusive, you berk.
    No. Just keep the lion well-fed with different food than the monkey.
  • TheSilverBadger (unregistered) in reply to Cbuttius

    Until someone adds a column in the middle of the table...

  • ath (unregistered) in reply to wtf!
    wtf!:
    "There are almost an infinite number of ways to perform any task; yet, there is only one best way. That is, our chances of guessing the correct way is basically zero. Nature has endowed us with “intuition” which quickly gives us a workable solution – one which is usually better than most solutions. However, among all possible solutions, there is only one best method. Since the intuitive solutions are generally arrived at quickly with insufficient information, they are seldom optimum. Therefore, your chances of hitting the optimum method using intuition are very low." Chang, Fundamentals of Piano Practice

    Actually, there are usually many equally "optimum" solutions to a given problem. For example, all great semi-circles are the shortest paths from one point to the antipodal point on a sphere.

    Even more actually: My intuition tells me the shortest path between two points in a plane is a straight line. Following Changs reasoning, it should be a 1 in infinity chance of guessing that. That's so unlikely I must be some kinda genius dude.

  • none (unregistered) in reply to LiteMan
    LiteMan:
    It certainly is. It's SOShipLine if I'm not mistaken.

    This also explains why everything is in alphabetical order. SL has, since its infancy if I'm not mistaken, always had all its columns in alphabetical order. No column can be Null. AND the primary key of the table HAS to be TableName0. So in this case, the primary key is a unique clusetered index named SOShipLine0.

    I hate myself for knowing this.

    I fear I am following in your footsteps. Shoot me now.

  • Fer (unregistered) in reply to Dragnslcr

    Nope. In contemporaneous Postgresql you can escape single quotes almost with anything else: #SELECT * FROM table WHERE col ~* $$'something''that''need''quotes''insides'$$; Here the $$ is the quoting delimiter. Also it's the now preferred way to quote psql and plpsql functions: CREATE FUNCTION fun (INTEGER) RETURNS text AS $$ DECLARE argum = $1; retval = VARCHAR; BEGIN SELECT INTO retval something FROM somewhere WHERE somevalue > argum; RETURN retval; END; $$ LANGUAGE plpgsql;

    In a side note, this article shows code that's not SQL, but's an OO sql interface or something.

  • Stephan (unregistered)

    "But in Computerland, there was no such thing as a 'best' solution. Once the complexity level of "Hello World" had been transcended, all that remained were overarchitecturized, hypergeneric, self-configuring, reflection-based enterprisoid ivory towers and fasthacked, copypasted, 9-3-1 monolithic 100000 line swamps barren of any but the autogenerated comments, with wide expanses of abandoned code in between, only crossed by the rivers of developers' tears. The only audible sound was the malevolent cry of a lone pencil and paper workflow circling overhead..."

    Persto? Do I put that on my pasta before I write it to the database?

  • jetimms (unregistered)

    But simple means easy to write, right?

Leave a comment on “The SQL String”

Log In or post as a guest

Replying to comment #:

« Return to Article