While normally just using a "do" would be correct, in this case
since we are talking about a BLOB, using bind with a datatype
is
safer. By that I mean, when you execute a "do" with
bind parameters inline, you are leaving it up the the DBI interface
to figure out the datatype. Sometime it will get it right, but
there is no guarentee. By using a "bind_param" call with a datatype
you are giving the DBI a
strong hint as to how to handle the
data. To quote again from the Perl DBI book( pg. 154):
Passing SQL_BLOB as the optional TYPE parameter to bind_param()
gives the driver a strong hint that you're binding to a LONG/LOB
type. Some drivers don't need the hint but it's always a good idea
to include it.
I keep quoting this book since the authors are Alligator Descartes
and Tim Bunce, both of whom have been heavily involved in the design
of the DBI interface. I tend to believe what they say about how
to use the interface.
Your second point about undef-ing $/ and passing in <TEXT> I
will concede. On examples I tend to be more verbose since it makes
debugging easier since you can easily look at the value of a varible.
Looking at a filehandle is distinctly harder. :-)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.