added getLongestEntry
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
35ae3c4505
commit
1bd36ce6fd
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue