3
* KumbiaPHP web & app Framework
7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://wiki.kumbiaphp.com/Licencia
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@kumbiaphp.com so we can send you a copy immediately.
15
* Clase que maneja los metadatos de las tablas
19
* @copyright Copyright (c) 2005-2009 Kumbia Team (http://www.kumbiaphp.com)
20
* @license http://wiki.kumbiaphp.com/Licencia New BSD License
24
* Clase que maneja los metadatos de las tablas
30
* Metadatos de la tabla
34
private $_metadata = null;
37
* Instancias de metadata
41
private static $_instances = array();
43
private function __construct()
49
* @param array $metadata
51
public function setMetadata($metadata)
53
$this->_metadata = $metadata;
57
* Obtiene la metadata de un campo especifico
59
* @param string $field nombre de campo
60
* @return array metadatos
62
public function getField($field)
64
if(!isset($this->_metadata[$field])) {
65
throw new KumbiaException("No existe la metadata para el campo $field");
68
return $this->_metadata[$field];
72
* Verifica si los metadatos estan cargados
76
public function isLoaded()
78
return !is_null($this->_metadata);
82
* Obtiene una instancia de la metadata para la tabla
84
* @param string $connection conexion a la bd
85
* @param string $schema esquema de tabla
86
* @param string $table nombre de tabla
87
* @return TableMetaData
89
public static function getInstance($connection, $schema, $table)
91
if(!isset(self::$_instances[$connection][$schema][$table])) {
92
self::$_instances[$connection][$schema][$table] = new self();
95
return self::$_instances[$connection][$schema][$table];
b'\\ No newline at end of file'