- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
TMysqlMetaData
TSqliteMetaData

Keyword

# Class TMysqlMetaData

    TComponent
       |
       --TDbMetaData
          |
          --TMysqlMetaData

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
Author: Wei Zhuo <weizho[at]gmail[dot]com>

Method Summary
protected TMysqlTableInfo | createNewTableInfo ( string $table, string 1)
protected TMysqlTableInfo | createTableInfo ( string $table) Get the column definitions for given table.
protected array | findForeignConstraints ( string $schemaName, string $tableName) Extract foreign key constraints by extracting the contraints from SHOW CREATE TABLE result.
protected array | getConstraintKeys ( string $schemaName, string $tableName) Gets the primary and foreign key column details for the given table.
protected array | getForeignConstraints ( string $schemaName, string $tableName) Gets foreign relationship constraint keys and table name
protected boolean | getIsView ( string $schemaName, string $tableName) 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
protected array | getSchemaTableName ( string $table)
protected float | getServerVersion ()
protected string | getShowCreateTable ( string $schemaName, string $tableName)
protected string | getTableInfoClass ()
protected boolean | isEnumSetType ( mixed $type)
protected boolean | isForeignKeyColumn ( string $columnId, TPgsqlTableInfo $tableInfo)
protected boolean | isPrecisionType ( mixed $type)
protected void | isValidIdentifier ( string $name, boolean 1) http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
protected void | processColumn ( TMysqlTableInfo $tableInfo, array $col)

Methods Inherited From TDbMetaData
TDbMetaData::createCommandBuilder(), TDbMetaData::getDbConnection(), TDbMetaData::getInstance(), TDbMetaData::getTableInfo(), TDbMetaData::getTableInfoClass()

Methods 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()

Method Details

## createNewTableInfo

protected TMysqlTableInfo createNewTableInfo | (string $table , string 1 )

Input
string | $table | table schema name
string | 1 | table name.
Output
Exception

## createTableInfo

protected TMysqlTableInfo createTableInfo | (string $table )

Get the column definitions for given table.

Input
string | $table | table name.
Output
TMysqlTableInfo | table information.
Exception

## findForeignConstraints

protected array findForeignConstraints | (string $schemaName , string $tableName )

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

Input
string | $schemaName | database name
string | $tableName | table name
Output
array | foreign relationship table name and keys.
Exception

## getConstraintKeys

protected array getConstraintKeys | (string $schemaName , string $tableName )

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

Input
string | $schemaName | schema name
string | $tableName | table name.
Output
array | tuple ($primary, $foreign)
Exception

## getForeignConstraints

protected array getForeignConstraints | (string $schemaName , string $tableName )

Gets foreign relationship constraint keys and table name

Input
string | $schemaName | database name
string | $tableName | table name
Output
array | foreign relationship table name and keys.
Exception

## getIsView

protected boolean getIsView | (string $schemaName , string $tableName )

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.

Input
string | $schemaName | database name, null to use default connection database.
string | $tableName | table or view name.
Output
boolean | true if is view, false otherwise.
Exception
throws | TDbException if table or view does not exist.

## getSchemaTableName

protected array getSchemaTableName | (string $table )

Input
string | $table | table name, may be quoted with back-ticks and may contain database name.
Output
array | tuple ($schema,$table), $schema may be null.
Exception
throws | TDbException when table name contains invalid identifier bytes.

## getServerVersion

protected float getServerVersion | ()

Output
float | server version.
Exception

## getShowCreateTable

protected string getShowCreateTable | (string $schemaName , string $tableName )

Input
string | $schemaName | database name
string | $tableName | table name
Output
string | SQL command to create the table.
Exception
throws | TDbException if PHP version is less than 5.1.3

## getTableInfoClass

protected string getTableInfoClass | ()

Output
string | TDbTableInfo class name.
Exception

## isEnumSetType

protected boolean isEnumSetType | (mixed $type )

Input
mixed | $type |
Output
boolean | true if column type if "enum" or "set".
Exception

## isForeignKeyColumn

protected boolean isForeignKeyColumn | (string $columnId , TPgsqlTableInfo $tableInfo )

Input
string | $columnId | column name.
TPgsqlTableInfo | $tableInfo | table information.
Output
boolean | true if column is a foreign key.
Exception

## isPrecisionType

protected boolean isPrecisionType | (mixed $type )

Input
mixed | $type |
Output
boolean | true if column type if "numeric", "interval" or begins with "time".
Exception

## isValidIdentifier

protected void isValidIdentifier | (string $name , boolean 1 )

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

Input
string | $name | identifier name
boolean | 1 | true if valid identifier.
Output
Exception

## processColumn

protected void processColumn | (TMysqlTableInfo $tableInfo , array $col )

Input
TMysqlTableInfo | $tableInfo | table information.
array | $col | column information.
Output
Exception