Perl/SQLite - How do I select / update a row with the prepare method?

Posted by somebody on Stack Overflow See other posts from Stack Overflow or by somebody
Published on 2010-03-08T12:06:04Z Indexed on 2010/03/08 12:36 UTC
Read the original article Hit count: 149

Filed under:
|

I have the following code

my $db = DBI->connect(
     "dbi:SQLite:data.db", "", "",
     { RaiseError => 1, AutoCommit => 1, PrintError => 0 }
);
my $row = $db->selectall_arrayref(
     "SELECT * FROM something WHERE name=\'$hash->{name}\'");
print Dumper $row;

How do I do the same with my $sql = $db->prepare("......"); $sql->execute($hash->{name}); so that it's escaped correctly and I have the selected data in $row?

© Stack Overflow or respective owner

Related posts about perl

Related posts about sqlite