diff --git a/src/Controller/NameserverController.php b/src/Controller/NameserverController.php index 199c38d..90da13b 100644 --- a/src/Controller/NameserverController.php +++ b/src/Controller/NameserverController.php @@ -178,4 +178,24 @@ class NameserverController exit($e->getMessage()); } } + + /** + * @param String $field + * + * @return int + */ + public function getLongestEntry(String $field): int + { + $statement = " + SELECT MAX(LENGTH(" . $field . ")) as length FROM " . DatabaseConnection::TABLE_NAMESERVERS; + + try { + $statement = $this->databaseConnection->getConnection()->prepare($statement); + $statement->execute(); + $result = $statement->fetch(); + return $result['length']; + } catch (PDOException $e) { + exit($e->getMessage()); + } + } } \ No newline at end of file