Retrieves error information for last action that was executed.
bool i5_error ( [resource connection] )
This is the function that allows error detailed analysis. It returns an associative indexed four elements table:
|
num |
0 |
error number, same in i5_errno() |
|
cat |
1 |
error category |
|
msg |
2 |
Error message, as in i5_errormsg() |
|
desc |
3 |
Detailed description of the error |
Message and description are related to error class:
|
I5_CAT_SQL |
SQL engine error SQL digital code included in number (i.e. 501) SQL message included in message (i.e. SQL0501) |
|
I5_CAT_SIGNAL |
Error from system signal (file not found) then message contains CPFxxxx code |
|
I5_CAT_MULTIREC |
Error with multiple recording (all records could not be written) then message contains CPFxxxx code Description contains a text telling how many records were really written. |
|
I5_CAT_APPC |
APPC communication error Number contains primary code. Description contains the text "APPC error primary xxxx secondary yyyy" |
|
I5_CAT_INTERNAL |
Easycom internal error |
|
I5_CAT_TCPIP |
TPC/IP communication error |
|
I5_CAT_UNKNOWN |
Unknown error |
|
I5_CAT_VBA |
Error in eac32vba library |
|
I5_CAT_PHP |
Easycom For PHP use error |
|
connection |
Connection – result of i5_connect |
Returns:
It returns an associative indexed four elements table
Specific error returned
|
I5_ERR_DESC_WRONG_DATAOP |
41 |
Wrong operation on a data field of a description |
|
I5_ERR_PARSEXML |
42 |
Internal error; please contact Aura Equipement; error number 42 |
|
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. |
/* Connection test */
$conn = i5_connect('NOT_EXIST','user','password');
if ($conn == FALSE) {
$err = i5_error();
print_r($err);echo '<BR>';
switch ($err["cat"]) {
case I5_CAT_TCPIP:
echo ' TCP/IP problem - Connection not possible ';
break;
case I5_CAT_INTERNAL:
echo ' Easycom error - Connection not possible ';
break;
}
echo 'Error number :'. i5_errno() . '<BR>';
echo 'Error message :'. i5_errormsg() .'<BR>';
}
$conn = i5_connect('p520', 'QPGMR', 'LAUNCHER');
if ($conn == FALSE) {
$err = i5_error();
print_r($err);echo '<BR>';
switch ($err["cat"]) {
case I5_CAT_TCPIP:
echo ' TCP/IP problem - Connection not possible ';
break;
case I5_CAT_INTERNAL:
echo ' Easycom error - Connection not possible ';
break;
}
echo 'Error number :'. i5_errno() . '<BR>';
echo 'Error message :'. i5_errormsg() .'<BR>';
}
echo "Connected : $conn<BR>";
$file = i5_open('EASYCOM/NCLIENT', I5_OPEN_READ);
if (is_bool($file)) trigger_error('i5_open error : '.i5_errormsg(), E_USER_ERROR);
/* testing file edition */
$edition = i5_edit($file);
if ($edition == FALSE) {
switch (i5_errno()) {
case I5_ERR_INVALIDOPENMODE:
echo 'Openning a file in writing to enable modification<BR>';
break;
case I5_ERR_RECORDNOTFOUND:
echo 'Pointing a record before modification<BR>';
break;
case I5_ERR_RECORDLOCKED:
echo 'Locked record...<BR>';
break;
}
}
/* SLQ request test */
$query = i5_query("SELECT * FROM EASYCOM/NOT_EXIST");
If ($query == FALSE){
$error = i5_error();
echo 'SQL error code: ' . i5_errno() . '<br>';
echo 'Error message: ' . i5_errormsg() . '<br>';
echo 'Error information : ';print_r($error);echo '<BR>';
}