The err() function returns the result of the last operation on a specified table. If no table name is specified, it will return the result of the last table operation regardless of which table it was performed on.
err({table table_name})
• table table_name – The name of table you wish to check the last error for.
Integer
The err() function is often used in an if then...end if structure that follows a table operation (get, change, save table and so on) to handle any errors that may have occurred during the operation. Using the err() function allows a script to detect errors, respond accordingly and specify whether to notify the user. In contrast, using the check error statement after table operations will automatically display an alert message dialog box notifying the user that an error occurred, but doesn’t provide a method for the script to respond to the error.
Some of the return values from the err() function correspond to predefined constants, allowing you to use the constant in place of the error number. The following table lists common operation errors, and their associated error values and constants.
Constant |
Value |
Error type |
---|---|---|
OKAY |
0 |
No Error |
LOCKED |
10 |
Locked Record |
EOF |
16 |
End of File |
DUPLICATE |
17 |
Duplicate Record |
MISSING |
18 |
Missing |
RECORDCHANGED |
30 |
Changed Record |
The following table lists other operation errors and their associated error values. While no constants have been associated with these error values, they are valid values that can be returned by the err() function.
1 – Low on memory |
22 – No table definition could be found |
2 – Database manager not initialized |
23 – Attempted to lock two records |
3 – Database manager not supported |
24 – No lock on update |
4 – Too many tables opened |
25 – Table doesn’t match definition |
5 – Record length too long |
26 – The disk is full |
6 – Too many keys for database type |
27 – Unknown error |
7 – Too many segments |
28 – A non-modifiable key changed |
8 – Table not registered |
29 – Not a variable length field |
9 – Table not found |
32 – Path not found |
11 – Table name error |
33 – Buffer error |
12 – Table not open |
34 – Error in creating a P.SQL table |
13 – Table not opened exclusive |
35 – Invalid key definition |
14 – Invalid command sent to database manager |
36 – Maximum number of SQL connections reached. |
15 – Key number doesn’t exist |
37 – Error accessing SQL data |
19 – A set is already active |
38 – Error converting SQL data |
20 – Transaction in progress |
39 – Error generating SQL data |
21 – Not a variable length table |
|