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


PHP DatabaseCompatibilityUtil::getMaxVarCharLength方法代碼示例

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


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

示例1: __construct

 public function __construct($modelClassName, $attributeName)
 {
     parent::__construct($modelClassName, $attributeName);
     assert('is_string($attributeName)');
     $this->maxLength = DatabaseCompatibilityUtil::getMaxVarCharLength();
     $this->messageCountData[static::EMAIL_TOO_LONG] = 0;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:7,代碼來源:EmailBatchAttributeValueDataAnalyzer.php

示例2: sanitizeValue

 /**
  * Given a value, resolve that the value is a correctly formatted url. If not, an
  * InvalidValueToSanitizeException is thrown.
  * @param mixed $value
  * @return sanitized value
  * @throws InvalidValueToSanitizeException
  */
 public function sanitizeValue($value)
 {
     if ($value == null) {
         return $value;
     }
     $maxLength = DatabaseCompatibilityUtil::getMaxVarCharLength();
     if (false === ($validatedUrl = $this->resolveValidatedUrl($value))) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'Invalid url format.'));
     }
     if (strlen($validatedUrl) > $maxLength) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'URL was too long.'));
     }
     return $validatedUrl;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:21,代碼來源:UrlSanitizerUtil.php

示例3: sanitizeValue

 /**
  * Given a value, resolve that the value is a correctly formatted email address. If not, an
  * InvalidValueToSanitizeException is thrown.
  * @param mixed $value
  * @return sanitized value
  * @throws InvalidValueToSanitizeException
  */
 public function sanitizeValue($value)
 {
     assert('$this->mappingRuleData == null');
     if ($value == null) {
         return $value;
     }
     $maximumLength = DatabaseCompatibilityUtil::getMaxVarCharLength();
     if (false === ($validatedEmail = $this->resolveValidatedEmail($value))) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'Invalid email format.'));
     }
     if (strlen($validatedEmail) > $maximumLength) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'Email was too long.'));
     }
     return $value;
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:22,代碼來源:EmailSanitizerUtil.php

示例4: sanitizeValue

 /**
  * Given a value, resolve that the value is a correctly formatted email address. If not, an
  * InvalidValueToSanitizeException is thrown.
  * @param string $modelClassName
  * @param string $attributeName
  * @param mixed $value
  * @param array $mappingRuleData
  */
 public static function sanitizeValue($modelClassName, $attributeName, $value, $mappingRuleData)
 {
     assert('is_string($modelClassName)');
     assert('is_string($attributeName)');
     assert('$mappingRuleData == null');
     if ($value == null) {
         return $value;
     }
     $maxLength = DatabaseCompatibilityUtil::getMaxVarCharLength();
     $validator = new CEmailValidator();
     $validatedEmail = $validator->validateValue($value);
     if ($validatedEmail === false) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'Invalid email format.'));
     }
     if (strlen($validatedEmail) > $maxLength) {
         throw new InvalidValueToSanitizeException(Zurmo::t('ImportModule', 'Email was too long.'));
     }
     return $value;
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:27,代碼來源:EmailSanitizerUtil.php

示例5: testGetMaxVarCharLength

 public function testGetMaxVarCharLength()
 {
     $this->assertEquals(255, DatabaseCompatibilityUtil::getMaxVarCharLength());
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:4,代碼來源:DatabaseCompatibilityUtilTest.php


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