Gets information about the file/record.
array i5_info (resource result/file, [ int/string field])
Parameters
result |
Resource describing file or other record set
|
field |
Integer or string identifying the field position or name.
|
Return
Information about the file/record. False is returned if error.
I5_ERR_PHP_HDLDFT |
256 |
No default connection found. |
I5_ERR_PHP_OPTIONSTYPE |
259 |
The type of " I5_OPTIONS_ALIAS" option must be x and not x |
I5_ERR_PHP_OPTIONSNUMBER |
260 |
Option number -1 is unknown. |
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
Details
Direct functions are available to find out about field main properties and file fields number:
for name, |
|
for size, |
|
For decimal place, |
|
For (PHP) type. |
|
Fields number |
i5_info function allows getting additional information's, either at field level giving accurate index or field name or at file level.
Defining an index or a field name as calling parameters, the following associative table is obtained:
PcType |
PC field type |
PcLen |
PC field length |
AsType |
Returns type name from the following list: CHAR, SHORT, LONG, FLOAT, DOUBLE, BIN, PACKED, ZONED, DATE or TIME. |
AsLen |
AS side field length in byte |
AsDec |
AS side decimal place |
allowNull |
returns TRUE if field accepts NULL values |
Name |
Field name |
comment |
Field comment |
heading1 |
First column header |
heading2 |
Second column header |
heading3 |
Third column header |
varLen |
returns TRUE if field is of variable length |
In lack of field name or position in calling parameters, an associated table is returned with the file following information's:
KEYNBR |
Keys number |
FIELDNBR |
Fields number |
UNIQUE |
Returns TRUE if key is unique |
SELOMIT |
Returns TRUE if key is of SELECT/OMIT type |
KEYED |
Returns TRUE if key is of KEY/ARRSEQ type |
Example
// File information
$info_file = i5_info($file);
if (is_bool($info_file))
{
print_r("i5_info error : ".i5_errormsg().'<br/>');
}
else
{
echo "s_customer file has " . $info_file["KEYNBR"] ." keys.<BR>";
}
// Field information
$info = i5_info($file, "CUST_ID");
if (is_bool($info_file))
{
print_r("i5_info error : ".i5_errormsg().'<br/>');
}
else
{
echo "CUST_ID type AS " . $info["AsType"] ."<BR>";
echo "CUST_ID comment " . $info["comment"] ."<BR>";
}
See also