Class TDbMetaData

Description

Table meta data for Active Record.

TDbMetaData is the base class for database vendor specific that builds the appropriate database commands for active record finder and commit methods.

  • abstract:
  • since: 3.1
  • version: $Id: TDbMetaData.php 1606 2007-01-09 10:42:06Z wei $
  • author: Wei Zhuo <weizho[at]gmail[dot]com>

Located in /Data/ActiveRecord/Vendor/TDbMetaData.php (line 25)

TComponent
   |
   --TDbMetaData
Direct descendents
Class Description
TDbMetaDataCommon Common database command: insert, update, select and delete.
Method Summary
TDbMetaData __construct (string $table, array $cols, array $pk, [array $fk = array()], [mixed $view = false])
void bindArrayKeyValues (TDbCommand $command, array $keys, array $values)
void bindParameterValues (mixed $conn, mixed $command, mixed $parameters)
TDbCommand createBindedCommand (TDbConnection $conn, string $sql, array $names, array $values)
void getColumn (unknown_type $name)
array getColumns ()
void getCompositeKeysCriteria (TDbConnection $conn, array $values, string 2)
array getForeignKeys ()
void getInsertColumNames (mixed $columns)
void getInsertColumnValues (mixed $columns)
void getIsView ()
array getObjectKeyValues (array $keys, TActiveRecord $object)
array getPrimaryKeys ()
string getTableName ()
string getUpdateBindings (mixed $columns)
array postQuery (TDbDataReader $rows)
mixed postQueryRow (mixed $row)
string quoteTuple (TDbConnection $conn, array $array)
Methods
Constructor __construct (line 40)

Initialize the meta data.

  • access: public
TDbMetaData __construct (string $table, array $cols, array $pk, [array $fk = array()], [mixed $view = false])
  • string $table: table name
  • array $cols: name value pair of column meta data in the table
  • array $pk: primary key field names
  • array $fk: foriegn key field meta data.
bindArrayKeyValues (line 184)

Bind a list of variables in the command. The named parameters is taken from the values of the $keys parameter. The bind value is taken from the $values parameter using the index taken from the each value of $keys array.

  • access: protected
void bindArrayKeyValues (TDbCommand $command, array $keys, array $values)
  • TDbCommand $command: SQL database command
  • array $keys: named parameters
  • array $values: binding values (index should match that of $keys)
bindParameterValues (line 313)

Bind parameter values.

  • access: protected
void bindParameterValues (mixed $conn, mixed $command, mixed $parameters)
createBindedCommand (line 272)

Create a new database command based on the given $sql and bind the named parameters given by $names with values corresponding in $values.

  • return: binded command, ready for execution.
  • access: protected
TDbCommand createBindedCommand (TDbConnection $conn, string $sql, array $names, array $values)
  • TDbConnection $conn: database connection.
  • string $sql: SQL string.
  • array $names: named parameters
  • array $values: matching named parameter values
createCriteriaBindedCommand (line 288)

Creates a new database command and bind the values from the criteria object.

  • return: binded command.
  • access: protected
TDbCommand createCriteriaBindedCommand (TDbConnection $conn, string $sql, TActiveRecordCriteria $criteria)
getColumn (line 89)
  • access: public
void getColumn (unknown_type $name)
  • unknown_type $name
getColumns (line 81)
  • return: name value pair column meta data
  • access: public
array getColumns ()
getCompositeKeysCriteria (line 145)

Construct a "pk IN ('key1', 'key2', ...)" criteria.

  • access: protected
void getCompositeKeysCriteria (TDbConnection $conn, array $values, string 2)
  • string 2: SQL string for primary keys IN a list.
  • TDbConnection $conn: database connection.
  • array $values: values for IN predicate
getForeignKeys (line 73)
  • return: foreign key meta data.
  • access: public
array getForeignKeys ()
getInsertableColumns (line 214)

Gets the columns that can be inserted into the database.

  • return: name value pairs of fields to be added.
  • access: protected
array getInsertableColumns (TActiveRecord $record)
getInsertColumNames (line 329)

Gets the comma delimited string of fields name for insert command.

  • access: protected
void getInsertColumNames (mixed $columns)
getInsertColumnValues (line 340)

Gets the comma delimited string of name bindings for insert command.

  • access: protected
void getInsertColumnValues (mixed $columns)
getIsView (line 49)
  • access: public
void getIsView ()
getObjectKeyValues (line 201)

Returns a list of name value pairs from the object.

  • return: name value pairs.
  • access: protected
array getObjectKeyValues (array $keys, TActiveRecord $object)
  • array $keys: named parameters
  • TActiveRecord $object: record object
getPrimaryKeyCriteria (line 129)

Construct search criteria using primary key names

  • return: SQL string for used after WHERE statement.
  • access: protected
string getPrimaryKeyCriteria ()
getPrimaryKeys (line 65)
  • return: primary key field names.
  • access: public
array getPrimaryKeys ()
getSelectionColumns (line 117)
  • return: command separated list of all fields in the table, field names are quoted.
  • access: protected
string getSelectionColumns ()
getTableName (line 57)
  • return: table name
  • access: public
string getTableName ()
getUpdatableColumns (line 238)

Gets the columns that will be updated, it exculdes primary key columns and record properties that are null.

  • return: name value pairs of fields to be updated.
  • access: protected
array getUpdatableColumns (TActiveRecord $record)
getUpdateBindings (line 255)

Gets a comma delimited string of name parameters for update.

  • return: update named parameter string.
  • access: protected
string getUpdateBindings (mixed $columns)
postQuery (line 109)

Post process the rows after returning from a 1 row query.

  • return: post processed data.
  • access: public
array postQuery (TDbDataReader $rows)

Redefined in descendants as:
postQueryRow (line 99)

Post process the rows after returning from a 1 row query.

  • return: processed rows.
  • access: public
mixed postQueryRow (mixed $row)
  • mixed $row: row data, may be null.

Redefined in descendants as:
quoteTuple (line 168)
  • return: quoted recursive tuple values, e.g. "('val1', 'val2')".
  • access: protected
string quoteTuple (TDbConnection $conn, array $array)

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

Documentation generated on Sun, 14 Jan 2007 21:42:15 -0500 by phpDocumentor 1.3.0RC4