Checks if the DATA constant is declared and declares it if not
@return Table
351865
public function checkDATA() {
        if (!defined(DATA))
                define(DATA,
                    __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR);

        if (!is_dir(DATA)) mkdir(DATA, 0777, true);

        return $this;
    }
1092396
protected function checkForTranslatedTable() : bool
    {
        $main_table = $this->getStorageDescriptor();
        if (!nb_strEndsWith($this->table_name, NABU_LANG_TABLE_SUFFIX) &&
            $main_table->hasPrimaryConstraint() &&
            ($child_table = $this->db_syntax->describeStorage(
                $this->table_name . NABU_LANG_TABLE_SUFFIX, $this->schema_name)
            ) !== null &&
            $child_table->hasPrimaryConstraint() &&
            $child_table->getPrimaryConstraintSize() === $main_table->getPrimaryConstraintSize() + 1
        ) {
            $key_diff = array_diff(
                $child_table->getPrimaryConstraintFieldNames(),
                $main_table->getPrimaryConstraintFieldNames()
            );
            $this->is_translated = (count($key_diff) === 1 && array_shift($key_diff) === NABU_LANG_FIELD_ID);
        }

        return $this->is_translated;
    }
1268368
public static function getTable()
    {
        $attribute = 'table';

        if (!static::hasClassAttribute($attribute)) {
            $name = !isset(static::$table)
                ? static::getClassName()
                : static::$table;

            $conventionName = Functions::applyConventions(
                static::getClassConfig('table-name-conventions'),
                $name
            );

            $tableName = static::getDatabase()->getPrefix($conventionName);

            static::setClassAttribute($attribute, $tableName);
        }

        return static::getClassAttribute($attribute);
    }
1040602
private function Constant()
    {
        $identifier = $this->Identifier();

        if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) {
            list($className, $const) = explode('::', $identifier);

            $pos = strpos($className, '\\');
            $alias = (false === $pos) ? $className : substr($className, 0, $pos);
            $found = false;
            $loweredAlias = strtolower($alias);

            switch (true) {
                case !empty ($this->namespaces):
                    foreach ($this->namespaces as $ns) {
                        if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) {
                             $className = $ns.'\\'.$className;
                             $found = true;
                             break;
                        }
                    }
                    break;

                case isset($this->imports[$loweredAlias]):
                    $found     = true;
                    $className = (false !== $pos)
                        ? $this->imports[$loweredAlias] . substr($className, $pos)
                        : $this->imports[$loweredAlias];
                    break;

                default:
                    if(isset($this->imports['__NAMESPACE__'])) {
                        $ns = $this->imports['__NAMESPACE__'];

                        if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) {
                            $className = $ns.'\\'.$className;
                            $found = true;
                        }
                    }
                    break;
            }

            if ($found) {
                 $identifier = $className . '::' . $const;
            }
        }

        // checks if identifier ends with ::class, \strlen('::class') === 7
        $classPos = stripos($identifier, '::class');
        if ($classPos === strlen($identifier) - 7) {
            return substr($identifier, 0, $classPos);
        }

        if (!defined($identifier)) {
            throw AnnotationException::semanticalErrorConstants($identifier, $this->context);
        }

        return constant($identifier);
    }
399278
public boolean table() {
        boolean isTable = false;
        try {
            WebElement webElement = element.getWebElement();
            if ("table".equalsIgnoreCase(webElement.getTagName())) {
                isTable = true;
            }
        } catch (NoSuchElementException e) {
            log.info(e);
        }
        return isTable;
    }
1126905
protected function addConstants()
    {
        return $this->renderTemplate('tableMapConstants', [
            'className'         => $this->getClasspath(),
            'dbName'            => $this->getDatabase()->getName(),
            'tableName'         => $this->getTable()->getName(),
            'tablePhpName'      => $this->getTable()->isAbstract() ? '' : addslashes($this->getStubObjectBuilder()->getFullyQualifiedClassName()),
            'classPath'         => $this->getStubObjectBuilder()->getClasspath(),
            'nbColumns'         => $this->getTable()->getNumColumns(),
            'nbLazyLoadColumns' => $this->getTable()->getNumLazyLoadColumns(),
            'nbHydrateColumns'  => $this->getTable()->getNumColumns() - $this->getTable()->getNumLazyLoadColumns(),
            'columns'           => $this->getTable()->getColumns(),
            'stringFormat'      => $this->getTable()->getDefaultStringFormat(),
        ]);
    }
