PHP Class PdoDataSet, recess

Example usage: $results = new PdoDataSet(Databases::getDefault()); $results->from('tableName')->equal('someColumn', 'Hi')->limit(10)->offset(50); foreach($results as $result) { // This is when the query is run! print_r($result); }
Author: Kris Jordan ([email protected])
Inheritance: implements Iterator, implements Countable, implements ArrayAccess, implements ISqlSelectOptions, implements ISqlConditions
ファイルを表示 Open project: KrisJordan/recess Class Usage Examples

Public Properties

Property Type Description
$rowClass The Class which PDO will fetch rows into.

Protected Properties

Property Type Description
$hasResults boolean Whether this instance has fetched results or not.
$index integer Index counter for our location in the result set.
$results Array of results that is filled once a query is realized.
$source PdoDataSource The PdoDataSource which this PdoDataSet is extracted from.
$sqlBuilder SqlBuilder The SqlBuilder instance we use to build up the query string.

Public Methods

Method Description
__clone ( )
__construct ( PdoDataSource $source )
assign ( $column, $value ) : PdoDataSet
between ( $column, $lhs, $rhs ) : PdoDataSet
count ( )
current ( )
distinct ( ) : PdoDataSet
equal ( $lhs, $rhs ) : PdoDataSet
exists ( )
first ( ) : object Return the first item in the PdoDataSet or Null if none exist
from ( $table ) : PdoDataSet
greaterThan ( $lhs, $rhs ) : PdoDataSet
greaterThanOrEqualTo ( $lhs, $rhs ) : PdoDataSet
groupBy ( $clause ) : PdoDataSet
in ( $lhs, $rhs ) : PdoDataSet
innerJoin ( $table, $tablePrimaryKey, $fromTableForeignKey ) : PdoDataSet
isEmpty ( )
isNotNull ( $lhs ) : PdoDataSet
isNull ( $lhs ) : PdoDataSet
key ( )
leftOuterJoin ( $table, $tablePrimaryKey, $fromTableForeignKey ) : PdoDataSet
lessThan ( $lhs, $rhs ) : PdoDataSet
lessThanOrEqualTo ( $lhs, $rhs ) : PdoDataSet
like ( $lhs, $rhs ) : PdoDataSet
limit ( $size ) : PdoDataSet
next ( )
notEqual ( $lhs, $rhs ) : PdoDataSet
notLike ( $lhs, $rhs ) : PdoDataSet
offset ( $offset ) : PdoDataSet
offsetExists ( $index ) * The following methods are in accordance with the ArrayAccess interface
offsetGet ( $index )
offsetSet ( $index, $value )
offsetUnset ( $index )
orderBy ( $clause ) : PdoDataSet
range ( $start, $finish ) : PdoDataSet
rewind ( ) * The following methods are in accordance with the Iterator interface
selectAs ( $select, $as ) : PdoDataSet
toArray ( ) : array Return the results as an array.
toSql ( ) : string Return the SQL representation of this PdoDataSet
useAssignmentsAsConditions ( $bool ) : PdoDataSet
valid ( )
where ( $lhs, $rhs, $operator ) : PdoDataSet

Protected Methods

Method Description
realize ( ) Once results are needed this method executes the accumulated query on the data source.
reset ( )

Method Details

__clone() public method

public __clone ( )

__construct() public method

public __construct ( PdoDataSource $source )
$source PdoDataSource

assign() public method

See also: SqlBuilder::assign
public assign ( $column, $value ) : PdoDataSet
return PdoDataSet

between() public method

See also: SqlBuilder::between
public between ( $column, $lhs, $rhs ) : PdoDataSet
return PdoDataSet

count() public method

public count ( )

current() public method

public current ( )

distinct() public method

See also: SqlBuilder::distinct
public distinct ( ) : PdoDataSet
return PdoDataSet

equal() public method

See also: SqlBuilder::equal
public equal ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

exists() public method

public exists ( )

first() public method

Return the first item in the PdoDataSet or Null if none exist
public first ( ) : object
return object or false

from() public method

See also: SqlBuilder::from
public from ( $table ) : PdoDataSet
return PdoDataSet

greaterThan() public method

See also: SqlBuilder::greaterThan
public greaterThan ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

greaterThanOrEqualTo() public method

See also: SqlBuilder::greaterThanOrEqualTo
public greaterThanOrEqualTo ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

groupBy() public method

See also: SqlBuilder::groupBy
public groupBy ( $clause ) : PdoDataSet
return PdoDataSet

in() public method

See also: SqlBuilder::in
public in ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

innerJoin() public method

See also: SqlBuilder::innerJoin
public innerJoin ( $table, $tablePrimaryKey, $fromTableForeignKey ) : PdoDataSet
return PdoDataSet

isEmpty() public method

public isEmpty ( )

isNotNull() public method

See also: SqlBuilder::like
public isNotNull ( $lhs ) : PdoDataSet
return PdoDataSet

isNull() public method

See also: SqlBuilder::isNull
public isNull ( $lhs ) : PdoDataSet
return PdoDataSet

key() public method

public key ( )

leftOuterJoin() public method

See also: SqlBuilder::leftOuterJoin
public leftOuterJoin ( $table, $tablePrimaryKey, $fromTableForeignKey ) : PdoDataSet
return PdoDataSet

lessThan() public method

See also: SqlBuilder::lessThan
public lessThan ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

lessThanOrEqualTo() public method

See also: SqlBuilder::lessThanOrEqualTo
public lessThanOrEqualTo ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

like() public method

See also: SqlBuilder::like
public like ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

limit() public method

See also: SqlBuilder::limit
public limit ( $size ) : PdoDataSet
return PdoDataSet

next() public method

public next ( )

notEqual() public method

See also: SqlBuilder::notEqual
public notEqual ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

notLike() public method

See also: SqlBuilder::like
public notLike ( $lhs, $rhs ) : PdoDataSet
return PdoDataSet

offset() public method

See also: SqlBuilder::offset
public offset ( $offset ) : PdoDataSet
return PdoDataSet

offsetExists() public method

* The following methods are in accordance with the ArrayAccess interface
public offsetExists ( $index )

offsetGet() public method

public offsetGet ( $index )

offsetSet() public method

public offsetSet ( $index, $value )

offsetUnset() public method

public offsetUnset ( $index )

orderBy() public method

See also: SqlBuilder::orderBy
public orderBy ( $clause ) : PdoDataSet
return PdoDataSet

range() public method

See also: SqlBuilder::range
public range ( $start, $finish ) : PdoDataSet
return PdoDataSet

realize() protected method

Once results are needed this method executes the accumulated query on the data source.
protected realize ( )

reset() protected method

protected reset ( )

rewind() public method

* The following methods are in accordance with the Iterator interface
public rewind ( )

selectAs() public method

See also: SqlBuilder::selectAs
public selectAs ( $select, $as ) : PdoDataSet
return PdoDataSet

toArray() public method

Return the results as an array.
public toArray ( ) : array
return array of type $this->rowClass

toSql() public method

Return the SQL representation of this PdoDataSet
public toSql ( ) : string
return string

useAssignmentsAsConditions() public method

See also: SqlBuilder::useAssignmentsAsConditions
public useAssignmentsAsConditions ( $bool ) : PdoDataSet
return PdoDataSet

valid() public method

public valid ( )

where() public method

See also: SqlBuilder::where
public where ( $lhs, $rhs, $operator ) : PdoDataSet
return PdoDataSet

Property Details

$hasResults protected_oe property

Whether this instance has fetched results or not.
protected bool $hasResults
return boolean

$index protected_oe property

Index counter for our location in the result set.
protected int $index
return integer

$results protected_oe property

Array of results that is filled once a query is realized.
protected $results

$rowClass public_oe property

The Class which PDO will fetch rows into.
public $rowClass

$source protected_oe property

The PdoDataSource which this PdoDataSet is extracted from.
protected PdoDataSource $source
return PdoDataSource

$sqlBuilder protected_oe property

The SqlBuilder instance we use to build up the query string.
protected SqlBuilder $sqlBuilder
return SqlBuilder