you need to call 'finish' on a statement handle after you are done using it.

This is a common mistake. You rarely need to call finish on a statement handle, and you should never call it for an insert statement. You should only call it on a select handle where you do not fetch the entire result set (the select after the last record). It exists to tell the database that you are done with any temporary resources required by the statement (e.g. temp tables for an order by, etc.).

I've never used bind_param, and as far as I can tell, it's completely unnecessary for what you are trying to do.

Bind_param is occasionally necessary to tell DBI what type of argument you have when DBI guesses wrong (though I admit I've never used it either and it probably IS unnecessary in this instance).

Update: I've also seen a case recently on the DBI list where a field is character, but the first value bound to it is numeric, so DBI (or the DBD?) assumes that the field is numeric and doesn't need quoting, which of course breaks when the value bound is non-numeric. Don't quote me on this, my memory is vague :)


In reply to Re: Re: DBI data types by runrig
in thread DBI data types by Dalin

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.