PHP 클래스 lithium\data\source\database\adapter\PostgreSql

- Implements timezone support. - Implements schema/searchPath support. For more information on configuring the database connection, see the __construct() method.
또한 보기: lithium\data\source\database\adapter\PostgreSql::timezone()
또한 보기: lithium\data\source\database\adapter\PostgreSql::searchPath()
또한 보기: lithium\data\source\database\adapter\PostgreSql::__construct()
상속: extends lithium\data\source\Database
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_columns array PostgreSQL column type definitions.
$_constraints array Column contraints
$_metas array Column/table metas By default 'escape' is false and 'join' is ' '
$_quotes array Pair of opening and closing quote characters used for quoting identifiers in queries.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor. Constructs the PostgreSQL adapter and sets the default port to 5432.
alias ( $alias, $context )
conditions ( string $conditions, string $context, array $options = [] ) : string
connect ( ) : boolean Connects to the database by constructing DSN string and creating a PDO intance using the parent class. Will set specific options on the connection as provided (timezone, schema).
describe ( mixed $entity, array $fields = [], array $meta = [] ) : array Gets the column schema for a given PostgreSQL table.
enabled ( string $feature = null ) : boolean Check for required PHP extension, or supported database feature.
encoding ( $encoding = null ) : mixed Gets or sets the encoding for the connection.
error ( ) : array Retrieves database error message and error code.
searchPath ( $searchPath ) : mixed Gets or sets the search path for the connection.
sources ( string $model = null ) : array Returns the list of tables in the currently-connected database.
timezone ( $timezone = null ) : mixed Gets or sets the time zone for the connection
value ( mixed $value, array $schema = [] ) : mixed Converts a given value into the proper type based on a given schema definition.

보호된 메소드들

메소드 설명
_buildColumn ( array $field ) : string Helper for Database::column().
_column ( string $real ) : array Converts database-layer column types to basic types.
_distinctExport ( object $query ) : array Helper method for PostgreSql::_queryExport() to export data for use in distinct query.
_execute ( string $sql, array $options = [] ) : Result Execute a given query.
_formatters ( ) Provide an associative array of Closures to be used as the "formatter" key inside of the Database::$_columns specification.
_insertId ( object $query ) : mixed Gets the last auto-generated ID from the query that inserted a new record.
_queryExport ( object $query ) : array Helper method for Database::read() to export query while handling additional joins when using relationships and limited result sets. Filters conditions on subsequent queries to just the ones applying to the relation.

메소드 상세

__construct() 공개 메소드

Constructor. Constructs the PostgreSQL adapter and sets the default port to 5432.
또한 보기: lithium\data\source\Database::__construct()
또한 보기: lithium\data\Source::__construct()
또한 보기: lithium\data\Connections::add()
public __construct ( array $config = [] ) : void
$config array The available configuration options are the following. Further options are inherited from the parent classes. Typically, these parameters are set in `Connections::add()`, when adding the adapter to the list of active connections. - `'host'` _string_: Defaults to `'localhost:5432'`. - `'schema'` _string_: The name of the database schema to use. Defaults to `'public'`. - `'timezone'` _string_: The timezone to use. Defaults to `'null'`
리턴 void

_buildColumn() 보호된 메소드

Helper for Database::column().
또한 보기: lithium\data\source\Database::column()
protected _buildColumn ( array $field ) : string
$field array A field array.
리턴 string SQL column string.

_column() 보호된 메소드

Converts database-layer column types to basic types.
protected _column ( string $real ) : array
$real string Real database-layer column type (i.e. `"varchar(255)"`)
리턴 array Column type (i.e. "string") plus 'length' when appropriate.

_distinctExport() 보호된 메소드

Helper method for PostgreSql::_queryExport() to export data for use in distinct query.
또한 보기: lithium\data\source\PostgreSql::_queryExport()
protected _distinctExport ( object $query ) : array
$query object The query object.
리턴 array Returns an array with the fields as the first value and the orders as the second value.

_execute() 보호된 메소드

