(#2392) - improve websql bulkDocs perf

Basically the same optimization as #2391,
but for websql. Also added a test for sanity.