Exemplo n.º 1
0
 /**
  * Retrieve all records larger than the id
  *
  * @param      array $servers<SphinxLogServer>
  * @param	   int $gap
  * @param      int $limit
  * @param	   array $handledEntries	
  * @param      PropelPDO $con the connection to use
  * @return     SphinxLog
  */
 public static function retrieveByLastId(array $servers, $gap = 0, $limit = 1000, array $handledEntries = null, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criterions = null;
     if (count($servers)) {
         $criterions = $criteria->getNewCriterion(SphinxLogPeer::ID, null, Criteria::ISNULL);
     }
     foreach ($servers as $server) {
         $dc = $server->getDc();
         $crit = $criteria->getNewCriterion(SphinxLogPeer::ID, $server->getLastLogId() - $gap, Criteria::GREATER_THAN);
         $crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::DC, $dc));
         if (!is_null($handledEntries)) {
             $crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::ID, $handledEntries[$dc], Criteria::NOT_IN));
         }
         $criterions->addOr($crit);
     }
     if ($criterions) {
         $criteria->addAnd($criterions);
     }
     $disabledPartnerIds = kConf::get('disable_sphinx_indexing_partners', 'local', array());
     if ($disabledPartnerIds) {
         $criteria->add(SphinxLogPeer::PARTNER_ID, $disabledPartnerIds, Criteria::NOT_IN);
     }
     $criteria->addAscendingOrderByColumn(SphinxLogPeer::ID);
     $criteria->setLimit($limit);
     return SphinxLogPeer::doSelect($criteria, $con);
 }
 /**
  * Retrieve all records larger than the id
  *
  * @param      array $servers<SphinxLogServer>
  * @param      int $limit
  * @param      PropelPDO $con the connection to use
  * @return     SphinxLog
  */
 public static function retrieveByLastId(array $servers, $limit = 1000, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criterions = null;
     if (count($servers)) {
         $criterions = $criteria->getNewCriterion(SphinxLogPeer::ID, null, Criteria::ISNULL);
     }
     foreach ($servers as $server) {
         $crit = $criteria->getNewCriterion(SphinxLogPeer::ID, $server->getLastLogId(), Criteria::GREATER_THAN);
         $crit->addAnd($criteria->getNewCriterion(SphinxLogPeer::DC, $server->getDc()));
         $criterions->addOr($crit);
     }
     if ($criterions) {
         $criteria->addAnd($criterions);
     }
     $criteria->addAscendingOrderByColumn(SphinxLogPeer::ID);
     $criteria->setLimit($limit);
     return SphinxLogPeer::doSelect($criteria, $con);
 }
Exemplo n.º 3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(SphinxLogPeer::DATABASE_NAME);
         $criteria->add(SphinxLogPeer::ID, $pks, Criteria::IN);
         $objs = SphinxLogPeer::doSelect($criteria, $con);
     }
     return $objs;
 }