Update sqlite queries so they actually work with sqlite
Add sqlcounter queries for sqlite