Allow tracing for database activity.

This commit adds the ability to trace database activity on a per thread
basis. 

Signed-off-by: Gunnar Wagenknecht <gunnar@ageto.net>
synchronize project settings and code clean-up

Signed-off-by: Gunnar Wagenknecht <gunnar@ageto.net>