switch to full sqlite system

todo:  test and optimize, make sure that datapoints are ordered right,
work in a system for expiry of old datapoints (probably fully within
sqlite).