Feedback on MySQL DBA class wanted.



  • Seeing as there are quite a few knowledgeable people on here, and the nature of the topic of this site, I was hoping someone would be kind enough to offer me some feedback on this class. In particular, if there are anything that I could have done better and why.

    In case it's not obvious it's meant as a fully interchangeable class for interfacing against a multitude of DBMS, without having to change anything other than the name of the file included. It doesn't, obviously, support all of the features. Nor will it ever do, but it should support the most used ones. If I've missed some, please let me know as well as why you think it's a necessary inclusion.

    Without further ado: The class in question

    All constructive criticism is appreciated, flames will go (mostly) ignored. (Unless I want a nice bbq. :P)
    I promise to even leave my favourite erinaceinae at home, lest someone wants to have a meet and greet?

    PS: If anyone wants to use it for their own projects, the license is stated in the PHPdoc header for the class. Should anyone, for any reason, want to use it in a commercial project please let me know. I'm sure we can come to an agreement.

    Edit: Gah! I now see why you guys are always stating that this forum software is TRWTF. It really is! >:(



  • @ChristianF said:

    Seeing as there are quite a few knowledgeable people on here, and the nature of the topic of this site, I was hoping someone would be kind enough to offer me some feedback on this class. In particular, if there are anything that I could have done better and why.

    In case it's not obvious it's meant as a fully interchangeable class for interfacing against a multitude of DBMS, without having to change anything other than the name of the file included. It doesn't, obviously, support all of the features. Nor will it ever do, but it should support the most used ones. If I've missed some, please let me know as well as why you think it's a necessary inclusion.

    I didn't have a thorough look at what you produced, I'm just wondering why you didn't give PDO a try. PDO will give you the same and is supported by the main PHP team, so you don't have to worry about maintaining it.



  • I was going to ask the same thing but phrase it a little more bluntly: "why does this class exist?"

    Then I assumed you must have had a good reason and my PHP is just rusty. But I'm glad Solitario brought it up.



  • @blakeyrat said:

    "why does this class exist?"

    Fair question. :)
    It exists primarily because of 4 reasons, in order:

    1. I wanted to learn more about DBA, and what it takes to write a good class for it.
    2. Other classes I've looked at didn't give me what I really wanted, either due to lack of features, too high usage complexity, not being DBA but DAA classes and so forth.
    3. I had an old attempt, that didn't work as an abstraction layer for anything but the most simple of queries, and wanted to improve it.
    4. And a little bit of "because I could." ;)

    Now, I do believe that constitutes as "good reason(s)". At least for the first 3.

    @solitario said:

    I'm just wondering why you didn't give PDO a try.

    First and foremost because PDO isn't a DBA (database abstraction) class, but a DAA (Data-access abstraction) class. They even mention it in the intro for PDO. So, no, It does not give me the same.

    Though, there are a few other things that I don't like about it, such as the throwing of exceptions for everything (I blame MSStrings for my hate of this), the connection string and a few other caveats. Arguably most of these caveats I have are personal preference, I have to admit. Still, that doesn't change the fact that PDO isn't a DBA layer.

    All that said, I think I should perhaps give you a couple of examples of how this class can be used.
    Put it on Pastebin.com so that I didn't have to muck about too much to get proper indenting and syntax highlighting here...

    PS: I change the class a bit, to allow for "false" as the first parameter instead of the 4th in the verbose mode.



  • Updated my class and example a bit. Was a couple of bugs in the code, and not to mention the whole "Get_Data ()" method I'd apparently forgot about.

    Couldn't edit my post above, so here are the new links:
    DBA class v2
    DBA usage examples



  • @ChristianF said:

    DBA (database abstraction)
     

    That confuzzled me. I thought DBA was Database Administration.

    I'll leave now...




Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.