Execute a given query.
또한 보기: lithium\data\source\Database::renderCommand()
protected _execute ( string $sql, array $options = [] ) : Result
$sql string The sql string to execute
$options array Available options:
리턴 lithium\data\source\Result Returns a result object if the query was successful.

_formatters() 보호된 메소드

Provide an associative array of Closures to be used as the "formatter" key inside of the Database::$_columns specification.
또한 보기: lithium\data\source\Database::_formatters()
protected _formatters ( )

_insertId() 보호된 메소드

Gets the last auto-generated ID from the query that inserted a new record.
protected _insertId ( object $query ) : mixed
$query object The `Query` object associated with the query which generated
리턴 mixed Returns the last inserted ID key for an auto-increment column or a column bound to a sequence.

_queryExport() 보호된 메소드

Helper method for Database::read() to export query while handling additional joins when using relationships and limited result sets. Filters conditions on subsequent queries to just the ones applying to the relation.
또한 보기: lithium\data\source\Database::read()
protected _queryExport ( object $query ) : array
$query object The query object.
리턴 array The exported query returned by reference.

alias() 공개 메소드

public alias ( $alias, $context )

conditions() 공개 메소드

public conditions ( string $conditions, string $context, array $options = [] ) : string
$conditions string
$context string
$options array
리턴 string

connect() 공개 메소드

Connects to the database by constructing DSN string and creating a PDO intance using the parent class. Will set specific options on the connection as provided (timezone, schema).
또한 보기: lithium\data\source\database\adapter\PostgreSql::timezone()
public connect ( ) : boolean
리턴 boolean Returns `true` if a database connection could be established, otherwise `false`.

describe() 공개 메소드

Gets the column schema for a given PostgreSQL table.
public describe ( mixed $entity, array $fields = [], array $meta = [] ) : array
$entity mixed Specifies the table name for which the schema should be returned, or the class name of the model object requesting the schema, in which case the model class will be queried for the correct table name.
$fields array Any schema data pre-defined by the model.
$meta array
리턴 array Returns an associative array describing the given table's schema, where the array keys are the available fields, and the values are arrays describing each field, containing the following keys: - `'type'`: The field type name

enabled() 공개 정적인 메소드

Check for required PHP extension, or supported database feature.
public static enabled ( string $feature = null ) : boolean
$feature string Test for support for a specific feature, i.e. `"transactions"` or `"arrays"`.
리턴 boolean Returns `true` if the particular feature (or if PostgreSQL) support is enabled, otherwise `false`.

encoding() 공개 메소드

Gets or sets the encoding for the connection.
public encoding ( $encoding = null ) : mixed
$encoding
리턴 mixed If setting the encoding; returns true on success, else false. When getting, returns the encoding.

error() 공개 메소드

Retrieves database error message and error code.
public error ( ) : array
리턴 array

searchPath() 공개 메소드

Gets or sets the search path for the connection.
public searchPath ( $searchPath ) : mixed
$searchPath
리턴 mixed If setting the searchPath; returns ture on success, else false When getting, returns the searchPath

sources() 공개 메소드

Returns the list of tables in the currently-connected database.
public sources ( string $model = null ) : array
$model string The fully-name-spaced class name of the model object making the request.
리턴 array Returns an array of sources to which models can connect.

timezone() 공개 메소드

Gets or sets the time zone for the connection
public timezone ( $timezone = null ) : mixed
$timezone
리턴 mixed If setting the time zone; returns true on success, else false When getting, returns the time zone

value() 공개 메소드

Converts a given value into the proper type based on a given schema definition.
또한 보기: lithium\data\source\Database::schema()
public value ( mixed $value, array $schema = [] ) : mixed
$value mixed The value to be converted. Arrays will be recursively converted.
$schema array Formatted array from `lithium\data\source\Database::schema()`
리턴 mixed Value with converted type.

프로퍼티 상세

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

PostgreSQL column type definitions.
protected array $_columns
리턴 array

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

Column contraints
protected array $_constraints
리턴 array

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

Column/table metas By default 'escape' is false and 'join' is ' '
protected array $_metas
리턴 array

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

Pair of opening and closing quote characters used for quoting identifiers in queries.
protected array $_quotes
리턴 array