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


PHP Sequence::getSequenceColumnType方法代码示例

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


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

示例1: prepareDimension

 public function prepareDimension(MetaModel $metamodel, DatasetMetaData $dataset, $columnName, CubeMetaData $cube)
 {
     $column = $dataset->getColumn($columnName);
     $sourceDatasetColumn = $cube->sourceDataset->getColumn($columnName);
     $dimension = $cube->getDimension($columnName);
     $this->prepareYearLevel($dimension, $column);
     // cube source dataset column contains a reference to year identifier
     $sourceDatasetColumn->initializeTypeFrom(Sequence::getSequenceColumnType());
     // adding a reference to date dataset
     $referenceName = DateDimensionDatasetNames::LEVEL_YEARS;
     $metamodel->registerSimpleReferencePoint($referenceName, DateDimensionDatasetNames::LEVEL_YEARS, 'year_id');
     $metamodel->registerSimpleReferencePoint($referenceName, $cube->sourceDatasetName, $columnName);
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:13,代码来源:DateDimensionYearLookupHandler.php

示例2: prepareDimension

    public function prepareDimension(MetaModel $metamodel, DatasetMetaData $dataset, $columnName, CubeMetaData $cube) {
        $logicalColumn = $dataset->getColumn($columnName);
        $column = $cube->factsDataset->getColumn($columnName);
        $dimension = $cube->getDimension($columnName);

        // preparing the dimension properties
        $dimension->attributeColumnName = $columnName;
        $dimension->setDatasetName(StarSchemaNamingConvention::getAttributeRelatedName($dataset->name, $columnName));

        // preparing dimension dataset
        $dimension->dataset = new DatasetMetaData();
        $dimension->dataset->name = $dimension->datasetName;
        $dimension->dataset->publicName = $dataset->publicName . " [$logicalColumn->publicName]";
        $dimension->dataset->description = t("Lookup table to store unique values from '@columnName' column", array('@columnName' => $logicalColumn->publicName));
        $dimension->dataset->datasourceName = $dataset->datasourceName;
        $dimension->dataset->source = StarSchemaNamingConvention::getAttributeRelatedName($dataset->source, $columnName);
        $dimension->dataset->markAsPrivate();
        // adding dimension dataset aliases
        if (isset($dataset->aliases)) {
            foreach ($dataset->aliases as $alias) {
                $dimension->dataset->aliases[] = StarSchemaNamingConvention::getAttributeRelatedName($alias, $columnName);
            }
        }

        // adding key column
        $keyColumn = $dimension->dataset->registerColumn($columnName);
        $keyColumn->publicName = $logicalColumn->publicName;
        $keyColumn->description = t("System generated ID to identify each unique value from '@columnName' column", array('@columnName' => $logicalColumn->publicName));
        $keyColumn->initializeTypeFrom(Sequence::getSequenceColumnType());
        $keyColumn->key = TRUE;
        $keyColumn->visible = FALSE;
        
        // adding 'value' column
        $valueColumn = $dimension->dataset->registerColumn('value');
        $valueColumn->publicName = $logicalColumn->publicName;
        $valueColumn->description = t("Actual value from '@columnName' column", array('@columnName' => $logicalColumn->publicName));
        $valueColumn->initializeTypeFrom($logicalColumn->type);

        // facts dataset column contains a reference to lookup
        $column->initializeTypeFrom(Sequence::getSequenceColumnType());
        $column->type->logicalApplicationType = StringDataTypeHandler::DATA_TYPE;

        // marking that the dimension dataset object contains complete meta data & registering it in meta model
        $dimension->dataset->markAsComplete();
        $metamodel->registerDataset($dimension->dataset);

        // adding a reference to the dimension dataset
        $referenceName = $dimension->datasetName;
        $metamodel->registerSimpleReferencePoint($referenceName, $dimension->datasetName, $columnName);
        $metamodel->registerSimpleReferencePoint($referenceName, $cube->factsDatasetName, $columnName);
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:51,代码来源:StringDimensionLookupHandler.php

示例3: adjustReferencedDataType4Casting

 protected function adjustReferencedDataType4Casting($datasetName, $columnName) {
     return Sequence::getSequenceColumnType()->applicationType;
 }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:3,代码来源:AbstractSQLDataSourceManipulationHandler.php

示例4: prepareColumnDatabaseType

 protected function prepareColumnDatabaseType(DataSourceHandler $handler, ColumnMetaData $column)
 {
     if (isset($column->type->applicationType)) {
         $storageDataType = NULL;
         list($datasetName) = ReferencePathHelper::splitReference($column->type->applicationType);
         if (isset($datasetName)) {
             $storageDataType = Sequence::getSequenceColumnType()->applicationType;
         } else {
             $datatypeHandler = DataTypeFactory::getInstance()->getHandler($column->type->applicationType);
             $storageDataType = $datatypeHandler->getStorageDataType();
         }
         switch ($storageDataType) {
             case StringDataTypeHandler::$DATA_TYPE:
                 break;
             case IntegerDataTypeHandler::$DATA_TYPE:
                 $this->prepareInteger($column);
                 break;
             case NumberDataTypeHandler::$DATA_TYPE:
             case CurrencyDataTypeHandler::$DATA_TYPE:
             case PercentDataTypeHandler::$DATA_TYPE:
                 $this->prepareNumber($column);
                 break;
             case BooleanDataTypeHandler::$DATA_TYPE:
                 // calculating length of mapping of TRUE and FALSE values
                 $valueTrue = $handler->castValue(BooleanDataTypeHandler::$DATA_TYPE, TRUE);
                 $valueFalse = $handler->castValue(BooleanDataTypeHandler::$DATA_TYPE, FALSE);
                 // length of the field depends on length of the mappings
                 $lengthValueTrue = strlen($valueTrue);
                 $lengthValueFalse = strlen($valueFalse);
                 $length = MathHelper::max($lengthValueTrue, $lengthValueFalse);
                 // detecting type for each value and selecting primary type
                 $datatype = DataTypeFactory::getInstance()->selectDataType(array(DataTypeFactory::getInstance()->autoDetectDataType($valueTrue), DataTypeFactory::getInstance()->autoDetectDataType($valueFalse)));
                 // for numeric values we use integer storage type, for rest - string
                 if ($datatype === IntegerDataTypeHandler::$DATA_TYPE) {
                     $this->prepareInteger($column, $length);
                 } elseif ($lengthValueTrue === $lengthValueFalse) {
                     $this->prepareFixedLengthString($column, $length);
                 } else {
                     $this->prepareVariableLengthString($column, $length);
                 }
                 break;
             case DateTimeDataTypeHandler::$DATA_TYPE:
                 $this->prepareDate($column, TRUE, TRUE);
                 break;
             case DateDataTypeHandler::$DATA_TYPE:
                 $this->prepareDate($column);
                 break;
             case TimeDataTypeHandler::$DATA_TYPE:
                 $this->prepareDate($column, FALSE, TRUE);
                 break;
             default:
                 throw new UnsupportedOperationException(t("Unsupported data type for '@columnName' column: @columnType", array('@columnName' => $column->publicName, '@columnType' => $column->type->applicationType)));
         }
     }
     if (!isset($column->type->databaseType)) {
         $this->prepareVariableLengthString($column);
     }
     return $column->type->databaseType;
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:59,代码来源:AbstractCreateTableStatementImpl.php

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

示例6: prepareDimension

    public function prepareDimension(MetaModel $metamodel, DatasetMetaData $dataset, $columnName, CubeMetaData $cube) {
        $column = $cube->factsDataset->getColumn($columnName);
        $dimension = $cube->getDimension($columnName);

        $referencedCube = $metamodel->findCube($this->datasetName);
        // TODO DHS Management Cube (we do not have cubes for lookups)
        $referencedDatasetName = isset($referencedCube) ? $referencedCube->factsDatasetName : $this->datasetName;

        // preparing dimension properties
        $dimension->attributeColumnName = $columnName;

        // preparing dimension dataset
        $dimension->setDatasetName($this->datasetName);
        $dimension->dataset = $metamodel->getDataset($dimension->datasetName);

        // facts dataset column contains a reference to lookup
        // TODO DHS Management Cube (column type has been already prepared)
        if (!isset($column->type->applicationType)) {
            $column->initializeTypeFrom(Sequence::getSequenceColumnType());
        }

        // adding a reference to dimension dataset
        $referenceName = $referencedDatasetName;
        $metamodel->registerSimpleReferencePoint($referenceName, $referencedDatasetName, NULL);
        $metamodel->registerSimpleReferencePoint($referenceName, $cube->factsDatasetName, $columnName);
        // ... to support retrieving properties of the dimension dataset
        $metamodel->registerSimpleReferencePoint($referenceName, $dimension->datasetName, $dimension->dataset->getKeyColumn()->name);
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:28,代码来源:LookupDatasetColumnDimensionLookupHandler.php


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