DBIx-PgLink
view release on metacpan or search on metacpan
lib/DBIx/PgLink.pm view on Meta::CPAN
$db = $conn->adapter;
$db->begin_work;
$st = $db->prepare('SELECT * FROM Orders WHERE OrderID=?');
$st->execute(42);
while (@row = $st->fetchrow_array) {
...
}
$db->commit;
$conn->builder->build_accessors(
local_schema => 'northwind',
remote_schema => 'dbo',
remote_object => 'Order%',
);
DBIx::PgLink->disconnect('NORTHWIND');
=head1 DESCRIPTION
I<PgLink> is based on I<DBI-Link> project for accessing
external data sources from PostgreSQL backend.
This module can be used only in untrusted PL/Perl function.
=head2 Differences from I<DBI-Link>
=over
=item *
I<PgLink> is standard Perl module
While I<DBI-Link> store all Perl code in PL/Perl functions,
DBIx-PgLink use Perl infrastructure for installation and testing.
=item *
Extensibility
The main goal is to compose functionality without writing a line of Perl code.
=item *
Flexible data type mapping
=item *
Customizable SQL queries.
=item *
Parametrized queries
Prevent SQL-injection attack.
=item *
Mapping between database accounts
Can connect with different credentials for each PostgreSQL user.
=item *
Additional functionality for DBI
Such as automatic reconnection after network outage,
nested transactions, charset conversion, prepared statement cache management.
=back
=head1 SUBROUTINES
=over
=item connect
$adapter = connect($conn_name);
Load connection metadata from PostgreSQL and connect to remote datasource.
Returns instance of L<DBIx::PgLink::Connector> object.
Subsequent calls return the same cached object.
Single connection persists while PostgreSQL session live
or until explicit C<disconnect>.
=item disconnect
disconnect($conn_name);
Close connection to remote database and delete entry from cache.
=item named_params
my $hashref = named_params(\@_, qw/foo bar/); # { foo=>$_[0], bar=>$_[1] }
Utility subroutine. Converts positional arguments of PL/Perl function (passed in @_) to named parameters.
NULL arguments are ignored.
Exported by default.
=back
=head1 SEE ALSO
L<DBIx::PgLink::Manual::Install>,
L<DBIx::PgLink::Manual::Usage>,
L<DBI>,
L<DBIx::PgLink::Connector>,
L<DBIx::PgLink::Adapter>,
L<DBIx::PgLink::Accessor::Table>,
L<DBIx::PgLink::Local>,
L<http://pgfoundry.org/projects/dbi-link/>
=head1 AUTHOR
Alexey Sharafutdinov E<lt>alexey.s.v.br@gmail.comE<gt>
( run in 1.381 second using v1.01-cache-2.11-cpan-5837b0d9d2c )