Packages

  • dibi
    • drivers
    • nette
    • reflection
  • None
  • PHP

Classes

  • dibi
  • DibiConnection
  • DibiDataSource
  • DibiDateTime
  • DibiEvent
  • DibiFileLogger
  • DibiFirePhpLogger
  • DibiFluent
  • DibiObject
  • DibiResult
  • DibiResultIterator
  • DibiRow
  • DibiTranslator

Interfaces

  • IDataSource
  • IDibiDriver
  • IDibiReflector
  • IDibiResultDriver

Exceptions

  • DibiDriverException
  • DibiException
  • DibiNotImplementedException
  • DibiNotSupportedException
  • DibiPcreException
  • Overview
  • Package
  • Class
  • Tree

Class DibiDataSource

Default implementation of IDataSource for dibi.

DibiObject
Extended by DibiDataSource implements IDataSource
Package: dibi
Author: David Grudl
Located at libs/DibiDataSource.php
Methods summary
public
# __construct( string $sql, DibiConnection $connection )

Parameters

$sql
string
SQL command or table or view name, as data source
$connection
DibiConnection
connection
public DibiDataSource
# select( string|array $col, string $as = NULL )

Selects columns to query.

Selects columns to query.

Parameters

$col
string|array
column name or array of column names
$as
string
column alias

Returns

DibiDataSource
provides a fluent interface
public DibiDataSource
# where( mixed $cond )

Adds conditions to query.

Adds conditions to query.

Parameters

$cond
mixed
conditions

Returns

DibiDataSource
provides a fluent interface
public DibiDataSource
# orderBy( string|array $row, string $sorting = 'ASC' )

Selects columns to order by.

Selects columns to order by.

Parameters

$row
string|array
column name or array of column names
$sorting
string
sorting direction

Returns

DibiDataSource
provides a fluent interface
public DibiDataSource
# applyLimit( integer $limit, integer $offset = NULL )

Limits number of rows.

Limits number of rows.

Parameters

$limit
integer
limit
$offset
integer
offset

Returns

DibiDataSource
provides a fluent interface
final public DibiConnection
# getConnection( )

Returns the dibi connection.

Returns the dibi connection.

Returns

DibiConnection
public DibiResult
# getResult( )

Returns (and queries) DibiResult.

Returns (and queries) DibiResult.

Returns

DibiResult
public DibiResultIterator
# getIterator( )

Returns

DibiResultIterator

Implementation of

IteratorAggregate::getIterator
public DibiRow|false
# fetch( )

Generates, executes SQL query and fetches the single row.

Generates, executes SQL query and fetches the single row.

Returns

DibiRow|false
array on success, FALSE if no next record
public mixed
# fetchSingle( )

Like fetch(), but returns only first field.

Like fetch(), but returns only first field.

Returns

mixed
value on success, FALSE if no next record
public array
# fetchAll( )

Fetches all records from table.

Fetches all records from table.

Returns

array
public array
# fetchAssoc( string $assoc )

Fetches all records from table and returns associative tree.

Fetches all records from table and returns associative tree.

Parameters

$assoc
string
associative descriptor

Returns

array
public array
# fetchPairs( string $key = NULL, string $value = NULL )

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

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

Parameters

$key
string
associative key
$value
string
value

Returns

array
public
# release( )

Discards the internal cache.

Discards the internal cache.

public DibiFluent
# toFluent( )

Returns this data source wrapped in DibiFluent object.

Returns this data source wrapped in DibiFluent object.

Returns

DibiFluent
public DibiDataSource
# toDataSource( )

Returns this data source wrapped in DibiDataSource object.

Returns this data source wrapped in DibiDataSource object.

Returns

DibiDataSource
public string
# __toString( )

Returns SQL query.

Returns SQL query.

Returns

string
public integer
# count( )

Returns the number of rows in a given data source.

Returns the number of rows in a given data source.

Returns

integer

Implementation of

Countable::count
public integer
# getTotalCount( )

Returns the number of rows in a given data source.

Returns the number of rows in a given data source.

Returns

integer
Methods inherited from DibiObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getClass(), getReflection()
dibi API documentation API documentation generated by ApiGen 2.3.0