DBIx-PgLink
view release on metacpan or search on metacpan
lib/DBIx/PgLink/Manual/Usage.pod view on Meta::CPAN
=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(
'NORTHWIND',
'dbi:ODBC:Northwind',
'DBIx::PgLink::Adapter::MSSQL',
'empty', --use integrated security
NULL,
'Sample database' --comment
);
=head2 Mapping between local and remote user
SELECT C<dbix_pglink.set_user>(I<conn_name>, I<local_user>, I<remote_user>, I<remote_password>);
SELECT C<dbix_pglink.delete_user>(I<conn_name>, I<local_user>);
This is optional when
- no authentication required (desktop database like DBF, SQLite)
- OS-level authentication of 'postgres' account on remote server
(MSSQL with integrated security mode, PostgreSQL with sspi)
There can be special <default> user entry for each connection, where I<local_user> = '' (empty string).
B<WARNING: Password stored as plain text>
=head2 Roles
Roles requires disconnect from remote database to apply.
SELECT C<dbix_pglink.set_conn_role>(I<conn_name>, I<local_user>, I<role_kind>, I<role_name>, I<position>, I<replace>);
SELECT C<dbix_pglink.delete_conn_role>(I<conn_name>, I<local_user>, I<role_kind>, I<role_name>);
where
=over
=item I<role_kind> (TEXT)
To which object role will be applied, 'Adapter' or 'Connector'
=item I<local_user> (TEXT)
PostgreSQL user name or '' (empty string) for global.
=item I<role_name> (TEXT)
Perl class name.
Can be full name like 'DBIx::PgLink::Adapter::Roles::InitSession' or just 'InitSession'.
See directory lib/DBIx/PgLink/Roles.
=item I<position> (INTEGER)
For some roles loading order can matter. Use NULL to append role to end of list.
=item I<replace> (BOOLEAN)
If true replace role in specified I<position>. If false insert role in I<position> and shift list down.
=back
=head2 Attributes
There is L<DBI> database handle attibutes (with name in CamelCase)
and Adapter object attributes (with name in lower case).
Some roles may add extra Adapter attributes.
SELECT C<dbix_pglink.set_conn_attr>(I<conn_name>, I<local_user>, I<name>, I<value>);
SELECT C<dbix_pglink.delete_conn_attr>(I<conn_name>, I<local_user>, I<name>);
See description of DBI attributes in L<DBI/ATTRIBUTES COMMON TO ALL HANDLES>:
( run in 2.038 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )