public function query($query, $params = null, $fetchResult = false)
        {
            $this->checkConnection(true);
            $this->log('Query: ' . $query);

            if(!empty($params)) {
                $this->log('Params: ' . print_r($params, true));
            }
            $start =  microtime(true);

            if(empty($params)) {
                $res = $this->executeQuery($query);
            } else {
                $res = $this->executePreparedStatement($query, $params);
            }

            $end = microtime(true);
            $this->log("Execution time: " . ($end - $start) . " seconds");


            if($fetchResult) {
    	        $this->log('Num Rows: '.odbc_num_rows($res));
                $resutlSet = $this->getRows($res);
                odbc_free_result($res);
                $res = $resutlSet;
                $resultSet = null;
                $fetch = microtime(true);
                $this->log("Fetch time: " . ($fetch - $end) . " seconds");
            }
            return $res;
        }
public function query($query, $params = null, $fetchResult = false)
        {
            $this->checkConnection(true);
            $this->log('Query: ' . $query);

            if(!empty($params)) {
                $this->log('Params: ' . print_r($params, true));
            }
            $start =  microtime(true);

            if(empty($params)) {
                $res = $this->executeQuery($query);
            } else {
                $res = $this->executePreparedStatement($query, $params);
            }

            $end = microtime(true);
            $this->log("Execution time: " . ($end - $start) . " seconds");


            if($fetchResult) {
    	        $this->log('Num Rows: '.odbc_num_rows($res));
                $resutlSet = $this->getRows($res);
                odbc_free_result($res);
                $res = $resutlSet;
                $resultSet = null;
                $fetch = microtime(true);
                $this->log("Fetch time: " . ($fetch - $end) . " seconds");
            }
            return $res;
        }
public function query ( $ query , $ params = null , $ fetchResult = false ) { $ this -> checkConnection ( true ) ; $ this -> log ( 'Query: ' . $ query ) ; if ( ! empty ( $ params ) ) { $ this -> log ( 'Params: ' . print_r ( $ params , true ) ) ; } $ start = microtime ( true ) ; if ( empty ( $ params ) ) { $ res = $ this -> executeQuery ( $ query ) ; } else { $ res = $ this -> executePreparedStatement ( $ query , $ params ) ; } $ end = microtime ( true ) ; $ this -> log ( "Execution time: " . ( $ end - $ start ) . " seconds" ) ; if ( $ fetchResult ) { $ this -> log ( 'Num Rows: ' . odbc_num_rows ( $ res ) ) ; $ resutlSet = $ this -> getRows ( $ res ) ; odbc_free_result ( $ res ) ; $ res = $ resutlSet ; $ resultSet = null ; $ fetch = microtime ( true ) ; $ this -> log ( "Fetch time: " . ( $ fetch - $ end ) . " seconds" ) ; } return $ res ; }
Execute a query and return the results
@param string $query
@param array $params
@param bool $fetchResult Return a ressource or a an array
@return resource|array
@throws Exception
Execute a query and return the results