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


PHP DBObjectSearch::ToOql方法代碼示例

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


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

示例1: Process


//.........這裏部分代碼省略.........
                             $valuecondition = $oExtKey->GetNullValue();
                             $aResult[$iRow][$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue());
                         } else {
                             $aResult[$iRow][$sAttCode] = new CellStatus_NullIssue();
                         }
                     } else {
                         // The value has to be found or verified
                         list($sQuery, $aMatches) = $this->ResolveExternalKey($aRowData, $sAttCode, $aResult[$iRow]);
                         if (count($aMatches) == 1) {
                             $oRemoteObj = reset($aMatches);
                             // first item
                             $valuecondition = $oRemoteObj->GetKey();
                             $aResult[$iRow][$sAttCode] = new CellStatus_Void($oRemoteObj->GetKey());
                         } elseif (count($aMatches) == 0) {
                             $aResult[$iRow][$sAttCode] = new CellStatus_SearchIssue();
                         } else {
                             $aResult[$iRow][$sAttCode] = new CellStatus_Ambiguous(null, count($aMatches), $sQuery);
                         }
                     }
                 } else {
                     // The value is given in the data row
                     $iCol = $this->m_aAttList[$sAttCode];
                     if ($sAttCode == 'id') {
                         $valuecondition = $aRowData[$iCol];
                     } else {
                         $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
                         $valuecondition = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
                     }
                 }
                 if (is_null($valuecondition)) {
                     $bSkipQuery = true;
                 } else {
                     $oReconciliationFilter->AddCondition($sAttCode, $valuecondition, '=');
                 }
             }
             if ($bSkipQuery) {
                 $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Reconciliation'));
             } else {
                 $oReconciliationSet = new CMDBObjectSet($oReconciliationFilter);
                 switch ($oReconciliationSet->Count()) {
                     case 0:
                         $oTargetObj = $this->CreateObject($aResult, $iRow, $aRowData, $oChange);
                         // $aResult[$iRow]["__STATUS__"]=> set in CreateObject
                         $aVisited[] = $oTargetObj->GetKey();
                         break;
                     case 1:
                         $oTargetObj = $oReconciliationSet->Fetch();
                         $this->UpdateObject($aResult, $iRow, $oTargetObj, $aRowData, $oChange);
                         // $aResult[$iRow]["__STATUS__"]=> set in UpdateObject
                         if (!is_null($this->m_sSynchroScope)) {
                             $aVisited[] = $oTargetObj->GetKey();
                         }
                         break;
                     default:
                         // Found several matches, ambiguous
                         $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Ambiguous'));
                         $aResult[$iRow]["id"] = new CellStatus_Ambiguous(0, $oReconciliationSet->Count(), $oReconciliationFilter->ToOql());
                         $aResult[$iRow]["finalclass"] = 'n/a';
                 }
             }
         } catch (Exception $e) {
             $aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-Internal', get_class($e), $e->getMessage()));
         }
     }
     if (!is_null($this->m_sSynchroScope)) {
         // Compute the delta between the scope and visited objects
         $oScopeSearch = DBObjectSearch::FromOQL($this->m_sSynchroScope);
         $oScopeSet = new DBObjectSet($oScopeSearch);
         while ($oObj = $oScopeSet->Fetch()) {
             $iObj = $oObj->GetKey();
             if (!in_array($iObj, $aVisited)) {
                 set_time_limit($iLoopTimeLimit);
                 $iRow++;
                 $this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange);
             }
         }
     }
     set_time_limit($iPreviousTimeLimit);
     // Fill in the blanks - the result matrix is expected to be 100% complete
     //
     foreach ($this->m_aData as $iRow => $aRowData) {
         foreach ($this->m_aAttList as $iCol) {
             if (!array_key_exists($iCol, $aResult[$iRow])) {
                 $aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
             }
         }
         foreach ($this->m_aExtKeys as $sAttCode => $aForeignAtts) {
             if (!array_key_exists($sAttCode, $aResult[$iRow])) {
                 $aResult[$iRow][$sAttCode] = new CellStatus_Void('n/a');
             }
             foreach ($aForeignAtts as $sForeignAttCode => $iCol) {
                 if (!array_key_exists($iCol, $aResult[$iRow])) {
                     // The foreign attribute is one of our reconciliation key
                     $aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
                 }
             }
         }
     }
     return $aResult;
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:101,代碼來源:bulkchange.class.inc.php


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