db4o - how do I get a distinct list of classes contained in a .db4o DB file? -
say open .db4o file. java code (psuedo) generate list of unique java classes/types contained in database?
i sure write code it, afraid quite slow. there way without querying every object in database? use sort of index?
i'd rather not rely on stored metadata database, i'd rather rely on true information objects stored within.
you can use (c# can converted java :)
const string databasefilename = "c:\\temp\\learning.odb"; static void main(string[] args) { using (var db = db4oembedded.openfile(databasefilename)) { var classes = db.ext().storedclasses(); foreach (var @class in classes) { console.writeline(); console.writeline(@class.getname()); foreach (var field in @class.getstoredfields()) { console.writeline("\t{1} {0}", field.getname(), field.getstoredtype().getname()); } } } }
note have more interesting methods in extobjectcontainer interface.
hope helps.
Comments
Post a Comment