From d3582ac336721b65e988f6ca1b7dd0b4310a2a6c Mon Sep 17 00:00:00 2001 From: itsme Date: Tue, 13 Jul 2021 23:26:22 +0200 Subject: added sysnum to enumrecs interface --- crodump.py | 2 +- dumpdbfields.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crodump.py b/crodump.py index 984770f..02abc80 100644 --- a/crodump.py +++ b/crodump.py @@ -455,7 +455,7 @@ class Database: for i in range(self.nrofrecords()): data = self.bank.readrec(i+1) if data and data[0] == table.tableid: - yield data[1:].split(b"\x1e") + yield i+1, data[1:].split(b"\x1e") def recdump(self, args): diff --git a/dumpdbfields.py b/dumpdbfields.py index 131cfa3..5de925d 100644 --- a/dumpdbfields.py +++ b/dumpdbfields.py @@ -20,8 +20,10 @@ def main(): tab.dump(args) print("nr=%d" % db.nrofrecords()) i = 0 - for rec in db.enumerate_records(tab): + for sysnum, rec in db.enumerate_records(tab): # beware to skip tab.fields[0], which is the 'sysnum' + # since the rec does not include the sysnum. + print(">> %s -- %s" % (tab.fields[0], sysnum)) for field, fielddef in zip(rec, tab.fields[1:]): print(">> %s -- %s" % (fielddef, asasc(field))) i += 1 -- cgit v1.2.3