W3cubDocs

/Yii 2.0

Class yii\db\oci\Schema

Inheritance yii\db\oci\Schema » yii\db\Schema » yii\base\Object
Implements yii\base\Configurable
Available since version 2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/oci/Schema.php

Schema is the class for retrieving metadata from an Oracle database

Public Properties

Property Type Description Defined By
$columnSchemaClass string Column schema class yii\db\Schema
$db yii\db\Connection The database connection yii\db\Schema
$defaultSchema string The default schema name used for the current session. yii\db\Schema
$exceptionMap array Map of DB errors and corresponding exceptions If left part is found in DB error message exception class from the right part is used. yii\db\oci\Schema
$lastInsertID string The row ID of the last row inserted, or the last value retrieved from the sequence object yii\db\oci\Schema
$queryBuilder yii\db\QueryBuilder The query builder for this connection. yii\db\Schema
$schemaNames string[] All schema names in the database, except system schemas. yii\db\Schema
$tableNames string[] All table names in the database. yii\db\Schema
$tableSchemas yii\db\TableSchema[] The metadata for all tables in the database. yii\db\Schema
$transactionIsolationLevel string The transaction isolation level to use for this transaction. yii\db\Schema

Public Methods

Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\Object
__construct() Constructor. yii\base\Object
__get() Returns the value of an object property. yii\base\Object
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Object
__set() Sets value of an object property. yii\base\Object
__unset() Sets an object property to null. yii\base\Object
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Object
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Object
className() Returns the fully qualified name of this class. yii\base\Object
convertException() Converts a DB exception to a more concrete one if possible. yii\db\Schema
createColumnSchemaBuilder() Create a column schema builder instance giving the type and value precision. yii\db\oci\Schema
createQueryBuilder() Creates a query builder for the database. yii\db\oci\Schema
createSavepoint() Creates a new savepoint. yii\db\Schema
findUniqueIndexes() Returns all unique indexes for the given table. yii\db\oci\Schema
getLastInsertID() yii\db\oci\Schema
getPdoType() Determines the PDO type for the given PHP data value. yii\db\Schema
getQueryBuilder() yii\db\Schema
getRawTableName() Returns the actual name of a given table name. yii\db\Schema
getSchemaNames() Returns all schema names in the database, except system schemas. yii\db\Schema
getTableNames() Returns all table names in the database. yii\db\Schema
getTableSchema() Obtains the metadata for the named table. yii\db\Schema
getTableSchemas() Returns the metadata for all tables in the database. yii\db\Schema
hasMethod() Returns a value indicating whether a method is defined. yii\base\Object
hasProperty() Returns a value indicating whether a property is defined. yii\base\Object
init() Initializes the object. yii\db\oci\Schema
insert() Executes the INSERT command, returning primary key values. yii\db\oci\Schema
isReadQuery() Returns a value indicating whether a SQL statement is for read purpose. yii\db\Schema
loadTableSchema() Loads the metadata for the specified table. yii\db\oci\Schema
quoteColumnName() Quotes a column name for use in a query. yii\db\Schema
quoteSimpleColumnName() Quotes a simple column name for use in a query. yii\db\Schema
quoteSimpleTableName() Quotes a simple table name for use in a query. yii\db\oci\Schema
quoteTableName() Quotes a table name for use in a query. yii\db\Schema
quoteValue() Quotes a string value for use in a query. yii\db\Schema
refresh() Refreshes the schema. yii\db\Schema
refreshTableSchema() Refreshes the particular table schema. yii\db\Schema
releaseSavepoint() Releases an existing savepoint. yii\db\oci\Schema
rollBackSavepoint() Rolls back to a previously created savepoint. yii\db\Schema
setTransactionIsolationLevel() Sets the isolation level of the current transaction. yii\db\Schema
supportsSavepoint() yii\db\Schema

Protected Methods

Method Description Defined By
createColumn() Creates ColumnSchema instance yii\db\oci\Schema
createColumnSchema() yii\db\Schema
extractColumnSize() Extracts size, precision and scale information from column's DB type. yii\db\oci\Schema
extractColumnType() Extracts the data types for the given column yii\db\oci\Schema
findColumns() Collects the table column metadata. yii\db\oci\Schema
findConstraints() Finds constraints and fills them into TableSchema object passed yii\db\oci\Schema
findSchemaNames() Returns all schema names in the database, including the default one but not system schemas. yii\db\oci\Schema
findTableNames() Returns all table names in the database. yii\db\oci\Schema
getCacheKey() Returns the cache key for the specified table name. yii\db\Schema
getCacheTag() Returns the cache tag name. yii\db\Schema
getColumnPhpType() Extracts the PHP type from abstract DB type. yii\db\Schema
getTableSequenceName() Sequence name of table yii\db\oci\Schema
resolveTableNames() Resolves the table name and schema name (if any). yii\db\oci\Schema

Constants

Constant Value Description Defined By
TYPE_BIGINT 'bigint' yii\db\Schema
TYPE_BIGPK 'bigpk' yii\db\Schema
TYPE_BINARY 'binary' yii\db\Schema
TYPE_BOOLEAN 'boolean' yii\db\Schema
TYPE_CHAR 'char' yii\db\Schema
TYPE_DATE 'date' yii\db\Schema
TYPE_DATETIME 'datetime' yii\db\Schema
TYPE_DECIMAL 'decimal' yii\db\Schema
TYPE_DOUBLE 'double' yii\db\Schema
TYPE_FLOAT 'float' yii\db\Schema
TYPE_INTEGER 'integer' yii\db\Schema
TYPE_MONEY 'money' yii\db\Schema
TYPE_PK 'pk' yii\db\Schema
TYPE_SMALLINT 'smallint' yii\db\Schema
TYPE_STRING 'string' yii\db\Schema
TYPE_TEXT 'text' yii\db\Schema
TYPE_TIME 'time' yii\db\Schema
TYPE_TIMESTAMP 'timestamp' yii\db\Schema
TYPE_UBIGPK 'ubigpk' yii\db\Schema
TYPE_UPK 'upk' yii\db\Schema

