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


PHP DatabaseCompatibilityUtil::escape方法代码示例

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


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

示例1: getMatchedModels

 /**
  * Gets matched models. Currently only supports if the attribute is 'name'
  * @param $value
  * @param null|int $pageSize
  * @return array
  */
 protected function getMatchedModels($value, $pageSize)
 {
     $matchedModels = array();
     $penultimateModelClassName = $this->penultimateModelClassName;
     $classToEvaluate = new ReflectionClass($penultimateModelClassName);
     if ($penultimateModelClassName != null && $classToEvaluate->isSubclassOf('Item') && $penultimateModelClassName::isAnAttribute('name')) {
         $matchedModels = $penultimateModelClassName::getSubset(null, null, $pageSize, 'name' . " = '" . DatabaseCompatibilityUtil::escape($value) . "'");
     }
     return $matchedModels;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:16,代码来源:NameDedupeSanitizerUtil.php

示例2: getCommentsByRelatedModelTypeIdAndPageSize

 /**
  * Given a related model type, a related model id, and a page size, return a list of comment models.
  * @param string $type
  * @param integer $relatedId
  * @param integer $pageSize
  */
 public static function getCommentsByRelatedModelTypeIdAndPageSize($type, $relatedId, $pageSize)
 {
     assert('is_string($type)');
     assert('is_int($relatedId)');
     assert('is_int($pageSize) || $pageSize = null');
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Comment');
     $orderByColumnName = RedBeanModelDataProvider::resolveSortAttributeColumnName('Comment', $joinTablesAdapter, 'createdDateTime');
     $where = "relatedmodel_type = '" . DatabaseCompatibilityUtil::escape(strtolower($type)) . "' AND relatedmodel_id = '" . DatabaseCompatibilityUtil::escape($relatedId) . "'";
     $orderBy = $orderByColumnName . ' desc';
     return self::getSubset($joinTablesAdapter, null, $pageSize, $where, $orderBy);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:17,代码来源:Comment.php

示例3: getByUrl

 public static function getByUrl($url)
 {
     return static::getSubset(null, null, null, "url = '" . DatabaseCompatibilityUtil::escape($url) . "'");
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:4,代码来源:EmailMessageUrl.php

示例4: getByNameOrEquivalent

 /**
  * @param string $attributeName
  * @param string $value
  * @return An
  */
 protected static function getByNameOrEquivalent($attributeName, $value)
 {
     assert('is_string($attributeName)');
     assert('is_string($value) && $value != ""');
     return static::getSubset(null, null, null, $attributeName . " = '" . DatabaseCompatibilityUtil::escape($value) . "'");
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:Item.php

示例5: resolveOperatorAndValueForOneOf

 public static function resolveOperatorAndValueForOneOf($operatorType, $values, $ignoreStringToLower = false)
 {
     assert('$operatorType == "oneOf"');
     assert('is_array($values) && count($values) > 0');
     $inPart = null;
     foreach ($values as $theValue) {
         if ($inPart != null) {
             $inPart .= ',';
             // Not Coding Standard
         }
         if (is_string($theValue)) {
             if ($ignoreStringToLower) {
                 $inPart .= "'" . DatabaseCompatibilityUtil::escape($theValue) . "'";
             } else {
                 $inPart .= "'" . DatabaseCompatibilityUtil::escape($theValue) . "'";
             }
         } elseif (is_numeric($theValue)) {
             $inPart .= $theValue;
         } elseif (is_bool($theValue)) {
             if (!$theValue) {
                 $theValue = 0;
             }
             $inPart .= $theValue;
         } else {
             throw new NotSupportedException();
         }
     }
     return 'IN(' . $inPart . ')';
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:29,代码来源:SQLOperatorUtil.php

示例6: doesPortletExistByViewTypeLayoutIdAndUser

 /**
  * Check if the portlet is already added to the detail view. This would
  * take care of the case where user click on the link in select portlet
  * list more than one time
  * @param string $viewType
  * @param string $uniqueLayoutId
  * @param int $userId
  * @return boolean
  */
 public static function doesPortletExistByViewTypeLayoutIdAndUser($viewType, $uniqueLayoutId, $userId)
 {
     assert('is_integer($userId) && $userId >= 1');
     $sql = "select count(*) as count " . 'from portlet ' . "where layoutid = '" . DatabaseCompatibilityUtil::escape($uniqueLayoutId) . "' and viewtype = '" . DatabaseCompatibilityUtil::escape($viewType) . "' and _user_id = " . DatabaseCompatibilityUtil::escape($userId);
     $row = ZurmoRedBean::getRow($sql);
     if ($row['count'] > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:20,代码来源:Portlet.php

示例7: getByName

 public static function getByName($name)
 {
     return static::getSubset(null, null, null, "name = '" . DatabaseCompatibilityUtil::escape($name) . "'");
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:4,代码来源:Autoresponder.php

示例8: escapeValues

 protected static function escapeValues(array &$values)
 {
     // We do use array_map as that would also escape null values
     //$values = array_map(array(ZurmoRedBean::$adapter, 'escape'), $values);
     foreach ($values as $key => &$value) {
         if (isset($value)) {
             $value = DatabaseCompatibilityUtil::escape($value);
         }
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:AutoresponderAndCampaignItemsEmailMessageUtil.php

示例9: sanitizeSearchTerm

 /**
  * Sanitize term to prevent sql injection
  * @param $term
  */
 protected static function sanitizeSearchTerm(&$term)
 {
     $term = DatabaseCompatibilityUtil::escape($term);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:BaseModelAutoCompleteUtil.php

示例10: getOperatorAndValueWherePart

 /**
  * Given an operator type and value, SQL is constructed. Example
  * return would be '>= 5'.
  * @return string
  */
 public static function getOperatorAndValueWherePart($operatorType, $value)
 {
     assert('is_string($operatorType)');
     if (!SQLOperatorUtil::isValidOperatorTypeByValue($operatorType, $value)) {
         throw new NotSupportedException();
     }
     if (is_string($value)) {
         return self::resolveToLowerForStringComparison($operatorType, self::escape($value));
     } elseif (is_array($value) && count($value) > 0) {
         return SQLOperatorUtil::resolveOperatorAndValueForOneOf($operatorType, $value);
     } elseif ($value !== null) {
         return SQLOperatorUtil::getOperatorByType($operatorType) . " " . DatabaseCompatibilityUtil::escape($value);
     } elseif ($value === null) {
         return SQLOperatorUtil::resolveOperatorAndValueForNullOrEmpty($operatorType);
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:21,代码来源:DatabaseCompatibilityUtil.php


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