• Daruku (unregistered)

    At least it has more lines of code...

  • (cs)

    Who needs to filter data on the database side when you can filter in your application, I mean, think of all the flexibility you have.

    There's a reason why 1gig of ram is so cheap and servers have terrabit connections!

    </sarcasm>

  • Elmer (unregistered)

    This is ezactly how one shouldn't do things. Get everything. Throw it into an array. Use clever find methods that you wrote. Hey, a sql database is just like some sheets in excel.

  • Salandur (unregistered)

    wtf.... guess they never read the sql manual :#

    Salandur

  • Marty Thompson (unregistered)

    Everyone knows you don't put business logic at the database level, so I don't see the WTF here.

  • (cs) in reply to Marty Thompson

    Maybe they read the "Sql injection" vulnerability stories and decided "well, we'll only run static string queries then"

  • (cs) in reply to Marty Thompson
    Anonymous:
    Everyone knows you don't put business logic at the database level, so I don't see the WTF here.


    Dude, please tell me my sarcasm meter is broken.
  • Justin Sippel (unregistered) in reply to mizhi

    At least they're protected from SQL injection attacks, I guess.

  • Marty Thompson (unregistered) in reply to mizhi

    It's either broken or there's been an overflow somewhere. :P

  • (cs)

    If you could just find a way to union all the tables together, you wouldn't really need the database anymore.

  • (cs) in reply to MikeB

    MikeB:
    If you could just find a way to union all the tables together, you wouldn't really need the database anymore.

    Oh yea.

    WTF!?[:'(]

  • Evan M. (unregistered)

    Um... what happens when you call getDetail() with a contactId on a ID that doesn't exist in the database? Infact, how did this thing even compile with only a conditional return being present?

  • Scotty (unregistered) in reply to MikeB

    Maybe they just recently converted the data layer from text files???

  • (cs)

    I paid for that bandwidth, dammitall, and I'm gonna use it!!!

  • (cs)

    Well, it wasn't slow when I tested it.  Maybe your server just needs more memory.

    Yes, I did test it with less than 100 records.  Why do you ask...?

  • (cs) in reply to Bustaz Kool
    Bustaz Kool:
    I paid for that bandwidth, dammitall, and I'm gonna use it!!!


    It's Damitol, and it's trademarked. (But covered by most drug plans.)
  • (cs)

    oh fer god's sake.
    that's just ridiculous.

  • (cs)

    You can do this in SQL alone.  We have a SQL statement that does:

    SELECT * FROM (
       --huge whopping pile of rows
    )
    WHERE ROWNUM BETWEEN 1 AND 200

     

  • Fregas (unregistered) in reply to Stan Rogers

    First, I have to admit that on a RARE occasion, I do something kind of like that in C#.  If I have a collection, that is ALREADY a subset of the data (Never the entire table--because I DO believe in WHERE clauses), and is relatively small (10-300 rows max) i might loop thru it rather than opening another connection to the database.  This is because I already have all the data I need, I just need to pick out a row from the existing collection or check for the existence of a particular item.  Its easier to code than creating another method to query in my data layer, another method in my business layer, etc.  Maybe this is non-optimal, but I don't do it all the time.  Feel free to berate me though...  [:D]

    Second, I had heard of a guy at one of my old jobs do something similar to this WTF.  This guy supposedly had worked for microsoft, and supposedly has helped develop ASP classic, and was supposedly this awesome miracle worker programmer.  Well, a colleague of mine at this job got a hold of his code while coming in contract to help with the same project, and the guy was getting all the records from one table, looping thru them using a recordset, then within each iteration, looping thru all the records in another table thru a second recordset, and matching the first table's Foreign key to the second table's primary key, so then he can display data from both tables on the same page...hey does that kinda sound like an INNER JOIN????

    The "microsoft" guy was fired, and my colleague had to start the project over from scratch because all the code was that bad.

     

  • James Carr (unregistered)

    Idiots. Everyone knows it is much more effecient to run a select query in a loop and select one row at a time until you find the one you need (probably better to keep selecting until the last record though, because since there is no such thing as primary  keys, there may be a newer record later on in the table).

  • steve (unregistered) in reply to Marty Thompson

    your suttle sarcasm has me in utter despair that there would be more than one person who does not recognize the utter horror of the code.  pls clarify your reasoning.[:|]

     

     

  • STEVE (unregistered)

    This way the guy can come back and solve the slow solution and get paid a bonus!

    pretty smart.

  • (cs)

    There really is only one response to that level of utter fuckwittery .... in Ireland it would be three alpha-numeric characters P45 (the form your employer has to give you and the taxman at the end of your employment)

  • (cs) in reply to Marty Thompson
    Anonymous:
    Everyone knows you don't put business logic at the database level, so I don't see the WTF here.


    That is sarcasam right?

    You'd be insane to suck ENTIRE tables into your application each time you want to suck out just a single record.

    If you were serious I's LOVE to be the person you buy your servres off, I'd be loaded!

    Bart.
  • Marty Thompson (unregistered) in reply to voyager
    voyager:

    That is sarcasam right?


    I don't even know anymore.
  • (cs)
    Alex Papadimoulis:

            <font color="#0000ff">if</font>(record.getContactId().<font color="#a52a2a">equals</font>(contactId))



    Maybe record.getContactId() returns an instance of a class that has a method "equals(String)" which can not be expressed as a WHERE clause in SQL. It's hard to tell whether or not this is a WTF. ;-)
  • James Carr (unregistered) in reply to voyager

    No.. you should suck in every database on the database server (if more than one), store each in an array, and use custom "search objects" that you coded during college to emulate the data access layer and pull out a single record.

    BTW, I wanted to note this site has given me inspiration. I am currently hard at work on a javascript based database that uses cookies for it's storage.

  • (cs) in reply to voyager

    voyager:

    You'd be insane to suck ENTIRE tables into your application each time you want to suck out just a single record.

    Well,  I .NET when you use a dataset, it does suck the entire SQL statement into memory on the local PC.  So if you do a "Select * from blah" it will load up every thing that is in that table to the dataset.  A dataset in .NET is really cool too!  You can just say .writexml and bam, you have a bloated file with the dataset in it for future use!  (In xml of course!)[:P][:D]

  • (cs)
  • Marc Rohloff (unregistered) in reply to James Carr

    Anonymous:
    No.. you should suck in every database on the database server (if more than one), store each in an array, and use custom "search objects" that you coded during college to emulate the data access layer and pull out a single record.

    BTW, I wanted to note this site has given me inspiration. I am currently hard at work on a javascript based database that uses cookies for it's storage.

    Hibernate?

     

  • (cs) in reply to John Smallberries

    John Smallberries:
    oh fer god's sake.
    that's just ridiculous.

    Your problem is that you're too negative, Mr. Ian Boysenberries.

  • (cs)

    This WTF tastes like burning.

  • mike (unregistered) in reply to rogthefrog

    well it's still better than the wtf we had some weeks ago - where a very confused guy loaded the whole table into a textfile an compared each line with the search string....

  • DentedHead (unregistered) in reply to Fregas
    Anonymous:


    Second, I had heard of a guy at one of my old jobs do something similar to this WTF.  This guy supposedly had worked for microsoft, and supposedly has helped develop ASP classic, and was supposedly this awesome miracle worker programmer.  Well, a colleague of mine at this job got a hold of his code while coming in contract to help with the same project, and the guy was getting all the records from one table, looping thru them using a recordset, then within each iteration, looping thru all the records in another table thru a second recordset, and matching the first table's Foreign key to the second table's primary key, so then he can display data from both tables on the same page...hey does that kinda sound like an INNER JOIN????

    The "microsoft" guy was fired, and my colleague had to start the project over from scratch because all the code was that bad.

     



    When I started working at my first .Com job, our CTO (who started a very famous .com before this one) FORBID us to us joins! His reasons were database indepenancy which kinda was valid, since we had no database abstraction layer, since we had no concept of appliation layers in the code to begin with, all our SQL calls were hand writen into the code.

    I will allso  mention that he frown edon the use of methods since it was inefficient compared to inlining everything. But that's another story for another time.
  • Disgruntled DBA (unregistered)

    <sarcasm>
    The real WTF is that he probably has more than one table in his database.  I mean really!  Why split "contacts" off of say "orders"?  After all, we all know that a single table to hold all of your data is much more efficient than having to do all those nasty joins, right?
    </sarcasm>

  • (cs) in reply to Disgruntled DBA

    DBs are pointless anyway. Perl, regexp and a single flat text file beat Oracle any day of the week in terms of maintainability, scalability, speed, and data integrity.

    Joins are for people who can't write a good regexp.

     

     

     

     

     

     

     

     

     

    <FONT size=1>(yes, I am kidding)</FONT>

  • (cs) in reply to Stan Rogers

    Stan Rogers:
    Bustaz Kool:
    I paid for that bandwidth, dammitall, and I'm gonna use it!!!


    It's Damitol, and it's trademarked. (But covered by most drug plans.)

    There's also the generic version of the drug, it's called screwitol.  There's also the extra strength version called fuckitol.  :O)

  • (cs)

    Well... I suppose if the table is not indexed on ContactId... oh screw it, I can't defend this.  WTF???

  • (cs) in reply to James Carr
    Anonymous:
    No.. you should suck in every database on the database server (if more than one), store each in an array, and use custom "search objects" that you coded during college to emulate the data access layer and pull out a single record.


    Actually, I know at least one programmer (TopMind of Ward's Wiki notoriety) who wants to do the opposite: replace all objects and containers with 'agile' in-memory relational databases. I swear to all the gods this is the truth. While some of what he says makes a lot of sense (especially about the cult of OO and the way programmers tend to take technical disagreements as personal attacks), most of it is pure lunacy.
  • Dave (unregistered) in reply to Stan Rogers

    Is that Damitol Red, Blue, or Yellow?

    In any case, just go into your drug store, and say "Damitol!"  They'll
    know what to give you.

    (FWIW, that's the first Congress Of Wonders reference I've seen on
    the net in at least five years.  Nice to know they're not entirely forgotten.)

  • (cs) in reply to Free
    Free:
    http://www.despair.com/incompetence.html

    Free as in beer, not as in speach.



    hum, speaches are expensive now that sgeorgia raised the price of the sfruit.

        -dZ.
  • (cs) in reply to ammoQ
    ammoQ:
    Alex Papadimoulis:

            <font color="#0000ff">if</font>(record.getContactId().<font color="#a52a2a">equals</font>(contactId))



    Maybe record.getContactId() returns an instance of a class that has a method "equals(String)" which can not be expressed as a WHERE clause in SQL. It's hard to tell whether or not this is a WTF. ;-)


    How can a string not be expressed as a string, when a WHERE condition is just that... a string?

    Looks like some dumdum Access "developer" that got thrown into an SQL project.
  • (cs)

    Alex Papadimoulis:
     
    <FONT face="Courier New" size=2>    <FONT color=#0000ff>while</FONT>(resultSet.hasNext())
        {
            ResultRecord record = resultSet.next();
            <FONT color=#0000ff>if</FONT>(record.getContactId().<FONT color=#a52a2a>equals</FONT>(contactId))
            {
                  <FONT color=#0000ff>return</FONT> record;
            }
        }
    </FONT>

    I love how he's declaring a new ResultRecord for each row in the table. (allocate more space on heap, read resultset var into it, compare, remove space from heap, repeat) Or would this not be a problem with todays compilers?

  • (cs) in reply to Jon Limjap
    Jon Limjap:
    ammoQ:
    Alex Papadimoulis:

            <FONT color=#0000ff>if</FONT>(record.getContactId().<FONT color=#a52a2a>equals</FONT>(contactId))



    Maybe record.getContactId() returns an instance of a class that has a method "equals(String)" which can not be expressed as a WHERE clause in SQL. It's hard to tell whether or not this is a WTF. ;-)


    How can a string not be expressed as a string, when a WHERE condition is just that... a string?

    Looks like some dumdum Access "developer" that got thrown into an SQL project.

     

    GetContacdId might concatenate 3 fields, subtract 42 from the result multiply it by blueberry pi's and then rijndael decrypt it. Try that in a where statement! [:P]

    Drak

  • (cs)

    This is so bad I'm really feeling sick. I've worked with lots of say, less gifted programmers, over the years and finally moved to a position to keep away from them. Codes like this bring all bad memories back.

  • (cs) in reply to cm5400
    cm5400:

    voyager:

    You'd be insane to suck ENTIRE tables into your application each time you want to suck out just a single record.

    Well,  I .NET when you use a dataset, it does suck the entire SQL statement into memory on the local PC.  So if you do a "Select * from blah" it will load up every thing that is in that table to the dataset.  A dataset in .NET is really cool too!  You can just say .writexml and bam, you have a bloated file with the dataset in it for future use!  (In xml of course!)[:P][:D]



    You seem to have forgotten that you can parameterize the query for your dataset.  Only a moron always sucks up the whole table.
  • (cs) in reply to Jon Limjap
    Jon Limjap:
    ammoQ:
    Alex Papadimoulis:

            <font color="#0000ff">if</font>(record.getContactId().<font color="#a52a2a">equals</font>(contactId))



    Maybe record.getContactId() returns an instance of a class that has a method "equals(String)" which can not be expressed as a WHERE clause in SQL. It's hard to tell whether or not this is a WTF. ;-)


    How can a string not be expressed as a string, when a WHERE condition is just that... a string?

    Looks like some dumdum Access "developer" that got thrown into an SQL project.


    public class ResultRecord {
      public MyContactId getContactId() {
         return new MyContactId();
      }

      private class MyContactId {

        public boolean equals (Object o) {

           return (Math.random() > 0.314);

        }
      }

    }

  • Hank Miller (unregistered)

    Well it was hard, but I finially came up with a logical explination:

    They are not using a standard database, rather something written long ago, say on some 36bit machine (not 32!) and now running on an emulator.  Back in those days they didn't know as much about algorithm analysis and didn't have to deal with very large datasets, so a O(n^2) algorithm in the where clause (which wasn't where at the time because SQL wasn't invented yet)  worked just fine.   As the company grew of course it no longer did, so they learned to do things this way.  As time went on SQL was added as a project to be more buzzword compliant, but  nobody was allowed to fix the database because it worked just fine even if it was slow.  

    So programers did thing this way because an O(n) search is much faster than the O(n^2) in the database.  Of course if  you needed lots of data over time from on query (and could assure the data wouldn't change in the meantime) many programers implimented a hash table, but when you just need one result from an unsorted list you can't beat this search.

    Excuse me now, I think i'm gonna have to go cry...

  • Ethan Boysenberries (unregistered) in reply to rogthefrog
    rogthefrog:

    John Smallberries:
    oh fer god's sake.
    that's just ridiculous.

    Your problem is that you're too negative, Mr. Ian Boysenberries.



    I knew Ian Boysenberries, John Smallberries is no Ian Boysenberries.
  • (cs) in reply to voyager

    Voyager: "There really is only one response to that level of utter fuckwittery .... in Ireland it would be three alpha-numeric characters P45 (the form your employer has to give you and the taxman at the end of your employment)"

    And on the right side of the Irish Sea, too.

    (I'm bemused that a P45 is a P45 in Ireland too. Presumably it predates the republic. Oh, and my regards to Maynooth - you have a seriously fun pool in the Glenroyal Hotel.)

Leave a comment on “Where's Rowdo?”

Log In or post as a guest

Replying to comment #:

« Return to Article