move sql to Db object