You are going to have to wait until mysql 4.x and DBD::mysql gets the real prepared statements. Once you get those, it will automatically look up types at prepare time (except for LIMIT stmts which you can't prepare server-side just yet).

Although, your mysql_discover_bind_type will probably go into the 2.9x tree because, I think, we are going to be removing the LIMIT ?, ? placeholder autodetection from the 2.9x code as there were just too many cases (bugs), and the code was getting too ugly trying to support it.

If you pester me over the weekend (I am slammed until friday afternnon), I'll add it for you. Of course (good) patches are always welcome. Also note that you can:

my $sth = $dbh->prepare($statement); $sth->bind_param(1, undef, SQL_INTEGER); # bind undef. for (1..$n) { #no need to rebind. $sth->execute($value); }
Rudolf.

In reply to Re: DBD::mysql and binding placeholders by tantarbobus
in thread DBD::mysql and binding placeholders by dragonchild

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.