Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Taking a quick read through the Tie::DBI pod, it looks like it doesn't support any of the relationships that Class::DBI does such has has_a and has_many. Also, it seems like CDBI's search() method is better than TDBI's select_where() method, and also CDBI has support for custom queries via set_sql but w/TDBI you just jet the dbh() to do it all yourself. TDBI docs also warn of performance concerns (but as for a direct TDBI-CDBI benchmark, i can't say). Another significant difference is that TDBI ties you to a hash, while CDBI provides objects to work with and all the obvious benefits that come with it (can't mispell hash keys, accessors/mutators, inheritance, custom methods, etc). Also note that CDBI has further support for specific databases in the Class::DBI::* modules (Class::DBI::Pg, Class::DBI::MSSQL, Class::DBI::mysql, etc), as well as Plugins. Class::DBI will also be far more supported by the mailing list and the wiki.

To summarize, I would say that TDBI is a lot more limited, and only consider it if your needs are very limited (just a couple/few unrelated tables), and even then I personally would still use CDBI.

Update: Summary bulletin points of things CDBI has that TDBI doesn't:
  • relationships (has_a and has_many)
  • search() better than select_where()
  • custom queries (set_sql)
  • better performance??
  • provides an object, not just a hash
  • db-specific support in the Class::DBI::* modules
  • Plugins
  • Support via active mailing list and wiki

In reply to Re: Tie::DBI vs Class::DBI by davidrw
in thread Tie::DBI vs Class::DBI by tlm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-23 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found