Add database query result collection implementation, as well as test
cases.