class DataSource implements IDataSource

Default implementation of IDataSource for dibi.

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()

Returns the dibi connection.

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 54
__construct($sql, Connection $connection)

No description

Parameters

$sql
Connection $connection

at line 71
DataSource select($col, $as = NULL)

Selects columns to query.

Parameters

$col
$as

Return Value

DataSource

at line 88
DataSource where($cond)

Adds conditions to query.

Parameters

$cond

Return Value

DataSource

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

Selects columns to order by.

Parameters

$row
$sorting

Return Value

DataSource

at line 125
DataSource applyLimit($limit, $offset = NULL)

Limits number of rows.

Parameters

$limit
$offset

Return Value

DataSource

at line 138
final Connection getConnection()

Returns the dibi connection.

Return Value

Connection

at line 151
Result getResult()

Returns (and queries) Result.

Return Value

Result

at line 163
ResultIterator getIterator()

No description

Return Value

ResultIterator

at line 173
Row|false fetch()

Generates, executes SQL query and fetches the single row.

Return Value

Row|false

at line 183
mixed fetchSingle()

Like fetch(), but returns only first field.

Return Value

mixed

value on success, FALSE if no next record

at line 193
array fetchAll()

Fetches all records from table.

Return Value

array

at line 204
array fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

Parameters

$assoc

Return Value

array

at line 216
array fetchPairs($key = NULL, $value = NULL)

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

Parameters

$key
$value

Return Value

array

at line 226
void release()

Discards the internal cache.

Return Value

void

at line 239
Fluent toFluent()

Returns this data source wrapped in Fluent object.

Return Value

Fluent

at line 249
DataSource toDataSource()

Returns this data source wrapped in DataSource object.

Return Value

DataSource

at line 259
string __toString()

Returns SQL query.

Return Value

string

at line 282
int count()

Returns the number of rows in a given data source.

Return Value

int

at line 299
int getTotalCount()

Returns the number of rows in a given data source.

Return Value

int

Traits

Better OOP experience.