Aion-Query

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately

README.md  view on Meta::CPAN

```

## default_connect_options ()

DSN, пользователь, пароль и команды после подключения.

```perl
[default_connect_options]  # --> ['DBI:SQLite:dbname=test-base.sqlite', 'root', 123, []]
```

## base_connect ($dsn, $user, $password, $conn)

Подключаемся к базе и возвращаем соединение и идентифицируем.

```perl
my ($dbh, $connect_id) = base_connect("DBI:SQLite:dbname=base-2.sqlite", "toor", "toorpasswd", []);

ref $dbh     # => DBI::db
$connect_id  # -> -1
```

i18n/Aion/Query.ru-en.po  view on Meta::CPAN

msgid "## default_dsn ()"
msgstr "## default_dsn()"

msgid "DSN по умолчанию для `DBI->connect`."
msgstr "Default DSN for `DBI->connect`."

msgid "## default_connect_options ()"
msgstr "## default_connect_options()"

msgid "DSN, пользователь, пароль и команды после подключения."
msgstr "DSN, user, password and commands after connection."

msgid "## base_connect ($dsn, $user, $password, $conn)"
msgstr "## base_connect ($dsn, $user, $password, $conn)"

msgid "Подключаемся к базе и возвращаем соединение и идентифицируем."
msgstr "We connect to the database and return the connection and identify it."

msgid "## connect_respavn ($base)"
msgstr "## connect_respavn ($base)"

msgid "Проверка подключения и повторное подключение."
msgstr "Checking the connection and reconnecting."

lib/Aion/Query.md  view on Meta::CPAN

```

## default_connect_options ()

DSN, пользователь, пароль и команды после подключения.

```perl
[default_connect_options]  # --> ['DBI:SQLite:dbname=test-base.sqlite', 'root', 123, []]
```

## base_connect ($dsn, $user, $password, $conn)

Подключаемся к базе и возвращаем соединение и идентифицируем.

```perl
my ($dbh, $connect_id) = base_connect("DBI:SQLite:dbname=base-2.sqlite", "toor", "toorpasswd", []);

ref $dbh     # => DBI::db
$connect_id  # -> -1
```

lib/Aion/Query.pm  view on Meta::CPAN

		if(DRV =~ /mysql|mariadb/i) {[
			"SET NAMES utf8",
			"SET sql_mode='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'",
   		]}
		else {[]}
	};
}

# Коннект к базе и id коннекта
sub base_connect {
	my ($dsn, $user, $password, $conn) = @_;
	my $base = DBI->connect($dsn, $user, $password, {
		RaiseError => 1,
		PrintError => 0,
		$dsn =~ /^DBI:mysql/i ? (mysql_enable_utf8 => 1): (),
	}) or die "Connect to db failed";

	$base->do($_) for @$conn;
	return $base unless wantarray;
	my ($base_connection_id) = $dsn =~ /^DBI:(mysql|mariadb)/i
		? $base->selectrow_array("SELECT connection_id()")
		: -1;

lib/Aion/Query.pm  view on Meta::CPAN

	query_scalar "SELECT name FROM author where id=7"  # => Pushkin N.

=head2 default_dsn()

Default DSN for C<< DBI-E<gt>connect >>.

	default_dsn  # => DBI:SQLite:dbname=test-base.sqlite

=head2 default_connect_options()

DSN, user, password and commands after connection.

	[default_connect_options]  # --> ['DBI:SQLite:dbname=test-base.sqlite', 'root', 123, []]

=head2 base_connect ($dsn, $user, $password, $conn)

We connect to the database and return the connection and identify it.

	my ($dbh, $connect_id) = base_connect("DBI:SQLite:dbname=base-2.sqlite", "toor", "toorpasswd", []);
	
	ref $dbh     # => DBI::db
	$connect_id  # -> -1

=head2 connect_respavn ($base)

t/aion/query.t  view on Meta::CPAN


# 
# ## default_connect_options ()
# 
# DSN, пользователь, пароль и команды после подключения.
# 
done_testing; }; subtest 'default_connect_options ()' => sub { 
::is_deeply scalar do {[default_connect_options]}, scalar do {['DBI:SQLite:dbname=test-base.sqlite', 'root', 123, []]}, '[default_connect_options]  # --> [\'DBI:SQLite:dbname=test-base.sqlite\', \'root\', 123, []]';

# 
# ## base_connect ($dsn, $user, $password, $conn)
# 
# Подключаемся к базе и возвращаем соединение и идентифицируем.
# 
done_testing; }; subtest 'base_connect ($dsn, $user, $password, $conn)' => sub { 
my ($dbh, $connect_id) = base_connect("DBI:SQLite:dbname=base-2.sqlite", "toor", "toorpasswd", []);

::is scalar do {ref $dbh}, "DBI::db", 'ref $dbh     # => DBI::db';
::is scalar do {$connect_id}, scalar do{-1}, '$connect_id  # -> -1';

# 
# ## connect_respavn ($base)
# 
# Проверка подключения и повторное подключение.
# 



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