CakeFest 2024: The Official CakePHP Conference

ibase_field_info

(PHP 5, PHP 7 < 7.4.0)

ibase_field_infoПолучает информацию о поле

Описание

ibase_field_info(resource $result, int $field_number): array

Возвращает массив с информацией о поле после выполнения запроса select.

Список параметров

result

Идентификатор результата InterBase.

field_number

Смещение поля.

Возвращаемые значения

Возвращает массив со следующими ключами: name, alias, relation, length и type.

Примеры

Пример #1 Пример использования ibase_field_info()

<?php
$rs
= ibase_query("SELECT * FROM tablename");
$coln = ibase_num_fields($rs);
for (
$i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
echo
"Имя: ". $col_info['name']. "\n";
echo
"Псевдоним: ". $col_info['alias']. "\n";
echo
"Связь: ". $col_info['relation']. "\n";
echo
"Длина: ". $col_info['length']. "\n";
echo
"Тип: ". $col_info['type']. "\n";
}
?>

Смотрите также

  • ibase_num_fields() - Возвращает количество полей в результирующем наборе

add a note

User Contributed Notes 2 notes

up
0
tiago at econtabil dot com
14 years ago
In Firebird 1.5 this function INT64 returned to the fields created as floating point numbers. In Firebird 2.x this function returns as NUMERIC (SIZE, PRECISION). Example: NUMERIC (18,2)

In Brazilian Portuguese:
No Firebird 1.5 esta função retornava INT64 para os campos criados como numéricos com ponto flutuante. No Firebird 2.x esta função retorna como NUMERIC(TAMANHO, PRECISAO). Exemplo: NUMERIC(18,2)
up
0
tiago at econtabil dot com
17 years ago
Example:
$db = ibase_connect($host,$username,$password, "None", 0, 3 ) or die ('Error trying connect to Database!');

$select = "SELECT * from TABLE";
$sql = ibase_query($db,$select) or die($select);

$total_fields= ibase_num_fields($sql);

for ($j = 1; $j <= $total_fields; $j++)
{
$info_field = ibase_field_info($sql, $j-1 );
print("Name: " . $info_campo[1]); // print the field name
print("Type:". $info_campo[4]); //print the field type
print("Size: " . $info_campo[3]); // print the field size
}
This function does not return the type from the fields as we are accustomed in interbase.
Example: Fields VARCHAR are returns as VARYING. Fields of the type CHAR return TEXT.

Tested in Firebird 1.5 Super Server.
To Top