Update em PDO não lança erros - Atributo de modo de erro ativo
Olá pessoal,
Estou executando o seguinte código em meu sistema:
try {
$stmt = parent::$dbh->prepare("UPDATE step SET feature = ?, sequence = ?, description = ?, full_step = ?, type = ? WHERE id = ?");
parent::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
parent::$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt->bindParam(1, $step->feature);
$stmt->bindParam(2, $step->sequence);
$stmt->bindParam(3, $step->description);
$stmt->bindParam(4, $step->full_step);
$stmt->bindParam(5, $step->type);
$stmt->bindParam(6, $step->id);
$stmt->execute();
return true;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
}Ao final da execução deste código recebo true. Nenhum registro é alterado no banco. E nenhum erro é lançado. Tenho um código idêntico que faz inserção na mesma tabela. E este insere registros normalmente e quando existe algum erro lança nos logs.
Estou fazendo algo de errado?
Agradeço a ajuda.
Discussão (5)
Carregando comentários...