It??™s similar, but not identical to, Perl??™s
DBI module.???
The official DBI site is http://ruby-dbi.rubyforge.org and installation files can be obtained
at http://rubyforge.org/projects/ruby-dbi.
The Pros of DBI
The biggest advantage to the Ruby DBI package, as the documentation outlines, is that for the
most part it??™s database independent. You only need to learn a couple of classes (DatabaseHandle
and StatementHandle), and the majority of database-specific details are abstracted from your
point of view.
In fact, viewing the source code reveals that many of the Active Record adaptors actually
rely on DBI classes and logic.
The Cons of DBI
The first disadvantage to the DBI package is that, you are required to install the specific driver
for each database that you intend to work with. This probably isn??™t a deal breaker, but it does
mean at least a little extra work in switching from one database to another in the background.
The second biggest drawback to using DBI directly, as we see it, is that even though your
database communication has been abstracted, your code really has not.
Pages:
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452