Good afternoon, I am having a problem inserting a line in to a mysql table. Actually the problem is that I can't get perl to give me an error. I am purposely trying to insert data for a non-existant column. So it should kcik back with an error - but it is not. It just not doing it and continuing with the script. It is just skipping over insert line like it didn't exist, even though I have raiseError on. I have traced the script and the only thing I can find is that the line where I am executing the insert says "<- execute= undef". Any ideas how to get this script to stop and give me an error? Here is the summarized code I am using:
use DBI; $dbh = DBI->connect("DBI:mysql:database=blah;host=127.0.0.1", "root", +"****", {'RaiseError' => 1}); DBI->trace(1); $insertline = "INSERT INTO table (column1,column2) VALUES ('value1','v +alue2');"#column2 does NOT exist in the table and should through back + an error $query = $dbh ->prepare($insertline); $query->execute();

In reply to DBI not erroring out on Insert by rethaew

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.