construct object from query result