view release on metacpan or search on metacpan
mariadb_dr_do_error(dbh, CR_SERVER_GONE_ERROR, "MySQL server has gone away", "HY000");
return 0;
}
mysql_options(imp_dbh->pmysql, FABRIC_OPT_MODE, str);
}
else if (memEQs(key, kl, "mariadb_fabric_opt_group_credentials"))
{
mariadb_dr_do_error(dbh, CR_UNKNOWN_ERROR, "'fabric_opt_group_credentials' is not supported", "HY000");
return 0;
}
#endif
else if (memEQs(key, kl, "mariadb_max_allowed_packet"))
{
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Neo4p/Test.pm view on Meta::CPAN
my $class = shift;
my ($db,$user,$pass) = @_;
REST::Neo4p->set_handle(0);
unless (REST::Neo4p->connected) {
eval {
REST::Neo4p->agent->credentials($db,'',$user,$pass) if defined $user;
REST::Neo4p->connect($db);
};
if (my $e = REST::Neo4p::CommException->caught) {
return
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/Oracle.pm view on Meta::CPAN
DBMS_OUTPUT.GET is discarded by the next call to DBMS_OUTPUT.PUT_LINE,
DBMS_OUTPUT.PUT, or DBMS_OUTPUT.NEW_LINE.
=head2 B<reauthenticate ( $username, $password )>
Starts a new session against the current database using the credentials
supplied. Note that this does not work with DRCP.
=head2 B<private_attribute_info>
$hashref = $dbh->private_attribute_info();
view all matches for this distribution
view release on metacpan or search on metacpan
}
#if SQLITE_USER_AUTHENTICATION
/*
** Return TRUE if zTable is the name of the system table that stores the
** list of users and their access credentials.
*/
SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){
return sqlite3_stricmp(zTable, "sqlite_user")==0;
}
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
}
#if SQLITE_USER_AUTHENTICATION
/*
** Return TRUE if zTable is the name of the system table that stores the
** list of users and their access credentials.
*/
SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){
return sqlite3_stricmp(zTable, "sqlite_user")==0;
}
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/WMI.pm view on Meta::CPAN
=over 4
=item * Implement placeholders and proper interpolation of values
=item * Need to implement DSN parameters for remote computers, credentials
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
xt/03_turso_live.t view on Meta::CPAN
"Get the correct URL from your Turso dashboard at https://app.turso.io\n";
}
plan tests => 8;
# Test 1: Connection with Turso credentials (using DBI standard password parameter)
my $dsn = "dbi:libsql:$hostname";
my $dbh = DBI->connect($dsn, '', $turso_token, {
RaiseError => 1,
AutoCommit => 1,
});
view all matches for this distribution
view release on metacpan or search on metacpan
perl Makefile.PL
make
make test
```
See the output of `perl Makefile.PL` for how to set database credentials.
Testing is also done via GitHub action.
## Installation
view all matches for this distribution
view release on metacpan or search on metacpan
1.000005 2012-10-08
- Fixed: filtered column handling
1.000004 2012-09-26
- Fixed: credentials are now transfered to commit (Steffen Schwigon)
- Show life signal only on -vv (Steffen Schwigon)
- Skip views for transfer (Bug #3, reported by Steffen Schwigon)
1.000003 2012-09-17
- set user in portable way
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/FilterColumn/Encrypt.pm view on Meta::CPAN
# in application code
$rs->create({ data => 'some secret' });
=head1 DESCRIPTION
This components transparently encrypts any value with the currently active key, or decrypts them with any known value. This is useful when needing read/write access to values that are too sensitive to store in plaintext, such as credentials for other...
To enable encryption, C<encrypt> must be a hash containing the key C<keys>, which shall be a hash mapping numberic identifiers to keys. An optional argument C<active_key> may be given which one will be used for encrypting, otherwise the key with the ...
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
return $class->next::method( @info );
}
my $attrs = $class->_make_connect_attrs(@info);
# We will not load credentials for someone who uses dbh_maker,
# however we will pass their request through.
return $class->next::method( $attrs )
if defined $attrs->{dbh_maker};
# Take responsibility for passing through normal-looking
# credentials.
$attrs = $class->load_credentials($attrs)
unless $attrs->{dsn} =~ /^dbi:/i;
return $class->next::method( $attrs );
}
sub coerce_credentials_from_mojolike {
my ( $class, $attrs ) = @_;
(my $in = $attrs->{dsn}) =~ s/^postgresql/http/;
my $url = URI->new( $in );
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
}
sub _load_config {
my ( $class ) = @_;
require Config::Any; # Only loaded if we need to load credentials.
# If we have ->config_files, we'll use those and load_files
# instead of the default load_stems.
my %cf_opts = ( use_ext => 1 );
return @{$class->config_files}
? Config::Any->load_files({ files => $class->config_files, %cf_opts })
: Config::Any->load_stems({ stems => $class->config_paths, %cf_opts });
}
sub load_credentials {
my ( $class, $connect_args ) = @_;
# Handle mojo-like postgres:// urls
return $class->coerce_credentials_from_mojolike($connect_args)
if $connect_args->{dsn} =~ /^postgresql:/i;
# While ->connect is responsible for returning normal-looking
# credential information, we do it here as well so that it can be
# independently unit tested.
return $connect_args if $connect_args->{dsn} =~ /^dbi:/i;
return $class->filter_loaded_credentials(
$class->_find_credentials( $connect_args, $class->config ),
$connect_args
);
}
# This will look through the data structure returned by Config::Any
# and return the first instance of the database credentials it can
# find.
sub _find_credentials {
my ( $class, $connect_args, $ConfigAny ) = @_;
for my $cfile ( @$ConfigAny ) {
for my $filename ( keys %$cfile ) {
for my $database ( keys %{$cfile->{$filename}} ) {
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
# Intended to be sub-classed, the default behavior is to
# overwrite the loaded configuration with any specified
# configuration from the connect() call, with the exception
# of the DSN itself.
sub filter_loaded_credentials {
my ( $class, $new, $old ) = @_;
local $old->{password}, delete $old->{password} unless $old->{password};
local $old->{user}, delete $old->{user} unless $old->{user};
local $old->{dsn}, delete $old->{dsn};
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
DBIx::Class::Schema::Config - Credential Management for DBIx::Class
=head1 DESCRIPTION
DBIx::Class::Schema::Config is a subclass of DBIx::Class::Schema that allows
the loading of credentials & configuration from a file. The actual code itself
would only need to know about the name used in the configuration file. This
aims to make it simpler for operations teams to manage database credentials.
A simple tutorial that compliments this documentation and explains converting
an existing DBIx::Class Schema to use this software to manage credentials can
be found at L<http://www.symkat.com/credential-management-in-dbix-class>
=head1 SYNOPSIS
/etc/dbic.yaml
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
use base 'DBIx::Class::Schema::Config';
__PACKAGE__->config_paths([( '/var/www/secret/dbic', '/opt/database' )]);
The above code would have I</var/www/secret/dbic.*> and I</opt/database.*>
searched, in that order. As above, the first credentials found would be used.
This will replace the files originally searched for, not add to them.
=head1 USE SPECIFIC CONFIG FILES
If you would rather explicitly state the configuration files you
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
Historical Note: This class accepts numerous ways to connect to DBIC that would
otherwise not be valid. These connection methods are discouraged but tested for
and kept for compatibility with earlier versions. For valid ways of connecting to DBIC
please see L<https://metacpan.org/pod/DBIx::Class::Storage::DBI#connect_info>
=head2 filter_loaded_credentials
Override this function if you want to change the loaded credentials before
they are passed to DBIC. This is useful for use-cases that include decrypting
encrypted passwords or making programmatic changes to the configuration before
using it.
sub filter_loaded_credentials {
my ( $class, $loaded_credentials, $connect_args ) = @_;
...
return $loaded_credentials;
}
C<$loaded_credentials> is the structure after it has been loaded from the
configuration file. In this case, C<$loaded_credentials-E<gt>{user}> eq
B<WalterWhite> and C<$loaded_credentials-E<gt>{dsn}> eq
B<DBI:mysql:database=students;host=%s;port=3306>.
C<$connect_args> is the structure originally passed on C<-E<gt>connect()>
after it has been turned into a hash. For instance,
C<-E<gt>connect('DATABASE', 'USERNAME')> will result in
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
package My::Schema
use warnings;
use strict;
use base 'DBIx::Class::Schema::Config';
sub filter_loaded_credentials {
my ( $class, $loaded_credentials, $connect_args ) = @_;
if ( $loaded_credentials->{dsn} =~ /\%s/ ) {
$loaded_credentials->{dsn} = sprintf( $loaded_credentials->{dsn},
$connect_args->{hostname});
}
}
__PACKAGE__->load_classes;
1;
Then the connection could be done with
C<$Schema-E<gt>connect('DATABASE', { hostname => 'my.hostname.com' });>
See L</load_credentials> for more complex changes that require changing
how the configuration itself is loaded.
=head2 load_credentials
Override this function to change the way that L<DBIx::Class::Schema::Config>
loads credentials. The function takes the class name, as well as a hashref.
If you take the route of having C<-E<gt>connect('DATABASE')> used as a key for
whatever configuration you are loading, I<DATABASE> would be
C<$config-E<gt>{dsn}>
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
TraceLevel => 1
}
);
Would result in the following data structure as $config in
C<load_credentials($class, $config)>:
{
dsn => "SomeTarget",
user => "Yuri",
password => "Yawny",
TraceLevel => 1,
}
Currently, load_credentials will NOT be called if the first argument to
C<-E<gt>connect()> looks like a valid DSN. This is determined by match
the DSN with C</^dbi:/i>.
The function should return the same structure. For instance:
lib/DBIx/Class/Schema/Config.pm view on Meta::CPAN
use strict;
use base 'DBIx::Class::Schema::Config';
use LWP::Simple;
use JSON
# Load credentials from internal web server.
sub load_credentials {
my ( $class, $config ) = @_;
return decode_json(
get( "http://someserver.com/v1.0/database?key=somesecret&db=" .
$config->{dsn} ));
view all matches for this distribution
view release on metacpan or search on metacpan
0.082821 2016-02-11 17:58 (UTC)
* Fixes
- Fix t/52leaks.t failures on compilerless systems (RT#104429)
- Fix t/storage/quote_names.t failures on systems with specified Oracle
test credentials while missing the optional Math::Base36
- Fix test failures when DBICTEST_SYBASE_DSN is set (unnoticed change
in error message wording during 0.082800 and a bogus test)
- Remove largely obsolete test of SQLite view deployment (RT#111916)
* Misc
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Config.pm view on Meta::CPAN
}
my $config = $self->_make_config(@info);
# Take responsibility for passing through normal-looking
# credentials.
$config = $self->default_load_credentials($config)
unless $config->{dsn} =~ /dbi:/i;
return $self->_dbi_credentials($config);
}
# Normalize arguments into a single hash. If we get a single hashref,
# return it.
# Check if $user and $pass are hashes to support things like
lib/DBIx/Config.pm view on Meta::CPAN
# DBI's ->connect expects
# ( "dsn", "user", "password", { option_key => option_value } )
# this function changes our friendly hashref into this format.
sub _dbi_credentials {
my ( $class, $config ) = @_;
return (
delete $config->{dsn},
delete $config->{user},
delete $config->{password},
$config,
);
}
sub default_load_credentials {
my ( $self, $connect_args ) = @_;
# To allow overriding without subclassing, if you pass a coderef
# to ->load_credentials, we will replace our default load_credentials
# without that function.
if ( $self->load_credentials ) {
return $self->load_credentials->( $self, $connect_args );
}
require Config::Any; # Only loaded if we need to load credentials.
# While ->connect is responsible for returning normal-looking
# credential information, we do it here as well so that it can be
# independently unit tested.
return $connect_args if $connect_args->{dsn} =~ /^dbi:/i;
lib/DBIx/Config.pm view on Meta::CPAN
my %cf_opts = ( use_ext => 1 );
my $ConfigAny = @{$self->config_files}
? Config::Any->load_files({ files => $self->config_files, %cf_opts })
: Config::Any->load_stems({ stems => $self->config_paths, %cf_opts });
return $self->default_filter_loaded_credentials(
$self->_find_credentials( $connect_args, $ConfigAny ),
$connect_args
);
}
# This will look through the data structure returned by Config::Any
# and return the first instance of the database credentials it can
# find.
sub _find_credentials {
my ( $class, $connect_args, $ConfigAny ) = @_;
for my $cfile ( @$ConfigAny ) {
for my $filename ( keys %$cfile ) {
for my $database ( keys %{$cfile->{$filename}} ) {
lib/DBIx/Config.pm view on Meta::CPAN
}
}
}
}
sub default_filter_loaded_credentials {
my ( $self, $loaded_credentials,$connect_args ) = @_;
if ( $self->filter_loaded_credentials ) {
return $self->filter_loaded_credentials->(
$self, $loaded_credentials,$connect_args
);
}
return $loaded_credentials;
}
# Assessors
sub config_paths {
my $self = shift;
lib/DBIx/Config.pm view on Meta::CPAN
my $self = shift;
$self->{config_files} = shift if @_;
return $self->{config_files};
}
sub filter_loaded_credentials {
my $self = shift;
$self->{filter_loaded_credentials} = shift if @_;
return $self->{filter_loaded_credentials};
}
sub load_credentials {
my $self = shift;
$self->{load_credentials} = shift if @_;
return $self->{load_credentials};
}
1;
=head1 NAME
DBIx::Config - Manage credentials for DBI
=head1 DESCRIPTION
DBIx::Config wraps around L<DBI> to provide a simple way of loading database
credentials from a file. The aim is make it simpler for operations teams to
manage database credentials.
=head1 SYNOPSIS
Given a file like C</etc/dbi.yaml>, containing:
lib/DBIx/Config.pm view on Meta::CPAN
TraceLevel => 1,
},
);
For cases where you may use something like C<DBIx::Connector>, a
method is provided that will simply return the connection credentials:
!/usr/bin/perl
use warnings;
use strict;
lib/DBIx/Config.pm view on Meta::CPAN
my $conn = DBIx::Connector->new(DBIx::Config->connect_info("MY_DATABASE"));
=head1 CONFIG FILES
By default the following configuration files are examined, in order listed,
for credentials. Configuration files are loaded with L<Config::Any>. You
should append the extention that Config::Any will recognize your file in
to the list below. For instance ./dbic will look for files such as
C<./dbic.yaml>, C<./dbic.conf>, etc. For documentation on acceptable files
please see L<Config::Any>. The first file which has the given credentials
is used.
=over 4
=item * C<$ENV{DBIX_CONFIG_DIR}> . '/dbic',
lib/DBIx/Config.pm view on Meta::CPAN
my $dbh = $DBI->connect( "MY_DATABASE" );
This would check, in order, C<dbcreds> in the current directory, and then C</etc/dbcreds>,
checking for valid configuration file extentions appended to the given file.
=head2 filter_loaded_credentials
You may want to change the credentials that have been loaded, before they are used
to connect to the DB. A coderef is taken that will allow you to make programatic
changes to the loaded credentials, while giving you access to the origional data
structure used to connect.
DBIx::Config->new(
filter_loaded_credentials => sub {
my ( $self, $loaded_credentials, $connect_args ) = @_;
...
return $loaded_credentials;
}
)
Your coderef will take three arguments.
=over 4
=item * C<$self>, the instance of DBIx::Config your code was called from. C
=item * C<$loaded_credentials>, the credentials loaded from the config file.
=item * C<$connect_args>, the normalized data structure of the inital C<connect> call.
=back
Your coderef should return the same structure given by C<$loaded_credentials>.
As an example, the following code will use the credentials from C</etc/dbi>, but
use its a hostname defined in the code itself.
C</etc/dbi> (note C<host=%s>):
MY_DATABASE:
lib/DBIx/Config.pm view on Meta::CPAN
use strict;
use DBIx::Config;
my $dbh = DBIx::Config->new(
# If we have %s, replace it with a hostname.
filter_loaded_credentials => sub {
my ( $self, $loaded_credentials, $connect_args ) = @_;
if ( $loaded_credentials->{dsn} =~ /\%s/ ) {
$loaded_credentials->{dsn} = sprintf(
$loaded_credentials->{dsn}, $connect_args->{hostname}
);
}
return $loaded_credentials;
}
)->connect( "MY_DATABASE", { hostname => "127.0.0.1" } );
=head2 load_credentials
Override this function to change the way that DBIx::Config loads credentials.
The function takes the class name, as well as a hashref.
If you take the route of having ->connect('DATABASE') used as a key for whatever
configuration you are loading, DATABASE would be $config->{dsn}
lib/DBIx/Config.pm view on Meta::CPAN
{
TraceLevel => 1
}
);
Would result in the following data structure as $config in load_credentials($self, $config):
{
dsn => "SomeTarget",
user => "Yuri",
password => "Yawny",
TraceLevel => 1,
}
Currently, load_credentials will NOT be called if the first argument to ->connect()
looks like a valid DSN. This is determined by match the DSN with /^dbi:/i.
The function should return the same structure. For instance:
#!/usr/bin/perl
lib/DBIx/Config.pm view on Meta::CPAN
use DBIx::Config;
use LWP::Simple;
use JSON;
my $DBI = DBIx::Config->new(
load_credentials => sub {
my ( $self, $config ) = @_;
return decode_json(
get( "http://someserver.com/v1.0/database?name=" . $config->{dsn} )
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Cookbook.pm view on Meta::CPAN
=head2 The sakila database is installed automatically
Just FYI, there is a C<sakila> target that runs automatically when you
run C<make>. This target downloads the sakila database and loads it
into MySQL. It also stores the MySQL auth credentials in
F<lib/DBI/Cookbook/DBH.pm>.
If you ever want to run it separately simply type
make sakila
view all matches for this distribution
view release on metacpan or search on metacpan
t/common-sqlserver.t view on Meta::CPAN
|computed_columns
|configurations
|conversation_endpoints
|conversation_groups
|conversation_priorities
|credentials
|crypt_properties
|cryptographic_providers
|data_spaces
|database_audit_specification_details
|database_audit_specifications
t/common-sqlserver.t view on Meta::CPAN
|server_event_session_targets
|server_event_sessions
|server_events
|server_file_audits
|server_permissions
|server_principal_credentials
|server_principals
|server_role_members
|server_sql_modules
|server_trigger_events
|server_triggers
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/DWIW.pm view on Meta::CPAN
## etc.) DBI::ProxyServer just reports "Unexpected EOF from
## server". Let's give the user a hint as to what that
## might mean.
##
if ($ERROR =~ m/^Cannot log in to DBI::ProxyServer: Unexpected EOF from server/) {
$ERROR = "Cannot log in via DBI::ProxyServer: Unexpected EOF from server (check user's MySQL credentials and privileges)";
}
if (not $NoAbort) {
die $ERROR;
}
elsif (not $Quiet) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/DataStore.pm view on Meta::CPAN
my $db = DBIx::DataStore->new({ config => $config });
=head2 Configuring Database Passwords
Because DBIx::DataStore uses the normal DBI/DBD layers underneath, all the
usual methods of locating and presenting database credentials to the
appropriate database server are available. This includes methods such as the
C<.pgpass> file for PostgreSQL and equivalents for other RDBMSes. If your
DBIx::DataStore configuration does not include a C<pass> attribute for a given
database host, these alternate methods will be used as long as they are
properly configured.
view all matches for this distribution
view release on metacpan or search on metacpan
* Mon May 21 11:38:02 2007 CEST
DBIx::Easy v0.17 released
* Fri May 18 17:27:15 2007 CEST
(Easy.pm): MySQL 5 has a different message for bad credentials
commit only if AutoCommit is turned off to avoid spurious warnings
* Fri May 18 00:17:37 2007 CEST
(Easy.pm): fixed now method for Postgresql
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/HTML.pm view on Meta::CPAN
=head1 SYNOPSIS
use DBIx::HTML;
my $generator = DBIx::HTML->connect( @db_credentials );
$generator->do( $query );
# supports multiple orientations
print $generator->portrait;
print $generator->landscape;
# stackable method calls:
print DBIx::HTML
->connect( @db_credentials )
->do( 'select foo,baz from bar' )
->landscape
;
# rotating attributes:
lib/DBIx/HTML.pm view on Meta::CPAN
=head1 METHODS
=over 4
=item C<connect( @database_credentials )>
Connects to the database. See L<DBI> for how to do that.
Optionally, create your own database handle and pass it:
my $dbh = DBI->connect ( @db_creds );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/JCL.pm view on Meta::CPAN
the various execution and output parsing that whould otherwise have to be \
handled by calling the db_sqlloader functions directly (which certainly you \
can if you prefer).
Execute SQL*Loader using the supplied paramaters. The Virtual Database \
Name is used to obtain login credentials. This will launch SQL*Loader \
and wait for it to finish, returning the SQL*Loader return code to the \
caller.
Data file name must be fully qualified. Path provided by data file name \
will be used for out, bad, and dis files.
view all matches for this distribution
view release on metacpan or search on metacpan
t/connect.t view on Meta::CPAN
use warnings;
=head1 SYNOPSIS
In order to run these tests, you'll need to set your MySQL slave access
credentials in %ENV.
For example:
export SLAVE_DSN="dbi:mysql:database=my_database;host=my_db_hostname"
export SLAVE_USER=replication_user
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/MyServer.pm view on Meta::CPAN
If you are subclassing C<DBIx::MyParse>, the way C<DBIx::MyParse::DBI> does, to establish a connection you call:
=item C<< $myserver->handshake() >>
which completes the handshake between the two parties. The return value will be C<undef> if some I/O error
occured, or the result of the client authorization routine. When the client sends its credentials, the
module will call:
=item C<< $myserver->authorize($remote_host, $username, $database) >>
whose default action is to accept only localhost connections regardless of username or password. You should
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
print FH<<STUB;
# named_dsn.conf
# This is the stub configuration file for DBIx::NamedDSN (version
# 0.01). Use this file to define your data source names and
# connection strings and optional login credentials.
# This file consists of up to four tab-separated columns. The first
# column is the unique name given to this configuration. This should
# be a single word which matches the perl regexp /^\w+\$/. This name
# is what you refer to in your programs when you want to connect to
view all matches for this distribution
view release on metacpan or search on metacpan
README.MySQL view on Meta::CPAN
In order to test DBIx::ORM::Declarative against a MySQL database, you need
to install the tables in the files t/dod_test.mysql.sql and
t/join_test.mysql.sql into a database, and update t/mysqlinfo.pl to reflect
the appropriate access credentials. For example, if you set up a database
with a name of 'dod_test' on your local machine, and give access to the
'dod_test' user with a password of 'dod_test', just uncommenting the
declarations in t/mysqlinfo.pl should do the trick.
You can install the tables by giving t/dod_test.mysql.sql and
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/PgLink.pm view on Meta::CPAN
=item *
Mapping between database accounts
Can connect with different credentials for each PostgreSQL user.
=item *
Additional functionality for DBI
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/QueryByName.pm view on Meta::CPAN
# Store information on how to open a database session
sub connect {
my ($self,$session,@params) = @_;
my $log = get_logger();
$log->logcroak("undefined session argument in connect") if (!defined $session);
$self->_dbh_pool()->add_credentials($session,@params);
return $self;
}
# Call dbi's quote()
sub quote {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/QuickORM.pm view on Meta::CPAN
=head1 RECIPES
=head2 DEFINE DB LATER
In some cases you may want to define your orm/schema before you have your
database credentials. Then you want to add the database later in an app/script
bootstrap process.
Schema:
package My::Schema;
lib/DBIx/QuickORM.pm view on Meta::CPAN
=item C<creds sub { return \%CREDS }>
Allows you to provide a coderef that will return a hashref with all the
necessary database connection fields.
This is mainly useful if you credentials are in an encrypted YAML or JSON file
and you have a method to decrypt and read it returning it as a hash.
db mydb => sub {
creds sub { ... };
};
lib/DBIx/QuickORM.pm view on Meta::CPAN
};
=item C<< server $NAME => sub { ... } >>
Used to define a server with multiple databases. This is a way to avoid
re-specifying credentials for each database you connect to.
You can use C<< db('server_name.db_name') >> to fetch the database.
Basically this allows you to specify any database fields once in the server, then
define any number of databases that inherit them.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/lib/DB.pm view on Meta::CPAN
use strict;
use warnings;
use base qw( DBIx::TNDBO );
sub credentials {
my ($database) = @_;
return {
user => 'dylan',
pass => 'nalyd',
driver => 'mysql',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/TempDB.pm view on Meta::CPAN
use Test::More;
use DBIx::TempDB;
use DBI;
# provide credentials with environment variables
plan skip_all => 'TEST_PG_DSN=postgresql://postgres@localhost' unless $ENV{TEST_PG_DSN};
# create a temp database
my $tmpdb = DBIx::TempDB->new($ENV{TEST_PG_DSN});
view all matches for this distribution