PHP SQLite3 捕获所有错误
我正在尝试捕获 PHP 中所有 SQLite3 错误的方法?我已经尝试了很多,它们似乎都有效。考虑下面的代码,是否足以捕获所有错误?有人可以提出其他建议吗?
$result = $stmt->execute();
if ($this->db->lastErrorCode()){
throw new DatabaseError($this->db->lastErrorMsg(),
$this->db->lastErrorCode());
} else {
return $this->db->changes();
}
I am trying ways to catch all SQLite3 errors in PHP? I have tried many and they all seem to work. Consider the code below, is it enough to catch all errors? Can someone suggest anything else?
$result = $stmt->execute();
if ($this->db->lastErrorCode()){
throw new DatabaseError($this->db->lastErrorMsg(),
$this->db->lastErrorCode());
} else {
return $this->db->changes();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这实际上已经足够了,因为当然,当出现错误时会有一个错误代码,所以这必须有效。
I think this is actually enough because there's an error code when an error is raised of course so this must work.