Acrux-DBI
view release on metacpan or search on metacpan
};
```
Ð ÑÑом пÑимеÑе модÑÐ»Ñ Ð¼Ð¾Ð´ÐµÐ»Ð¸ подклÑÑаеÑÑÑ Ð² оÑновном клаÑÑе ÑеÑвеÑа [WWW::Suffit::Server](https://metacpan.org/pod/WWW::Suffit::Server), а ÑкземплÑÑ Ð¼Ð¾Ð´ÐµÐ»Ð¸ ÑоздаÑÑÑÑ Ð...
```text
mysql://username:password@hostname/altair?mysql_auto_reconnect=1
mariadb://username:password@hostname/altair?mariadb_auto_reconnect=1
sqlite:///var/lib/altair/altair.db?sqlite_unicode=1
```
Ðалее ÑÐºÐ°Ð·Ð°Ð½Ð½Ð°Ñ URL ÑÑÑока бÑÐ´ÐµÑ Ð¿ÑеобÑазована авÑомаÑиÑеÑки в DSN бÑдÑÑего ÑоединениÑ
## Connect
ÐÑи запÑÑке WEB ÑеÑвеÑа и пеÑеÑ
оде на главнÑÑ ÑÑÑаниÑÑ ÑеÑÑового ÑайÑа бÑÐ´ÐµÑ Ð¾ÑÑÑеÑÑвлен "вÑ
од" в обÑабоÑÑик ÑÑого маÑÑÑÑÑа `WWW::Altair::Server::Alp...
```perl
my $model = $self->app->model->init;
lib/Acrux/DBI.pm view on Meta::CPAN
my $tx = $dbi->transaction;
$dbi->query( ... );
$dbi->query( ... );
$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
$dbi = $dbi->url('sqlite:///./test.db?sqlite_unicode=1');
Default: C<"sponge://">
=head2 username
my $username = $dbi->username;
This is the L<Mojo::URL/username> that will be used for generating the connection DSN
default: none
t/05-dump.t view on Meta::CPAN
};
#$dbi->disconnect; # Disabled this: see autoclean option
done_testing;
1;
__END__
DB_CONNECT_URL='sqlite://./test.db?sqlite_unicode=1' prove -lv t/05-dump.t
( run in 2.383 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )