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

  • since: 3.1
  • version: $Id: TMysqlMetaData.php 2008 2007-06-15 14:55:45Z xue $
  • author: Wei Zhuo <weizho[at]gmail[dot]com>

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 (mixed $type)
boolean isForeignKeyColumn (string $columnId, TPgsqlTableInfo $tableInfo)
boolean isPrecisionType (mixed $type)
void isValidIdentifier (string $name, boolean 1)
void processColumn (TMysqlTableInfo $tableInfo, array $col)
Methods
createNewTableInfo (line 188)
  • access: protected
TMysqlTableInfo createNewTableInfo (string $table, string 1)
  • string 1: table name.
  • string $table: table schema name
createTableInfo (line 47)

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 319)

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 238)

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 262)

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 210)

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.
  • access: protected
  • throws: TDbException if table or view does not exist.
boolean getIsView (string $schemaName, string $tableName)
  • string $schemaName: database name, null to use default connection database.
  • string $tableName: table or view name.
getSchemaTableName (line 158)
  • return: tuple ($schema,$table), $schema may be null.
  • access: protected
  • throws: TDbException when table name contains invalid identifier bytes.
array getSchemaTableName (string $table)
  • string $table: table name, may be quoted with back-ticks and may contain database name.
getServerVersion (line 69)
  • return: server version.
  • access: protected
float getServerVersion ()
getShowCreateTable (line 297)
  • return: SQL command to create the table.
  • access: protected
  • throws: TDbException if PHP version is less than 5.1.3
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 147)
  • return: true if column type if "enum" or "set".
  • access: protected
boolean isEnumSetType (mixed $type)
isForeignKeyColumn (line 343)
  • 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 136)
  • return: true if column type if "numeric", "interval" or begins with "time".
  • access: protected
boolean isPrecisionType (mixed $type)
isValidIdentifier (line 178)

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 85)
  • access: protected
void processColumn (TMysqlTableInfo $tableInfo, array $col)
  • TMysqlTableInfo $tableInfo: table information.
  • array $col: column information.

Inherited Methods

Inherited From TDbMetaData

TDbMetaData::__construct()
TDbMetaData::createCommandBuilder()
TDbMetaData::createTableInfo()
TDbMetaData::getDbConnection()
TDbMetaData::getInstance()
TDbMetaData::getTableInfo()
TDbMetaData::getTableInfoClass()

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::__get()
TComponent::__set()

Documentation generated on Mon, 21 Apr 2008 11:35:40 -0400 by phpDocumentor 1.3.0RC4