Derive maximum identifier length from doctrine DBAL

@return integer
436806
protected function getMaxIdentifierLength()
    {
        if ($this->tableNameLengthLimit === null) {
            $this->tableNameLengthLimit = $this->entityManager->getConnection()->getDatabasePlatform()->getMaxIdentifierLength();
        }

        return $this->tableNameLengthLimit;
    }
986457
protected function getUidOfLastTopLevelPage(): int
    {
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
        $lastPage = $queryBuilder->select('uid')
            ->from('pages')
            ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)))
            ->orderBy('sorting', 'DESC')
            ->execute()
            ->fetchColumn(0);
        $uid = 0;
        if (MathUtility::canBeInterpretedAsInteger($lastPage) && $lastPage > 0) {
            $uid = (int)$lastPage;
        }
        return $uid;
    }
446715
public function getMaximalDistance()
    {
        $oneSize = mb_strlen($this->compOne, 'UTF-8');
        $twoSize = mb_strlen($this->compTwo, 'UTF-8');

        // Is substitution cheaper that delete + insert?
        $subCost = min($this->subCost, $this->delCost + $this->insCost);

        // Get common size
        $minSize = min($oneSize, $twoSize);
        $maxSize = max($oneSize, $twoSize);
        $extraSize = $maxSize - $minSize;

        // On common size perform substitution / delete + insert, what is cheaper
        $maxCost = $subCost * $minSize;

        // On resulting do insert/delete
        if ($oneSize > $twoSize) {
            // Delete extra characters
            $maxCost += $extraSize * $this->delCost;
        } else {
            // Insert extra characters
            $maxCost += $extraSize * $this->insCost;
        }

        return $maxCost;
    }
57973
private function getMaxFileSize(): int
    {
        $validatorConfiguration = $this->assetMapper
            ->getAssetFieldDefinition()
            ->getValidatorConfiguration();

        $maxFileSize = $validatorConfiguration['FileSizeValidator']['maxFileSize'];
        if ($maxFileSize > 0) {
            return min($maxFileSize * 1024 * 1024, $this->maxUploadSize->get());
        }

        return $this->maxUploadSize->get();
    }
1325466
public function getCurrentId()
    {
        $sql   = 'SELECT value FROM ' . $this->table . ' WHERE name = ?';

        $id = $this->db->fetchOne($sql, array($this->name));

        if (!empty($id) || '0' === $id || 0 === $id) {
            return (int) $id;
        }
    }
111465
protected function buildLimit() {
		if(!$this->limit && !$this->offset)
			return '';

		$driver = $this->db->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME);
		if($driver === 'pgsql') {
			$limit = '';
			if($this->limit)
				$limit .= "\n".'LIMIT '.$this->limit;
			if($this->offset)
				$limit .= "\n".'OFFSET '.$this->offset;
		}
		else {
			$limit = "\n".'LIMIT ';
			if($this->offset) {
				$limit .= $this->offset;
				if($this->limit)
					$limit .= ', '.$this->limit;
				else
					$limit .= ', '.PHP_INT_MAX;
			}
			else
				$limit .= $this->limit;
		}

		return $limit;
	}
341262
public function getAsManualSqlColumn()
    {
        if ($this->strTableName) {
            return $this->strTableName . '.' . $this->strName;
        } else {
            if (($this->objParentNode) && ($this->objParentNode->strTableName)) {
                return $this->objParentNode->strTableName . '.' . $this->strName;
            } else {
                return $this->strName;
            }
        }
    }
774677
private function _prepareLimit()
	{
		$sQuery = '';
		$limit = (int) $this->_iLimit;
		$iOffset = $this->_iOffset;

		if($limit != 0 || $iOffset > 0) { $sQuery .= ' LIMIT '; }

		if($iOffset > 0) { $sQuery .= $iOffset.', '.$limit; }
		else if($limit != 0) { $sQuery .= $limit.' '; }

		return $sQuery;
	}
775927
public function getLastInsertDocumentId($entity)
    {
        $metaInformation = $this->metaInformationFactory->loadInformation($entity);

        /** @var Query $select */
        $select = $this->solariumClient->createQuery(SolariumClient::QUERY_SELECT);
        $select->setQuery(sprintf('id:%s*', $metaInformation->getDocumentKey()));
        $select->setRows($this->getNumberOfDocuments($metaInformation->getDocumentName()));
        $select->addFields(array('id'));

        $result = $this->solariumClient->select($select);

        if ($result->count() == 0) {
            return 0;
        }

        $ids = array_map(function ($document) {
            return substr($document->id, stripos($document->id, '_') + 1);
        }, $result->getIterator()->getArrayCopy());

        return intval(max($ids));
    }
3102
public function getMaxDepth()
    {
        if (0 === func_num_args() || func_get_arg(0)) {
            @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::isMaxDepthEnabled() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
        }

        return $this->maxDepth;
    }
858176
public function getUsedLength(): int
    {
        $maxLength = 0;

        /** @var PackedItem $item */
        foreach ($this->items as $item) {
            $maxLength = max($maxLength, $item->getY() + $item->getLength());
        }

        return $maxLength;
    }
624384
public function getIdStringAttribute()
    {
        $key = $this->getKeyName();
        return (property_exists($this, 'uuidOptimization') && $this::$uuidOptimization)
            ? self::toNormal($this->attributes[$key]) : bin2hex($this->attributes[$key]);
    }
214156
protected function getMaxOrdering()
    {
        $table  = $this->getTable();
        $db     = $table->getAdapter();
        
        $query = $this->getObject('lib:database.query.select')
            ->columns('MAX(ordering)')
            ->table($table->getName());

        $this->_buildQueryWhere($query);

        return (int) $db->select($query, KDatabase::FETCH_FIELD);
    }
1082374
public function getCurrentMaxLangId()
    {
        if (isset($this->_iCurrentMaxLangId)) {
            return $this->_iCurrentMaxLangId;
        }

        $table = $tableSet = "oxarticles";
        $field = $fieldSet = "oxtitle";
        $lang = 0;
        while ($this->tableExists($tableSet) && $this->fieldExists($fieldSet, $tableSet)) {
            $lang++;
            $tableSet = getLangTableName($table, $lang);
            $fieldSet = $field . '_' . $lang;
        }

        return $this->_iCurrentMaxLangId = --$lang;
    }
1334791
protected function generateId(): int
    {
        if ($this->getId() !== null) {
            return $this->getId();
        }

        $maxIdLength = \mb_strlen((string) PHP_INT_MAX) - 1;

        // try generate unique id for file
        $id = mb_substr(crc32($this->getModelId()), $maxIdLength - self::ID_PATH_HASH_LENGTH)
            . mb_substr(crc32($this->getActualPath()), self::ID_PATH_HASH_LENGTH);

        return (int) $id;
    }
1347467
protected function get_unique_db_instance_id() {
        global $CFG;

        $strkey = $CFG->dbname . ':' . $CFG->prefix;
        $intkey = crc32($strkey);
        // Normalize between 64 bit unsigned int and 32 bit signed ints. Php could return either from crc32.
        if (PHP_INT_SIZE == 8) {
            if ($intkey > 0x7FFFFFFF) {
                $intkey -= 0x100000000;
            }
        }

        return $intkey;
    }
454319
public function getObjectLength()
    {
        $nrOfIdentifierOctets = strlen($this->getIdentifier());
        $contentLength = $this->getContentLength();
        $nrOfLengthOctets = $this->getNumberOfLengthOctets($contentLength);

        return $nrOfIdentifierOctets + $nrOfLengthOctets + $contentLength;
    }