public function getFields($tableName)
{
$result = $this->query('SHOW COLUMNS FROM ' . $tableName);
$info = array();
if ($result) {
foreach ($result as $key => $val) {
$info[$val['Field']] = array('name' => $val['Field'], 'type' => $val['Type'], 'notnull' => (bool) ($val['Null'] === ''), 'default' => $val['Default'], 'primary' => strtolower($val['Key']) == 'pri', 'autoinc' => strtolower($val['Extra']) == 'auto_increment');
}
}
return $info;
}