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


PHP Sequence::getNextSequenceValues方法代碼示例

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


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

示例1: flush

    public function flush() {
        if (!isset($this->recordsHolder)) {
            return;
        }

        $datasetName = NameSpaceHelper::addNameSpace(DATASOURCE_NAME__HEALTH_MONITORING, 'hm_trails');

        // generating and assigning primary key
        $identifiers = Sequence::getNextSequenceValues($datasetName, count($this->recordsHolder->records));
        foreach ($this->recordsHolder->records as $index => $recordInstance) {
            $recordInstance->setColumnValue(0, $identifiers[$index]);
        }

        // storing data in the database
        $dataManipulationController = data_controller_dml_get_instance();
        $dataManipulationController->insertDatasetRecordBatch($datasetName, $this->recordsHolder);

        $this->recordsHolder = NULL;
    }
開發者ID:reisystems-india,項目名稱:GovDashboard-Community,代碼行數:19,代碼來源:DatabaseEventRecorder.php

示例2: generateAndStoreIdentifiers

    protected function generateAndStoreIdentifiers($lookupDatasetName, array $uniqueSetColumns, array $nonKeyColumns = NULL, $sequenceName, array &$lookupValues) {
        $dataManipulationController = data_controller_dml_get_instance();
        $metamodel = data_controller_get_metamodel();

        $lookupDataset = $metamodel->getDataset($lookupDatasetName);
        $identifierColumnName = $lookupDataset->getKeyColumn()->name;

        $lookupCacheKey = $this->prepareLookupCacheKey($lookupDataset->name);

        // preparing insert operation meta data
        $recordsHolder = new IndexedRecordsHolder();
        $recordsHolder->recordMetaData = new RecordMetaData();
        // registering 'identifier' column
        $column = $recordsHolder->recordMetaData->registerColumn($identifierColumnName);
        $column->initializeTypeFrom(Sequence::getSequenceColumnType());
        // registering columns which represent lookup key
        foreach ($uniqueSetColumns as $uniqueSetColumn) {
            $column = $recordsHolder->recordMetaData->registerColumn($uniqueSetColumn->name);
            $column->initializeTypeFrom($uniqueSetColumn->type);
            $column->key = TRUE;
        }
        // registering non key columns
        if (isset($nonKeyColumns)) {
            foreach ($nonKeyColumns as $nonKeyColumn) {
                $column = $recordsHolder->recordMetaData->registerColumn($nonKeyColumn->name);
                $column->initializeTypeFrom($nonKeyColumn->type);
            }
        }

        // generating identifiers for source table
        $identifiers = Sequence::getNextSequenceValues($sequenceName, count($lookupValues));

        // preparing records for insert operation
        foreach ($lookupValues as $lookupKey => $lookupValue) {
            $identifier = array_pop($identifiers);

            $record = array($identifier);

            foreach ($uniqueSetColumns as $uniqueSetColumn) {
                $columnName = $uniqueSetColumn->name;
                $record[] = $lookupValue->$columnName;
            }

            if (isset($nonKeyColumns)) {
                $lookupValue = $lookupValues[$lookupKey];
                foreach ($nonKeyColumns as $nonKeyColumn) {
                    $record[] = $lookupValue->{$nonKeyColumn->name};
                }
            }

            $recordInstance = $recordsHolder->initiateRecordInstance();
            $recordInstance->initializeFrom($record);
            $recordsHolder->registerRecordInstance($recordInstance);

            $lookupValue->identifier = $identifier;
            $this->cachedIdentifiers[$lookupCacheKey][$lookupKey] = $identifier;
        }

        $this->freeSpaceInIdentifierCache($lookupDataset->name);

        // storing 'missing' records
        $dataManipulationController->insertDatasetRecordBatch($lookupDataset->name, $recordsHolder);
    }
開發者ID:reisystems-india,項目名稱:GovDashboard-Community,代碼行數:63,代碼來源:AbstractDimensionLookupHandler.php


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