Sorry about the long title.
Basically, I'm trying to use DBI to call a stored procedure with one of the parameters containing an ASCII NUL character. What I've tried so far:
my $packed = pack("i", 15);
$packed .= '$';
# #1
$sth = $dbh->prepare("exec my_proc ?");
$sth->execute($packed);
# #2
$sth = $dbh->prepare("exec my_proc $packed");
$sth->execute();
What I think the problem is is that the
pack('i',15)<code> makes <code>"^@^@^@^O", where ^@ is ASCII NUL. So, when this gets passed, perl somehow sees this as the end of string (just like in C), and stops processing the string. Is there some way to pass this in without having perl interpret the NUL's?
thanks,
thor
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.