DBIO-MySQL

 view release on metacpan or  search on metacpan

t/10-mysql.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More;
use Test::Exception;
use Test::Warn;

use DBI::Const::GetInfoType;
use Scalar::Util qw/weaken/;

use DBIO::Test;
use DBIO::Util qw(peepeeness);

my ($dsn, $user, $pass) = @ENV{map { "DBIO_TEST_MYSQL_${_}" } qw/DSN USER PASS/};

plan skip_all => 'Set $ENV{DBIO_TEST_MYSQL_DSN}, _USER and _PASS to run this test'
  unless ($dsn && $user);

my $schema = DBIO::Test::Schema->connect($dsn, $user, $pass, { quote_names => 1 });

t/10-mysql.t  view on Meta::CPAN


  SKIP: {
    # DBD::MariaDB handles fork+reconnect differently from DBD::mysql — the
    # child process spins instead of cleanly reconnecting. Skip the fork
    # portion of this test when using DBD::MariaDB.
    skip 'DBD::MariaDB fork+auto_reconnect behaves differently', 6
      if $is_mariadb;

    my $schema_autorecon = DBIO::Test::Schema->connect($dsn, $user, $pass, { $ar_attr => 1 });
    my $orig_dbh = $schema_autorecon->storage->_get_dbh;
    weaken $orig_dbh;

    ok ($orig_dbh, 'Got weak $dbh ref');
    ok ($orig_dbh->{$ar_attr}, 'auto_reconnect is properly set if explicitly requested' );

    my $rs = $schema_autorecon->resultset('Artist');

    my ($parent_in, $child_out);
    pipe( $parent_in, $child_out ) or die "Pipe open failed: $!";
    my $pid = fork();
    if (! defined $pid ) {



( run in 0.649 second using v1.01-cache-2.11-cpan-995e09ba956 )