Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace errors into a file #288

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Aug 5, 2015

  1. trace errors into a file

    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 function to generate the error from querys:
    errorTrack($insertData = null,$case_err="")
    
    Function that help us to populate our file with all the data recolected from errorTrack function
    private function createLog($data)
    
    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;
    
    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
         * */
        public static function execute($sql,$params){
            
            //Set the errorTrack method
            self::getInstance()->setErrTrack(true);
    
            //Execute Query
            $result = self::getInstance()->rawQuery($sql, $params);     
    
            //Return result
            return $result;        
        }
    
    This methods and properties have been tested with INSERT,UPDATE,DELETE sentences working OK.
    Moatilliatta committed Aug 5, 2015
    Configuration menu
    Copy the full SHA
    dfc63b2 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2015

  1. Update on errorTrack method

    Now the query shows all the parameters in its place, insted of ? symbols in the query.
    Moatilliatta committed Aug 6, 2015
    Configuration menu
    Copy the full SHA
    faa21f8 View commit details
    Browse the repository at this point in the history
  2. Update errorTrack

    It was showing the mysqli->error twice! Now it is corrected
    Moatilliatta committed Aug 6, 2015
    Configuration menu
    Copy the full SHA
    86cc0f8 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2015

  1. Configuration menu
    Copy the full SHA
    8d22a9b View commit details
    Browse the repository at this point in the history
  2. remove extra code

    Moatilliatta committed Aug 10, 2015
    Configuration menu
    Copy the full SHA
    4fb8473 View commit details
    Browse the repository at this point in the history