Set fetch mode to function fetch().
Replace SC_Query with DB at class Model\Design\Block.
set where to innerJoin().
Replace SC_Query->extractOnlyColsOf with DB->restrictExistingFields.
Replace SC_Query with DB at class Model\Design\Page.
Replace SC_Query with DB at class Model\Design\Template.