RE: Inserting an Email Address fails.
speattle_at_yahoo.com
Date: 09/24/04
- Next message: Rudy Lippan: "RE: Inserting an Email Address fails."
- Previous message: speattle_at_yahoo.com: "RE: Inserting an Email Address fails."
- Maybe in reply to: Kent Hamilton: "Inserting an Email Address fails."
- Next in thread: Rudy Lippan: "RE: Inserting an Email Address fails."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "Reidy, Ron" <Ron.Reidy@arraybiopharma.com>;"Hamilton, Kent" <KHamilton@Hunter.COM>;dbi-users@perl.org; Date: Thu, 23 September 2004 17:57:02 -0700
Scroll down. :)
he does have insert as well as update queries embedded,
unfortunately neither doing what he's telling to do.
-----Original Message-----
From: "Reidy, Ron" <Ron.Reidy@arraybiopharma.com>
Date: 09/23/04 01:02 PM
To: "Hamilton, Kent" <KHamilton@Hunter.COM>, <dbi-users@perl.org>
Subject: RE: Inserting an Email Address fails.
Isn't the syntax for INSERT ...
INSERT INTO tab [(col_list)] values (value_list);
??
-----------------
Ron Reidy
Lead DBA
Array BioPharma, Inc.
-----Original Message-----
From: Hamilton, Kent [mailto:KHamilton@Hunter.COM]
Sent: Thursday, September 23, 2004 1:16 PM
To: dbi-users@perl.org
Subject: Inserting an Email Address fails.
I'm trying to insert an email address into a mysql database and it seems
to fail no matter what I do. Here are two different cuts at the code,
neither of which works and both return pretty much the same error message.
sub update_Unprocessed
{
my $From = shift; # From
my $MsgID = shift; # MsgID
my $Subject = shift; # Subject
my $Date = shift; # Date
my $Reason = shift; # Reason
my $Attachment = shift; # Body or attachment
$rows = $dbh->do("INSERT INTO UnprocessedMail SET
From = '$From',
MsgID = '$MsgID',
Subject = '$Subject',
Date = \'$Date\',
Reason = '$Reason',
Attachment = '$Attachment'");
if ( $DBI::errstr ) {
$errmsg = 'Can not updated UnprocessedMail. Error: ' .
$DBI::errstr . "\n";
doerror($errmsg);
if ( $DEBUG ) {
print STDERR "Can not update UnprocessedMail.
Error: $DBI::errstr\n";
}
}
}
This produces this error message:
Can not update UnprocessedMail. Error: 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 'From = 'KHamilton@Hunter.COM',
MsgID = '<BB7A3D4475F89F4696DC
Changing the subroutine to look like:
sub update_Unprocessed
{
my $count = 0;
$values[$count++] = shift; # From
$values[$count++] = shift; # MsgID
$values[$count++] = shift; # Subject
$values[$count++] = shift; # Date
$values[$count++] = shift; # Reason
$values[$count] = shift; # Body or attachment
$sth = $dbh->prepare(q{INSERT INTO UnprocessedMail
(From, MsgID, Subject, Date, Reason, Attachment )
VALUES ( ?, ?, ?, ?, ?, ? )});
if ( $DBI::errstr ) {
$errmsg = 'Can not prepare UnprocessedMail. Error: ' .
$DBI::errstr . "\n";
doerror($errmsg);
if ( $DEBUG ) {
print STDERR "Can not prepare UnprocessedMail.
Error: $DBI::errstr\n";
}
}
$sth->execute(@values);
if ( $DBI::errstr ) {
$errmsg = 'Can not update UnprocessedMail. Error: ' .
$DBI::errstr . "\n";
doerror($errmsg);
if ( $DEBUG ) {
print STDERR "Can not update UnprocessedMail.
Error: $DBI::errstr\n";
}
}
}
Gives me THIS error message
Can not update UnprocessedMail. Error: 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 'From, MsgID, Subject, Date, Reason,
Attachment )
VALUES ( 'KH
If I change the insert order it still blows up on the email address, IE if
I put MsgID first and the email address last it still dies on the mail
address.
I've tried various $sth->quote(), perl quotemeta, qq, q, etc., options.
I'm sure it's something
These words brought to you by Ogo. Find out more at www.ogo.com
- Next message: Rudy Lippan: "RE: Inserting an Email Address fails."
- Previous message: speattle_at_yahoo.com: "RE: Inserting an Email Address fails."
- Maybe in reply to: Kent Hamilton: "Inserting an Email Address fails."
- Next in thread: Rudy Lippan: "RE: Inserting an Email Address fails."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|