Check table and data

@param Table $table
@throws \Exception       Throw when error found
489639
public function check(Table $table)
    {
        foreach ($table->getColumns() as $id => $params) {
            if (!isset($params['field_name']))
                throw new \Exception("No 'field_name' param for ID $id");
        }

        $backupAndOps = $this->andOps;

        $columns = $table->getColumns();
        $successfulFilters = [];
        foreach ($table->getFilters() as $column => $filters) {
            $successfulNames = [];
            foreach ($filters as $name => $value) {
                if ($this->buildFilter($columns[$column]['field_name'], $columns[$column]['type'], $name, $value))
                    $successfulNames[$name] = $value;
            }
            if (count($successfulNames) > 0)
                $successfulFilters[$column] = $successfulNames;
        }
        $table->setFilters($successfulFilters);

        $this->andOps = $backupAndOps;
    }
629163
protected function _isSearchable($table)
    {
        if ($table instanceof Table) {
            $table = App::shortName(get_class($table), 'Model/Table', 'Table');
            list(, $table) = pluginSplit($table);
        }

        try {
            $config = new ModuleConfig(ConfigType::MODULE(), $table);
            $result = (bool)$config->parse()->table->searchable;
        } catch (Exception $e) {
            $result = false;
        }

        return $result;
    }
349175
public function hasTable($table)
    {
        [$schema, $table] = $this->parseSchemaAndTable($table);

        $table = $this->connection->getTablePrefix().$table;

        return count($this->connection->select(
            $this->grammar->compileTableExists(), [$schema, $table]
        )) > 0;
    }
55601
@Then("^table '(.+?)' exists$")
    public void checkTable(String tableName) throws Exception {
        Statement myStatement = null;
        Connection myConnection = this.commonspec.getConnection();

        //query checks table existence, existence table name in system table  pg_tables
        String query = "SELECT * FROM pg_tables WHERE tablename = " + "\'" + tableName + "\'" + ";";
        try {
            myStatement = myConnection.createStatement();
            java.sql.ResultSet rs = myStatement.executeQuery(query);
            //if there are no data row
            if (rs.next() == false) {
                Assertions.assertThat(rs.next()).as("there are no table " + tableName).isTrue();
            } else {
                //data exist
                String resultTableName = rs.getString(2);
                assertThat(resultTableName).as("there are incorrect table name " + tableName).contains(tableName);
            }
            rs.close();
            myStatement.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
646464
protected function tableIgnored(string $table): bool
    {
        foreach ($this->ignoredTables as $ignoredTable) {
            if (preg_match("/^$ignoredTable\$/", $table)) {
                return true;
            }
        }

        return false;
    }
613590
protected function checkTable(string $table)
    {
        if (! property_exists($this, $table) || ! $this->$table instanceof Table) {
            throw new \InvalidArgumentException("Invalid table name: `{$table}`.");
        }
    }
1012445
public function setCurrentTable(Table $table)
    {
        $this->fieldsCacheFile = $this->fieldsCacheDir . DIRECTORY_SEPARATOR . '.table.' . $table->getFullTableName() . '.cache';

        if (file_exists($this->fieldsCacheFile)) {
            try {
                $this->fieldsCache = include $this->fieldsCacheFile;
                $this->fieldsCache = unserialize($this->fieldsCache);
            } catch (\Exception $e) {
                $this->fieldsCache = [];
            }
        }else if(!is_null($this->table) && $this->table->getTableName() !== $table->getTableName()) {
            $this->fieldsCache = [];
        }

        $this->table = $table;

        return $this;
    }
1114681
protected function validateTable($table)
    {
        $this->checkTableArgument($table);
        if (!$this->hasTable($table)) {
            throw new Exception\TableNotFoundException(__METHOD__ . ": Table '$table' does not exists in database '{$this->schema}'");
        }

        return $this;
    }
1094898
public function initialize(Table $table)
    {
        $this->table = $table;
        $this->table->setTableId($this->tableId);
    }
427071
public function loadTable($table)
    {
        $file = $this->path . '/' . $table . '.json';
        if (is_file($file)) {
            $data = file_get_contents($file);
            if (!$data) {
                return $this->blankTable();
            }

            if (!$data = @json_decode($data, true, 512)) {
                throw new Exception("Unable to parse table file '{$table}.json'");
            }

            return  $data;
        }

        return $this->blankTable();
    }
1230273
public function setControllerSource($table = null)
    {
        if (is_null($this->controller)) {
            throw $this->exception('Call setControllerData before');
        }
        $this->controller->setSource($this, $table);
    }
540650
public function equals(Table $table) {
        $prefix = $this->getName() . ': ';
        $errors = [];
        if($table->getName() !== $this->getName()) {
            throw new \Exception('Comparing Incomparable Tables');
        }
        if($table->getEngine() !== $this->getEngine()) {
            $errors[] = $prefix . 'Engine Does Not Match:' . "\n" . $table->getEngine() . "\n" . $this->getEngine();
        }
        if($table->getDefaultCharset() !== $this->getDefaultCharset()) {
            $errors[] = $prefix . 'Default Charset Does Not Match:' . "\n" . $table->getDefaultCharset() . "\n" . $this->getDefaultCharset();
        }
        if($table->getCollate() !== $this->getCollate()) {
            $errors[] = $prefix . 'Collate Does Not Match:' . "\n" . $table->getCollate() . "\n" . $this->getCollate();
        }
        $errors = array_merge($errors, $this->equalsLines($table, $prefix));
        $errors = array_merge($errors, $this->equalsKeys($table, $prefix));
        $errors = array_merge($errors, $this->equalsConstraints($table, $prefix));
        return $errors;
    }
1235809
public function iShouldSeeGivenCategories(TableNode $table)
    {
        foreach ($table as $row) {
            $found = array_filter(
                $this->categoryItems,
                function (CategoryListItem $categoryListItem) use ($row) {
                    return $categoryListItem->getName() == $row['name'];
                }
            );

            if (!$found) {
                throw new \Exception(sprintf('Category %s is not found', $row['name']));
            }
        }
    }
1331734
public function hasTable($table)
    {
        /** @var \Yajra\Oci8\Schema\Grammars\OracleGrammar $grammar */
        $grammar = $this->grammar;
        $sql     = $grammar->compileTableExists();

        $database = $this->connection->getConfig('username');
        if ($this->connection->getConfig('prefix_schema')) {
            $database = $this->connection->getConfig('prefix_schema');
        }
        $table = $this->connection->getTablePrefix() . $table;

        return count($this->connection->select($sql, [$database, $table])) > 0;
    }
1088754
public function setTable($table){

		//put this in try...catch block for better error handling
		try{

			//check if from is empty
			if ( empty($table)) 
			{
				//throw new exception
				throw new MySQLException("Invalid argument passed for table name", 1);

			}

		}

		//diplay error message
		catch(MySQLException $MySQLExceptionObject){

			//display error message
			$MySQLExceptionObject->errorShow();

		}		

		//set the protected $from value
		$this->froms = $table;
		if(!isset($this->fields[$table])) $this->fields[$table] = array("*");
		return $this;
			
	}
734572
protected function _loadBehavior(Table $table)
    {
        $behaviors = $table->behaviors();
        if (!Arr::in('Process', $behaviors->loaded())) {
            $behaviors->load('Core.Process');
        }
    }
408006
private function check_tables() {
		$tab = new AdminStoreTables();
		$tab::init($this);
		$force = $this->force_create_table;
		if ($tab::exists($force)) {
			if (!$force)
				$tab::upgrade();
			$tab::deinit();
			return;
		}
		$tab::install($this->expiration);
		$tab::deinit();
	}