Good day monks. I am writing an app to take e-mails out of my MS Outlook client and store them in a MySQL db. Everything goes along fine for about 425 messages and then I get an error: "DBD::mysql::st execute failed: called with 1 bind variables when 0 are needed at E:\mail\mailtosql.pl line 111."

Line 111 is the third line of:

if ($msg->{Body}) { my $sth = $dbh->prepare($command); $sth->execute($msg->{Body}) || die "could not execute MySQL st +atement: $command"; $sth->finish(); }
and the $command in question is
$command="insert into mailstore.received (SenderName,SenderEmailAddres +s,SentOnBehalfOfName,ReplyRecipientNames,SenderEmailType,SentOn,Recei +vedTime,MessageClass,Size,Subj,SentTo,Unread,InternetCodepage,importa +nce,EntryID,ConversationIndex,ConversationTopic,Class,BodyFormat,Body +) values ('Bob O\'Neill','bob.oneill@polit.org','Bob O\'Neill','bob.o +neill@polit.org','SMTP',20060407143605,20060407150746,'IPM.Note',2792 +2,'FW: Less Than a Month to Register - 2nd Annual Sciences Forum','Bo +b O\'Neill',1,20127,1,'000000007AD91AAD8C99D111B2A90000F843DC060700E4 +22DA54DFB9D011B2710000F843DC0600000170A97100001CA7D120557E1744BFE304E +F057275DB000000BBAA130000','01C65A8FB33408E229DC00114BA1BB7DBD1E5F218 +50E','Less Than a Month to Register - 2nd Annual Sciences Forum',43,2 +,?)";
As you can see from the $command, there is one bind at the end, and $msg->{Body} is not null or the insert command would never execute, so I'm a little stumped as to how I can need zero binds. Your monastic thoughts appreciated.

TIA...

Steve


In reply to DBD::MySQL bind variable error by cormanaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.