As far as SQL goes, as long as the data you provide to
the INSERT call fits in the target columns, it will go in
the table as planned. "Raw"
fields, or BINARY, or BLOB or whatever you happen to call
them, are just the same as your regular run-of-the-mill
strings -- You still have to "escape" the content.
# $blob_a_data is a GIF, or other binary data
$db->do("INSERT INTO blob_table (blob_a)
VALUES (?)", {}, $blob_a_data);
# Later on...
my ($blob_a_fromdb) =
$db->selectrow_array("SELECT blob_a
FROM blob_table");
# $blob_a_fromdb and $blob_a_data should be the same.
Or you can use $db->quote($blob_a_value) to force
the proper conversion. DBI should "decode" any of the
inserted data back into its original format for you when
you use any of the fetch() or select()-type functions.
Calls such as the $db->do() above do automatic
quotation of your data for '?' identified parameters.
Experiment with $db->quote() to see how it behaves,
as it escapes any potentially dangerous characters
such as '\n', or " ' ".
It sounds too good to be true, but it isn't.
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.