On Thu, Apr 21, 2005 at 09:36:33AM -0400, Robert wrote:
> This is my hash structure:
>
> "Veterans Day" => {
> date => '20051111',
> type => 'US',
> federal => 'true',
> active => 'true',
> },
>
> Would I just use a placeholder (?) in my statement and pass it in via that?
> It will be in a loop as I have quite a few.
A placeholder only holds one place. You would need to have a
placeholder for each value you wanted to insert. Something like
my $sth = $dbh->prepare('insert into holiday ('
. join(',', sort keys %hash)
. ') values (?, ?, ?, ?)')
|| die "prepare failed";
$sth->execute(@hash{sort keys %hash})
|| die "execute failed";
if your hash keys correspond to your column names.
dd
--
David Dooling