Aion-Query

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN


                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    {one line to give the program's name and a brief idea of what it does.}
    Copyright (C) {year}  {name of author}

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

LICENSE  view on Meta::CPAN

    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    {project}  Copyright (C) {year}  {fullname}
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

README.md  view on Meta::CPAN


```perl
my $old_base = $Aion::Query::base;

$old_base->ping  # -> 1
connect_respavn $Aion::Query::base, $Aion::Query::base_connection_id;

$old_base  # -> $Aion::Query::base
```

## connect_restart ($base)

Перезапуск соединения.

```perl
my $connection_id = $Aion::Query::base_connection_id;
my $base = $Aion::Query::base;

connect_restart $Aion::Query::base, $Aion::Query::base_connection_id;

$base->ping  # -> 0
$Aion::Query::base->ping  # -> 1
```

## query_stop ()

Создает дополнительное соединение с базой и убивает основное.

Для этого используется `$Aion::Query::base_connection_id`.

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


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."

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

msgid "Перезапуск соединения."
msgstr "Restarting the connection."

msgid "## query_stop ()"
msgstr "## query_stop()"

msgid "Создает дополнительное соединение с базой и убивает основное."
msgstr "Creates an additional connection to the base and kills the main one."

msgid "Для этого используется `$Aion::Query::base_connection_id`."
msgstr "To do this, use `$Aion::Query::base_connection_id`."

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


```perl
my $old_base = $Aion::Query::base;

$old_base->ping  # -> 1
connect_respavn $Aion::Query::base, $Aion::Query::base_connection_id;

$old_base  # -> $Aion::Query::base
```

## connect_restart ($base)

Перезапуск соединения.

```perl
my $connection_id = $Aion::Query::base_connection_id;
my $base = $Aion::Query::base;

connect_restart $Aion::Query::base, $Aion::Query::base_connection_id;

$base->ping  # -> 0
$Aion::Query::base->ping  # -> 1
```

## query_stop ()

Создает дополнительное соединение с базой и убивает основное.

Для этого используется `$Aion::Query::base_connection_id`.

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


# Проверка коннекта и переконнект
sub connect_respavn {
	my ($base) = @_;
	$base->disconnect, undef $base if $base and !$base->ping;
	($_[0], $_[1]) = base_connect(default_connect_options) if !$base;
	return;
}

# Рестарт коннекта
sub connect_restart {
	my ($base, $base_connection_id) = @_;
	$base->disconnect if $base;
	($_[0], $_[1]) = base_connect(default_connect_options());
	return;
}


# Инициализация БД
our $base; our $base_connection_id;

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


Checking the connection and reconnecting.

	my $old_base = $Aion::Query::base;
	
	$old_base->ping  # -> 1
	connect_respavn $Aion::Query::base, $Aion::Query::base_connection_id;
	
	$old_base  # -> $Aion::Query::base

=head2 connect_restart ($base)

Restarting the connection.

	my $connection_id = $Aion::Query::base_connection_id;
	my $base = $Aion::Query::base;
	
	connect_restart $Aion::Query::base, $Aion::Query::base_connection_id;
	
	$base->ping  # -> 0
	$Aion::Query::base->ping  # -> 1

=head2 query_stop()

Creates an additional connection to the base and kills the main one.

To do this, use C<$Aion::Query::base_connection_id>.

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

# 
done_testing; }; subtest 'connect_respavn ($base)' => sub { 
my $old_base = $Aion::Query::base;

::is scalar do {$old_base->ping}, scalar do{1}, '$old_base->ping  # -> 1';
connect_respavn $Aion::Query::base, $Aion::Query::base_connection_id;

::is scalar do {$old_base}, scalar do{$Aion::Query::base}, '$old_base  # -> $Aion::Query::base';

# 
# ## connect_restart ($base)
# 
# Перезапуск соединения.
# 
done_testing; }; subtest 'connect_restart ($base)' => sub { 
my $connection_id = $Aion::Query::base_connection_id;
my $base = $Aion::Query::base;

connect_restart $Aion::Query::base, $Aion::Query::base_connection_id;

::is scalar do {$base->ping}, scalar do{0}, '$base->ping  # -> 0';
::is scalar do {$Aion::Query::base->ping}, scalar do{1}, '$Aion::Query::base->ping  # -> 1';

# 
# ## query_stop ()
# 
# Создает дополнительное соединение с базой и убивает основное.
# 
# Для этого используется `$Aion::Query::base_connection_id`.



( run in 0.892 second using v1.01-cache-2.11-cpan-0d8aa00de5b )