PHP Class Pix_Table_Db_Adapter_SQL, pixframework

Inheritance: extends Pix_Table_Db_Adapter_Abstract
Show file Open project: pixnet/pixframework

Public Methods

Method Description
bulkInsert ( Pix_Table $table, array $keys, array $values_list, array $options = [] ) : void bulk insert
column_quote ( string $a ) : string column_quote 把 $a 字串加上 quote
deleteOne ( Pix_Table_Row $row ) : void deleteOne 從 db 上刪除一個 Row
fetch ( Pix_Table $table, Pix_Table_Search $search, string $select_columns = '*' ) : array fetch 從 $table 找出符合 $search 的所有 column
fetchCount ( Pix_Table $table, mixed $search ) : integer fetchCount 從 $table 找出符合 $search 條件的數量
fetchOne ( Pix_Table $table, array $primary_values, $select_columns = '*' ) : array fetchOne 從 $table 找出符合 $primary_values 條件的一筆
fetchSum ( Pix_Table $table, string $column, Pix_Table_Search $search ) : mixed fetchSum 從 $table 找出符合 $search 數量的 $column 總合
getSQLConditionByTerm ( Pix_Table_Search_Term $term, $table )
insertOne ( Pix_Table $table, array | string $keys_values ) : void insertOne 從 db 上增加一筆資料
updateOne ( Pix_Table_Row $row, array | string $data ) : void updateOne 從 db 上更新一個 $row 的 data

Protected Methods

Method Description
_filterRow ( array $row ) : array filter database raw data to Pix_Table_Row data
_getSelectExpression ( Pix_Table $table, string | array $select_columns = '*' ) : string get select expression for SELECT
_get_clause ( Pix_Table_Search $search ) : string _get_clause 從 $search 條件中,回傳 ORDER BY .
_get_set_clause ( mixed $keys_values, $table ) : string _get_set_clause 從 $keys_values 條件中,回傳 SET 後面的 SQL
_get_where_clause ( Pix_Table_Search $search, Pix_Table $table ) : string _get_where_clause 依照 $search 條件以及指定的 $table 回傳 WHERE 的 SQL
_hasSpecialColumns ( Pix_Table $table ) : boolean check $table has special column or not

Method Details

_filterRow() protected method

filter database raw data to Pix_Table_Row data
protected _filterRow ( array $row ) : array
$row array
return array

_getSelectExpression() protected method

get select expression for SELECT
protected _getSelectExpression ( Pix_Table $table, string | array $select_columns = '*' ) : string
$table Pix_Table
$select_columns string | array
return string

_get_clause() protected method

.. LIMIT ...
protected _get_clause ( Pix_Table_Search $search ) : string
$search Pix_Table_Search
return string

_get_set_clause() protected method

_get_set_clause 從 $keys_values 條件中,回傳 SET 後面的 SQL
protected _get_set_clause ( mixed $keys_values, $table ) : string
$keys_values mixed
return string

_get_where_clause() protected method

_get_where_clause 依照 $search 條件以及指定的 $table 回傳 WHERE 的 SQL
protected _get_where_clause ( Pix_Table_Search $search, Pix_Table $table ) : string
$search Pix_Table_Search
$table Pix_Table
return string

_hasSpecialColumns() protected method

check $table has special column or not
protected _hasSpecialColumns ( Pix_Table $table ) : boolean
$table Pix_Table
return boolean

bulkInsert() public method

bulk insert
public bulkInsert ( Pix_Table $table, array $keys, array $values_list, array $options = [] ) : void
$table Pix_Table
$keys array
$values_list array
$options array
return void

column_quote() public method

column_quote 把 $a 字串加上 quote
public column_quote ( string $a ) : string
$a string
return string

deleteOne() public method

deleteOne 從 db 上刪除一個 Row
public deleteOne ( Pix_Table_Row $row ) : void
$row Pix_Table_Row
return void

fetch() public method

fetch 從 $table 找出符合 $search 的所有 column
public fetch ( Pix_Table $table, Pix_Table_Search $search, string $select_columns = '*' ) : array
$table Pix_Table
$search Pix_Table_Search
$select_columns string
return array

fetchCount() public method

fetchCount 從 $table 找出符合 $search 條件的數量
public fetchCount ( Pix_Table $table, mixed $search ) : integer
$table Pix_Table
$search mixed
return integer

fetchOne() public method

fetchOne 從 $table 找出符合 $primary_values 條件的一筆
public fetchOne ( Pix_Table $table, array $primary_values, $select_columns = '*' ) : array
$table Pix_Table
$primary_values array
return array or null

fetchSum() public method

fetchSum 從 $table 找出符合 $search 數量的 $column 總合
public fetchSum ( Pix_Table $table, string $column, Pix_Table_Search $search ) : mixed
$table Pix_Table
$column string
$search Pix_Table_Search
return mixed

getSQLConditionByTerm() public method

public getSQLConditionByTerm ( Pix_Table_Search_Term $term, $table )
$term Pix_Table_Search_Term

insertOne() public method

insertOne 從 db 上增加一筆資料
public insertOne ( Pix_Table $table, array | string $keys_values ) : void
$table Pix_Table
$keys_values array | string
return void

updateOne() public method

updateOne 從 db 上更新一個 $row 的 data
public updateOne ( Pix_Table_Row $row, array | string $data ) : void
$row Pix_Table_Row
$data array | string
return void