PHP 클래스 Pop\Db\Record

저자: Nick Sagona, III ([email protected])
상속: implements ArrayAccess
파일 보기 프로젝트 열기: nicksagona/PopPHP 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$db array Database connection(s)
$rows array Rows of multiple return results from a database query in an ArrayObject format.

보호된 프로퍼티들

프로퍼티 타입 설명
$auto boolean Property that determines whether or not the primary ID is auto-increment or not
$columns array Column names of the database table
$interface Pop\Db\Record\AbstractRecord Record interface
$prefix string Table prefix
$primaryId string | array Primary ID column name of the database table
$tableName string Table name of the database table
$usePrepared boolean Flag on whether or not to use prepared statements

공개 메소드들

메소드 설명
__construct ( array $columns = null, Db $db = null ) : Record Constructor
__get ( string $name ) : mixed Get method to return the value of columns[$name].
__isset ( string $name ) : boolean Return the isset value of columns[$name].
__set ( string $name, mixed $value ) : void Set method to set the property to the value of columns[$name].
__unset ( string $name ) : void Unset columns[$name].
count ( ) : integer Method to return the current number of records.
delete ( array $columns = null ) : void Delete the database record.
escape ( string $value ) : string Return the escaped string value.
execute ( string $sql, array $params = null ) : Record Execute a custom prepared SQL query.
findAll ( string $order = null, array $columns = null, integer $limit = null, integer $offset = null ) : Record 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 ) : Record Find a database row by the column passed through the method argument.
findById ( mixed $id, integer $limit = null, integer $offset = null ) : Record Find a database row by the primary ID passed through the method argument.
getCount ( array $columns = null ) : mixed Get total count of records
getDb ( ) : Db Get DB connection
getFullTableName ( ) : string Get the full table name, with the prefix
getId ( ) : mixed Get the table primary ID
getPrefix ( ) : string Get the table prefix
getSql ( ) : Sql Get the SQL object.
getTableInfo ( ) : array Get table info anf return as an array.
getTableName ( ) : string Get the abbreviated table name, without the prefix
getValues ( ) : array Get all the table column values at once as an associative array.
isAuto ( ) : boolean Get if the table is an autoincrement table
isPrepared ( ) : boolean Get if the record interface is prepared or not
lastId ( ) : integer Return the auto-increment ID of the last query.
numFields ( ) : integer Return the number of fields in the result.
numRows ( ) : integer Return the number of rows in the result.
query ( string $sql ) : Record Execute a custom SQL query.
save ( integer $type = Record::INSERT ) : void Save the database record.
setDb ( Db $db, boolean $isDefault = false ) : void Set DB connection
setValues ( array $columns = null ) : Record Set all the table column values at once.
update ( ) : void Update (save) the existing database record.

보호된 메소드들

메소드 설명
camelCaseToUnderscore ( string $string ) : string Method to convert a camelCase string to an under_score string
setResults ( array $result ) : void Set the query results.

메소드 상세

__construct() 공개 메소드

Instantiate the database record object.
public __construct ( array $columns = null, Db $db = null ) : Record
$columns array
$db Db
리턴 Record

__get() 공개 메소드

Get method to return the value of columns[$name].
public __get ( string $name ) : mixed
$name string
리턴 mixed

__isset() 공개 메소드

Return the isset value of columns[$name].
public __isset ( string $name ) : boolean
$name string
리턴 boolean

__set() 공개 메소드

Set method to set the property to the value of columns[$name].
public __set ( string $name, mixed $value ) : void
$name string
$value mixed
리턴 void

__unset() 공개 메소드

Unset columns[$name].
public __unset ( string $name ) : void
$name string
리턴 void

camelCaseToUnderscore() 보호된 메소드

Method to convert a camelCase string to an under_score string
protected camelCaseToUnderscore ( string $string ) : string
$string string
리턴 string

count() 공개 메소드

Method to return the current number of records.
public count ( ) : integer
리턴 integer

delete() 공개 메소드

Delete the database record.
public delete ( array $columns = null ) : void
$columns array
리턴 void

