Created
February 5, 2016 09:03
-
-
Save PurpleBooth/013cfde768895aa706b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static function getFieldFlags($what) | |
{ | |
// Order of flags taken from http://lxr.php.net/xref/PHP_5_6/ext/mysql/php_mysql.c#2507 | |
$constantFlagMap = [ | |
MYSQLI_NOT_NULL_FLAG => "not_null", | |
MYSQLI_PRI_KEY_FLAG => "primary_key" | |
... | |
]; | |
$flags = []; | |
foreach($constantFlagMap as $constant => $flag) { | |
if ($what & $constant) { | |
$flags[] = $flag; | |
} | |
} | |
return implode(" ", $flags); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment