Gets error message for last executed action.
string i5_errormsg ([resource connection] )
Parameters
|
connection |
Connection - result of i5_connect.
|
Return
i5_errno and i5_errormsg functions simply returns number and error message.
i5_error function gives more details (category, number, message, and description).
|
N° |
Code |
Description |
|
0 |
I5_ERR_OK |
No error. |
|
1 |
I5_ERR_ERROR |
Error occurred |
|
2 |
I5_ERR_TOOMUCHOPENFILE |
Too many open files |
|
3 |
I5_ERR_MEMALLOC |
Available memory too small |
|
4 |
I5_ERR_INVALIDPTR |
Invalid pointer (handle) |
|
5 |
I5_ERR_FILENOTFOUND |
File not found |
|
6 |
I5_ERR_FIELDNOTFOUND |
Field not found |
|
7 |
I5_ERR_INVALIDFIELDNBR |
Field number does not exist |
|
8 |
I5_ERR_INVALIDKEYLEN |
Wrong key size |
|
9 |
I5_ERR_INVALIDKEYNBR |
False key number |
|
10 |
I5_ERR_NOTENABLETOUPDATE |
File can not be modified |
|
11 |
I5_ERR_INVALIDOPENMODE
|
File opening type does not allow this operation |
|
12 |
I5_ERR_RECORDNOTFOUND |
Record not found |
|
13 |
I5_ERR_RECORDLOCKED |
Record locked |
|
14 |
I5_ERR_BEOF |
File head or end |
|
15 |
I5_ERR_FILELIMITS |
Out of file limits reading attempt (before or after EOF) |
|
16 |
I5_ERR_NOTCONNECTED |
Not connected |
|
17 |
I5_ERR_INVALIDSEQ |
Invalid operation sequence. |
|
18 |
I5_ERR_NORANGESET |
Undefined range. |
|
19 |
I5_ERR_NOLINKDEFINED |
Undefined link |
|
20 |
I5_ERR_NOCURRENTRECORD |
No current record |
|
21 |
I5_ERR_NULLNOTALLOWED |
NULL operation not allowed (field do not support NULL value) |
|
22 |
I5_ERR_BADSESSION |
I5 session does not exist. |
|
23 |
I5_ERR_WRONGLOGIN |
User name or pass word error. |
|
24 |
I5_ERR_NOTENOUGHRIGHTS |
User rights problem. |
|
|
|
|
|
25 |
I5_ERR_INVALIDTYPE |
Invalid type. |
|
26 |
I5_ERR_INVALIDINFO |
Retrieving information variable too small. |
|
27 |
I5_ERR_NOTTYPEPROPERTY |
Requested property does not exist. |
|
28 |
I5_ERR_RECORDCHANGED |
Record changed before update. |
|
29 |
I5_ERR_ALREADYINTRAN |
All ready in transaction mode. |
|
30 |
I5_ERR_NOTINTRAN |
No transaction started. |
|
4097 |
I5_ERR_FIELDNULL |
NULL field value |
Example
/* Connection test */
$conn = i5_connect("MY_AS","USER","PASSWORD");
if ($conn == FALSE) {
$err = i5_error();
switch ($err["cat"]) {
case I5_CAT_TCPIP:
echo "TCP/IP problem – Connection not possible";
exit;
case I5_CAT_INTERNAL:
echo " Easycom error - Connection not possible";
}
echo "Error number". i5_errno() . "<BR>";
echo "Error message". i5_errormsg() ."<BR>";
/* File edition test */
$edition = i5_edit($file);
if ($edition == FALSE) {
switch (i5_errno()) {
case I5_ERR_INVALIDOPENMODE:
echo "Opens the file in writing to enable modification";
case I5_ERR_RECORDNOTFOUND:
echo "Points a record before modification";
case I5_ERR_RECORDLOCKED:
echo "Locked record...";
}
/* Command test */
$ret = i5_cmd("NB=CHAR(20); RTVSYSVAL SYSVAL(QSRLNBR) RTNVAR(&NB)");
if ($ret) { // correct syntax
$res = i5_cmdget("RC");
if ($res == 0) {...} // correct execution
else {echo "Command provoked error ". $res;}
else {
echo "Check command syntax";
}
/* SQL request test */
$query = i5_query("SELECT * FROM EASYCOM/SP_CUST");
if($query == FALSE){
echo "SQL error code: " . i5_errno($query) . "<br>";
echo "Error message: " . i5_errormsg($query) . "<br>";}
}
See also