private function do_query($sql, $params, $sql_query_type, $free_result = true, $scrollable = false) {
        list($sql, $params, $type) = $this->fix_sql_params($sql, $params);

        /*
         * Bound variables *are* supported. Until I can get it to work, emulate the bindings
         * The challenge/problem/bug is that although they work, doing a SELECT SCOPE_IDENTITY()
         * doesn't return a value (no result set)
         *
         * -- somebody from MS
         */

        $sql = $this->emulate_bound_params($sql, $params);
        $this->query_start($sql, $params, $sql_query_type);
        if (!$scrollable) { // Only supporting next row
            $result = sqlsrv_query($this->sqlsrv, $sql);
        } else { // Supporting absolute/relative rows
            $result = sqlsrv_query($this->sqlsrv, $sql, array(), array('Scrollable' => SQLSRV_CURSOR_STATIC));
        }

        if ($result === false) {
            // TODO do something with error or just use if DEV or DEBUG?
            $dberr = $this->get_last_error();
        }

        $this->query_end($result);

        if ($free_result) {
            $this->free_result($result);
            return true;
        }
        return $result;
    }
private function do_query($sql, $params, $sql_query_type, $free_result = true, $scrollable = false) {
        list($sql, $params, $type) = $this->fix_sql_params($sql, $params);

        /*
         * Bound variables *are* supported. Until I can get it to work, emulate the bindings
         * The challenge/problem/bug is that although they work, doing a SELECT SCOPE_IDENTITY()
         * doesn't return a value (no result set)
         *
         * -- somebody from MS
         */

        $sql = $this->emulate_bound_params($sql, $params);
        $this->query_start($sql, $params, $sql_query_type);
        if (!$scrollable) { // Only supporting next row
            $result = sqlsrv_query($this->sqlsrv, $sql);
        } else { // Supporting absolute/relative rows
            $result = sqlsrv_query($this->sqlsrv, $sql, array(), array('Scrollable' => SQLSRV_CURSOR_STATIC));
        }

        if ($result === false) {
            // TODO do something with error or just use if DEV or DEBUG?
            $dberr = $this->get_last_error();
        }

        $this->query_end($result);

        if ($free_result) {
            $this->free_result($result);
            return true;
        }
        return $result;
    }
private function do_query ( $ sql , $ params , $ sql_query_type , $ free_result = true , $ scrollable = false ) { list ( $ sql , $ params , $ type ) = $ this -> fix_sql_params ( $ sql , $ params ) ; /*
         * Bound variables *are* supported. Until I can get it to work, emulate the bindings
         * The challenge/problem/bug is that although they work, doing a SELECT SCOPE_IDENTITY()
         * doesn't return a value (no result set)
         *
         * -- somebody from MS
         */ $ sql = $ this -> emulate_bound_params ( $ sql , $ params ) ; $ this -> query_start ( $ sql , $ params , $ sql_query_type ) ; if ( ! $ scrollable ) { // Only supporting next row $ result = sqlsrv_query ( $ this -> sqlsrv , $ sql ) ; } else { // Supporting absolute/relative rows $ result = sqlsrv_query ( $ this -> sqlsrv , $ sql , array ( ) , array ( 'Scrollable' => SQLSRV_CURSOR_STATIC ) ) ; } if ( $ result === false ) { // TODO do something with error or just use if DEV or DEBUG? $ dberr = $ this -> get_last_error ( ) ; } $ this -> query_end ( $ result ) ; if ( $ free_result ) { $ this -> free_result ( $ result ) ; return true ; } return $ result ; }
Prepare the query binding and do the actual query.

@param string $sql The sql statement
@param array $params array of params for binding. If NULL, they are ignored.
@param int $sql_query_type - Type of operation
@param bool $free_result - Default true, transaction query will be freed.
@param bool $scrollable - Default false, to use for quickly seeking to target records
@return resource|bool result
Prepare the query binding and do the actual query .