Gets information about the file/record.
array i5_info ( |
resource result/file, |
A direct functions set is 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 either 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 |
result |
Resource describing file or other record set
|
field |
Integer or string identifying the field position or name.
|
Returns:
Field's length.
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. |
$res = i5_open("easycom/s_customer");
/* File information */
$info_file = i5_info($res);
echo "CLIENTS file have " . $info_file["KEYNBR"] ." keys.<BR>";
/* Field information */
$info = i5_info($res, "ZIP");
echo "CODE type AS " . $info["AsType"] ."<BR>";
echo "CODE comment " . $info["comment"] ."<BR>";
if ($info["varLen"])
echo "CODE field length is variable";