.

DBTableDriverSwitch Class Reference
[DriverSwitch]

Change driver of given DBTable. More...

Inheritance diagram for DBTableDriverSwitch:
IDBTable

List of all members.

Public Member Functions

  __construct (IDBTable $table, $driver)
  Constructor.
  get_matching_relations (IDBTable $other)
  Returns relations between two tables.
  get_table_alias ()
  Returns alias of table, if any.
  get_table_alias_escaped ()
  Returns alias of table, if any - but escaped.
  get_table_constraints ()
  Returns array of constraints.
  get_table_driver ()
  Returns DB driver fro this table.
  get_table_field ($column)
  Returns field for given column.
  get_table_fields ()
  Returns array of columns.
  get_table_keys ()
  Returns array of keys.
  get_table_name ()
  Returns name of table.
  get_table_name_escaped ()
  Returns name of table, but escaped.
  get_table_relations ()
  Returns array of relations.

Static Public Member Functions

static  switch_table ($table_name, $driver)
  Switch given table to connection.

Protected Attributes

  $delegate
  $driver

Detailed Description

Change driver of given DBTable.

Author:
Gerd Riesselmann

Definition at line 8 of file dbtabledriverswitch.csl.php.


Constructor & Destructor Documentation

DBTableDriverSwitch::__construct ( IDBTable table,
driver  
)

Constructor.

Parameters:
IDBTable  $table The table
IDBDriver  $driver

Definition at line 28 of file dbtabledriverswitch.csl.php.

00028                                                               {
00029                 $this->delegate = $table;
00030                 $this->driver = $driver;
00031         }

Member Function Documentation

DBTableDriverSwitch::get_matching_relations ( IDBTable other  ) 

Returns relations between two tables.

Parameters:
IDBTable  $other
Returns:
array Array of IDBRelations

Implements IDBTable.

Definition at line 125 of file dbtabledriverswitch.csl.php.

00125                                                                 {
00126                 return $this->delegate->get_matching_relations($other);
00127         }
DBTableDriverSwitch::get_table_alias (  ) 

Returns alias of table, if any.

Returns:
string

Implements IDBTable.

Definition at line 60 of file dbtabledriverswitch.csl.php.

00060                                           {
00061                 return $this->delegate->get_table_alias();
00062         }
DBTableDriverSwitch::get_table_alias_escaped (  ) 

Returns alias of table, if any - but escaped.

Returns:
string

Implements IDBTable.

Definition at line 78 of file dbtabledriverswitch.csl.php.

00078                                                   {
00079                 return $this->delegate->get_table_alias_escaped();
00080         }       
DBTableDriverSwitch::get_table_constraints (  ) 

Returns array of constraints.

Returns:
array Array with IDBConstraint instance as value

Implements IDBTable.

Definition at line 134 of file dbtabledriverswitch.csl.php.

00134                                                 {
00135                 return $this->delegate->get_table_constraints();
00136         }
DBTableDriverSwitch::get_table_driver (  ) 

Returns DB driver fro this table.

Returns:
IDBDriver

Implements IDBTable.

Definition at line 143 of file dbtabledriverswitch.csl.php.

00143                                            {
00144                 return $this->driver;
00145         }               
DBTableDriverSwitch::get_table_field ( column  ) 

Returns field for given column.

Parameters:
string  $column Column name
Returns:
IDBField Either field or false if no such field exists

Implements IDBTable.

Definition at line 97 of file dbtabledriverswitch.csl.php.

00097                                                  {
00098                 return $this->delegate->get_table_field($column);
00099         }
DBTableDriverSwitch::get_table_fields (  ) 

Returns array of columns.

Returns:
array Associative array with column name as key and IDBField instance as value

Implements IDBTable.

Definition at line 87 of file dbtabledriverswitch.csl.php.

00087                                            {
00088                 return $this->delegate->get_table_fields();
00089         }
DBTableDriverSwitch::get_table_keys (  ) 

Returns array of keys.

Returns:
array Associative array with column name as key and IDField instance as value

Implements IDBTable.

Definition at line 106 of file dbtabledriverswitch.csl.php.

00106                                          {
00107                 return $this->delegate->get_table_keys();
00108         }
DBTableDriverSwitch::get_table_name (  ) 

Returns name of table.

Returns:
string

Implements IDBTable.

Definition at line 51 of file dbtabledriverswitch.csl.php.

00051                                          {
00052                 return $this->delegate->get_table_name();
00053         }
DBTableDriverSwitch::get_table_name_escaped (  ) 

Returns name of table, but escaped.

Returns:
string

Implements IDBTable.

Definition at line 69 of file dbtabledriverswitch.csl.php.

00069                                                  {
00070                 return $this->get_table_driver()->escape_database_entity($this->get_table_name(), IDBDriver::TABLE);
00071         }
DBTableDriverSwitch::get_table_relations (  ) 

Returns array of relations.

Returns:
array Array with IDBRelation instance as value

Implements IDBTable.

Definition at line 115 of file dbtabledriverswitch.csl.php.

00115                                               {
00116                 return $this->delegate->get_table_relations();
00117         }
static DBTableDriverSwitch::switch_table ( table_name,
driver  
) [static]

Switch given table to connection.

Parameters:
string  Table or model name
IDBDriver|string  Driver or driver name

Definition at line 39 of file dbtabledriverswitch.csl.php.

00039                                                                   {
00040                 DB::create($table_name);
00041                 $table = DBTableRepository::get($table_name);
00042                 $switched = new DBTableDriverSwitch($table, DB::get_connection($driver));
00043                 DBTableRepository::register($switched, $table_name);
00044         } 

Member Data Documentation

DBTableDriverSwitch::$delegate [protected]

Definition at line 14 of file dbtabledriverswitch.csl.php.

DBTableDriverSwitch::$driver [protected]

Definition at line 20 of file dbtabledriverswitch.csl.php.


The documentation for this class was generated from the following file: