L******r 发帖数: 199 | 1 用如下语句给MySQL插值,当$words[0]= " 的时候,perl脚本出错:
比如这行数据: ! ) " 60252
my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1)
VALUES ("$words[0]","$words[1]","$words[2]","$words[3]")});
DBD::mysql::db do 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 '60252")' at line 1 at delimiter_changer4.pl line 15, line
31.
请赐教,谢谢 | c**t 发帖数: 2744 | 2 用单引号
to
line
【在 L******r 的大作中提到】 : 用如下语句给MySQL插值,当$words[0]= " 的时候,perl脚本出错: : 比如这行数据: ! ) " 60252 : my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1) : VALUES ("$words[0]","$words[1]","$words[2]","$words[3]")}); : DBD::mysql::db do 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 '60252")' at line 1 at delimiter_changer4.pl line 15, line : 31. : 请赐教,谢谢
| l*******9 发帖数: 177 | 3 you need place-holder
my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1)
VALUES (?,?,?,?)}, @words[0,1,2,3]);
(untested)..
recommend you "use DBIx::Simple" which makes DBI interface much easier..
to
line
【在 L******r 的大作中提到】 : 用如下语句给MySQL插值,当$words[0]= " 的时候,perl脚本出错: : 比如这行数据: ! ) " 60252 : my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1) : VALUES ("$words[0]","$words[1]","$words[2]","$words[3]")}); : DBD::mysql::db do 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 '60252")' at line 1 at delimiter_changer4.pl line 15, line : 31. : 请赐教,谢谢
| L******r 发帖数: 199 | 4 谢谢,还有问题
在插入如下行时出错:
$ ' 1550166
DBD::mysql::db do 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 '1550166')' at line 1 at delimiter_changer5.pl line 19,
line 10000000.
$ '0 13616
DBD::mysql::db do 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 '0','13616')' at line 1 at delimiter_changer5.pl line
【在 l*******9 的大作中提到】 : you need place-holder : my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1) : VALUES (?,?,?,?)}, @words[0,1,2,3]); : (untested).. : recommend you "use DBIx::Simple" which makes DBI interface much easier.. : : to : line
| L******r 发帖数: 199 | 5 DBI::db=HASH(0x812d770)->do(...): attribute parameter '!' is not a hash ref
at delimiter_changer4.pl line 17, line 31.
N1)
the
syntax
【在 l*******9 的大作中提到】 : you need place-holder : my $rows = $dbh->do(qq{INSERT INTO GoogleDVD_all (word_0,word_1,word_2,N1) : VALUES (?,?,?,?)}, @words[0,1,2,3]); : (untested).. : recommend you "use DBIx::Simple" which makes DBI interface much easier.. : : to : line
|
|