New initialization modes and tests; decoupled log and cache

A database connection can bem estabilished in lazy or immediate mode, as
well as by wrapping a existing PDO object. Query log and cache were
detached from DatabaseConnection class for a better separation of
concerns. New tests were added to verify initialization, logging and
caching.