class DataSource implements IDataSource

Default implementation of IDataSource.

Methods

__construct($sql, Connection $connection)

No description

select($col, $as = null)

Selects columns to query.

where($cond)

Adds conditions to query.

orderBy($row, $sorting = 'ASC')

Selects columns to order by.

applyLimit($limit, $offset = null)

Limits number of rows.

getConnection()

No description

getResult()

Returns (and queries) Result.

getIterator()

No description

Row|false
fetch()

Generates, executes SQL query and fetches the single row.

mixed
fetchSingle()

Like fetch(), but returns only first field.

array
fetchAll()

Fetches all records from table.

array
fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

array
fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

void
release()

Discards the internal cache.

toFluent()

Returns this data source wrapped in Fluent object.

toDataSource()

Returns this data source wrapped in DataSource object.

string
__toString()

Returns SQL query.

int
count()

Returns the number of rows in a given data source.

int
getTotalCount()

Returns the number of rows in a given data source.

Details

at line 53
__construct($sql, Connection $connection)

No description

Parameters

$sql
Connection $connection

at line 70
DataSource select($col, $as = null)

Selects columns to query.

Parameters

$col
$as

Return Value

DataSource

at line 87
DataSource where($cond)

Adds conditions to query.

Parameters

$cond

Return Value

DataSource

at line 106
DataSource orderBy($row, $sorting = 'ASC')

Selects columns to order by.

Parameters

$row
$sorting

Return Value

DataSource

at line 124
DataSource applyLimit($limit, $offset = null)

Limits number of rows.

Parameters

$limit
$offset

Return Value

DataSource

at line 136
final Connection getConnection()

No description

Return Value

Connection

at line 149
Result getResult()

Returns (and queries) Result.

Return Value

Result

at line 161
ResultIterator getIterator()

No description

Return Value

ResultIterator

at line 171
Row|false fetch()

Generates, executes SQL query and fetches the single row.

Return Value

Row|false

at line 181
mixed fetchSingle()

Like fetch(), but returns only first field.

Return Value

mixed

value on success, false if no next record

at line 191
array fetchAll()

Fetches all records from table.

Return Value

array

at line 202
array fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

Parameters

$assoc

Return Value

array

at line 214
array fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

Parameters

$key
$value

Return Value

array

at line 224
void release()

Discards the internal cache.

Return Value

void

at line 237
Fluent toFluent()

Returns this data source wrapped in Fluent object.

Return Value

Fluent

at line 247
DataSource toDataSource()

Returns this data source wrapped in DataSource object.

Return Value

DataSource

at line 257
string __toString()

Returns SQL query.

Return Value

string

at line 281
int count()

Returns the number of rows in a given data source.

Return Value

int

at line 298
int getTotalCount()

Returns the number of rows in a given data source.

Return Value

int

Traits

Better OOP experience.