add plaintext & db query test

add plaintext & db query
Merge pull request #839 from astaxie/patch-2

add plaintext & db query test Also needed to merge PR 840 before to make this PR work.