summaryrefslogtreecommitdiff
path: root/dumpdbfields.py
diff options
context:
space:
mode:
Diffstat (limited to 'dumpdbfields.py')
-rw-r--r--dumpdbfields.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/dumpdbfields.py b/dumpdbfields.py
new file mode 100644
index 0000000..131cfa3
--- /dev/null
+++ b/dumpdbfields.py
@@ -0,0 +1,33 @@
1from crodump import Database
2import os
3import os.path
4from hexdump import asasc
5
6class Cls: pass
7
8def main():
9 import sys
10 dbpath = sys.argv[1] if len(sys.argv)>1 else os.path.join(os.getenv("HOME"), "prj/cronos")
11 args = Cls()
12 args.verbose = False
13
14 for path, _, files in os.walk(dbpath):
15 if any(_ for _ in files if _.lower()=="crostru.dat"):
16 print(path)
17
18 db = Database(path)
19 for tab in db.enumerate_tables():
20 tab.dump(args)
21 print("nr=%d" % db.nrofrecords())
22 i = 0
23 for rec in db.enumerate_records(tab):
24 # beware to skip tab.fields[0], which is the 'sysnum'
25 for field, fielddef in zip(rec, tab.fields[1:]):
26 print(">> %s -- %s" % (fielddef, asasc(field)))
27 i += 1
28 if i>100: break
29
30
31if __name__=="__main__":
32 main()
33