PHP Class Pop\Db\Record\Prepared

Author: Nick Sagona, III ([email protected])
Inheritance: extends AbstractRecord
Show file Open project: nicksagona/PopPHP

Protected Properties

Property Type Description
$placeholder string Prepared statement parameter placeholder

Public Methods

Method Description
__construct ( Db $db, array $options ) : Prepared Constructor
delete ( array $columnsPassed, array $columns = null ) : void Delete the database record.
execute ( string $sql, array $params = null ) : void Execute a custom prepared SQL query.
findAll ( string $order = null, array $columns = null, integer $limit = null, integer $offset = null ) : void Find all of the database rows by the column passed through the method argument.
findBy ( array $columns, string $order = null, integer $limit = null, integer $offset = null ) : void Find a database row by the column passed through the method argument.
findById ( mixed $id, integer $limit = null, integer $offset = null ) : void Find a database row by the primary ID passed through the method argument.
getCount ( array $columns = null ) : integer Get total count of records
query ( string $sql ) : void Execute a custom SQL query.
save ( array $columnsPassed, integer $type = Pop\Db\Record::INSERT ) : void Save the database record.

Protected Methods

Method Description
getPlaceholder ( string $column, integer $i = 1 ) : string Get the placeholder for a prepared statement
setResults ( ) : void Set the query results.

Method Details

__construct() public method

Instantiate the record prepared object.
public __construct ( Db $db, array $options ) : Prepared
$db Pop\Db\Db
$options array
return Prepared

delete() public method

Delete the database record.
public delete ( array $columnsPassed, array $columns = null ) : void
$columnsPassed array
$columns array
return void

execute() public method

Execute a custom prepared SQL query.
public execute ( string $sql, array $params = null ) : void
$sql string
$params array
return void

findAll() public method

Find all of the database rows by the column passed through the method argument.
public findAll ( string $order = null, array $columns = null, integer $limit = null, integer $offset = null ) : void
$order string
$columns array
$limit integer
$offset integer
return void

findBy() public method

Find a database row by the column passed through the method argument.
public findBy ( array $columns, string $order = null, integer $limit = null, integer $offset = null ) : void
$columns array
$order string
$limit integer
$offset integer
return void

findById() public method

Find a database row by the primary ID passed through the method argument.
public findById ( mixed $id, integer $limit = null, integer $offset = null ) : void
$id mixed
$limit integer
$offset integer
return void

getCount() public method

Get total count of records
public getCount ( array $columns = null ) : integer
$columns array
return integer

getPlaceholder() protected method

Get the placeholder for a prepared statement
protected getPlaceholder ( string $column, integer $i = 1 ) : string
$column string
$i integer
return string

query() public method

Execute a custom SQL query.
public query ( string $sql ) : void
$sql string
return void

save() public method

Save the database record.
public save ( array $columnsPassed, integer $type = Pop\Db\Record::INSERT ) : void
$columnsPassed array
$type integer
return void

setResults() protected method

Set the query results.
protected setResults ( ) : void
return void

Property Details

$placeholder protected property

Prepared statement parameter placeholder
protected string $placeholder
return string