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


PHP PropelPDO::exec方法代码示例

本文整理汇总了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;
 }
开发者ID:DBezemer,项目名称:server,代码行数:17,代码来源:KalturaPDO.php

示例2: exec

 public function exec($sql)
 {
     KalturaLog::debug($sql);
     return parent::exec($sql);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:5,代码来源:KalturaPDO.php

示例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;
 }
开发者ID:sundesz,项目名称:crafthouse,代码行数:16,代码来源:DebugPDO.php

示例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;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:KalturaPDO.php

示例5: exec

 /**
  * overridden for query counting
  * @return     int
  */
 public function exec($sql)
 {
     $this->log('exec: ' . $sql);
     $this->incrementQueryCount();
     return parent::exec($sql);
 }
开发者ID:nhemsley,项目名称:propel,代码行数:10,代码来源:DebugPDO.php

示例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());
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:61,代码来源:PartnerLoadPeer.php


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