Fix SQL typo.
Add cached database methods.
Remove cursor usage from adapter.
Move everything to the cached database methods.