escape() 공개 메소드

Return the escaped string value.
public escape ( string $value ) : string
$value string
리턴 string

execute() 공개 정적인 메소드

Execute a custom prepared SQL query.
public static execute ( string $sql, array $params = null ) : Record
$sql string
$params array
리턴 Record

findAll() 공개 정적인 메소드

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

findBy() 공개 정적인 메소드

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

findById() 공개 정적인 메소드

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

getCount() 공개 정적인 메소드

Get total count of records
public static getCount ( array $columns = null ) : mixed
$columns array
리턴 mixed

getDb() 공개 정적인 메소드

Get DB connection
public static getDb ( ) : Db
리턴 Db

getFullTableName() 공개 메소드

Get the full table name, with the prefix
public getFullTableName ( ) : string
리턴 string

getId() 공개 메소드

Get the table primary ID
public getId ( ) : mixed
리턴 mixed

getPrefix() 공개 메소드

Get the table prefix
public getPrefix ( ) : string
리턴 string

getSql() 공개 정적인 메소드

Get the SQL object.
public static getSql ( ) : Sql
리턴 Sql

getTableInfo() 공개 정적인 메소드

Get table info anf return as an array.
public static getTableInfo ( ) : array
리턴 array

getTableName() 공개 메소드

Get the abbreviated table name, without the prefix
public getTableName ( ) : string
리턴 string

getValues() 공개 메소드

Get all the table column values at once as an associative array.
public getValues ( ) : array
리턴 array

isAuto() 공개 메소드

Get if the table is an autoincrement table
public isAuto ( ) : boolean
리턴 boolean

isPrepared() 공개 메소드

Get if the record interface is prepared or not
public isPrepared ( ) : boolean
리턴 boolean

lastId() 공개 메소드

Return the auto-increment ID of the last query.
public lastId ( ) : integer
리턴 integer

numFields() 공개 메소드

Return the number of fields in the result.
public numFields ( ) : integer
리턴 integer

numRows() 공개 메소드

Return the number of rows in the result.
public numRows ( ) : integer
리턴 integer

query() 공개 정적인 메소드

Execute a custom SQL query.
public static query ( string $sql ) : Record
$sql string
리턴 Record

save() 공개 메소드

Save the database record.
public save ( integer $type = Record::INSERT ) : void
$type integer
리턴 void

setDb() 공개 정적인 메소드

Set DB connection
public static setDb ( Db $db, boolean $isDefault = false ) : void
$db Db
$isDefault boolean
리턴 void

setResults() 보호된 메소드

Set the query results.
protected setResults ( array $result ) : void
$result array
리턴 void

setValues() 공개 메소드

Set all the table column values at once.
public setValues ( array $columns = null ) : Record
$columns array
리턴 Record

update() 공개 메소드

Update (save) the existing database record.
public update ( ) : void
리턴 void

프로퍼티 상세

$auto 보호되어 있는 프로퍼티

Property that determines whether or not the primary ID is auto-increment or not
protected bool $auto
리턴 boolean

$columns 보호되어 있는 프로퍼티

Column names of the database table
protected array $columns
리턴 array

$db 공개적으로 정적으로 프로퍼티

Database connection(s)
public static array $db
리턴 array

$interface 보호되어 있는 프로퍼티

Record interface
protected AbstractRecord,Pop\Db\Record $interface
리턴 Pop\Db\Record\AbstractRecord

$prefix 보호되어 있는 프로퍼티

Table prefix
protected string $prefix
리턴 string

$primaryId 보호되어 있는 프로퍼티

Primary ID column name of the database table
protected string|array $primaryId
리턴 string | array

$rows 공개적으로 프로퍼티

Rows of multiple return results from a database query in an ArrayObject format.
public array $rows
리턴 array

$tableName 보호되어 있는 프로퍼티

Table name of the database table
protected string $tableName
리턴 string

$usePrepared 보호되어 있는 프로퍼티

Flag on whether or not to use prepared statements
protected bool $usePrepared
리턴 boolean