Hello monks...
I think that this should work:
my $sql1 = qq{ INSERT INTO table VALUES (
current_timestamp,
?
)
};
$dbh->do ($sql1,undef,$var);
"table" has two columns to hold timestamp and varchar. $var is getting set correctly. And when I run this code, I get
execute called with 1 bind variables, 0 needed at /usr/lib/perl5/vendo
+r_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 1383.
I have tried using two ?s and replacing undef with current_timestamp, but that didn't help. I've also tried "do ($sql1,,$var)", which yields the message
DBI::st=HASH(0x8357038)->_prepare(...): attribute parameter '<contents
+ of $var>' is not a hash ref at /usr/lib/perl5/vendor_perl/5.8.3/i586
+-linux-thread-multi/DBD/Pg.pm line 146.
Any suggestions to get this INSERT to work would be appreciated.
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.