Overview

Packages

  • Db
    • Adapter
    • Migration

Classes

  • Horde_Db_Adapter_Base
  • Horde_Db_Adapter_Base_Column
  • Horde_Db_Adapter_Base_ColumnDefinition
  • Horde_Db_Adapter_Base_Index
  • Horde_Db_Adapter_Base_Schema
  • Horde_Db_Adapter_Base_Table
  • Horde_Db_Adapter_Base_TableDefinition
  • Horde_Db_Adapter_Mysql
  • Horde_Db_Adapter_Mysql_Column
  • Horde_Db_Adapter_Mysql_Result
  • Horde_Db_Adapter_Mysql_Schema
  • Horde_Db_Adapter_Mysqli
  • Horde_Db_Adapter_Mysqli_Result
  • Horde_Db_Adapter_Pdo_Base
  • Horde_Db_Adapter_Pdo_Mysql
  • Horde_Db_Adapter_Pdo_Pgsql
  • Horde_Db_Adapter_Pdo_Sqlite
  • Horde_Db_Adapter_Postgresql_Column
  • Horde_Db_Adapter_Postgresql_Schema
  • Horde_Db_Adapter_SplitRead
  • Horde_Db_Adapter_Sqlite_Column
  • Horde_Db_Adapter_Sqlite_Schema

Interfaces

  • Horde_Db_Adapter
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Copyright 2007 Maintainable Software, LLC
  4:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
  5:  *
  6:  * @author     Mike Naberezny <mike@maintainable.com>
  7:  * @author     Derek DeVries <derek@maintainable.com>
  8:  * @author     Chuck Hagenbuch <chuck@horde.org>
  9:  * @license    http://www.horde.org/licenses/bsd
 10:  * @category   Horde
 11:  * @package    Db
 12:  * @subpackage Adapter
 13:  */
 14: 
 15: /**
 16:  * @author     Mike Naberezny <mike@maintainable.com>
 17:  * @author     Derek DeVries <derek@maintainable.com>
 18:  * @author     Chuck Hagenbuch <chuck@horde.org>
 19:  * @license    http://www.horde.org/licenses/bsd
 20:  * @category   Horde
 21:  * @package    Db
 22:  * @subpackage Adapter
 23:  */
 24: class Horde_Db_Adapter_Base_Table implements ArrayAccess, IteratorAggregate
 25: {
 26:     /**
 27:      * The table's name.
 28:      *
 29:      * @var string
 30:      */
 31:     protected $_name;
 32:     protected $_primaryKey;
 33:     protected $_columns;
 34:     protected $_indexes;
 35: 
 36: 
 37:     /*##########################################################################
 38:     # Construct/Destruct
 39:     ##########################################################################*/
 40: 
 41:     /**
 42:      * Constructor.
 43:      *
 44:      * @param string $name  The table's name.
 45:      */
 46:     public function __construct($name, $primaryKey, $columns, $indexes)
 47:     {
 48:         $this->_name       = $name;
 49:         $this->_primaryKey = $primaryKey;
 50:         $this->_columns    = $columns;
 51:         $this->_indexes    = $indexes;
 52:     }
 53: 
 54: 
 55:     /*##########################################################################
 56:     # Accessor
 57:     ##########################################################################*/
 58: 
 59:     /**
 60:      * @return  string
 61:      */
 62:     public function getName()
 63:     {
 64:         return $this->_name;
 65:     }
 66: 
 67:     /**
 68:      * @return  mixed
 69:      */
 70:     public function getPrimaryKey()
 71:     {
 72:         return $this->_primaryKey;
 73:     }
 74: 
 75:     /**
 76:      * @return  array
 77:      */
 78:     public function getColumns()
 79:     {
 80:         return $this->_columns;
 81:     }
 82: 
 83:     /**
 84:      * @return  Horde_Db_Adapter_Base_Column
 85:      */
 86:     public function getColumn($column)
 87:     {
 88:         return isset($this->_columns[$column]) ? $this->_columns[$column] : null;
 89:     }
 90: 
 91:     /**
 92:      * @return  array
 93:      */
 94:     public function getColumnNames()
 95:     {
 96:         $names = array();
 97:         foreach ($this->_columns as $column) {
 98:             $names[] = $column->getName();
 99:         }
100:         return $names;
101:     }
102: 
103:     /**
104:      * @return  array
105:      */
106:     public function getIndexes()
107:     {
108:         return $this->_indexes;
109:     }
110: 
111:     /**
112:      * @return  array
113:      */
114:     public function getIndexNames()
115:     {
116:         $names = array();
117:         foreach ($this->_indexes as $index) {
118:             $names[] = $index->getName();
119:         }
120:         return $names;
121:     }
122: 
123: 
124:     /*##########################################################################
125:     # Object composition
126:     ##########################################################################*/
127: 
128:     public function __get($key)
129:     {
130:         return $this->getColumn($key);
131:     }
132: 
133:     public function __isset($key)
134:     {
135:         return isset($this->_columns[$key]);
136:     }
137: 
138: 
139:     /*##########################################################################
140:     # ArrayAccess
141:     ##########################################################################*/
142: 
143:     /**
144:      * ArrayAccess: Check if the given offset exists
145:      *
146:      * @param   int     $offset
147:      * @return  boolean
148:      */
149:     public function offsetExists($offset)
150:     {
151:         return isset($this->_columns[$offset]);
152:     }
153: 
154:     /**
155:      * ArrayAccess: Return the value for the given offset.
156:      *
157:      * @param   int     $offset
158:      * @return  object  {@link {@Horde_Db_Adapter_Base_ColumnDefinition}
159:      */
160:     public function offsetGet($offset)
161:     {
162:         return $this->getColumn($offset);
163:     }
164: 
165:     /**
166:      * ArrayAccess: Set value for given offset
167:      *
168:      * @param   int     $offset
169:      * @param   mixed   $value
170:      */
171:     public function offsetSet($offset, $value)
172:     {
173:     }
174: 
175:     /**
176:      * ArrayAccess: remove element
177:      *
178:      * @param   int     $offset
179:      */
180:     public function offsetUnset($offset)
181:     {
182:     }
183: 
184: 
185:     /*##########################################################################
186:     # IteratorAggregate
187:     ##########################################################################*/
188: 
189:     public function getIterator()
190:     {
191:         return new ArrayIterator($this->_columns);
192:     }
193: 
194: 
195:     /*##########################################################################
196:     # Protected
197:     ##########################################################################*/
198: 
199: }
200: 
API documentation generated by ApiGen