860571
function(constantsData) {
	var i;
	var registerName;
	try {
		for(i = 0; i < constantsData.registers.length; i++) {
			registerName = constantsData.registers[i].name;
			if(buffer_registers.indexOf(registerName) >= 0) {
				constantsData.registers[i].isBuffer = true;

				addMissingBufferRegisterInfoObject({
					'constantsData': constantsData,
					'location': 'registers',
					'index': i,
					'name': registerName,
				});
			}
		}
		for(i = 0; i < constantsData.registers_beta.length; i++) {
			registerName = constantsData.registers_beta[i].name;
			if(buffer_registers.indexOf(registerName) >= 0) {
				constantsData.registers_beta[i].isBuffer = true;

				addMissingBufferRegisterInfoObject({
					'constantsData': constantsData,
					'location': 'registers_beta',
					'index': i,
					'name': registerName,
				});
			}
		}
	} catch(err) {
		console.log('Error adding missing buffer register flags', err, i);
	}
	return constantsData;
}
222914
public function asDataTable()
    {
        $dataArray = $this->getDataArray();
        $dataArrayTwoLevels = $this->getDataArrayWithTwoLevels();

        $subtableByLabel = null;
        if (!empty($dataArrayTwoLevels)) {
            $subtableByLabel = array();
            foreach ($dataArrayTwoLevels as $label => $subTable) {
                $subtableByLabel[$label] = DataTable::makeFromIndexedArray($subTable);
            }
        }
        return DataTable::makeFromIndexedArray($dataArray, $subtableByLabel);
    }
568597
protected function createTableIfNeeded()
    {
        if ($this->tableExists) {
            return false;
        }

        if ($this->tableExist($this->tableName)) {
            $this->tableExists = true;
            return false;
        }

        $this->createTable();

        $this->tableExists = true;
        return true;
    }
991433
private function isTable(){
        try {
            if($table = $this->GetTable()){
                $sql = 'SHOW COLUMNS FROM '.$table;
                return $res = $this->query($sql)->all();
            }
        }catch(\Exception $e){
            echo $e->getMessage();
        }
        return false;
    }
1320257
public function showSchemaDefinitionInTable()
    {
        //change connection if provide
        if ($this->option('c')) {
            $this->schema->setConnection($this->option('c'));
            $this->schema->switchWrapper();
        }

        $tables = $this->schema->databaseWrapper->getTables();

        if (!count($tables)) {
            $this->warn('Database does not contain any table');
            return false;
        }

        $tableName = $this->option('t');
        if (empty($tableName)) {
            $this->warn('Table name is required!');
            return false;
        }

        if ($this->isNamespaceModel($tableName)) {
            $tableName = $this->tableNameFromModel($tableName);
        }

        if (!in_array($tableName, $tables)) {
            $this->warn('Table name is not correct!');
            return false;
        }

        $page = (!empty($this->option('p'))) ? $this->option('p') : 1;
        $limit = (!empty($this->option('l'))) ? $this->option('l') : 15;
        $orderBy = (!empty($this->option('o'))) ? $this->option('o') : null;
        $select = (!empty($this->option('s'))) ? $this->option('s') : null;
        $columns = $this->schema->databaseWrapper->getColumns($tableName);
        if (str_contains($select, ',')) {
            $selectedColumns = explode(',', $select);
        } else {
            $selectedColumns[] = $select;
        }

        $headers = [];
        foreach ($columns as $column) {
            foreach ($selectedColumns as $selected) {
                if (!$select) {
                    $headers[] = $column['Field'];
                } else {
                    if (($selected == $column['Field']))
                        $headers[] = $column['Field'];
                }
            }
        }
        $attributeName = null;
        $order = null;
        if (null !== $orderBy) {
            if (strpos($orderBy, ':') !== false) {
                $orderBy = explode(':', $orderBy);
            }
            $attributeName = $orderBy[0];
            if (isset($orderBy[1])) {
                $order = ('desc' == strtolower($orderBy[1])) ? 'DESC' : 'ASC';
            }
            if (!in_array($attributeName, $headers)) {
                $this->warn("There is no column named '$attributeName'. Please provide a correct column name for ordering!");
                return false;
            }
        }

        $rows = $this->schema->getPaginatedData($tableName, $page, $limit, $attributeName, $order)['data'];
        $body = $this->makeTableBody($headers, $rows);
        $rowsCount = $this->schema->getTableRowCount($tableName);
        $this->info($tableName . ' (rows ' . $rowsCount . ')');

        $this->table($headers, $body);
        return false;
    }
