/**
  *  获取表的字段
  * @param $tableName
  * @return array
  */
 public function getFieldsByTable($tableName)
 {
     $sql = "SHOW FULL COLUMNS FROM `{$tableName}`";
     $statement = $this->pdo->prepare($sql);
     $statement->execute();
     $data = $statement->fetchAll();
     if (!$data) {
         return array();
     }
     $fields = array();
     foreach ($data as $v) {
         $f = $v["field"];
         //字段名称
         $type = $v["type"];
         //字段类型
         $varType = "";
         //变量的类型
         if ($this->isInt($type)) {
             $varType = "int";
         } else {
             $varType = "string";
         }
         $information = array("type" => $varType, "name" => $f, "comment" => $v['comment']);
         $information["ispri"] = 0;
         if (strcmp(strtolower($v["key"]), "pri") === 0) {
             $information['ispri'] = 1;
         }
         $fields[] = $information;
     }
     return $fields;
 }