PHP Class BaseQuery, fluentpdo

Inheritance: implements IteratorAggregate
Datei anzeigen Open project: fpdo/fluentpdo Class Usage Examples

Protected Properties

Property Type Description
$clauses - definition clauses
$parameters array
$statements array

Public Methods

Method Description
asObject ( boolean | object $object = true ) : BaseQuery Select an item as object
execute ( ) : PDOStatement Execute query with earlier added parameters
getIterator ( ) : PDOStatement Implements method from IteratorAggregate
getParameters ( ) : array Get query parameters
getQuery ( boolean $formatted = true ) : string Get query string
getResult ( ) : PDOStatement Get PDOStatement result
getTime ( ) : float Get time of execution

Protected Methods

Method Description
__construct ( FluentPDO $fpdo, $clauses ) BaseQuery constructor.
addStatement ( $clause, $statement, array $parameters = [] ) Add statement for all kind of clauses
buildParameters ( ) : array
buildQuery ( ) : string Generate query
getPDO ( ) : PDO
getStructure ( ) : FluentStructure
quote ( $value ) : string
resetClause ( $clause ) Remove all prev defined statements

Private Methods

Method Description
clauseNotEmpty ( $clause ) : boolean
debugger ( ) Echo/pass a debug string
formatValue ( DateTime $val ) : string
initClauses ( ) Initialize statement and parameter clauses.

Method Details

__construct() protected method

BaseQuery constructor.
protected __construct ( FluentPDO $fpdo, $clauses )
$fpdo FluentPDO
$clauses

addStatement() protected method

Add statement for all kind of clauses
protected addStatement ( $clause, $statement, array $parameters = [] )
$clause
$statement
$parameters array

asObject() public method

Select an item as object
public asObject ( boolean | object $object = true ) : BaseQuery
$object boolean | object If set to true, items are returned as stdClass, otherwise a class name can be passed and a new instance of this class is return. Can be set to false to return items as an associative array.
return BaseQuery

buildParameters() protected method

protected buildParameters ( ) : array
return array

buildQuery() protected method

Generate query
protected buildQuery ( ) : string
return string

execute() public method

Execute query with earlier added parameters
public execute ( ) : PDOStatement
return PDOStatement

getIterator() public method

Implements method from IteratorAggregate
public getIterator ( ) : PDOStatement
return PDOStatement

getPDO() protected method

protected getPDO ( ) : PDO
return PDO

getParameters() public method

Get query parameters
public getParameters ( ) : array
return array

getQuery() public method

Get query string
public getQuery ( boolean $formatted = true ) : string
$formatted boolean - Return formatted query
return string

getResult() public method

Get PDOStatement result
public getResult ( ) : PDOStatement
return PDOStatement

getStructure() protected method

protected getStructure ( ) : FluentStructure
return FluentStructure

getTime() public method

Get time of execution
public getTime ( ) : float
return float

quote() protected method

protected quote ( $value ) : string
$value
return string

resetClause() protected method

Remove all prev defined statements
protected resetClause ( $clause )
$clause

Property Details

$clauses protected_oe property

- definition clauses
protected $clauses

$parameters protected_oe property

protected array $parameters
return array

$statements protected_oe property

protected array $statements
return array