Version: current

# Class SS_Report_FakeQuery

This is an object that can be used to dress up a more complex querying mechanism in the clothing of a SQLQuery object. This means that you can inject it into a TableListField.

Use it like this:
function sourceQuery($params) { return new SS_Report_FakeQuery($this, 'sourceRecords', $params) } function sourceRecords($params, $sort, $limit) { // Do some stuff // Return a DataObjectSet of actual objects. }

This object is used by the default implementation of sourceQuery() on SS_Report, to make use of a sourceReords() method if one exists.

  SQLQuery
  SS_Report_FakeQuery

Located at cms/code/Report.php

## Methods summary

`public` | # `__construct( array $obj, array $method, array $params )` Construct a new SQLQuery. Construct a new SQLQuery. #### Parameters $obj array $select An array of fields to select. $method array $from An array of join clauses. The first one should be just the table name. $params array $where An array of filters, to be inserted into the WHERE clause. #### Overrides `SQLQuery::__construct`
`public` | # `setSortColumnMethod( mixed $sortColMethod )` Provide a method that will return a list of columns that can be used to sort. Provide a method that will return a list of columns that can be used to sort.
`public `SQLQuery`` | # `limit( string|array $limit )` Pass LIMIT clause either as SQL snippet or in array format. Pass LIMIT clause either as SQL snippet or in array format. #### Parameters $limit string|array $limit #### Returns ``SQLQuery`` This instance #### Overrides `SQLQuery::limit`
`public integer` | # `unlimitedRowCount( mixed $column = NULL )` Return the number of rows in this query if the limit were removed. Useful in paged data sets. Return the number of rows in this query if the limit were removed. Useful in paged data sets. #### Returns `integer` int #### Overrides `SQLQuery::unlimitedRowCount`
`public `SS_Query`` | # `execute( )` Execute this query. Execute this query. #### Returns ``SS_Query`` SS_Query #### Overrides `SQLQuery::execute`
`public` | # `canSortBy( mixed $fieldName )` Returns true if this query can be sorted by the given field. Note that the implementation of this method is a little crude at the moment, it wil return "false" more often that is strictly necessary. Returns true if this query can be sorted by the given field. Note that the implementation of this method is a little crude at the moment, it wil return "false" more often that is strictly necessary. #### Overrides `SQLQuery::canSortBy`

### Methods inherited from SQLQuery

`__toString()`, `filtersOnFK()`, `filtersOnID()`, `from()`, `getFilter()`, `groupby()`, `having()`, `innerJoin()`, `isJoinedTo()`, `leftJoin()`, `orderby()`, `renameTable()`, `replaceText()`, `select()`, `sql()`, `useConjunction()`, `useDisjunction()`, `where()`

### Magic methods summary

## Properties summary

`public string` | $orderby | # An ORDER BY clause. An ORDER BY clause.
`public string` | $limit | # A limit clause. A limit clause.
`protected mixed` | $obj | #
`protected mixed` | $method | #
`protected mixed` | $params | #

### Properties inherited from SQLQuery

`$connective`, `$delete`, `$distinct`, `$from`, `$groupby`, `$having`, `$select`, `$where`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -