PHP 클래스 RedBeanPHP\QueryWriter\AQueryWriter

Represents an abstract Database to RedBean To write a driver for a different database for RedBean Contains a number of functions all implementors can inherit or override.
저자: Gabor de Mooij and the RedBeanPHP Community
파일 보기 프로젝트 열기: gabordemooij/redbean 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$renames array
$typeno_sqltype array

보호된 프로퍼티들

프로퍼티 타입 설명
$adapter RedBeanPHP\Adapter\DBAdapter
$cache array
$defaultValue string
$flagUseCache boolean
$maxCacheSizePerType integer
$quoteCharacter string

공개 메소드들

메소드 설명
addColumn ( $type, $column, $field )
addUniqueIndex ( $type, $properties )
camelsSnake ( string $camel ) : string Globally available service method for RedBeanPHP.
canBeTreatedAsInt ( string $value ) : boolean Checks whether a number can be treated like an int.
clearRenames ( ) : void Clears renames.
deleteRecord ( $type, $conditions = [], $addSql = NULL, $bindings = [] )
deleteRelations ( $sourceType, $destType, $sourceID )
esc ( $dbStructure, $dontQuote = FALSE )
flushCache ( $newMaxCacheSizePerType = NULL ) : integer Flushes the Query Writer Cache.
getAssocTable ( $types )
getAssocTableFormat ( $types )
getSQLFilters ( ) : array Returns current SQL Filters.
glueLimitOne ( $sql = '' )
glueSQLCondition ( $sql, $glue = NULL )
inferFetchType ( $type, $property )
queryRecord ( $type, $conditions = [], $addSql = NULL, $bindings = [] )
queryRecordCount ( $type, $conditions = [], $addSql = NULL, $bindings = [] )
queryRecordCountRelated ( $sourceType, $destType, $linkID, $addSql = '', $bindings = [] )
queryRecordLink ( $sourceType, $destType, $sourceID, $destID )
queryRecordRelated ( $sourceType, $destType, $linkIDs, $addSql = '', $bindings = [] )
queryRecordWithCursor ( $type, $addSql = NULL, $bindings = [] )
queryTagged ( $type, $tagList, $all = FALSE, $addSql = '', $bindings = [] )
renameAssocTable ( $from, $to = NULL )
renameAssociation ( $from, $to = NULL )
safeColumn ( string $column, boolean $noQuotes = FALSE ) : string
safeTable ( string $table, boolean $noQuotes = FALSE ) : string
setNarrowFieldMode ( boolean $narrowField ) : void Toggles 'Narrow Field Mode'.
setSQLFilters ( $sqlFilters, $safeMode = false ) : void Sets SQL filters.
setUseCache ( $yesNo ) : void Turns caching on or off. Default: off.
tableExists ( string $table ) : boolean Checks whether the specified type (i.e. table) already exists in the database.
updateRecord ( $type, $updatevalues, $id = NULL )
widenColumn ( $type, $property, $dataType )
wipe ( $type )
writeJoin ( $type, $targetType, $leftRight = 'LEFT' )

보호된 메소드들

메소드 설명
addDataType ( integer $dataTypeID, string $SQLDefinition ) : self Adds a data type to the list of data types.
check ( $struct ) : string Checks table name or column name.
getForeignKeyForTypeProperty ( string $type, string $property ) : array | null Given a type and a property name this method returns the foreign key map section associated with this pair.
getInsertSuffix ( string $table ) : string Returns the sql that should follow an insert statement.
getKeyMapForType ( string $type ) : array Returns the foreign key map (FKM) for a type.
getParametersForInClause ( &$valueList, array $otherBindings, integer $offset ) : string Generates a list of parameters (slots) for an SQL snippet.
getSQLFilterSnippet ( string $type ) : string Returns an SQL Filter snippet for reading.
insertRecord ( $type, array $insertcolumns, array $insertvalues ) : integer Inserts a record into the database using a series of insert columns and corresponding insertvalues. Returns the insert id.
makeFKLabel ( string $from, string $type, string $to ) : string This method makes a key for a foreign key description array.
startsWithZeros ( string $value ) : boolean Checks whether a value starts with zeros. In this case the value should probably be stored using a text datatype instead of a numerical type in order to preserve the zeros.

비공개 메소드들

메소드 설명
getCacheKey ( array $keyValues ) : string Returns a cache key for the cache values passed.
getCached ( string $cacheTag, string $key ) : mixed Returns the values associated with the provided cache tag and key.
getRelationalTablesAndColumns ( string $sourceType, string $destType, boolean $noQuote = FALSE ) : array Returns the table names and column names for a relational query.
makeSQLFromConditions ( array $conditions, array &$bindings, string $addSql = '' ) : string Creates an SQL snippet from a list of conditions of format:
putResultInCache ( string $cacheTag, string $key, array $values ) : void Stores data from the writer in the cache under a specific key and cache tag.
updateCache ( ) : boolean Checks if the previous query had a keep-cache tag.

메소드 상세

addColumn() 공개 메소드

또한 보기: QueryWriter::addColumn
public addColumn ( $type, $column, $field )

addDataType() 보호된 메소드

Use this method to add a new column type definition to the writer. Used for UUID support.
protected addDataType ( integer $dataTypeID, string $SQLDefinition ) : self
$dataTypeID integer magic number constant assigned to this data type
$SQLDefinition string SQL column definition (i.e. INT(11))
리턴 self

addUniqueIndex() 공개 메소드

또한 보기: QueryWriter::addUniqueConstraint
public addUniqueIndex ( $type, $properties )

camelsSnake() 공개 정적인 메소드

Converts a camel cased string to a snake cased string.
public static camelsSnake ( string $camel ) : string
$camel string camelCased string to converty to snake case
리턴 string

canBeTreatedAsInt() 공개 정적인 메소드

Checks whether a number can be treated like an int.
public static canBeTreatedAsInt ( string $value ) : boolean
$value string string representation of a certain value
리턴 boolean

check() 보호된 메소드

Checks table name or column name.
protected check ( $struct ) : string
리턴 string

clearRenames() 공개 정적인 메소드

Clears renames.
public static clearRenames ( ) : void
리턴 void

deleteRecord() 공개 메소드

또한 보기: QueryWriter::deleteRecord
public deleteRecord ( $type, $conditions = [], $addSql = NULL, $bindings = [] )

deleteRelations() 공개 메소드

또한 보기: QueryWriter::deleteRelations
public deleteRelations ( $sourceType, $destType, $sourceID )

esc() 공개 메소드

또한 보기: QueryWriter::esc
public esc ( $dbStructure, $dontQuote = FALSE )

flushCache() 공개 메소드

Clears the internal query cache array and returns its overall size.
public flushCache ( $newMaxCacheSizePerType = NULL ) : integer
리턴 integer

getAssocTable() 공개 메소드

또한 보기: QueryWriter::getAssocTable
public getAssocTable ( $types )

getAssocTableFormat() 공개 정적인 메소드

또한 보기: QueryWriter::getAssocTableFormat
public static getAssocTableFormat ( $types )

getForeignKeyForTypeProperty() 보호된 메소드

Given a type and a property name this method returns the foreign key map section associated with this pair.
protected getForeignKeyForTypeProperty ( string $type, string $property ) : array | null
$type string name of the type
$property string name of the property
리턴 array | null

getInsertSuffix() 보호된 메소드

Returns the sql that should follow an insert statement.
protected getInsertSuffix ( string $table ) : string
$table string name
리턴 string

getKeyMapForType() 보호된 메소드

A foreign key map describes the foreign keys in a table. A FKM always has the same structure: array( 'name' => 'from' => 'table' => 'to' => (most of the time 'id') 'on_update' => 'on_delete' => )
protected getKeyMapForType ( string $type ) : array
$type string the bean type you wish to obtain a key map of
리턴 array

getParametersForInClause() 보호된 메소드

This method calculates the correct number of slots to insert in the SQL snippet and determines the correct type of slot. If the bindings array contains named parameters this method will return named ones and update the keys in the value list accordingly (that's why we use the &). If you pass an offset the bindings will be re-added to the value list. Some databases cant handle duplicate parameter names in queries.
protected getParametersForInClause ( &$valueList, array $otherBindings, integer $offset ) : string
$otherBindings array list of additional bindings
$offset integer start counter at...
리턴 string

getSQLFilterSnippet() 보호된 메소드

Returns an SQL Filter snippet for reading.
protected getSQLFilterSnippet ( string $type ) : string
$type string type of bean
리턴 string

getSQLFilters() 공개 정적인 메소드

This method returns the raw SQL filter array. This is a lowlevel method. For a more friendly method please take a look at the facade: R::bindFunc().
public static getSQLFilters ( ) : array
리턴 array

glueLimitOne() 공개 메소드

또한 보기: QueryWriter::glueLimitOne
public glueLimitOne ( $sql = '' )

glueSQLCondition() 공개 메소드

또한 보기: QueryWriter::glueSQLCondition
public glueSQLCondition ( $sql, $glue = NULL )

inferFetchType() 공개 메소드

또한 보기: QueryWriter::inferFetchType
public inferFetchType ( $type, $property )

insertRecord() 보호된 메소드

Inserts a record into the database using a series of insert columns and corresponding insertvalues. Returns the insert id.
protected insertRecord ( $type, array $insertcolumns, array $insertvalues ) : integer
$insertcolumns array columns to be inserted
$insertvalues array values to be inserted
리턴 integer

makeFKLabel() 보호된 메소드

This key is a readable string unique for every source table. This uniform key is called the FKDL Foreign Key Description Label. Note that the source table is not part of the FKDL because this key is supposed to be 'per source table'. If you wish to include a source table, prefix the key with 'on_table__'.
protected makeFKLabel ( string $from, string $type, string $to ) : string
$from string the column of the key in the source table
$type string the type (table) where the key points to
$to string the target column of the foreign key (mostly just 'id')
리턴 string

queryRecord() 공개 메소드

또한 보기: QueryWriter::queryRecord
public queryRecord ( $type, $conditions = [], $addSql = NULL, $bindings = [] )

queryRecordCount() 공개 메소드

또한 보기: QueryWriter::queryRecordCount
public queryRecordCount ( $type, $conditions = [], $addSql = NULL, $bindings = [] )

queryRecordCountRelated() 공개 메소드

또한 보기: QueryWriter::queryRecordCountRelated
public queryRecordCountRelated ( $sourceType, $destType, $linkID, $addSql = '', $bindings = [] )

queryRecordRelated() 공개 메소드

또한 보기: QueryWriter::queryRecordRelated
public queryRecordRelated ( $sourceType, $destType, $linkIDs, $addSql = '', $bindings = [] )

queryRecordWithCursor() 공개 메소드

또한 보기: QueryWriter::queryRecordWithCursor
public queryRecordWithCursor ( $type, $addSql = NULL, $bindings = [] )

queryTagged() 공개 메소드

또한 보기: QueryWriter::queryTagged
public queryTagged ( $type, $tagList, $all = FALSE, $addSql = '', $bindings = [] )

renameAssocTable() 공개 메소드

또한 보기: QueryWriter::renameAssocTable
public renameAssocTable ( $from, $to = NULL )

renameAssociation() 공개 정적인 메소드

또한 보기: QueryWriter::renameAssociation
public static renameAssociation ( $from, $to = NULL )

safeColumn() 공개 메소드

사용 중단: Use esc() instead.
public safeColumn ( string $column, boolean $noQuotes = FALSE ) : string
$column string column to be escaped
$noQuotes boolean omit quotes
리턴 string

safeTable() 공개 메소드

사용 중단: Use esc() instead.
public safeTable ( string $table, boolean $noQuotes = FALSE ) : string
$table string table to be escaped
$noQuotes boolean omit quotes
리턴 string

setNarrowFieldMode() 공개 정적인 메소드

In Narrow Field mode the queryRecord method will narrow its selection field to SELECT {table}.* instead of SELECT * This is a better way of querying because it allows more flexibility (for instance joins). However if you need the wide selector for backward compatibility; use this method to turn OFF Narrow Field Mode by passing FALSE.
public static setNarrowFieldMode ( boolean $narrowField ) : void
$narrowField boolean TRUE = Narrow Field FALSE = Wide Field
리턴 void

setSQLFilters() 공개 정적인 메소드

This is a lowlevel method to set the SQL filter array. The format of this array is: array( '' => array( '' => array( '' => '' ) ) ) Example: array( QueryWriter::C_SQLFILTER_READ => array( 'book' => array( 'title' => ' LOWER(book.title) ' ) ) Note that you can use constants instead of magical chars as keys for the uppermost array. This is a lowlevel method. For a more friendly method please take a look at the facade: R::bindFunc().
public static setSQLFilters ( $sqlFilters, $safeMode = false ) : void
리턴 void

setUseCache() 공개 메소드

If caching is turned on retrieval queries fired after eachother will use a result row cache.
public setUseCache ( $yesNo ) : void
리턴 void

startsWithZeros() 보호된 메소드

Checks whether a value starts with zeros. In this case the value should probably be stored using a text datatype instead of a numerical type in order to preserve the zeros.
protected startsWithZeros ( string $value ) : boolean
$value string value to be checked.
리턴 boolean

tableExists() 공개 메소드

Not part of the Object Database interface!
public tableExists ( string $table ) : boolean
$table string table name
리턴 boolean

updateRecord() 공개 메소드

또한 보기: QueryWriter::updateRecord
public updateRecord ( $type, $updatevalues, $id = NULL )

widenColumn() 공개 메소드

또한 보기: QueryWriter::widenColumn
public widenColumn ( $type, $property, $dataType )

wipe() 공개 메소드

또한 보기: QueryWriter::wipe
public wipe ( $type )

writeJoin() 공개 메소드

또한 보기: QueryWriter::writeJoin
public writeJoin ( $type, $targetType, $leftRight = 'LEFT' )

프로퍼티 상세

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

protected DBAdapter,RedBeanPHP\Adapter $adapter
리턴 RedBeanPHP\Adapter\DBAdapter

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

protected array $cache
리턴 array

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

protected string $defaultValue
리턴 string

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

protected bool $flagUseCache
리턴 boolean

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

protected int $maxCacheSizePerType
리턴 integer

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

protected string $quoteCharacter
리턴 string

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

public static array $renames
리턴 array

$typeno_sqltype 공개적으로 프로퍼티

public array $typeno_sqltype
리턴 array