Rewrote the xtc_db_* functions to use doctrine and fixed all code, that didn't use the xtc database wrapper.