some helper functions and macros for automatically setting up sqlite databases
move db-connection code into function; silently reuse existing connection