20. Result Code Reference

Most FileFlex calls return result codes that are either negative or positive. You should check the result code after every call to FileFlex. Generally, positive result codes (zero and up) mean that the function executed successfully. Negative result codes generally mean that something didn't go right with the function call.

One of the most common technical support call is "Gee, my database isn't working." When I ask the caller if he or she checked the result codes after, say, DBUse, I'm told "No, why?" I then go into a long, reasoned discourse that, summarized, goes like this: "If you don't check an earlier result, the later operation isn't guaranteed to work. So, if your DBUse fails (and it often does when you don't specify the file path properly), lots of stuff later in your code will fail. The moral of the story: check result codes."

Positive Result Codes

Positive result codes are different from FileFlex function to FileFlex function. Therefore, the positive result codes are organized by function call:
-- DBBottom -------------------------------------------------------
3: File is empty

-- DBFindMemo -----------------------------------------------------

0: The search was successful.
3: The search failed and the record pointer is at end of file.

-- DBSeek ---------------------------------------------------------

0: An exact match was found.
2: A partial match was found.
3: Seek past end of file.
4: No match was found.
Note: A result code of 4 means that the database engine stopped searching when it encountered a data item of a value higher than the search engine. It leaves the record pointer on this value. (Hint: This has some interesting algorithmic potential)
-- DBSkip ---------------------------------------------------------

0: The skip operation was completed successfully.
1: The skip operation moved before the beginning of the file.
3: The skip operation moved past the end of the file.  

-- DBTop ----------------------------------------------------------

3: File is empty

-- DBUse ----------------------------------------------------------

0 and up: DBUse returns codes of zero and up if the database file was successfully opened.  These codes are the database ID numbers and are used by the DBSelect function.

-- DBUseIndex -----------------------------------------------------

0 and up: DBUseIndex returns codes of zero and up if the index file was successfully opened.  These codes are the index ID numbers and are used by the DBSelectIndex function.

Negative Result Codes

Negative result codes indicate that some internal error was identified by FileFlex. Here's a list of negative codes by number:
  -1 = General program error
  -2 = Database is empty
  -3 = Index is empty
  -4 = No such data field
  -5 = No such record
  -6 = Field not numeric
  -7 = Insufficient number of parameters
  -8 = Index file out of date
-100 = File creation error
-120 = File open error
-140 = File read error
-160 = File write error
-180 = File close error
-200 = Bad database file
-240 = Database file not found
-260 = Record length too large
-280 = Record length inconsistent
-310 = Error closing index file
-320 = File is not an index file
-330 = Index file is missing a key
-335 = Index file record error
-340 = Key is not unique
-350 = Key equates to a logical value
-360 = Key length or type has changed or is invalid
-370 = Key length exceeds 100 characters
-380 = Seek attempted with no index file active
-500 = Database not found during expr evaluation
-510 = Attempt to evaluate null expression
-515 = Illegal date in expression
-520 = Expecting ',' or ')' in expression
-530 = Incomplete expression
-540 = Math overflow in expression
-550 = Operator or parameter type mismatch
-560 = Right bracket missing in expression
-570 = Unrecognized function
-575 = Unrecognized operator
-580 = Unrecognized value
-590 = Unterminated string in expression
-610 = Not a memo field
-620 = Not enough memory to convert CRLF
-900 = Out of memory
-950 = Internal error
-960 = No encryption key provided
-961 = No encryption string provided
-962 = Path specification required
-963 = Encryption option not valid
-910 = Attempt to move beyond max allowed records
       (100 in demo, 1000 in Lite edition)




  [Previous Chapter]    [Table of Contents]    [Next Chapter]


Copyright (c) 1996 David Gewirtz under license to Component Software Corp. All rights reserved worldwide.