Text-Tradition-Directory
view release on metacpan or search on metacpan
lib/Text/Tradition/Directory.pm view on Meta::CPAN
$args = { @_ };
}
my @column_args;
if( $args->{'dsn'} =~ /^dbi:(\w+):/ ) { # We're using Backend::DBI
my $dbtype = $1;
@column_args = ( 'columns',
[ 'name' => { 'data_type' => 'varchar', 'is_nullable' => 1 },
'public' => { 'data_type' => 'bool', 'is_nullable' => 1 } ] );
if( $dbtype eq 'mysql' &&
exists $args->{extra_args}->{dbi_attrs} &&
$args->{extra_args}->{dbi_attrs}->{mysql_enable_utf8} ) {
# There is a bad interaction with MySQL in utf-8 mode.
# Work around it here.
# TODO fix the underlying storage problem
$args->{extra_args}->{dbi_attrs}->{mysql_enable_utf8} = undef;
$args->{_mysql_utf8_hack} = 1;
}
}
my $ea = $args->{'extra_args'};
if( ref( $ea ) eq 'ARRAY' ) {
push( @$ea, @column_args );
} elsif( ref( $ea ) eq 'HASH' ) {
$ea = { %$ea, @column_args };
} else {
$ea = { @column_args };
t/mysql_utf8.t view on Meta::CPAN
$user = $v;
} elsif( $k eq 'password' ) {
$pass = $v;
} else {
$dsn .= "$item;";
}
}
my $dir = Text::Tradition::Directory->new( 'dsn' => $dsn,
'extra_args' => { 'user' => $user, 'password' => $pass, 'create' => 1,
dbi_attrs => { 'mysql_enable_utf8' => 1 } },
);
my $scope = $dir->new_scope();
my $utf8_t = Text::Tradition->new(
'input' => 'Self',
'file' => 't/data/florilegium_graphml.xml' );
my $uuid = $dir->save( $utf8_t );
foreach my $tinfo( $dir->traditionlist ) {
next unless $tinfo->{id} eq $uuid;
( run in 0.335 second using v1.01-cache-2.11-cpan-00829025b61 )