added getLongest entry
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
37e358e4ad
commit
b7df1220fb
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue