It looks as though the best bet is to catch the PDOException and inspect the stack trace, as that includes the prepared query.
So say you are having trouble with $this->User->save($data)
you could do this:
try {
$this->User->save($data);
} catch (PDOException $e) {
var_dump(array_slice($e->getTrace(), 0, 3));
}
The _execute
call should be fairly near the top, with the generated query included in args
.