protected function execute($sql, array $values = [], \Closure $callback = null)
    {
        if($statement = $this->pdo->prepare($sql)) {
            if($statement->execute($values)) {

                // format output
                $return = $callback ? $callback($statement) : true;

                // close statement connection
                $statement->closeCursor();
                unset($statement);

                return $return;
            }

            throw $this->error($sql, $statement);
        }

        throw $this->error($sql);
    }
protected function execute($sql, array $values = [], \Closure $callback = null)
    {
        if($statement = $this->pdo->prepare($sql)) {
            if($statement->execute($values)) {

                // format output
                $return = $callback ? $callback($statement) : true;

                // close statement connection
                $statement->closeCursor();
                unset($statement);

                return $return;
            }

            throw $this->error($sql, $statement);
        }

        throw $this->error($sql);
    }
protected function execute ( $ sql , array $ values = [ ] , \ Closure $ callback = null ) { if ( $ statement = $ this -> pdo -> prepare ( $ sql ) ) { if ( $ statement -> execute ( $ values ) ) { // format output $ return = $ callback ? $ callback ( $ statement ) : true ; // close statement connection $ statement -> closeCursor ( ) ; unset ( $ statement ) ; return $ return ; } throw $ this -> error ( $ sql , $ statement ) ; } throw $ this -> error ( $ sql ) ; }
Safe SQL execution

@param string $sql
@param array $values
@param \Closure $callback
@return \PDOStatement
Safe SQL execution