-
-
01 Jun 2017 12:25:34 UTC
- Distribution: DBIx-Poggy
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (351 / 0 / 44)
- Kwalitee
Bus factor: 0- 72.86% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity
24 month- Tools
- Download (25.72KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- AnyEvent
- DBD::Pg
- DBI
- Devel::GlobalDestruction
- Guard
- Promises
- Scalar::Util
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
DBIx::Poggy::DBI - DBI subclass
DESCRIPTION
Overrides several methods in DBI. All queries are marked as async. See list of supported methods below:
METHODS
supported
These are supported: "selectrow_array" in DBI, "selectrow_arrayref" in DBI, "selectrow_hashref" in DBI, "selectall_arrayref" in DBI, "selectall_hashref" in DBI and "do" in DBI.
For example:
$pool->take->selectrow_array( "SELECT * FROM test LIMIT 1", )->then(sub { my @row = @_; ... });
See "Transactions" to learn about "begin_work", "commit" and "rollback".
not supported
These are not supported, but will be when I need them or somebody will write a patch: "selectcol_arrayref" in DBI
You don't use
prepare
,bind*
,execute
orfetch*
. I have some ideas of making these work, but don't think there is urgent need to pursue.Transactions
This module wraps "begin_work", "commit" and "rollback" methods to help handle transactions.
NOTE that flow is similar to sync DBI: begin, query, query, ..., commit or rollback, so it's your job to make sure commit or rollback is called after all queries on the handle are finished otherwise code dies.
begin_work
Returns a Promise that will be resolved once transaction is committed or rejected if the transaction is rolled back or failed attempt to start the transaction.
Value of the promise would be whatever is passed to commit or rollback.
commit
Takes resolution value of the transaction, commits and resolves the promise returned by "begin_work" with the value.
Dies if you call commit without transaction or while queries are active.
rollback
Takes rollback value of the transaction, commits and rejects the promise returned by "begin_work" with the value.
Dies if you call rollback without transaction or while queries are active.
Module Install Instructions
To install DBIx::Poggy, copy and paste the appropriate command in to your terminal.
cpanm DBIx::Poggy
perl -MCPAN -e shell install DBIx::Poggy
For more information on module installation, please visit the detailed CPAN module installation guide.