DBIx-PgLink

 view release on metacpan or  search on metacpan

lib/DBIx/PgLink/Manual/Usage.pod  view on Meta::CPAN

Emulation of DBI for local PostgreSQL database. 

=back

Metadata and helper functions stored in PostgreSQL I<dbix_pglink> schema.


=head1 CONNECTION SETUP

=head2 Main connection record

=over

=item *

Ensure that DBD driver works properly.

Simple test perl script provided

  ./util/dbd_check.pl --dsn="dbi:..." --user=... --password=...

It is OK to fail some catalog information tests, 
if exists adapter for your database that cover that issues.
If not, you cannot use persistent accessor, but (probably) can use ad-hoc queries.

=item *

Login to PostgreSQL database as PostgreSQL superuser

Run C<psql> or C<pgAdmin> or another query tool of your choice.

=item *

Create main connection record:

SELECT C<dbix_pglink.create_connection>(I<conn_name>, I<data_source>,
I<adapter_class>, I<logon_mode>, I<use_libs>, I<comment>);

or

SELECT C<dbix_pglink.create_connection>(I<conn_name>, I<data_source>, I<comment>)

where

=over

=item I<conn_name> (TEXT, mandatory)

Connection name

=item I<data_source> (TEXT, mandatory)

DBI connection string ('dbi:Driver:params...')

=item I<adapter_class> (TEXT)

Perl module name for used database, guessed if not specified.

=item I<logon_mode> (TEXT, mandatory)

Tells what credentials are used when no mapping exists
between local PostgreSQL login and remote user

=over

=item 'empty'

Connect with empty user name and empty password

=item 'current'

Connect as session_user without password

=item 'default'

Connect as default user with default password (see below).

This is default value.

=item 'deny'

Connection refused

=back

=item I<use_libs> (TEXT[])

List of directories, which will be appended to Perl library path (@INC global variable).
Useful when part of code resides out of default Perl locations (or PERL5LIB environment variable)
and restart of main PostgreSQL process is undesirable.

Main Connector class loaded *before* using this libs. 
Setting this attribute can affects only class or role loaded at runtime.

=back

=item *

To modify connection update of I<dbix_pglink.connections> table directly.

=item *

To delete connection:

SELECT C<dbix_pglink.delete_connection>(I<conn_name>) 

All metadata and database objects will be deleted as well.

=back

Example:

  SELECT dbix_pglink.create_connection(
    'NORTHWIND',
    'dbi:ODBC:Northwind',
    'Sample database'
  );

  or

  SELECT dbix_pglink.create_connection(



( run in 0.585 second using v1.01-cache-2.11-cpan-5837b0d9d2c )