Hier die Stelle aus Model.pm Zeile 49ff:
$schema->{$name} = $model->connect(
sub { $handle->get_handle },
{
on_connect_do => [
# "SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES'",
],
mysql_enable_utf8 => 1,
},
);
Bei mir sieht das dann so aus:
my $dbc = $self->cfg('db') or die("Missing ...cut");
$schema1 = My::Schema->connect(
$dbc->{dsn},
$dbc->{username},
$dbc->{password},
$dbc->{attributes},
{
mysql_enable_utf8 => 1,
},
);
$schema1->storage->sql_maker->quote_char('`');
$schema1->storage->sql_maker->name_sep('.');
Aber: es passiert nichts. Mich wundert es, dass die nur-sql-Variante das kann, DBIC aber nicht mehr.
Hier ist der Test-Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
my $dbc = $self->cfg('db') or die("Missing ...cut");
my $dbh = DBI->connect(
$dbc->{dsn},
$dbc->{username},
$dbc->{password},
$dbc->{attributes},
) or die("Could not connect to DB " . DBI->errstr());
my $sql = qq~
SELECT keyword
FROM keywords
...
~;
my $sth = $dbh->prepare($sql) or die("prep: " . $dbh->errstr());
my $rv = $sth->execute( $shop_id ) or die("exec: " . $dbh->errstr());
while( my $href = $sth->fetchrow_hashref() ) {
print $href->{keyword};
Devel::Peek::Dump($href->{keyword});
}
Edit: hier noch der Devel::Peek-Dump von dem, was DBIC zurück liefert:
SV = PVMG(0xe29ea0) at 0xd4495c
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8)
IV = 0
NV = 0
PV = 0x1a53670 "Blutdruckmessger\303\244t"\0 [UTF8 "Blutdruckmessger\x{e4}t"]
CUR = 19
LEN = 20
MAGIC = 0x1a52fa0
MG_VIRTUAL = &PL_vtbl_utf8
MG_TYPE = PERL_MAGIC_utf8(w)
MG_LEN = 18
Last edited: 2009-10-05 14:52:39 +0200 (CEST)