Exemplo n.º 1
0
function IIF($exp, $val)
{
    return IFF($exp, $exp, $val);
}
Exemplo n.º 2
0
 private function generateTable($tableName)
 {
     $fields = M()->query('SHOW FULL COLUMNS FROM ' . $tableName);
     foreach ($fields as $key => $value) {
         $rows[] = array($value['field'], $value['type'], IFF($value["null"] == "YES", "是", "否"), IFF($value["key"] == "PRI", "是"), $value['default'], IFF($value["extra"] == "auto_increment", "是"), $value['comment']);
     }
     $this->headers = array('字段', '类型', '允许空值', '主键', '默认值', '自动递增', '注释');
     $this->aligns = array(1, 1, 2, 2, 2, 2, 1);
     $this->rows = $rows;
     return $this->generate();
 }
Exemplo n.º 3
0
 public function generate($tableName = '', $comment, $out)
 {
     // $this->crossingChar = '|';
     $out_array = array();
     $output = '';
     if ($tableName) {
         $output .= $comment . "(" . substr($tableName, strlen(C('DB_PREFIX'))) . ")" . PHP_EOL;
         $rows = array();
         $array = M()->query('SHOW FULL COLUMNS FROM ' . $tableName);
         foreach ($array as $key => $value) {
             $rows[] = array($value['field'], $value['type'], IFF($value["null"] == "YES", "是", "否"), IFF($value["key"] == "PRI", "是"), $value['default'], IFF($value["extra"] == "auto_increment", "是"), $value['comment']);
         }
         $this->headers = array('字段', '类型', '允许空值', '主键', '默认值', '自动递增', '注释');
         $this->rows = $rows;
         return $this->renderWitoutHeadTail($output, $out);
     }
     //echo PHP_EOL;
 }