我有这个代码:
if($update[$entity_id])
{
my $sql = "UPDATE cache SET date = '?', value = '?' WHERE item_id = ? AND level = ? AND type = ?;";
}
else
{
my $sql = "INSERT INTO cache (date, value, item_id, level, type) VALUES ('?','?',?,?,?);";
}
my $db = $self->{dbh}->prepare(q{$sql}) or die ("unable to prepare");
$db->execute(time2str("%Y-%m-%d %X", time), $stored, $entity_id, 'entity', 'variance');
但是当它想要运行更新时,我得到了这个错误:
DBD::Pg::st 执行失败:当需要 0 时使用 5 个绑定变量调用。
为什么?