| 1 | package Eve::Gateway::PgSql; | ||
| 2 | |||
| 3 | 1 | ▶ | use parent qw(Eve::Class); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | B<Eve::Gateway::PgSql> - a base class for PostgreSQL data gateways. | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | # Creating a subclass | ||
| 15 | package Eve::Gateway::PgSql::Foo; | ||
| 16 | |||
| 17 | use parent qw(Eve::Gateway::PgSql); | ||
| 18 | |||
| 19 | # Adapting a stored function | ||
| 20 | sub do_something { | ||
| 21 | my $self = shift; | ||
| 22 | |||
| 23 | if (not exists $self->{'_do_something'}) { | ||
| 24 | $self->{'_do_something'} = $self->_pgsql->function( | ||
| 25 | name => 'do_something', | ||
| 26 | output_list => [{'result_code' => $self->_pgsql->smallint()}]); | ||
| 27 | } | ||
| 28 | my $row = $self->_do_something->execute(); | ||
| 29 | |||
| 30 | return $row->{'result_code'}; | ||
| 31 | } | ||
| 32 | |||
| 33 | 1; | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | B<Eve::Gateway::PgSql> is a base class for PostgreSQL data | ||
| 38 | gateways. It houses some generic initialization stuff. | ||
| 39 | |||
| 40 | =head3 Constructor arguments | ||
| 41 | |||
| 42 | =over 4 | ||
| 43 | |||
| 44 | =item C<pgsql> | ||
| 45 | |||
| 46 | a B<Eve::Registry::PgSql> instance. | ||
| 47 | |||
| 48 | =back | ||
| 49 | |||
| 50 | =head1 METHODS | ||
| 51 | |||
| 52 | =head2 B<init()> | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | 0 | ▶ | sub init { |
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 57 | 0 | my ($self, %arg_hash) = @_; | |
| 58 | 0 | Eve::Support::arguments(\%arg_hash, my $pgsql); | |
| 59 | |||
| 60 | 0 | $self->{'_pgsql'} = $pgsql; | |
| 61 | |||
| 62 | 0 | return; | |
| 63 | } | ||
| 64 | |||
| 65 | =head1 SEE ALSO | ||
| 66 | |||
| 67 | =over 4 | ||
| 68 | |||
| 69 | =item L<Eve::Class> | ||
| 70 | |||
| 71 | =item L<Eve::Registry::PgSql> | ||
| 72 | |||
| 73 | =back | ||
| 74 | |||
| 75 | =head1 LICENSE AND COPYRIGHT | ||
| 76 | |||
| 77 | Copyright 2012 Igor Zinovyev. | ||
| 78 | |||
| 79 | This program is free software; you can redistribute it and/or modify it | ||
| 80 | under the terms of either: the GNU General Public License as published | ||
| 81 | by the Free Software Foundation; or the Artistic License. | ||
| 82 | |||
| 83 | See http://dev.perl.org/licenses/ for more information. | ||
| 84 | |||
| 85 | |||
| 86 | =head1 AUTHOR | ||
| 87 | |||
| 88 | =over 4 | ||
| 89 | |||
| 90 | =item L<Sergey Konoplev|mailto:gray.ru@gmail.com> | ||
| 91 | |||
| 92 | =back | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | 1 | 1; | |