Code Monkey home page Code Monkey logo

amon2-dbi's Introduction

GitHub Stats Card GitHub Top Languages Card

amon2-dbi's People

Contributors

kazeburo avatar makamaka avatar neilb avatar tokuhirom avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

amon2-dbi's Issues

mysql_enable_utf8 automaticallyとt/05_mysql.tについて

Amon2::DBIのconnect内でmysql_enable_utf8に真値を与えるための判定条件が
$dsn =~ /-dbi:mysql:/ とケースセンシティブとなっていますが
05_mysql.tの$mysqld->dsnが返すdnsはDBI:mysqlからはじまります。
そのためsubtest utf8においてmysql_enable_utf8は有効になっていないのですが、
use utf8していないので、テスト自体はokになります。
これは意図された通りのテストなのでしょうか?

あるいは、下記のようなものが本来想定されているテストなのでしょうか?

diff --git a/lib/Amon2/DBI.pm b/lib/Amon2/DBI.pm
index f30d9aa..8ad59e6 100644
--- a/lib/Amon2/DBI.pm
+++ b/lib/Amon2/DBI.pm
@@ -12,12 +12,17 @@ sub connect {
if ($DBI::VERSION >= 1.614) {
$attr->{AutoInactiveDestroy} = 1 unless exists $attr->{AutoInactiveDestroy};
}

  • if ($dsn =~ /^dbi:SQLite:/) {
  • if ($dsn =~ /^dbi:SQLite:/i) {
    $attr->{sqlite_unicode} = 1 unless exists $attr->{sqlite_unicode};
    }
  • if ($dsn =~ /^dbi:mysql:/) {
  • if ($dsn =~ /^dbi:mysql:/i) {
    $attr->{mysql_enable_utf8} = 1 unless exists $attr->{mysql_enable_utf8};
    }

diff --git a/t/05_mysql.t b/t/05_mysql.t
index ad8a0c3..27fdd18 100644
--- a/t/05_mysql.t
+++ b/t/05_mysql.t
@@ -17,6 +17,7 @@ $dbh->do_i('INSERT INTO foo ', {e => 4});
is join(',', map { @$_ } @{$dbh->selectall_arrayref('SELECT * FROM foo ORDER BY e')}), '3,4';

subtest 'utf8' => sub {

  • use utf8;
    $dbh->do(q{CREATE TABLE bar (x varchar(255))});
    $dbh->insert(bar => { x => "こんにちは" });
    my ($x) = $dbh->selectrow_array(q{SELECT x FROM bar});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.