Доброго всем
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->selectrow_array('select now() as now', {Async=>1,});
Transaction syntax
See also Mojo::Pg::Che#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#Non-blocking-query-cases.
METHODS
All methods from parent module Mojo::Pg::Database are inherits and implements the following new ones.
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. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
selectrow_arrayref
DBI style quering. See DBI#selectrow_arrayref. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
selectrow_hashref
DBI style quering. See DBI#selectrow_hashref. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
selectall_arrayref
DBI style quering. See DBI#selectall_arrayref. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
selectall_hashref
DBI style quering. See DBI#selectall_hashref. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
selectcol_arrayref
DBI style quering. See DBI#selectcol_arrayref. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
do
DBI style quering. See DBI#do. Blocking|non-blocking, query string|statement handler. Input params - Mojo::Pg::Che::Database#Params-for-quering-methods.
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.
Params for quering methods
The methods select...
, do
has next input params:
String query | statement handler object
Hashref attrs (optional)
Array of bind values (optional)
Callback non-blocking (optional)
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.