DBIx-Sunny

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.05    Thu Apr 21 18:05:06 2011
        - added args method, Data::Validator shortcut
        - uses Data::Validator's error message 

0.04    Wed Apr 19 23:44:03 2011
	- added mysql test to author tests
	- last_insert_id hack

0.03    Tue Apr 19 15:55:32 2011
	- require perl 5.8.5 for SQLite's unicode support

0.02    Tue Apr 19 10:12:17 2011
	- added DBD::SQLite >= 1.27 to test_requires

0.01    Mon Dec  6 23:49:05 2010
        - original version

README.md  view on Meta::CPAN

DBIx::Sunny supports only SQLite and MySQL.

# FEATURES

- Set AutoInactiveDestroy to true.

    DBIx::Sunny sets AutoInactiveDestroy as true.

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

    DBIx::Sunny sets sqlite\_unicode, mysql\_enable\_utf8 and pg\_enable\_utf8 automatically.

- \[SQLite\] Performance tuning

    DBIx::Sunny sets sqlite\_use\_immediate\_transaction to true, and executes these PRAGMA statements

        PRAGMA journal_mode = WAL
        PRAGMA synchronous = NORMAL

- Nested transaction management.

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


sub connect {
    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);
}

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


sub connected {
    my $dbh = shift;
    my ($dsn, $user, $pass, $attr) = @_;
    $dbh->{RaiseError} = 1;
    $dbh->{PrintError} = 0;
    $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:/) {

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.944 second using v1.01-cache-2.11-cpan-88abd93f124 )