/** * Function to get the name and type of the columns of a table * * @return array */ public function getNameAndTypeOfTheColumns() { $columns = array(); foreach ($this->_dbi->getColumnsFull($this->_db_name, $this->_name) as $row) { if (preg_match('@^(set|enum)\\((.+)\\)$@i', $row['Type'], $tmp)) { $tmp[2] = mb_substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); $columns[$row['Field']] = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; } else { $columns[$row['Field']] = $row['Type']; } } return $columns; }