Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been into a requirement from my job, and I think this works well and I suppose that are other colleagues that would use this functions so they save all the error data related to MySQLi so here is my contribution to this excellent library
methods:
Main functions to generate the error from querys:
Properties:
//Boolean variable to set the errorTrack method
protected $errTrack = false;
//String variable to set the route where the file will be created
protected $routeTrack;
//String variable to set the catched error
protected $errMsg = '';
Function that help us to populate our file with all the data recolected from errorTrack function
/**
* Internal function to create a .txt file to save all the log
* collected from an specific query
* @param [type] $data Data that is going to be written in the file
*/
/**
* Save errors into a file
* @param bool $enabled Allow create file to save errors
* @param string $route Set a route to create this file
*/
/**
* Reset states after an execution
*
* @return object Returns the current instance.
*/
...
}
Example of use
/**
* Execute sql sentence with parameters
* @param string $sql SQL sentence
* @param array $params All parameters necessary for the query
*
* @return int Result
* */
This methods and properties have been tested with INSERT,UPDATE,DELETE sentences working OK.