DbSql::ExistTable PHP Method

ExistTable() public method

检查表是否存在,返回SQL语句
public ExistTable ( string $table, string $dbname = '' ) : string
$table string
$dbname string
return string
    public function ExistTable($table, $dbname = '')
    {
        return $this->get()->exist($table, $dbname)->sql;
    }

Usage Example

Example #1
0
 /**
  * @param $table
  */
 function ExistTable($table)
 {
     $a = $this->Query($this->sql->ExistTable($table));
     if (!is_array($a)) {
         return false;
     }
     $b = current($a);
     if (!is_array($b)) {
         return false;
     }
     $c = (int) current($b);
     if ($c > 0) {
         return true;
     } else {
         return false;
     }
 }