@param string $name

@return string Table alias.

@throws DBALException
517841
public function createRelationshipAlias(string $name): string
    {
        $relationshipType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
        switch ($relationshipType) {
            case RelationshipTypes::BELONGS_TO:
                list($targetColumn, $targetTable) =
                    $this->getModelSchemas()->getReversePrimaryKey($this->getModelClass(), $name);
                $targetAlias = $this->innerJoinOneTable(
                    $this->getAlias(),
                    $this->getModelSchemas()->getForeignKey($this->getModelClass(), $name),
                    $targetTable,
                    $targetColumn
                );
                break;

            case RelationshipTypes::HAS_MANY:
                list($targetColumn, $targetTable) =
                    $this->getModelSchemas()->getReverseForeignKey($this->getModelClass(), $name);
                $targetAlias = $this->innerJoinOneTable(
                    $this->getAlias(),
                    $this->getModelSchemas()->getPrimaryKey($this->getModelClass()),
                    $targetTable,
                    $targetColumn
                );
                break;

            case RelationshipTypes::BELONGS_TO_MANY:
            default:
                assert($relationshipType === RelationshipTypes::BELONGS_TO_MANY);
                $primaryKey = $this->getModelSchemas()->getPrimaryKey($this->getModelClass());
                list ($intermediateTable, $intermediatePk, $intermediateFk) =
                    $this->getModelSchemas()->getBelongsToManyRelationship($this->getModelClass(), $name);
                list($targetPrimaryKey, $targetTable) =
                    $this->getModelSchemas()->getReversePrimaryKey($this->getModelClass(), $name);

                $targetAlias = $this->innerJoinTwoSequentialTables(
                    $this->getAlias(),
                    $primaryKey,
                    $intermediateTable,
                    $intermediatePk,
                    $intermediateFk,
                    $targetTable,
                    $targetPrimaryKey
                );
                break;
        }

        return $targetAlias;
    }
856230
public function column(string $name): string
    {
        $name = \addcslashes($name, "'");
        $table = $this->getMetadata()->getTableName();

        return \sprintf("FIELD('%s', '%s', '%s')", $table, $this->getAlias(), $name);
    }
563965
public function getColumn($name, $alias = '')
    {
        $column = new DerivedColumn($name, $alias);

        return $column->setTable($this);
    }
404231
public function getTableAlias($table_name = null)
    {
        if (!$table_name) {
            $table_name = $this->getTableName();
        }
        $bits = explode("_", $table_name);
        $alias = '';
        foreach ($bits as $bit) {
            $alias .= strtolower(substr($bit, 0, 1));
        }
        return $alias;
    }
1243115
protected function parseName($name)
    {
        $tables = array_map('str_singular', $this->getSortedTableNames());
        $name = implode('', array_map('ucwords', $tables));
        $pieces = explode('_', $name);
        $name = implode('', array_map('ucwords', $pieces));

        return "Create{$name}PivotTable";
    }
527219
public function getSQLTableAlias($tableName, $dqlAlias = '')
    {
        $tableName .= $dqlAlias ? '@[' . $dqlAlias . ']' : '';

        if (! isset($this->tableAliasMap[$tableName])) {
            $this->tableAliasMap[$tableName] = 't' . $this->tableAliasCounter++;
        }

        return $this->tableAliasMap[$tableName];
    }
1193696
public static function table(string $tableName, string $alias = null): QueryBuilder
    {
        $query = new QueryBuilder();
        $query = $query->table($tableName, $alias);

        return $query;
    }
944816
protected function dbDropTable($name = '')
    {
        $result = Eresus_CMS::getLegacyKernel()->db->drop($this->__table($name));
        return $result;
    }
503309
public function getTableName($name)
    {
        if (isset($this->map[$name])) {
            return $this->map[$name]->getTable();
        }

        return null;
    }
1258184
private function getDatabase($name)
    {
        foreach ($this->getDataModels() as $dm) {
            foreach ($dm->getDatabases() as $db) {
                if ($db->getName() == $name) {
                    return $db;
                }
            }
        }
    }
1200714
public function getColumnRaw($name)
    {
        $results = [];
        foreach ($this->entities as $entity) {
            $results[] = $entity->getRaw($name);
        }

        return $results;
    }
896167
public function getColumn($name)
    {
        $results = [];
        foreach ($this->entities as $entity) {
            $results[] = $entity->get($name);
        }

        return $results;
    }
544022
public function getColumn($name)
    {
        if (!$this->hasColumn($name)) {
            throw SchemaException::tableColumnDoesNotExist($this->getName(), $name);
        }

        return $this->columns[$name];
    }
244137
public function alias($alias)
    {
        if (is_array($alias)) {
            foreach ($alias as $key => $val) {
                $this->options['alias'][$key] = $val;
            }
        } else {
            if (isset($this->options['table'])) {
                $table = is_array($this->options['table']) ? key($this->options['table']) : $this->options['table'];
                if (false !== strpos($table, '__')) {
                    $table = $this->parseSqlTable($table);
                }
            } else {
                $table = $this->getTable();
            }

            $this->options['alias'][$table] = $alias;
        }
        return $this;
    }
268143
public function setSQLTableAlias($tableName, $alias, $dqlAlias = '')
    {
        $tableName .= $dqlAlias ? '@[' . $dqlAlias . ']' : '';

        $this->tableAliasMap[$tableName] = $alias;

        return $alias;
    }
455485
public function getRule($name){
        
        $rule = DB::table($this->dbTablePrefix . $this->tableAuthRule)->where('name' , $name)->where('status' , '1')->find();
        
        return $rule;
    }
723397
protected function loadTable($name)
	{
		$table=new CMssqlTableSchema;
		$this->resolveTableNames($table,$name);
		//if (!in_array($table->name, $this->tableNames)) return null;
		$table->primaryKey=$this->findPrimaryKey($table);
		$table->foreignKeys=$this->findForeignKeys($table);
		if($this->findColumns($table))
		{
			return $table;
		}
		else
			return null;
	}