Move db specific code to own compilation units and add MySQL