Removes range. Reverses the action of i5_range_from and i5_range_to
bool i5_range_ clear (resource file)
Parameter
file |
IBM i file resource |
Return
True if OK, false if failed.
Error returned
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
Range is a set of values (interval or filter) in a file, it can be activated with i5_range_from and/or i5_range_to and remains active, limiting file access to the records included in the range until i5_range_clear is called (full file access).
Example
$file = i5_open('EASYCOM/NCLIENT');
if (is_bool($file)) trigger_error('i5_open error : '.i5_errormsg(), E_USER_ERROR);
$first = array('CNOM' => 'D');
$last = array('CNOM' => 'F');
$ret = i5_range_from($file, true, $first);
if (!$ret) trigger_error('i5_range_from error : '.i5_errormsg(), E_USER_ERROR);
$ret = i5_range_to($file, false, $last);
if (!$ret) trigger_error('i5_range_to error : '.i5_errormsg(), E_USER_ERROR);
echo 'i5_fetch_row : <BR>';
i5_seek($file, I5_FIRST);
while ($tab = i5_fetch_row($file))
{
printf('%s (%s)<BR>', $tab[3], $tab[2]);
}
$ret = i5_range_clear($file);
if (!$ret) trigger_error('i5_range_clear error : '.i5_errormsg(), E_USER_ERROR);
echo '<BR>i5_fetch_assoc : <BR>';
$tab = i5_fetch_assoc($file, I5_READ_FIRST);
$count = 0;
while ($tab)
{
printf('%s (%s)<BR>', $tab['CPREN'], $tab['CNOM']);
$tab = i5_fetch_assoc($file, I5_READ_NEXT);
$count ++;
if ($count > 3) break;
}
See also