Speed up findBuildDependencyInQueue

This was taking a long time due to the giant SQL query.

Issue #99.

Created by  Eelco Dolstra  on June 7, 2013
TPSCSZKXKQAMSLMRACXSHWQ4OY7HPSJSJ4KTJY6HLHZQAJ5MDRZAC
Change contents