Add DB QueryCondition

Add QueryCondition  to generalize DB querying