当前位置: 首页>>代码示例>>PHP>>正文


PHP BatchJobPeer::doSelectStmt方法代码示例

本文整理汇总了PHP中BatchJobPeer::doSelectStmt方法的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer::doSelectStmt方法的具体用法?PHP BatchJobPeer::doSelectStmt怎么用?PHP BatchJobPeer::doSelectStmt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BatchJobPeer的用法示例。


在下文中一共展示了BatchJobPeer::doSelectStmt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reload

 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(BatchJobPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     $stmt = BatchJobPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
     }
     // if (deep)
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:36,代码来源:BaseBatchJob.php

示例2: set_time_limit

<?php

set_time_limit(0);
ini_set("memory_limit", "700M");
error_reporting(E_ALL);
chdir(dirname(__FILE__));
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/scripts/' . basename(__FILE__) . '.cache');
KAutoloader::register();
KalturaLog::setLogger(new KalturaStdoutLogger());
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$createdAt = time() - 60 * 60 * 24;
$jobType = 0;
$c = new Criteria();
//		$c->add(BatchJobPeer::CREATED_AT, $createdAt, Criteria::GREATER_THAN);
$c->add(BatchJobPeer::JOB_TYPE, $jobType);
//		$c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PENDING);
$c->clearSelectColumns();
$c->addSelectColumn('MAX(' . BatchJobPeer::PRIORITY . ')');
$stmt = BatchJobPeer::doSelectStmt($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
$maxPriority = $stmt->fetchColumn();
var_dump($maxPriority);
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:27,代码来源:test.php

示例3: doSelect

 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      PropelPDO $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 {
     return BatchJobPeer::populateObjects(BatchJobPeer::doSelectStmt($criteria, $con));
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:13,代码来源:BaseBatchJobPeer.php

示例4: doSelectJoinAll

 /**
  * Selects a collection of BatchJob objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of BatchJob objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     BatchJobPeer::addSelectColumns($criteria);
     $startcol2 = BatchJobPeer::NUM_COLUMNS - BatchJobPeer::NUM_LAZY_LOAD_COLUMNS;
     BatchJobLockPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (BatchJobLockPeer::NUM_COLUMNS - BatchJobLockPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(BatchJobPeer::BATCH_JOB_LOCK_ID, BatchJobLockPeer::ID, $join_behavior);
     $stmt = BatchJobPeer::doSelectStmt($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = BatchJobPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = BatchJobPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = BatchJobPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             BatchJobPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined BatchJobLock rows
         $key2 = BatchJobLockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = BatchJobLockPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = BatchJobLockPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 BatchJobLockPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (BatchJob) to the collection in $obj2 (BatchJobLock)
             $obj2->addBatchJob($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
开发者ID:DBezemer,项目名称:server,代码行数:57,代码来源:BaseBatchJobPeer.php

示例5: getNextJobPriority

 public static function getNextJobPriority($jobType)
 {
     //$priorities = array(1 => 33, 2 => 27, 3 => 20, 4 => 13, 5 => 7);
     $priorities = kConf::get('priority_percent');
     $createdAt = time() - kConf::get('priority_time_range');
     //		$createdAt = kConf::get('priority_time_range');
     $c = new Criteria();
     $c->add(BatchJobPeer::CREATED_AT, $createdAt, Criteria::GREATER_THAN);
     $c->add(BatchJobPeer::JOB_TYPE, $jobType);
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PENDING);
     $c->clearSelectColumns();
     $c->addSelectColumn('MAX(' . BatchJobPeer::PRIORITY . ')');
     $stmt = BatchJobPeer::doSelectStmt($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     $maxPriority = $stmt->fetchColumn();
     // gets the current queues
     $c = new Criteria();
     $c->add(BatchJobPeer::CREATED_AT, $createdAt, Criteria::GREATER_THAN);
     $c->add(BatchJobPeer::JOB_TYPE, $jobType);
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PENDING, Criteria::GREATER_THAN);
     $c->addGroupByColumn(BatchJobPeer::PRIORITY);
     // To prevent stress on the master DB - use the slave for checking the queue sizes
     $queues = BatchJobPeer::doCountGroupBy($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     // copy the queues and calcs the total
     $total = 0;
     $queues_size = array();
     foreach ($queues as $queue) {
         $queues_size[$queue['PRIORITY']] = $queue[BatchJobPeer::COUNT];
         $total += $queue[BatchJobPeer::COUNT];
     }
     // go over the priorities and see if its percent not used
     foreach ($priorities as $priority => $top_percent) {
         if ($priority > $maxPriority) {
             continue;
         }
         if (!isset($queues_size[$priority])) {
             return $priority;
         }
         $percent = $queues_size[$priority] / ($total / 100);
         if ($percent < $top_percent) {
             return $priority;
         }
     }
     return 1;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:44,代码来源:kBatchManager.php


注:本文中的BatchJobPeer::doSelectStmt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。