• (cs)

    So basically, he uses a single-column table as (totally unnecessary) scratch space for this existence check, when he could have just as easily has run SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '?' [table_name]. Assuming he really needed to check if the table existed in the first place.

    He'd better have a really good justification for this...

  • TheSHEEEP (unregistered) in reply to toth
    toth:
    So basically, he uses a single-column table as (totally unnecessary) scratch space for this existence check, when he could have just as easily has run SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '?' [table_name]. Assuming he really needed to check if the table existed in the first place.

    He'd better have a really good justification for this...

    Madness?

  • Nagesh (unregistered) in reply to toshir0
    toshir0:
    PedanticCurmudgeon:
    Nagesh:
    SilentRunner:
    It's amazing what words some people will come up with when trying to communicate with educated people.
    I am lern two in past weeks: "ain't" and "massage."
    At that rate you should have a decent vocabulary in about 50 years.
    Please... you're no new guy here, Pedobearmudgeon. That scarecrow is *not* worth a talk. He's not even a joke getting old, he deserves only one thing : to be shot with *the Ignore gun*.

    Scarecrow? Ain't this new word? I am massaging my hands to gether to find what it menes.

  • (cs) in reply to Jack
    Jack:
    Metadata should be stored in XML in case the database is down.

    What if the disk where the XML file is stored is offline also.

    All access to metadata shall be done through a MetadataManager class (subclassed from a DataManager and, ultimately, an AbstractManager class) which maintains a list of MetdataManagerDriver objects that represent different ways in which the metadata can be stored: MetadataManagerXMLDriver, MetadataManagerDBDriver, MetadataManagerCSVDriver, MetadataManagerExcelCompatibleCSVDriver, etc...

    To prevent overloading any one storage medium, a different MetadataManagerDriver will be used for each method call to the MetadataManager. The algorithm for choosing which MetadataManagerDriverSelector to use per call (MetadataManagerDriverRandomSelector, MetadataManagerDriverRoundRobinSelector, etc.) shall be implemented in the MetadataManagerDriverSelectorMediator.

    Just hardcode all the config values for the MetadataManager right in the constructor for now.

  • Nagesh (unregistered) in reply to Nagesh
    Nagesh:
    toshir0:
    PedanticCurmudgeon:
    Nagesh:
    SilentRunner:
    It's amazing what words some people will come up with when trying to communicate with educated people.
    I am lern two in past weeks: "ain't" and "massage."
    At that rate you should have a decent vocabulary in about 50 years.
    Please... you're no new guy here, Pedobearmudgeon. That scarecrow is *not* worth a talk. He's not even a joke getting old, he deserves only one thing : to be shot with *the Ignore gun*.

    Scarecrow? Ain't this new word? I am massaging my hands to gether to find what it menes.

    dictionary.com:
    scarecrow [skair-kroh]   Origin scare·crow    [skair-kroh] Show IPA noun 1. an object, usually a figure of a person in old clothes, set up to frighten crows or other birds away from crops. 2. anything frightening but not really dangerous. 3. a person in ragged clothes. 4. an extremely thin person.

    I ain't understanding this.

  • (cs) in reply to Nagesh
    Nagesh:
    toshir0:
    Please... you're no new guy here, Pedobearmudgeon. That scarecrow is *not* worth a talk. He's not even a joke getting old, he deserves only one thing : to be shot with *the Ignore gun*.

    Scarecrow? Ain't this new word? I am massaging my hands to gether to find what it menes.

    Well, toshir0, I hope you're happy. Now he's "learned" a third word.

  • (cs) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    Nagesh (fake):
    SilentRunner:
    It's amazing what words some people will come up with when trying to communicate with educated people.
    I am lern two in past weeks: "ain't" and "massage."
    At that rate you should have a decent vocabulary in about 50 years.

    This madarchod is bad version of imitating me. Atleast I have spell-checking feature in my browser all enabled now.

  • (cs) in reply to Diego
    Diego:
    Production code shouldn't execute DDL statements

    I couldn't agree more. Yet, I know of a certain individual who, when asked what would be the best way to implement a relationship such as "user->list of friends" (typical of a social network), recommended creating a separate table for each user. That means, each user would have his/her own list of friends in his/her own personal, private table created on the fly. It would be interesting to see if the DB behind Facebook contains indeed over 900 million tables...

    I have seen code like this in real live production system. It is only for some special group of users, but each user having individual table that define rights and privileges.

    We found out after some user changes his single-sign-on identity name. Then lose all rights. This table never maintained, except by severe sql scripts kept in a Unix folder with label of IMP-DO-NOT-MESS-WITH-THIS.

    Then we discover reason for lost rights for that user. This is still the way the system is running. This is system in place for client in Canada. Not develop by Indian programmers, but now being maintain by us only

    I could never make this story anonymous, so I not submit it to WTF

  • Nagesh (unregistered) in reply to Gyxi
    Gyxi:
    If you've been paying attention to quantum theory you'd know that UniverseIsThere cannot be represented in a simple boolean.

    How about a nullable boolean then?

    enum UniverseIsThere (is, ain't, FileNotFound);

    Kant compile. Must the ' marke be require for spell ain't?

    Pls send me the corect codez.

    Pls do not ignore becuse I know you are think "bad Nagesh I punnish him by ignore" but even so you are think about Nagesh so I win.

  • Meep (unregistered) in reply to Tasty
    Tasty:
    emurphy:
    Part of the implied WTF (which some have missed, or perhaps pretended to miss for the lulz) is that this is the only function that does anything with this table. There are some things that it could make sense for a program to test (whether it can reach the database server at all, whether it can create/insert/update tables) but this function and table would still be a WTF regardless.

    No, it never makes sense. Production code shouldn't execute DDL statements, with the rare exception of CREATE TEMP TABLE.

    One can test a program's database access and DML statement permissions by following them with a terminal SELECT. I don't think most live applications should have DDL permissions.

    You do realize that a DBMS will routinely create temporary tables to execute large SELECT queries, right? There is absolutely nothing wrong with generating temp tables to handle your work, especially if they're only visible to your transaction.

    For handling really large modifications to a table, often the best way to do it is through a CREATE ... AS SELECT because the DBMS doesn't have to do any locking: no one else can possibly access that table because it hasn't been created yet.

    Certain systems absolutely do, for legal reasons such as provenance and auditing, require a fixed schema.

    Many don't. The only good reason not to do DDL in a system that doesn't have a legal restriction on the schema is your concurrency model.

    Oracle, for instance, isolates DDL from transactions. That is, (BEGIN DML DDL DML COMMIT) is quietly changed to (BEGIN DML COMMIT) DDL (BEGIN DML COMMIT), since, being Oracle, it happens in the most unexpected way possible.

    Others, like PostgreSQL, handle DDL within a transaction just fine.

    As to whether you have a genuinely good reason that your fields aren't fixed, and whether these tables you're constructing have any actual meaning in the real world, that's a whole other debate...

  • Diego (unregistered) in reply to Jim
    Jim:
    Diego:
    Production code shouldn't execute DDL statements

    I couldn't agree more. Yet, I know of a certain individual who, when asked what would be the best way to implement a relationship such as "user->list of friends" (typical of a social network), recommended creating a separate table for each user.

    You laugh, but this really happened at my workplace recently. [...] I guess this is the expected level of brainpower for a former Director of Big Things (recently demoted).

    Well, the person who gave me the example teaches in a US College, he's a Professor. Perhaps he was thinking in an abstract way, but the information is way too often absorbed as "dogmatic way of doing things". No wonder, then, that some graduates come out with some abominations.

  • M (unregistered) in reply to Diego
    Diego:
    Jim:
    Diego:
    Production code shouldn't execute DDL statements

    I couldn't agree more. Yet, I know of a certain individual who, when asked what would be the best way to implement a relationship such as "user->list of friends" (typical of a social network), recommended creating a separate table for each user.

    You laugh, but this really happened at my workplace recently. [...] I guess this is the expected level of brainpower for a former Director of Big Things (recently demoted).

    Well, the person who gave me the example teaches in a US College, he's a Professor. Perhaps he was thinking in an abstract way, but the information is way too often absorbed as "dogmatic way of doing things". No wonder, then, that some graduates come out with some abominations.

    I'm not really a DB person as I find them incredibly boring, but wouldn't the obvious way to look at it be similar to a OO approach in programming? Tables take on the role of classes, and each row would be an instance of that class. If you think of it this way, then creating a table for each user would be analogous to creating a separate class for each user...i.e. batshit insane.

  • Jeff (unregistered) in reply to M
    M:
    creating a table for each user would be analogous to creating a separate class for each user...i.e. batshit insane.
    I am intrigued by your ideas. Hmmm... an opportunity to implement a UserClassFactory Class!

    No, you're right. Not enterprisey. Need more layers of factories.

  • (cs) in reply to Tasty
    Tasty:
    emurphy:
    Part of the implied WTF (which some have missed, or perhaps pretended to miss for the lulz) is that this is the only function that does anything with this table. There are some things that it could make sense for a program to test (whether it can reach the database server at all, whether it can create/insert/update tables) but this function and table would still be a WTF regardless.

    No, it never makes sense. Production code shouldn't execute DDL statements, with the rare exception of CREATE TEMP TABLE.

    One can test a program's database access and DML statement permissions by following them with a terminal SELECT. I don't think most live applications should have DDL permissions.

    Most, yes. Another exception would be an installer that creates a database and initializes its tables and such.

    Nagesh:
    This madarchod is bad version of imitating me.

    You wash your hands out with soap, young man!

  • Dave (unregistered) in reply to Ruakh
    Ruakh:
    Oracle has a built-in system table named "dual" with exactly one row. (Unlike some DBMSes, Oracle emits a syntax error on any query or subquery that doesn't have a FROM clause, so a single-row table is useful for things like "SELECT current_date FROM dual" and "SELECT 1 FROM dual WHERE EXISTS (...)" and so on.) Anonymous' code would hide that table by creating a non-system table with that name . . . and it would put two records in that user table, thereby causing lots of queries to return the wrong number of rows.
    So Oracle databases have a table called DUAL which has only ONE thing in it. But you can fix this by making a DUAL with 2 things in it. But that breaks normal code.

    Yet DUAL isn't a reserved word, or otherwise restricted to its valid if ill-named purpose.

    Conclusion: Oracle is the Real WTF. AMIRITE?

  • ur (unregistered) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    So TRWTF is that this function doesn't return FILE_NOT_FOUND?
    Close - we have here a pentabool, able to return TRUE, FALSE, NULL, RECORD_NOT_FOUND and TABLE_NOT FOUND.
  • ur (unregistered) in reply to ur
    ur:
    ¯\(°_o)/¯ I DUNNO LOL:
    So TRWTF is that this function doesn't return FILE_NOT_FOUND?
    Close - we have here a pentabool, able to return TRUE, FALSE, NULL, RECORD_NOT_FOUND and TABLE_NOT FOUND.
    D'oh - I misread the table definition, the field isn't nullable, so this is just a boring old quadbool.
  • Mr Clever Ideas (unregistered) in reply to Jeff
    Jeff:
    M:
    creating a table for each user would be analogous to creating a separate class for each user...i.e. batshit insane.
    I am intrigued by your ideas. Hmmm... an opportunity to implement a UserClassFactory Class!

    No, you're right. Not enterprisey. Need more layers of factories.

    DDL should also include syntax for anonymous inner tables.

  • M (unregistered) in reply to Mr Clever Ideas
    Mr Clever Ideas:
    Jeff:
    M:
    creating a table for each user would be analogous to creating a separate class for each user...i.e. batshit insane.
    I am intrigued by your ideas. Hmmm... an opportunity to implement a UserClassFactory Class!

    No, you're right. Not enterprisey. Need more layers of factories.

    DDL should also include syntax for anonymous inner tables.

    Fine, fine, but I think multiple inheritance of tables should be avoided. Instead we should have abstract and interface tables with no actual columns, just ideas.

    captcha: letatio = lettuce head

  • Melvis (unregistered)

    You guys are all crazy. He's obviously using this code to see if the DATABASE is there. Jeez...

  • C (unregistered) in reply to Agention
    Agention:
    Bill Clinton:
    tblIsThere? That depends on what the definition of the word "Is" is.

    The definition of "Is" is is is is is is.

    Umm, could you please properly paranthesize that? My brain's Language Interpretation Module just overflowed on me... :">

  • nmn (unregistered) in reply to Jack
    Metadata should be stored in XML in case the database is down...
    And if the database is down? Is the metadata useful in any way? I doubt.

Leave a comment on “tblIsThere”

Log In or post as a guest

Replying to comment #:

« Return to Article