Amber sql

Fixed some persistence bugs and added commit and rollback.

Reading from persistent db should be reasonably fast now, but writing updates is still a little slow and needs further work.