update dblayer to use sql