improve tree generation

- enable users to verify that their node is included in the root.
- provide implementation of DB::getDataCode(int datapos)