Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
DBIx/Connection version 0.12 ============================ DBIx::Connection provides a simple interface for fast and safe DBI connection and transaction management. Connecting to a database can be expensive; you don't want your application to re-connect every time you want to run a query. The efficient thing to do is to cache database handles and then just fetch them from the cache as needed in order to minimize that overhead. Database handle caching is the core function of DBIx::Connection. You might be familiar with Apache::DBI and with the DBI's `connect_cached()` method. DBIx::Connection serves a similar need, but does a much better job. How is it different? I'm glad you asked! * Fork Safety Like Apache::DBI, but unlike `connect_cached`, DBIx::Connection will return a new database handle if a new process has been `fork`ed. This happens all the time under mod_perl, in POE applications, and elsewhere. * Thread Safety Unlike Apache::DBI or `connect_cached()`, DBIx::Connection will return a new database handle if a new thread has been spawned. Like`fork`ing, spawning a new thread can break database connections. * Works Anywhere Like Apache::DBI, DBIx::Connection doesn't cache its objects during mod_perl startup, but unlike Apache::DBI, it runs anywhere -- inside of mod_perl or not. Why limit yourself? * Explicit Interface DBIx::Connection has an explicit interface. There is none of the magical action-at-a-distance crap that Apache::DBI is guilty of. I've personally diagnosed a few issues with Apache::DBI's magic, and killed it off in two different applications in favor of `connect_cached()` No more. * Optimistic Execution If you use the `do()` or `txn_do()` methods, the database handle will be passed without first pinging the server. For the 99% or more of the time when the database is just there, you'll save a ton of overhead without the ping. DBIx::Connection will only connect to the server if a query fails. =back The second function of DBIx::Connection is transaction management. Borrowing from DBIx::Class, DBIx::Connection offers an interface that efficiently handles the scoping of database transactions so that you needn't worry about managing the transaction yourself. Even better, it offers an interface for savepoints if your database supports them. Within a transaction, you can scope savepoints to behave like subtransactions, so that you can save some of your work in a transaction even if some of it fails. Read the full documentation via `perldoc DBIx::Connection` for all the details. INSTALLATION To install this module, type the following: perl Build.PL ./Build ./Build test ./Build install Dependencies ------------ DBIx::Connection requires DBI 1.605 or higher. Copyright and Licence --------------------- Copyright (c) 2009 David E. Wheeler. Some Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.