Added StatementSource to encapsulate the queries and postpone communication with database server as much as possible.