separate generic DB helpers into db_p.h
when the QPDB is implemented, we will need to have both qpdb_p.h and rbtdb_p.h. in order to prevent name collisions or code duplication, this commit adds a generic private header file, db_p.h, containing structures and macros that will be used by both databases.
some functions and structs have been renamed to more specifically refer to the RBT database, in order to avoid namespace collision with similar things that will be needed by the QPDB later.