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


PHP Doctrine_Connection::getPrefix方法代碼示例

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


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

示例1: replaceTokens

 private function replaceTokens($query)
 {
     $tokens = $this->getQueryTokens($query);
     foreach ($tokens as $token) {
         switch (strtolower($token)) {
             case 'prefix':
                 $query = str_replace('${prefix}', $this->connection->getPrefix(), $query);
                 AppKitLogger::verbose("Replaced prefix %s", $query);
                 break;
             case 'username':
                 $query = str_replace('${username}', $this->user->user_name, $query);
                 break;
             case 'retained_flag':
                 $query = str_replace('${retained_flag}', $this->useRetained, $query);
                 break;
             case 'active_flag':
                 $query = str_replace('${active_flag}', 1, $query);
                 break;
             default:
                 $query = $this->resolveReferenceToken($token, $query);
         }
     }
     return $query;
 }
開發者ID:philippjenni,項目名稱:icinga-web,代碼行數:24,代碼來源:ApiDQLViewModel.class.php

示例2: 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


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