add validation tests

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-06-05 20:52:37 +02:00
parent 4917b9c057
commit 0afbe3d13b
3 changed files with 157 additions and 62 deletions

View File

@@ -183,6 +183,21 @@ class Database
return $return;
}
/**
* return number of characters that are allowed to use as username
*
* @return int
*/
public static function getSqlUsernameLength()
{
// MySQL user names can be up to 32 characters long (16 characters before MySQL 5.7.8).
$mysql_max = 32;
if (version_compare(Database::getAttribute(\PDO::ATTR_SERVER_VERSION), '5.7.8', '<')) {
$mysql_max -= 16;
}
return $mysql_max;
}
/**
* let's us interact with the PDO-Object by using static
* call like "Database::function()"