private function _getData() { if (isset($this->_data)) { return $this->_data; } $data = array(); $query = new CM_Db_Query_Describe($this->_client, $this->_table, $this->_column); $result = $query->execute(); $columns = $result->fetch(); if (false === $columns) { throw new CM_Db_Exception('Column `' . $this->_column . '` not found'); } foreach ($columns as $var => $value) { if ($var === 'Type') { if (preg_match("/^(\\w++)(?:\\((\\d+|'[^']*(?:''[^']*)*'(?:,'[^']*(?:''[^']*)*')*)\\))?(?: (\\w++))?\$/", $value, $matches)) { $data['type'] = $matches[1]; if (isset($matches[2])) { if (preg_match('/\\d+/', $matches[2])) { $data['size'] = (int) $matches[2]; } elseif (strlen($matches[2])) { preg_match_all("/,'([^']*(?:''[^']*)*)'/", ',' . $matches[2], $enumMatches); $data['enum'] = array_map(function ($value) { return str_replace("''", "'", $value); }, $enumMatches[1]); } } $data['unsigned'] = isset($matches[3]) && $matches[3] === 'unsigned'; } } else { $data[$var] = $value; } } return $data; }