Split SQLite and PostgreSQL connection and SQL source into separate files.

This split only applies to those places where the two diverge.

Also I moved some stuff around in the model/ directory to make things more clear.
Merge branch 'tl-master'