Доброго всем
Mojo::Pg::Che::Database
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
NAME
Mojo::Pg::Che::Database - mix of parent Mojo::Pg::Database and DBI.pm
SYNOPSIS
See Mojo::Pg::Database#SYNOPSIS
my $db = $pg->db;
# DBI style
my $now = $db->selectrow_hashref('select now() as now')->{now};
my $now = $db->db->selectrow_hashref('select now() as now')->{now};
my $now = $db->selectrow_array('select now() as now', {Async=>1,});
Transaction syntax
eval {
$db->begin;
$db->query('insert into foo (name) values (?)', 'bar');
$db->do('insert into foo (name) values (?)', 'baz');
$db->commit;
};
die $@ if $@;
$db->begin;
$db->do('insert into foo (name) values (?)', 'bazzzz');
$db->rollback;
$db->begin;
$db->query('insert into foo (name) values (?)', 'barrr');
$db->commit;
Non-blocking query cases
See Mojo::Pg::Che.
METHODS
new
Parent method of Mojo::Pg::Database#new
prepare
Prepare and return DBI statement handler for query string.
prepare_cached
Prepare and return DBI cached statement handler for query string.
selectrow_array
DBI style quering. See DBI#selectrow_array. Blocking|non-blocking, query string|statement handler.
selectrow_arrayref
DBI style quering. See DBI#selectrow_arrayref. Blocking|non-blocking, query string|statement handler.
selectrow_hashref
DBI style quering. See DBI#selectrow_hashref. Blocking|non-blocking, query string|statement handler.
selectall_arrayref
DBI style quering. See DBI#selectall_arrayref. Blocking|non-blocking, query string|statement handler.
selectall_hashref
DBI style quering. See DBI#selectall_hashref. Blocking|non-blocking, query string|statement handler.
selectcol_arrayref
DBI style quering. See DBI#selectcol_arrayref. Blocking|non-blocking, query string|statement handler.
do
DBI style quering. See DBI#do. Blocking|non-blocking, query string|statement handler.
begin
Start transaction for given object which attr {tx}
is a <Mojo::Pg::Transaction> object. Sinonyms are: ->tx
and ->begin_work
.
commit
Commit transaction and drop attr {tx}
for destroing <Mojo::Pg::Transaction> object.
rollback
Rollback transaction and drop attr {tx}
for destroing <Mojo::Pg::Transaction> object.
AUTHOR
Михаил Че (Mikhail Che), <mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/Mojo-Pg-Che/issues. Pull requests also welcome.
COPYRIGHT
Copyright 2016 Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.