Property Details

$exceptionMap public property

Map of DB errors and corresponding exceptions If left part is found in DB error message exception class from the right part is used.

public array $exceptionMap = ['ORA-00001: unique constraint' => 'yii\db\IntegrityException']

$lastInsertID public read-only property

The row ID of the last row inserted, or the last value retrieved from the sequence object

public string getLastInsertID ( $sequenceName = '' )

Method Details

createColumn() protected method

Creates ColumnSchema instance

protected yii\db\ColumnSchema createColumn ( $column )
$column array

createColumnSchemaBuilder() public method

Create a column schema builder instance giving the type and value precision.

This method may be overridden by child classes to create a DBMS-specific column schema builder.

public yii\db\ColumnSchemaBuilder createColumnSchemaBuilder ( $type, $length = null )
$type string

Type of the column. See yii\db\oci\ColumnSchemaBuilder::$type.

$length integer|string|array

Length or precision of the column. See yii\db\oci\ColumnSchemaBuilder::$length.

return yii\db\ColumnSchemaBuilder

Column schema builder instance

createQueryBuilder() public method

Creates a query builder for the database.

This method may be overridden by child classes to create a DBMS-specific query builder.

public yii\db\QueryBuilder createQueryBuilder ( )
return yii\db\QueryBuilder

Query builder instance

extractColumnSize() protected method

Extracts size, precision and scale information from column's DB type.

protected void extractColumnSize ( $column, $dbType, $precision, $scale, $length )
$column yii\db\ColumnSchema
$dbType string

The column's DB type

$precision string

Total number of digits. This parameter is available since version 2.0.4.

$scale string

Number of digits on the right of the decimal separator. This parameter is available since version 2.0.4.

$length string

Length for character types. This parameter is available since version 2.0.4.

extractColumnType() protected method

Extracts the data types for the given column

protected void extractColumnType ( $column, $dbType, $precision, $scale, $length )
$column yii\db\ColumnSchema
$dbType string

DB type

$precision string

Total number of digits. This parameter is available since version 2.0.4.

$scale string

Number of digits on the right of the decimal separator. This parameter is available since version 2.0.4.

$length string

Length for character types. This parameter is available since version 2.0.4.

findColumns() protected method

Collects the table column metadata.

protected boolean findColumns ( $table )
$table yii\db\TableSchema

The table schema

return boolean

Whether the table exists

findConstraints() protected method

Finds constraints and fills them into TableSchema object passed

protected void findConstraints ( $table )
$table yii\db\TableSchema

findSchemaNames() protected method

Returns all schema names in the database, including the default one but not system schemas.

This method should be overridden by child classes in order to support this feature because the default implementation simply throws an exception.

protected array findSchemaNames ( )
return array

All schema names in the database, except system schemas

throws yii\base\NotSupportedException

if this method is called

findTableNames() protected method

Returns all table names in the database.

This method should be overridden by child classes in order to support this feature because the default implementation simply throws an exception.

protected array findTableNames ( $schema = '' )
$schema string

The schema of the tables. Defaults to empty string, meaning the current or default schema.

return array

All table names in the database. The names have NO schema name prefix.

throws yii\base\NotSupportedException

if this method is called

findUniqueIndexes() public method (available since version 2.0.4)

Returns all unique indexes for the given table.

Each array element is of the following structure:

[
    'IndexName1' => ['col1' [, ...]],
    'IndexName2' => ['col2' [, ...]],
]
public array findUniqueIndexes ( $table )
$table yii\db\TableSchema

The table metadata

return array

All unique indexes for the given table.

getLastInsertID() public method

See also http://www.php.net/manual/en/function.PDO-lastInsertId.php -> Oracle does not support this Returns the ID of the last inserted row or sequence value.

public string getLastInsertID ( $sequenceName = '' )
$sequenceName string

Name of the sequence object (required by some DBMS)

return string

The row ID of the last row inserted, or the last value retrieved from the sequence object

throws yii\base\InvalidCallException

if the DB connection is not active

getTableSequenceName() protected method

Sequence name of table

protected string|null getTableSequenceName ( $tableName )
$tableName string
return string|null

Whether the sequence exists

init() public method

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

public void init ( )

insert() public method

Executes the INSERT command, returning primary key values.

public array|false insert ( $table, $columns )
$table string

The table that new rows will be inserted into.

$columns array

The column data (name => value) to be inserted into the table.

return array|false

Primary key values or false if the command fails

loadTableSchema() public method

Loads the metadata for the specified table.

public null|yii\db\TableSchema loadTableSchema ( $name )
$name string

Table name

return null|yii\db\TableSchema

DBMS-dependent table metadata, null if the table does not exist.

quoteSimpleTableName() public method

Quotes a simple table name for use in a query.

A simple table name should contain the table name only without any schema prefix. If the table name is already quoted, this method will do nothing.

public string quoteSimpleTableName ( $name )
$name string

Table name

return string

The properly quoted table name

releaseSavepoint() public method

Releases an existing savepoint.

public void releaseSavepoint ( $name )
$name string

The savepoint name

resolveTableNames() protected method

Resolves the table name and schema name (if any).

protected void resolveTableNames ( $table, $name )
$table yii\db\TableSchema

The table metadata object

$name string

The table name

© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-db-oci-schema.html