1251069
function &TableInfo()
	{
	global $_ADODB_ACTIVE_DBS;

		$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
		$table = $activedb->tables[$this->_tableat];
		return $table;
	}
295560
public function getTable()
    {
        if ($this->_table !== false)
        {
            if (!($this->_table instanceof KDatabaseTableInterface))
            {
                //Make sure we have a table identifier
                if (!($this->_table instanceof KObjectIdentifier)) {
                    $this->setTable($this->_table);
                }

                try {
                    $this->_table = $this->getObject($this->_table);
                } catch (RuntimeException $e) {
                    $this->_table = false;
                }
            }
        }

        return $this->_table;
    }
281427
private function getDataTypesDeclaration()
    {

        $arrayDeclaration = [];
        foreach( $this->entity->dataTypes as $name => $dataType ) {
            $arrayDeclaration[] = sprintf(
                "'%s' => %s,",
                $name,
                Php::varExport( $dataType->serialize() )
            );
        }

        $this->class->classComponents[] = new VariableDeclaration(
            'dataTypes',
            new SFormatf( <<<'PHP'
                /**
                 * Datatype information used by this entity. See, Bond\Entity\DataType
                 * @var array
                 */
                protected $dataTypes = [
%s
                ];
PHP
                , (new Format($arrayDeclaration))->indent(20)
            )
        );

    }
1319739
private function createRunTimeTable(): bool
    {
        $this->setRunTimeTable(new Table('runTime', self::TABLE_SIZE, $this->runTimeStruct));

        return $this->getRunTimeTable()->create();
    }
623184
public static function database_is_ready()
    {
        // Used for unit tests
        if (self::$force_database_is_ready !== null) {
            return self::$force_database_is_ready;
        }

        if (self::$database_is_ready) {
            return self::$database_is_ready;
        }

        $requiredClasses = ClassInfo::dataClassesFor(Member::class);
        $requiredClasses[] = Group::class;
        $requiredClasses[] = Permission::class;
        $schema = DataObject::getSchema();
        foreach ($requiredClasses as $class) {
            // Skip test classes, as not all test classes are scaffolded at once
            if (is_a($class, TestOnly::class, true)) {
                continue;
            }

            // if any of the tables aren't created in the database
            $table = $schema->tableName($class);
            if (!ClassInfo::hasTable($table)) {
                return false;
            }

            // HACK: DataExtensions aren't applied until a class is instantiated for
            // the first time, so create an instance here.
            singleton($class);

            // if any of the tables don't have all fields mapped as table columns
            $dbFields = DB::field_list($table);
            if (!$dbFields) {
                return false;
            }

            $objFields = $schema->databaseFields($class, false);
            $missingFields = array_diff_key($objFields, $dbFields);

            if ($missingFields) {
                return false;
            }
        }
        self::$database_is_ready = true;

        return true;
    }
889751
private function _const() {
    $node = new ConstantDeclarationStatementNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_CONST, $node);
    $declarations = new CommaListNode();
    do {
      $declarations->addChild($this->constDeclaration());
    } while ($this->tryMatch(',', $declarations));
    $node->addChild($declarations, 'declarations');
    $this->endStatement($node);
    return $node;
  }