Dshafik\MySQL::mysqlFieldInfo PHP Method

mysqlFieldInfo() public static method

public static mysqlFieldInfo ( mysqli_result $result, $field, $what )
$result mysqli_result
        public static function mysqlFieldInfo(\mysqli_result $result, $field, $what)
        {
            try {
                $field = mysqli_fetch_field_direct($result, $field);
            } catch (\Exception $e) {
                trigger_error(sprintf("mysql_field_%s(): Field %d is invalid for MySQL result index %s", $what, $field, spl_object_hash($result)), E_USER_WARNING);
                // @codeCoverageIgnoreStart
                // PHPUnit turns the warning into an exception, so this never runs
                return false;
                // @codeCoverageIgnoreEnd
            }
            if ($what == 'name' || $what == 'table') {
                return $field->{$what};
            }
            if ($what == 'len') {
                return $field->length;
            }
            if ($what == 'type') {
                return static::getFieldType($field->type);
            }
            if ($what == 'flags') {
                return static::getFieldFlags($field->flags);
            }
            return false;
        }

Usage Example

示例#1
0
 function mysql_field_flags($result, $field)
 {
     if (\Dshafik\MySQL::checkValidResult($result, __FUNCTION__)) {
         // @codeCoverageIgnoreStart
         return false;
         // @codeCoverageIgnoreEnd
     }
     return \Dshafik\MySQL::mysqlFieldInfo($result, $field, 'flags');
 }