[英]perl DBIx sqlite {sqlite_unicode=>1}?
If connecting to MySQL with: 如果连接到MySQL :
my $schema = MyDatabase::Main->connect("dbi:mysql:database=$database;host=$host",'root','', {mysql_enable_utf8 => 1});
The connection is forced to utf8; 连接被强制为utf8;
Connect to SQLite : 连接到SQLite :
my $schema = MyDatabase::Main->connect('dbi:SQLite:data/sample.db', {sqlite_unicode => 1});
The connection seems not to be in utf8; 连接似乎不在utf8中;
The purpose is to eliminate having to use decode() while fetching data: from: 目的是消除在获取数据时必须使用decode():from:
Mojo::ByteStream->new($cycle->type)->decode('utf-8')
to: 至:
$cycle->type
Thanks 谢谢
What if you connect with this: 如果你连接这个怎么办:
my $schema = MyDatabase::Main->connect(
'dbi:SQLite:data/sample.db',
'', # empty username
'', # empty password
{sqlite_unicode => 1}
);
Maybe connect()
is looking for the options hash-ref as argument four without realizing that SQLite doesn't need the username and password arguments. 也许connect()
正在寻找选项hash-ref作为参数四而没有意识到SQLite不需要用户名和密码参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.