PHP 클래스 Hylax_SQL_Attributes, horde

Copyright 1999-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
저자: Chuck Hagenbuch ([email protected])
파일 보기 프로젝트 열기: horde/horde

공개 프로퍼티들

프로퍼티 타입 설명
$_db DB The PEAR::DB object to run queries with.
$_params array primary_table - The main table name. attribute_table - The table that the attributes are stored in.
$_table_count integer The number of copies of the attributes table that we need to join on in the current query.

공개 메소드들

메소드 설명
Hylax_SQL_Attributes ( DB $dbh, array $params ) Constructor.
_buildAttributeQuery ( string $glue, array $criteria, boolean $join = false ) : string Build a piece of an attribute query.
_getAlias ( boolean $increment = false ) Get an alias to an attributes table, incrementing it if necessary.
deleteAttributes ( integer $id ) Given an id, delete all attributes for that id from the attributes table.
getAttributes ( integer | array $id ) : array Returns all attributes for a given id or multiple ids.
getByAttributes ( array $criteria ) Return a set of ids based on a set of attribute criteria.
insertAttributes ( integer $id, array $attributes ) Given a new attribute set and an id, insert each into the DB. If anything fails in here, rollback the transaction, return the relevant error and bail out.
updateAttributes ( integer $id, array $attributes ) Given an id, update all attributes for that id in the attributes table with the new attributes.

메소드 상세

Hylax_SQL_Attributes() 공개 메소드

Constructor.
public Hylax_SQL_Attributes ( DB $dbh, array $params )
$dbh DB A PEAR::DB object.
$params array The id column, table names, etc.

_buildAttributeQuery() 공개 메소드

Build a piece of an attribute query.
public _buildAttributeQuery ( string $glue, array $criteria, boolean $join = false ) : string
$glue string The glue to join the criteria (OR/AND).
$criteria array The array of criteria.
$join boolean Should we join on a clean attributes table?
리턴 string An SQL fragment.

_getAlias() 공개 메소드

Get an alias to an attributes table, incrementing it if necessary.
public _getAlias ( boolean $increment = false )
$increment boolean Increment the alias count? Defaults to false.

deleteAttributes() 공개 메소드

Given an id, delete all attributes for that id from the attributes table.
public deleteAttributes ( integer $id )
$id integer The id of the record for which attributes are being deleted.

getAttributes() 공개 메소드

Returns all attributes for a given id or multiple ids.
public getAttributes ( integer | array $id ) : array
$id integer | array
리턴 array A hash of attributes, or a multi-level hash of ids => their attributes.

getByAttributes() 공개 메소드

Return a set of ids based on a set of attribute criteria.
public getByAttributes ( array $criteria )
$criteria array The array of criteria. Example: $criteria['OR'] = array( array('field' => 'name', 'op' => '=', 'test' => 'foo'), array('field' => 'name', 'op' => '=', 'test' => 'bar')); This would return all ids for which the field attribute_name is either 'foo' or 'bar'.

insertAttributes() 공개 메소드

Given a new attribute set and an id, insert each into the DB. If anything fails in here, rollback the transaction, return the relevant error and bail out.
public insertAttributes ( integer $id, array $attributes )
$id integer The id of the record for which attributes are being inserted.
$attributes array An hash containing the attributes.

updateAttributes() 공개 메소드

Given an id, update all attributes for that id in the attributes table with the new attributes.
public updateAttributes ( integer $id, array $attributes )
$id integer The id of the record for which attributes are being deleted.
$attributes array An hash containing the attributes.

프로퍼티 상세

$_db 공개적으로 프로퍼티

The PEAR::DB object to run queries with.
public DB $_db
리턴 DB

$_params 공개적으로 프로퍼티

primary_table - The main table name. attribute_table - The table that the attributes are stored in.
public array $_params
리턴 array

$_table_count 공개적으로 프로퍼티

The number of copies of the attributes table that we need to join on in the current query.
public int $_table_count
리턴 integer