Overhaul SQL abstraction to a more clean version
The only issue that may occur is if we need SQLite (or some other SQL implentation) to do things differently. We may need to re-visit this if needed, but this should work for such cases.