本文整理汇总了PHP中mysqli_result::fetch_field_direct方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_result::fetch_field_direct方法的具体用法?PHP mysqli_result::fetch_field_direct怎么用?PHP mysqli_result::fetch_field_direct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli_result
的用法示例。
在下文中一共展示了mysqli_result::fetch_field_direct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_col_info
/**
* Load the column metadata from the last query.
* @return array
*/
public function load_col_info()
{
if ($this->col_info) {
return $this->col_info;
}
$num_fields = $this->result->field_count;
for ($i = 0; $i < $num_fields; $i++) {
$this->col_info[$i] = $this->result->fetch_field_direct($i);
}
return $this->col_info;
}
示例2: mysqlFieldName
/**
* @param mysqli_result $res
* @param int $n
* @return string
*/
protected function mysqlFieldName($res, $n)
{
Assert::true($res instanceof mysqli_result, __METHOD__);
$field = $res->fetch_field_direct($n);
return $field->name;
}
示例3: getFieldType
/**
* Get field type
*
* @param mysqli_result $result query result
* @param int $offset numerical field index
*
* @return string
*/
public function getFieldType($result, $offset)
{
$typecode = $result->fetch_field_direct($offset)->type;
switch ($typecode) {
case MYSQLI_TYPE_DECIMAL:
case MYSQLI_TYPE_NEWDECIMAL:
$type = 'decimal';
break;
case MYSQLI_TYPE_BIT:
$type = 'bit';
break;
case MYSQLI_TYPE_TINY:
case MYSQLI_TYPE_CHAR:
$type = 'tinyint';
break;
case MYSQLI_TYPE_SHORT:
$type = 'smallint';
break;
case MYSQLI_TYPE_LONG:
$type = 'int';
break;
case MYSQLI_TYPE_FLOAT:
$type = 'float';
break;
case MYSQLI_TYPE_DOUBLE:
$type = 'double';
break;
case MYSQLI_TYPE_NULL:
$type = 'NULL';
break;
case MYSQLI_TYPE_TIMESTAMP:
$type = 'timestamp';
break;
case MYSQLI_TYPE_LONGLONG:
$type = 'bigint';
break;
case MYSQLI_TYPE_INT24:
$type = 'mediumint';
break;
case MYSQLI_TYPE_NEWDATE:
case MYSQLI_TYPE_DATE:
$type = 'date';
break;
case MYSQLI_TYPE_TIME:
$type = 'time';
break;
case MYSQLI_TYPE_DATETIME:
$type = 'datetime';
break;
case MYSQLI_TYPE_YEAR:
$type = 'year';
break;
case MYSQLI_TYPE_INTERVAL:
$type = 'interval';
break;
case MYSQLI_TYPE_ENUM:
$type = 'enum';
break;
case MYSQLI_TYPE_SET:
$type = 'set';
break;
case MYSQLI_TYPE_TINY_BLOB:
$type = 'tinyblob';
break;
case MYSQLI_TYPE_MEDIUM_BLOB:
$type = 'mediumblob';
break;
case MYSQLI_TYPE_LONG_BLOB:
$type = 'longblob';
break;
case MYSQLI_TYPE_BLOB:
$type = 'blob';
break;
case MYSQLI_TYPE_VAR_STRING:
$type = 'varchar';
break;
case MYSQLI_TYPE_STRING:
$type = 'char';
break;
case MYSQLI_TYPE_GEOMETRY:
$type = 'geometry';
break;
default:
$type = 'unknown';
break;
}
return $type;
}
示例4: dbFieldName
/**
* Retrieves returns the field name for a field
*
* Returns the field name for a given field number
*
* @param mysqli_result $recordSet The recordset to operate on
* @param int $fieldNumber field number to return the name of
* @return string Returns name of specified field
*
*/
public function dbFieldName($recordSet, $fieldNumber)
{
$result = $recordSet->fetch_field_direct($fieldNumber);
return $result === false ? '' : $result->name;
}
示例5: fetch_field
/**
* Get the column information and return it as array
*
* @param integer $intOffset The field offset
*
* @return array|object An array or object with the column information
*/
protected function fetch_field($intOffset)
{
return $this->resResult->fetch_field_direct($intOffset);
}