Acrux-DBI

 view release on metacpan or  search on metacpan

lib/Acrux/DBI.pm  view on Meta::CPAN

package Acrux::DBI;
use strict;
use utf8;

=encoding utf8

=head1 NAME

Acrux::DBI - Database independent interface for Acrux applications

=head1 SYNOPSIS

    use Acrux::DBI;

=head1 DESCRIPTION

lib/Acrux/DBI.pm  view on Meta::CPAN

      $tx->commit;
    };
    say $@ if $@;

=head2 url

    my $url = $dbi->url;
    $dbi = $dbi->url('sqlite:///tmp/test.db?sqlite_unicode=1');
    $dbi = $dbi->url('sqlite:///./test.db?sqlite_unicode=1'); # '/./' will be removed
    $dbi = $dbi->url('postgres://foo:pass@localhost/mydb?PrintError=1');
    $dbi = $dbi->url('mysql://foo:pass@localhost/test?mysql_enable_utf8=1');

Database connect url

The database connection URL from which all other attributes can be derived.
C<"url"> must be specified before the first call to C<"connect"> is made,
otherwise it will have no effect on setting the defaults.

For using SQLite databases with files relative to current directory you cat use '/./' prefix:

    # '/./' will be removed automatically

lib/Acrux/DBI/Dump.pm  view on Meta::CPAN

package Acrux::DBI::Dump;
use strict;
use utf8;

=encoding utf8

=head1 NAME

Acrux::DBI::Dump - Working with SQL dumps

=head1 SYNOPSIS

    use Acrux::DBI::Dump;

    my $dump = Acrux::DBI::Dump->new(

lib/Acrux/DBI/Res.pm  view on Meta::CPAN

package Acrux::DBI::Res;
use strict;
use utf8;

=encoding utf8

=head1 NAME

Acrux::DBI::Res - Results of your database queries

=head1 SYNOPSIS

    use Acrux::DBI::Res;

    my $res = Acrux::DBI::Res->new(sth => $sth);

lib/Acrux/DBI/Tx.pm  view on Meta::CPAN

package Acrux::DBI::Tx;
use strict;
use utf8;

=encoding utf8

=head1 NAME

Acrux::DBI::Tx - Transaction

=head1 SYNOPSIS

    use Acrux::DBI::Tx;

    my $tx = Acrux::DBI::Tx->new( dbi => $dbi );

t/03-connect.t  view on Meta::CPAN

    ok($res, 'Drop table') or diag $dbi->error;
};

done_testing;

1;

__END__

DB_CONNECT_URL='postgres://foo:pass@localhost/mydb?PrintError=1&foo=123' prove -lv t/03-connect.t
DB_CONNECT_URL='mysql://test:test@192.168.0.1/test?mysql_auto_reconnect=1&mysql_enable_utf8=1' prove -lv t/03-connect.t

t/04-transaction.t  view on Meta::CPAN

    my $res = $dbi->query('DROP TABLE IF EXISTS `names`');
    ok($res, 'Drop table') or diag $dbi->error;
};

done_testing;

1;

__END__

DB_CONNECT_URL='mysql://test:test@192.168.0.1/test?mysql_auto_reconnect=1&mysql_enable_utf8=1' prove -lv t/04-transaction.t



( run in 1.279 second using v1.01-cache-2.11-cpan-49f99fa48dc )