home *** CD-ROM | disk | FTP | other *** search
- Read me too (shareware release)
-
- --Status value return code with transaction-based routines
-
- The transaction-based routines, InsertXB, UpdateXB, ReindexXB, LockXB and
- UnlockXB, do not return the completion status. The return value is the
- pack index number that failed. The following example assumes that you are
- using multiple index files. If you're not, replace AP(x).y with AP.y.
-
- AP[0].Func = INSERTXB;
- pid = BULLET(&AP);
- if (pid == 0) {
- if (AP[0].stat == 0) {
- /* all okay */
- else { /* error while adding the data record is */
- rstat = AP[1].stat; /* returned in AP(1).stat if and only if pid=0 */
- DoErrorWithDataRecord(stat);
- }
- }
- else {
- rstat = AP[pid].stat;
- DoErrorWithIndexFile(pid, stat);
- }
- }
-
- For complete information consult the above named routines in CZ. Note that
- ReindexXB does not operate on a data file separately so if its return
- code=0 (pid=0) then all operations succeeded. However, with the LockXB
- routines, if pid > number_of_packs then the lock on the data file failed.
- The following example assumes that a single index file and data file are
- to be locked.
-
- packs = 1; /* 1 pack (single index file per data file) */
- AP.Func = LOCKXB;
- pid = BULLET(&AP);
- if (pid == 0) {
- /* all okay */
- else
- if (pid <= packs) { /* error while locking index file and error code */
- rstat = AP.stat; /* in AP.stat */
- DoErrorWithIndexFile(stat);
- }
- else { /* error while locking data file and error code */
- stat = AP.stat; /* also in AP.stat */
- DoErrorWithDataFile(stat);
- }
- }
-
- --In case a C example does not compile, do not assume that the example is 100%
- correct C and that something must be wrong. I'm no C programmer--not by a mile.
- If something doesn't compile make the needed corrections. Let me know about my
- mistakes and I will be ever so grateful. -chh
-