public function getFieldTable($id) { $tData = $this->getModel()->loadTable($id); if (!$tData) { return sprintf($this->_('%s no longer exists in the database.'), $id); } if (\Gems_Model_DbaModel::STATE_DEFINED == $tData['state']) { return sprintf($this->_('%s does not yet exist in the database.'), ucfirst($tData['type'])); } if ('table' !== $tData['type']) { return sprintf($this->_('%s object does exist.'), ucfirst($tData['type'])); } try { $table = new \Zend_DB_Table(array(\Zend_Db_Table_Abstract::NAME => $id, \Zend_Db_Table_Abstract::ADAPTER => $tData['db'])); $data = \MUtil_Lazy::repeat($table->info('metadata')); $html = new \MUtil_Html_TableElement($data); $html->addColumn($data->COLUMN_NAME, 'Column'); $html->addColumn($data->DATA_TYPE, 'Type'); $html->addColumn($data->LENGTH, 'Length'); $html->addColumn($data->SCALE, 'Precision'); $html->addColumn($data->UNSIGNED, 'Unsigned'); $html->addColumn($data->NULLABLE, 'Nullable'); $html->addColumn($data->DEFAULT, 'Default'); } catch (\Zend_Db_Table_Exception $zdte) { $html = $this->_('Object is not a table.'); } return $html; }
protected function loadTableMetaData() { try { $tableName = $this->_getSurveyTableName(); $table = new \Zend_DB_Table(array('name' => $tableName, 'db' => $this->lsDb)); $info = $table->info(); } catch (Exception $exc) { $info = array('metadata' => array()); } $this->tableMetaData = $info['metadata']; return $this->tableMetaData; }