本文整理汇总了PHP中PropelPDO::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP PropelPDO::exec方法的具体用法?PHP PropelPDO::exec怎么用?PHP PropelPDO::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropelPDO
的用法示例。
在下文中一共展示了PropelPDO::exec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
public function exec($sql)
{
$comment = $this->getCommentWrapped();
$sql = $comment . $sql;
KalturaLog::debug($sql);
$sqlStart = microtime(true);
try {
$result = parent::exec($sql);
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
$sqlTook = microtime(true) - $sqlStart;
KalturaLog::debug("Sql took - " . $sqlTook . " seconds");
KalturaMonitorClient::monitorDatabaseAccess($sql, $sqlTook, $this->hostName);
return $result;
}
示例2: exec
public function exec($sql)
{
KalturaLog::debug($sql);
return parent::exec($sql);
}
示例3: exec
/**
* Execute an SQL statement and return the number of affected rows.
*
* Overridden for query counting and logging.
*
* @return int
*/
public function exec($sql)
{
$debug = $this->getDebugSnapshot();
$return = parent::exec($sql);
$this->log($sql, null, __METHOD__, $debug);
$this->setLastExecutedQuery($sql);
$this->incrementQueryCount();
return $return;
}
示例4: exec
public function exec($sql)
{
KalturaLog::debug($sql);
$comment = $this->getCommentWrapped();
$sql = $comment . $sql;
$sqlStart = microtime(true);
try {
$result = parent::exec($sql);
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
KalturaLog::debug("Sql took - " . (microtime(true) - $sqlStart) . " seconds");
return $result;
}
示例5: exec
/**
* overridden for query counting
* @return int
*/
public function exec($sql)
{
$this->log('exec: ' . $sql);
$this->incrementQueryCount();
return parent::exec($sql);
}
示例6: updatePartnerLoad
public static function updatePartnerLoad($partnerId, $jobType, $jobSubType = null, PropelPDO $con = null)
{
$partner = PartnerPeer::retrieveByPK($partnerId);
$priorityFactor = PartnerPeer::getPartnerPriorityFactorByPartner($partner);
$maxQuota = $partner->getJobTypeQuota($jobType, $jobSubType);
if (!$maxQuota) {
$maxQuota = BatchJobLockPeer::getMaxJobsForPartner($jobType);
}
$dcId = kDataCenterMgr::getCurrentDcId();
// Hack to avoid the not-null constaint on job sub type
if (is_null($jobSubType)) {
$jobSubType = 0;
}
$c = new Criteria();
$c->add(self::PARTNER_ID, $partnerId);
$c->add(self::JOB_TYPE, $jobType);
$c->add(self::JOB_SUB_TYPE, $jobSubType);
$c->add(self::DC, $dcId);
$oldPartnerLoad = self::doSelectOne($c);
if ($oldPartnerLoad === null) {
try {
// Try to insert new entry
$partnerLoad = new PartnerLoad();
$partnerLoad->setPartnerId($partnerId);
$partnerLoad->setJobType($jobType);
$partnerLoad->setJobSubType($jobSubType);
$partnerLoad->setPartnerLoad(1);
$partnerLoad->setDc($dcId);
$partnerLoad->setWeightedPartnerLoad($priorityFactor);
$partnerLoad->setQuota($maxQuota - 1);
$res = $partnerLoad->save();
if ($res == 1) {
return;
// if we arrived here, it means the insert was successful
}
} catch (Exception $e) {
// probably a unique constraint - use the updae version below
}
}
$table = PartnerLoadPeer::TABLE_NAME;
$colPartnerLoad = PartnerLoadPeer::PARTNER_LOAD;
$colWeightedPartnerLoad = PartnerLoadPeer::WEIGHTED_PARTNER_LOAD;
$colJobType = PartnerLoadPeer::JOB_TYPE;
$colJobSubType = PartnerLoadPeer::JOB_SUB_TYPE;
$colPartnerId = PartnerLoadPeer::PARTNER_ID;
$colDC = PartnerLoadPeer::DC;
$colQuota = PartnerLoadPeer::QUOTA;
$sql = "UPDATE {$table} ";
$sql .= "SET {$colPartnerLoad} = ({$colPartnerLoad} + 1)";
$sql .= ", {$colWeightedPartnerLoad} = ({$colWeightedPartnerLoad} + {$priorityFactor})";
$sql .= ", {$colQuota} = ({$colQuota} - 1)";
$sql .= "WHERE {$colJobType} = {$jobType} ";
$sql .= "AND {$colJobSubType} = {$jobSubType} ";
$sql .= "AND {$colPartnerId} = {$partnerId} ";
$sql .= "AND {$colDC} = {$dcId} ";
try {
$affectedRows = $con->exec($sql);
} catch (Exception $e) {
KalturaLog::err("Failed to update partner load with error : " . $e->getMessage());
}
}