DBIx-Sunny

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - support named placeholder #13

0.24 2017-09-28T01:19:10Z

       - The comment insertion mechanism to work correctly when used with DBIx::Class #10
       - Perl 5.26+ removes dot from @INC. #9
       Thank you tokuhirom! 

0.23 2017-04-03T07:25:30Z

        - Support mysql_enable_utf8mb4
        - Accept SQL::Maker::SQLType objects as bound values
        Thank you nanto!

0.22 2014-05-29T05:49:43Z

        - re-packaging with Minilla
        - requries DBIx::TransactionManager 0.13. for fork safe

0.21    Wed Dec 5 15:04:58 2012
        - add schema txn test

lib/DBIx/Sunny.pm  view on Meta::CPAN

    my $class = shift;
    my ($dsn, $user, $pass, $attr) = @_;
    $attr->{RaiseError} = 1;
    $attr->{PrintError} = 0;
    $attr->{ShowErrorStatement} = 1;
    $attr->{AutoInactiveDestroy} = 1;
    if ($dsn =~ /^(?i:dbi):SQLite:/) {
        $attr->{sqlite_use_immediate_transaction} = 1;
        $attr->{sqlite_unicode} = 1 unless exists $attr->{sqlite_unicode};
    }
    if ($dsn =~ /^(?i:dbi):mysql:/ && ! exists $attr->{mysql_enable_utf8} && ! exists $attr->{mysql_enable_utf8mb4} ) {
        $attr->{mysql_enable_utf8} = 1;
    }
    if ($dsn =~ /^(?i:dbi):Pg:/ && ! exists $attr->{pg_enable_utf8}) {
        $attr->{pg_enable_utf8} = 1;
    }
    $class->SUPER::connect($dsn, $user, $pass, $attr);
}

package DBIx::Sunny::db;
our @ISA = qw(DBI::db);

lib/DBIx/Sunny.pm  view on Meta::CPAN

    $dbh->{ShowErrorStatement} = 1;
    $dbh->{AutoInactiveDestroy} = 1;
    if ($dsn =~ /^dbi:SQLite:/) {
        $dbh->{sqlite_use_immediate_transaction} = 1;
        $dbh->{sqlite_unicode} = 1 unless exists $attr->{sqlite_unicode};

        $dbh->do("PRAGMA journal_mode = WAL");
        $dbh->do("PRAGMA synchronous = NORMAL");

    }
    if ($dsn =~ /^dbi:mysql:/ && ! exists $attr->{mysql_enable_utf8} && ! exists $attr->{mysql_enable_utf8mb4} ) {
        $dbh->{mysql_enable_utf8} = 1;
        $dbh->do("SET NAMES utf8");
    }
    if ($dsn =~ /^dbi:mysql:/) {
        $dbh->{mysql_auto_reconnect} = 0;
    }
    $dbh->{private_connect_info} = [@_];
    $dbh->SUPER::connected(@_);
}

sub connect_info { $_[0]->{private_connect_info} }

lib/DBIx/Sunny.pm  view on Meta::CPAN

=head1 FEATURES

=over 4

=item Set AutoInactiveDestroy to true.

DBIx::Sunny sets AutoInactiveDestroy as true.

=item [SQLite/MySQL/Pg] Auto encode/decode UTF-8

DBIx::Sunny sets sqlite_unicode, mysql_enable_utf8 and pg_enable_utf8 automatically.

=item [SQLite] Performance tuning

DBIx::Sunny sets sqlite_use_immediate_transaction to true, and executes these PRAGMA statements

  PRAGMA journal_mode = WAL
  PRAGMA synchronous = NORMAL

=item Nested transaction management.



( run in 0.296 second using v1.01-cache-2.11-cpan-00829025b61 )