Acrux-DBI
view release on metacpan or search on metacpan
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
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 0.271 second using v1.01-cache-2.11-cpan-00829025b61 )