add exclusive lock for sqlite db
Merge pull request #263 from LipuFei/db-optimize-test

Optimize sqlite db