Added SQL_DEBUG setting

With SQL_DEBUG enabled, all executed SQL queries get printed to stdout.
Optimized database access in swid-measurement endpoint