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


PHP QueryBuilder::setSql方法代码示例

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


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

示例1: getEntityPreviousStatus

 function getEntityPreviousStatus($idp, $fedsDisabledList)
 {
     $query = new QueryBuilder();
     $query->setSql('SELECT * FROM EntityDescriptors WHERE entityID = ? ORDER BY lastCheck');
     $query->addQueryParam($idp['entityID'], 's');
     $result = $this->dbManager->executeStatement(true, $query);
     $previousStatus = NULL;
     $ignoreEntity = false;
     // If I found the input IdP on the EntityDescriptors table
     if ($result->num_rows > 0) {
         while ($row = $result->fetch_assoc()) {
             // If the IdP was disabled before, but now its registrationAuthority is accepted, then enables the IdP
             if (!in_array($row['registrationAuthority'], $fedsDisabledList) && $row['ignoreReason'] == 'Federation excluded from check') {
                 $query = new QueryBuilder();
                 $query->setSql("UPDATE EntityDescriptors SET ignoreEntity = 0, ignoreReason = NULL WHERE entityID = ?");
                 $query->addQueryParam($row['entityID'], 's');
                 $this->dbManager->executeStatement(false, $query);
                 $previousStatus = NULL;
                 $ignoreEntity = false;
             } else {
                 if (in_array($row['registrationAuthority'], $fedsDisabledList) && $row['ignoreReason'] != 'Federation excluded from check') {
                     $query = new QueryBuilder();
                     $query->setSql("UPDATE EntityDescriptors SET ignoreEntity = 1, ignoreReason = 'Federation excluded from check' WHERE entityID = ?");
                     $query->addQueryParam($row['entityID'], 's');
                     $this->dbManager->executeStatement(false, $query);
                     $previousStatus = NULL;
                     $ignoreEntity = true;
                 } else {
                     $previousStatus = $row['currentResult'];
                     $ignoreEntity = $row['ignoreEntity'];
                 }
             }
         }
         return array($ignoreEntity, $previousStatus);
     } else {
         $query = new QueryBuilder();
         $query->setSql("INSERT INTO EntityDescriptors (entityID, registrationAuthority, displayName, technicalContacts, supportContacts, serviceLocation, ignoreEntity, ignoreReason) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
         $query->addQueryParam($idp['entityID'], 's');
         $query->addQueryParam($idp['registrationAuthority'], 's');
         $query->addQueryParam($idp['displayName'], 's');
         $query->addQueryParam($idp['technicalContacts'], 's');
         $query->addQueryParam($idp['supportContacts'], 's');
         $query->addQueryParam($idp['SingleSignOnService'], 's');
         if (in_array($idp['registrationAuthority'], $fedsDisabledList)) {
             $query->addQueryParam('1', 's');
             $query->addQueryParam('Federation excluded from check', 's');
             $previousStatus = NULL;
             $ignoreEntity = true;
         } else {
             $query->addQueryParam('0', 's');
             $query->addQueryParam(NULL, 's');
             $previousStatus = NULL;
             $ignoreEntity = false;
         }
         $result = $this->dbManager->executeStatement(false, $query);
         return array($ignoreEntity, $previousStatus);
     }
 }
开发者ID:biancini,项目名称:edugain-connectivity-check,代码行数:58,代码来源:StoreResultsDB.php

示例2: getFederationStatistics

 private function getFederationStatistics()
 {
     $query = new QueryBuilder();
     $sql = "SELECT * FROM FederationStats";
     $query->setSql($sql);
     $result = $this->dbManager->executeStatement(true, $query);
     $entities = array();
     while ($row = $result->fetch_assoc()) {
         $entity = array('checkDate' => $row['checkDate'], 'registrationAuthority' => $row['registrationAuthority'], 'currentResult' => $row['currentResult'] ? substr($row['currentResult'], 4) : 'disabled', 'css_class' => $this->computeCssClass($row['currentResult']), 'numIdPs' => $row['numIdPs']);
         array_push($entities, $entity);
     }
     return array('results' => $entities);
 }
开发者ID:biancini,项目名称:edugain-connectivity-check,代码行数:13,代码来源:JsonAPI.php


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