added getLongest entry

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-01-23 16:32:22 +01:00
parent 37e358e4ad
commit b7df1220fb

View File

@ -181,4 +181,24 @@ class PanelController
}
}
/**
* @param $id
*
* @return int
*/
public function getLongestEntry(String $field): int
{
$statement = "
SELECT MAX(LENGTH(" . $field . ")) as length FROM " . DatabaseConnection::TABLE_PANELS;
try {
$statement = $this->databaseConnection->getConnection()->prepare($statement);
$statement->execute();
$result = $statement->fetch();
return $result['length'];
} catch (PDOException $e) {
exit($e->getMessage());
}
}
}