當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Connection::getDbh方法代碼示例

本文整理匯總了PHP中Doctrine_Connection::getDbh方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Connection::getDbh方法的具體用法?PHP Doctrine_Connection::getDbh怎麽用?PHP Doctrine_Connection::getDbh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine_Connection的用法示例。


在下文中一共展示了Doctrine_Connection::getDbh方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getMySQLSummaryQuery

 private static function getMySQLSummaryQuery(Doctrine_Connection $c, $filter = null)
 {
     $dbh = $c->getDbh();
     $prefix = $c->getPrefix();
     $timeQuery = self::getTimeRangeQuery($c, $filter);
     // MYSQL has no with clause, so we need two queries
     $mainQuery = "(SELECT\n                s.object_id,\n                state*(scheduled_downtime-1)*-1 as sla_state,\n                obj.objecttype_id,\n                SUM(\n                    COALESCE(\n                        UNIX_TIMESTAMP(acknowledgement_time)-UNIX_TIMESTAMP(start_time),\n                        UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time),\n                        UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(start_time)\n                    )\n                ) as duration\n             FROM  ({$timeQuery}) s\n             INNER JOIN " . $prefix . "objects obj ON obj.object_id = s.object_id ";
     if ($filter) {
         $filterParts = self::buildWherePart($c, $filter);
         $mainQuery .= $filterParts["wherePart"];
     }
     $mainQuery .= "\n             GROUP BY\n                 state*(scheduled_downtime-1)*-1,\n                 object_id,\n                 objecttype_id\n             ) slahistory_main";
     $stmt = $dbh->prepare($query = "\n\n            SELECT\n                slahistory_main.sla_state AS SLA_STATE,\n                slahistory_main.object_id AS OBJECT_ID,\n                slahistory_main.objecttype_id AS OBJECTTYPE_ID,\n                SUM(slahistory_main.duration/s.complete*100) AS PERCENTAGE\n            FROM\n                 {$mainQuery}\n                 INNER JOIN (\n                     SELECT t1.object_id,\n                     SUM(\n                         COALESCE(\n                             UNIX_TIMESTAMP(acknowledgement_time)-UNIX_TIMESTAMP(start_time),\n                             UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time),\n                             UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(start_time)\n                         )\n                    ) as complete FROM ({$timeQuery}) t1\n                    GROUP BY\n                        object_id\n                 ) as s ON slahistory_main.object_id = s.object_id\n             GROUP BY\n                slahistory_main.object_id,\n                slahistory_main.sla_state,\n                slahistory_main.objecttype_id;\n         ");
     foreach ($filterParts["params"] as $param => $value) {
         $stmt->bindValue($param, $value);
     }
     return $stmt;
 }
開發者ID:philippjenni,項目名稱:icinga-web,代碼行數:18,代碼來源:IcingaSlahistoryTable.php

示例2: connect

 /**
  * Initializes the connection and sets it to object.
  *
  * @return void
  */
 public function connect()
 {
     $this->connection = $this->_doctrineConnection->getDbh();
 }
開發者ID:seven07ve,項目名稱:vendorepuestos,代碼行數:9,代碼來源:sfDoctrineDatabase.class.php

示例3: __construct

 /**
  * DOCUMENT ME
  * @param Doctrine_Connection $connection
  * @param mixed $params
  */
 public function __construct(Doctrine_Connection $connection, $params = array())
 {
     $this->connection = $connection;
     $this->sql = new aSql($connection->getDbh());
     $this->initialize($params);
 }
開發者ID:hashir,項目名稱:UoA,代碼行數:11,代碼來源:aImporter.class.php


注:本文中的Doctrine_Connection::getDbh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。