' tb-screen: 80x25
' tb-tempdir
' Verschachtelte Sicherungspunkte nehmen Inhalt, Indizes und Tabellen zurueck.
TYPE R
    Nr AS INTEGER
END TYPE
DIM r AS R
ON ERROR GOTO Handler
OPEN "struktur.isam" FOR ISAM R "R" AS #1
CREATEINDEX #1, "Nr", 1, "Nr"
r.Nr = 1
INSERT #1, r
BEGINTRANS
a% = SAVEPOINT
CREATEINDEX #1, "Neu", 0, "Nr"
b% = SAVEPOINT
DELETEINDEX #1, "Nr"
INSERT #1, r
CLOSE #1
ROLLBACK b%
OPEN "struktur.isam" FOR ISAM R "R" AS #1
PRINT "Saetze="; LTRIM$(STR$(LOF(1)))
SETINDEX #1, "Neu"
PRINT "Index="; GETINDEX$(1)
INSERT #1, r
CLOSE
DELETETABLE "struktur.isam", "R"
OPEN "struktur.isam" FOR ISAM R "R" AS #1
r.Nr = 9
INSERT #1, r
CLOSE
ROLLBACK a%
OPEN "struktur.isam" FOR ISAM R "R" AS #1
SETINDEX #1, "Neu"
SETINDEX #1, "Nr"
RETRIEVE #1, r
PRINT "wiederhergestellt="; LTRIM$(STR$(r.Nr))
c% = SAVEPOINT
r.Nr = 2
UPDATE #1, r
DELETE #1
INSERT #1, r
CLOSE
ROLLBACK c%
COMMITTRANS
OPEN "struktur.isam" FOR ISAM R "R" AS #1
SETINDEX #1, "Nr"
RETRIEVE #1, r
PRINT "nach COMMIT="; LTRIM$(STR$(r.Nr))
CLOSE
END
Handler:
PRINT "ERR="; LTRIM$(STR$(ERR))
RESUME NEXT
