protected function getStatement(QubitQuery $leaf)
 {
     // HACK Tell the caller whether we sorted according to the leaf
     $sorted = false;
     if (!isset($this->statement)) {
         foreach ($leaf->getOrderByNames() as $name) {
             $this->criteria->addAscendingOrderByColumn(constant($this->className . '::' . strtoupper($name)));
         }
         $sorted = true;
         $this->statement = BasePeer::doSelect($this->criteria);
     }
     // TODO Determine whether the sort order matches the previous sort order
     return array($this->statement, $sorted);
 }