Class TMysqlMetaData

Description

TMysqlMetaData loads Mysql version 4.1.x and 5.x database table and column information.

For Mysql version 4.1.x, PHP 5.1.3 or later is required. See http://netevil.org/node.php?nid=795&SC=1

  • author: Wei Zhuo <weizho[at]gmail[dot]com>
  • version: $Id: TMysqlMetaData.php 3062 2011-11-12 16:12:40Z ctrlaltca@gmail.com $
  • since: 3.1

Located in /Data/Common/Mysql/TMysqlMetaData.php (line 30)

TComponent
   |
   --TDbMetaData
      |
      --TMysqlMetaData
Method Summary
TMysqlTableInfo createNewTableInfo (string $table, string 1)
TMysqlTableInfo createTableInfo (string $table)
array findForeignConstraints (string $schemaName, string $tableName)
array getConstraintKeys (string $schemaName, string $tableName)
array getForeignConstraints (string $schemaName, string $tableName)
boolean getIsView (string $schemaName, string $tableName)
array getSchemaTableName (string $table)
float getServerVersion ()
string getShowCreateTable (string $schemaName, string $tableName)
string getTableInfoClass ()
boolean isEnumSetType ( $type)
boolean isForeignKeyColumn (string $columnId, TPgsqlTableInfo $tableInfo)
boolean isPrecisionType ( $type)
void isValidIdentifier (string $name, boolean 1)
void processColumn (TMysqlTableInfo $tableInfo, array $col)
string quoteColumnAlias (string $name)
string quoteColumnName (string $name)
string quoteTableName (string $name)
Variables

Inherited Variables

Inherited from TDbMetaData

TDbMetaData::$delimiterIdentifier
Methods
createNewTableInfo (line 218)
  • access: protected
TMysqlTableInfo createNewTableInfo (string $table, string 1)
  • string 1: table name.
  • string $table: table schema name
createTableInfo (line 77)

Get the column definitions for given table.

  • return: table information.
  • access: protected
TMysqlTableInfo createTableInfo (string $table)
  • string $table: table name.

Redefinition of:
TDbMetaData::createTableInfo()
This method should be implemented by decendent classes.
findForeignConstraints (line 352)

Extract foreign key constraints by extracting the contraints from SHOW CREATE TABLE result.

  • return: foreign relationship table name and keys.
  • access: protected
array findForeignConstraints (string $schemaName, string $tableName)
  • string $schemaName: database name
  • string $tableName: table name
getConstraintKeys (line 268)

Gets the primary and foreign key column details for the given table.

  • return: tuple ($primary, $foreign)
  • access: protected
array getConstraintKeys (string $schemaName, string $tableName)
  • string $schemaName: schema name
  • string $tableName: table name.
getForeignConstraints (line 294)

Gets foreign relationship constraint keys and table name

  • return: foreign relationship table name and keys.
  • access: protected
array getForeignConstraints (string $schemaName, string $tableName)
  • string $schemaName: database name
  • string $tableName: table name
getIsView (line 240)

For MySQL version 5.0.1 or later we can use SHOW FULL TABLES http://dev.mysql.com/doc/refman/5.0/en/show-tables.html

For MySQL version 5.0.1 or ealier, this always return false.

  • return: true if is view, false otherwise.
  • throws: TDbException if table or view does not exist.
  • access: protected
boolean getIsView (string $schemaName, string $tableName)
  • string $schemaName: database name, null to use default connection database.
  • string $tableName: table or view name.
getSchemaTableName (line 188)
  • return: tuple ($schema,$table), $schema may be null.
  • throws: TDbException when table name contains invalid identifier bytes.
  • access: protected
array getSchemaTableName (string $table)
  • string $table: table name, may be quoted with back-ticks and may contain database name.
getServerVersion (line 99)
  • return: server version.
  • access: protected
float getServerVersion ()
getShowCreateTable (line 330)
  • return: SQL command to create the table.
  • throws: TDbException if PHP version is less than 5.1.3
  • access: protected
string getShowCreateTable (string $schemaName, string $tableName)
  • string $schemaName: database name
  • string $tableName: table name
getTableInfoClass (line 37)
  • return: TDbTableInfo class name.
  • access: protected
string getTableInfoClass ()

Redefinition of:
TDbMetaData::getTableInfoClass()
isEnumSetType (line 177)
  • return: true if column type if "enum" or "set".
  • access: protected
boolean isEnumSetType ( $type)
  • $type
isForeignKeyColumn (line 376)
  • return: true if column is a foreign key.
  • access: protected
boolean isForeignKeyColumn (string $columnId, TPgsqlTableInfo $tableInfo)
  • string $columnId: column name.
  • TPgsqlTableInfo $tableInfo: table information.
isPrecisionType (line 166)
  • return: true if column type if "numeric", "interval" or begins with "time".
  • access: protected
boolean isPrecisionType ( $type)
  • $type
isValidIdentifier (line 208)

http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

  • access: protected
void isValidIdentifier (string $name, boolean 1)
  • boolean 1: true if valid identifier.
  • string $name: identifier name
processColumn (line 115)
  • access: protected
void processColumn (TMysqlTableInfo $tableInfo, array $col)
  • TMysqlTableInfo $tableInfo: table information.
  • array $col: column information.
quoteColumnAlias (line 67)

Quotes a column alias for use in a query.

  • return: the properly quoted column alias
  • access: public
string quoteColumnAlias (string $name)
  • string $name: column alias

Redefinition of:
TDbMetaData::quoteColumnAlias()
Quotes a column alias for use in a query.
quoteColumnName (line 57)

Quotes a column name for use in a query.

  • return: the properly quoted column name
  • access: public
string quoteColumnName (string $name)
  • string $name: column name

Redefinition of:
TDbMetaData::quoteColumnName()
Quotes a column name for use in a query.
quoteTableName (line 47)

Quotes a table name for use in a query.

  • return: the properly quoted table name
  • access: public
string quoteTableName (string $name)
  • string $name: table name

Redefinition of:
TDbMetaData::quoteTableName()
Quotes a table name for use in a query.

Inherited Methods

Inherited From TDbMetaData

TDbMetaData::__construct()
TDbMetaData::createCommandBuilder()
TDbMetaData::createTableInfo()
TDbMetaData::getDbConnection()
TDbMetaData::getInstance()
TDbMetaData::getTableInfo()
TDbMetaData::getTableInfoClass()
TDbMetaData::quoteColumnAlias()
TDbMetaData::quoteColumnName()
TDbMetaData::quoteTableName()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:38:45 +0200 by phpDocumentor 1.4.3