Check if table exists

@param string $table
@return bool
1944
public function hasTable($table)
    {
        $parts = explode('.', $table);
        if (count($parts) == 1) {
            $db = $this->db->getDbname();
            $table = $parts[0];
        } else {
            list($db, $table) = $parts;
        }

        $tableExistsSql = $this->checkTableSqls[$this->db->getDriver()];

        return (bool) $this->db->fetchColumn($tableExistsSql, array($db, $table));
    }
401870
function record_exists($table, $data) {
		if (!empty($this->prefix) && !(substr_count($table,$this->prefix) > 0)) {
			$table = $this->prefix."_".$table;
        }
		$pairs = array();
		foreach($data as $key => $value) {
			if (!is_numeric($value)) {
				$pairs[] = $this->encapsulate_column_name($key)." = '".$this->escape($value)."'";
			} else {
				$pairs[] = $this->encapsulate_column_name($key)." = $value";
			}
		}
		$where = implode(" AND ", $pairs);
		$records = $this->select("*",$table,$data);
		if ($records->num_rows > 0) {
			return $records;
		} else {
			return false;
		}
	}
646464
protected function tableIgnored(string $table): bool
    {
        foreach ($this->ignoredTables as $ignoredTable) {
            if (preg_match("/^$ignoredTable\$/", $table)) {
                return true;
            }
        }

        return false;
    }
810722
public function FieldExists($Table, $Field) {
      if (array_key_exists($Table, $this->_Schema)
         && is_array($this->_Schema[$Table])
         && array_key_exists($Field, $this->_Schema[$Table])
         && is_object($this->_Schema[$Table][$Field]))
         return TRUE;
      else
         return FALSE;
   }
165690
public function has_id_increment($table): bool
  {
    return ($model = $this->modelize($table)) &&
      isset($model['keys']['PRIMARY']) &&
      (\count($model['keys']['PRIMARY']['columns']) === 1) &&
      ($model['fields'][$model['keys']['PRIMARY']['columns'][0]]['extra'] === 'auto_increment');
  }
746051
protected function checkTable($table)
    {
        try {
            $this->Table = $this->loadModel($table);
        } catch (Exception $e) {
            $this->out(__('<error>' . $e->getMessage() . '</error>'));
            $this->_stop();
        }

        if (get_class($this->Table) === 'AppModel') {
            $this->out(__('<error>The table could not be found, instance of AppModel loaded.</error>'));
            $this->_stop();
        }

        if (!$this->Table->hasBehavior('Proffer')) {
            $out = __(
                "<error>The table '" . $this->Table->alias() .
                "' does not have the Proffer behavior attached.</error>"
            );
            $this->out($out);
            $this->_stop();
        }

        $config = $this->Table->behaviors()->Proffer->config();
        foreach ($config as $field => $settings) {
            if (!$this->Table->hasField($field)) {
                $out = __(
                    "<error>The table '" . $this->Table->alias() .
                    "' does not have the configured upload field in it's schema.</error>"
                );
                $this->out($out);
                $this->_stop();
            }
            if (!$this->Table->hasField($settings['dir'])) {
                $out = __(
                    "<error>The table '" . $this->Table->alias() .
                    "' does not have the configured dir field in it's schema.</error>"
                );
                $this->out($out);
                $this->_stop();
            }
        }

        if ($this->param('remove-behaviors')) {
            $removeBehaviors = explode(',', (string)$this->param('remove-behaviors'));
            foreach ($removeBehaviors as $removeBehavior) {
                $this->Table->removeBehavior($removeBehavior);
            }
        }
    }
251972
protected function tableExists($tableName) {
		if(isset($this->nonExistingTables[$tableName]))
			return false;
		if(isset($this->existingTables[$tableName]))
			return true;
		$exists = $this->schemaManager->tablesExist(array(
			$tableName 
		));
		if(!$exists) {
			$this->nonExistingTables[$tableName] = 1;
		} else {
			$this->existingTables[$tableName] = 1;
		}
		return $exists;
	}
306988
public function tableExists($table)
    {
        $result = $this->query("SHOW TABLES LIKE " . $this->pdo->quote($table));
        return $result->rowCount() > 0;
    }
41007
public function getTableDetail($table)
    {
        $tables = $this->getTableDetails();

        $table = $this->db->replacePrefix($table);

        if (!isset($tables[$table])) {
            return false;
        }

        return $tables[$table];
    }
1311857
def table_exists(self, table):
        
        if not self.dataset_exists(table.dataset):
            return False

        try:
            self.client.tables().get(projectId=table.project_id,
                                     datasetId=table.dataset_id,
                                     tableId=table.table_id).execute()
        except http.HttpError as ex:
            if ex.resp.status == 404:
                return False
            raise

        return True
810498
protected function detectRelationTable($table): bool
    {
        $foreignKeys = $table->getForeignKey();
        if (count($foreignKeys) != 2) {
            return false;
        }
        $tables = [];
        foreach ($foreignKeys as $foreignKey) {
            if (!$foreignKey->hasMany()) {
                return false;
            }
            $tables[] = $foreignKey->getReferenceTableName();
        }
        if ($table->getName() === implode('_', [singularize($tables[0]), $tables[1]])
            || $table->getName() === implode('_', [singularize($tables[1]), $tables[0]])) {
            return true;
        }

        return false;
    }
1156965
protected function checkTable(string $table)
    {
        if (!in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) {
            throw new InvalidArgumentException("Invalid table name: `{$table}`.");
        }
    }
661085
private function _tableExists() {

        // Try a select statement against the table
        // Run it in try/catch in case PDO is in ERRMODE_EXCEPTION.
        try {
            $result = mysqli_query($this->link,"SELECT 1 FROM $this->table_name LIMIT 1");
        } catch (\Exception $e) {
            // We got an exception == table not found
            return FALSE;
        }

        // Result is either boolean FALSE (no table found) or PDOStatement Object (table found)
        return $result !== FALSE;
    }
634170
function exists($table) {
		$mode=$this->pdo->getAttribute(\PDO::ATTR_ERRMODE);
		$this->pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_SILENT);
		$out=$this->pdo->
			query('SELECT 1 FROM '.$this->quotekey($table).' LIMIT 1');
		$this->pdo->setAttribute(\PDO::ATTR_ERRMODE,$mode);
		return is_object($out);
	}
1259289
public function isAutoIncrementsFor(Table $table)
    {
        $primaryKey = $table->getPrimaryKey();

        if ($primaryKey === null) {
            return false;
        }

        $pkColumns = $primaryKey->getColumns();

        if (count($pkColumns) !== 1) {
            return false;
        }

        $column = $table->getColumn($pkColumns[0]);

        if (! $column->getAutoincrement()) {
            return false;
        }

        $sequenceName      = $this->getShortestName($table->getNamespaceName());
        $tableName         = $table->getShortestName($table->getNamespaceName());
        $tableSequenceName = sprintf('%s_%s_seq', $tableName, $column->getShortestName($table->getNamespaceName()));

        return $tableSequenceName === $sequenceName;
    }
1247362
public function hasColumn($table, $column)
    {
        $column = strtolower($column);

        return in_array($column, array_map('strtolower', $this->getColumnListing($table)));
    }
925176
public function table_exists($table) {
        if (!is_string($table) and !($table instanceof xmldb_table)) {
            throw new ddl_exception('ddlunknownerror', NULL, 'incorrect table parameter!');
        }
        return $this->generator->table_exists($table);
    }