-
Notifications
You must be signed in to change notification settings - Fork 122
explicitly display mysqli error #269
base: master
Are you sure you want to change the base?
explicitly display mysqli error #269
Conversation
@@ -206,7 +206,8 @@ public function prepare($sql = null) | |||
$this->resource = $this->mysqli->prepare($sql); | |||
if (!$this->resource instanceof \mysqli_stmt) { | |||
throw new Exception\InvalidQueryException( | |||
'Statement couldn\'t be produced with sql: ' . $sql, | |||
' Error #' . $this->mysqli->errno . ': ' . $this->mysqli->error . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use sprintf
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late update. Should be sorted now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add in unit tests for this new behavior.
@mwillbanks I'm having some trouble creating a mock connection to a database. I've pushed up my attempt in the last commit. Sorry, it's a bit messy. I tried following the Pdo test setup as an example. Could you give me some suggestions on how to create an appropriate mock or stub for the db connection? |
This repository has been moved to laminas/laminas-db. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#64. |
Minor change to show mysqli errno and error explicitly. Without this, mysqli errors do not get shown in some debuggers when preparing sql statements, for example whoops.
Here is an example with whoops before
and after the change.
I think some components already use this style, for example zend-http/src/Client/Adapter/Socket.php line 278.