started abstracting out the sql stuff

insert works. selectfromwhere is in progress.