本文整理汇总了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);
}
}
示例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);
}