- 论坛徽章:
- 0
|
出现问题的是比如:
@a的内容是 ( '马', 1)
my $sql = q/insert into table_1(c1,c2)values(?,?)/;
$sth= $dbh->prepare($sql);
$sth->execute(@a);
这时会报错:DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...
还有一些:玕璡誠...,只要字段值最后一个字是这些字,就有上面的问题
但是如果直接用my $sql = q/insert into(c1,c2)values( '马', 1)/;
$sth= $dbh->prepare($sql);
$sth->execute();
则是可以插入的
研究了一下有一些繁体汉字在perl按字节编码最后的编码与反斜杠\的编码一样,所以我想是不是这个原因导致的,不知道有人遇过并解决这个问题的吗? |
|