Add postgresql prepared queries and stop relying on string formatting
for sql parameter passing
Merge pull request #1507 from idlewan/postgresql

Add postgresql prepared queries