- 論壇徽章:
- 0
|
出現(xiàn)問題的是比如:
@a的內(nèi)容是 ( '馬', 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按字節(jié)編碼最后的編碼與反斜杠\的編碼一樣,所以我想是不是這個原因?qū)е碌,不知道有人遇過并解決這個問題的嗎? |
|