由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Perl插入MySQL中双引号的问题
相关主题
perl用DBI操作MySQL出错的问题perl to html
Help: a Perl script question, Thanks (转载)包子求助一道题 Perl
Perl DBI比python的MySQLdb快吗?A Software Intern Position Open / Palo Alto (转载)
怎样才能用perl等东西知道c macro中的数值《Apache+MySQL+memcached+Perl开发高速开源网站》[PDF]
诚心请教Perl:简单的Variable Match in Regular expressionPerl, PHP, Pathon, 那个好?
这个PERL表达式干啥的?请问用什么语言合适
python能检查出space是一个还是两个吗?STL iterator的疑问
Do you like perl style?Perl 的一个问题
相关话题的讨论汇总
话题: mysql话题: line话题: syntax话题: words话题: word
进入Programming版参与讨论
1 (共1页)
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

1 (共1页)
进入Programming版参与讨论
相关主题
Perl 的一个问题诚心请教Perl:简单的Variable Match in Regular expression
如何实现 strtok() ?这个PERL表达式干啥的?
这个有更好的算法吗?python能检查出space是一个还是两个吗?
一道C++面试编程题Do you like perl style?
perl用DBI操作MySQL出错的问题perl to html
Help: a Perl script question, Thanks (转载)包子求助一道题 Perl
Perl DBI比python的MySQLdb快吗?A Software Intern Position Open / Palo Alto (转载)
怎样才能用perl等东西知道c macro中的数值《Apache+MySQL+memcached+Perl开发高速开源网站》[PDF]
相关话题的讨论汇总
话题: mysql话题: line话题: syntax话题: words话题: word