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


PHP DatabaseCompatibilityUtil::resolveIntegerMaxAllowedValuesByType方法代码示例

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


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

示例1: isColumnTypeSmallerThanExistingFieldType

 protected static function isColumnTypeSmallerThanExistingFieldType($columnType, $fieldType)
 {
     return false;
     // We have intentionally kept this here but not implemented it.
     // Design wise its bit tough decision with regard to what to allow and what not to.
     // For example, do we allow change from a text type to mediumblob?
     // mediumblob is smaller in size but may be user did that knowingly and he wants us to do in db.
     // and if we don't then his binary data won't be stored as he expects it to be.
     // What now?
     // TODO: @Shoaibi: Low: Implement
     $integerTypes = array_keys(DatabaseCompatibilityUtil::resolveIntegerMaxAllowedValuesByType());
     // TODO: @Shoaibi: Low: Shouldn't these types also come from DbCU
     $floatTypes = array('float', 'double', 'decimal');
     $stringTypes = array('char', 'varchar', 'tinytext', 'mediumtext', 'text', 'longtext');
     $blogTypes = array('tinyblob', 'mediumblob', 'blob', 'longblob');
     //DatabaseCompatibilityUtil::resolveIntegerMaxAllowedValuesByType
     // type is different, check if we are switching to higher type or not.
     // check int types
     // check float types
     // check string types(blob inclusive)
     // if types from totally different domain, then what? int < float < text < blob?
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:22,代码来源:CreateOrUpdateExistingTableFromSchemaDefinitionArrayUtil.php

示例2: resolveIntegerTypeByMinAndMaxValue

 public static function resolveIntegerTypeByMinAndMaxValue(&$type, $min, $max)
 {
     $intMaxValuesAllows = DatabaseCompatibilityUtil::resolveIntegerMaxAllowedValuesByType(static::ASSUME_SIGNED);
     $type = 'integer';
     if (isset($max)) {
         foreach ($intMaxValuesAllows as $relatedType => $valueLimit) {
             $maxAllowedValue = $valueLimit;
             $minAllowedValue = 0;
             if (static::ASSUME_SIGNED) {
                 $minAllowedValue = -1 * $valueLimit;
             }
             if ((!isset($min) || $min >= $minAllowedValue) && $max < $maxAllowedValue) {
                 $type = $relatedType;
                 break;
             }
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:RedBeanModelMemberRulesToColumnAdapter.php

示例3: testResolveWithNumericalValidatorAndVariableMinForSigned

 /**
  * @depends testResolveWithNumericalValidatorAndVariableMax
  */
 public function testResolveWithNumericalValidatorAndVariableMinForSigned()
 {
     $assumedSigned = RedBeanModelMemberRulesToColumnAdapter::ASSUME_SIGNED;
     if (!$assumedSigned) {
         return;
     }
     $maxAllowed = DatabaseCompatibilityUtil::resolveIntegerMaxAllowedValuesByType($assumedSigned);
     $modelClassName = 'AuditEvent';
     $types = array_keys($maxAllowed);
     foreach ($types as $type) {
         $dbType = strtoupper($type);
         if ($type == 'integer') {
             $dbType = 'INT';
         }
         $dbType .= '(11)';
         $max = $maxAllowed[$type] - $maxAllowed[$type] / 5;
         $minAllowed = static::calculateMinByMaxAndSigned($maxAllowed[$type], $assumedSigned);
         $minAllowed = $minAllowed + $max / 5;
         $rules = array(array('attributeName' . $type, 'type', 'type' => 'integer'), array('attributeName' . $type, 'numerical', 'min' => $minAllowed, 'max' => $max));
         $column = RedBeanModelMemberRulesToColumnAdapter::resolve($modelClassName, $rules, static::$messageLogger);
         $this->assertNotEmpty($column);
         $this->assertArrayHasKey('name', $column);
         $this->assertArrayHasKey('type', $column);
         $this->assertArrayHasKey('unsigned', $column);
         $this->assertArrayHasKey('notNull', $column);
         $this->assertArrayHasKey('collation', $column);
         $this->assertArrayHasKey('default', $column);
         $this->assertEquals('attributename' . $type, $column['name']);
         $this->assertEquals($dbType, $column['type']);
         $this->assertNull($column['unsigned']);
         $this->assertEquals('NULL', $column['notNull']);
         // Not Coding Standard
         $this->assertNull($column['collation']);
         $this->assertEquals('DEFAULT NULL', $column['default']);
         // Not Coding Standard
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:40,代码来源:RedBeanModelMemberRulesToColumnAdapterTest.php


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