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


PHP JDatabase::escape方法代碼示例

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


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

示例1: escape

 /**
  * Esegue l'escape di una stringa per l'inserimento in una query
  * FUNZIONE CHIAMATA DAL MODULO DEVE ESSERE SEMPRE IMPLEMENTATA QUI
  * @param string $text
  * @return string
  */
 public function escape($text)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         return $this->db->escape($text);
     } else {
         return $this->db->getEscaped($text);
     }
 }
開發者ID:alesconti,項目名稱:FF_2015,代碼行數:14,代碼來源:ProPayment_Database.php

示例2: quote

 /**
  * Method to quote and optionally escape a string to database requirements for insertion into the database.
  * @param   string $text   The string to quote.
  * @param   bool   $escape True to escape the string, false to leave it unchanged.
  * @return  string  The quoted input string.
  */
 public function quote($text, $escape = true)
 {
     if (version_compare(JVERSION, '1.5.0', '>')) {
         $escape = false;
     } else {
         $escape = true;
     }
     return $this->db->quote($escape ? $this->db->escape($text) : $text);
 }
開發者ID:alexmixaylov,項目名稱:real,代碼行數:15,代碼來源:JBDatabaseQuery.php

示例3: stringMatch

 /**
  * @param $field
  * @param $data
  */
 protected function stringMatch($field, $data)
 {
     $wheres = array();
     foreach ($data as $match) {
         $match = trim($match);
         if (!empty($match)) {
             $wheres[] = $field . ' LIKE ' . $this->db->quote('%' . $this->db->escape($match, true) . '%');
         }
     }
     if (!empty($wheres)) {
         $this->filter_where[] = '(' . implode(' OR ', $wheres) . ')';
     }
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:17,代碼來源:AbstractJoomlaPlatformFilter.php

示例4: getTableKeyExpression

 /**
  * Method to get a query expression for a table key.
  *
  * @param   string   $alias     The table alias.
  * @param   string   $key       The table key alias.
  * @param   boolean  $useAlias  True to use the alias in the expression, false otherwise.
  *
  * @return  string  The table expression.
  *
  * @since   12.1
  * @throws  InvalidArgumentException
  */
 protected function getTableKeyExpression($alias, $key, $useAlias = true)
 {
     $return = '';
     // Assert that the table alias is defined.
     if (!array_key_exists($alias, $this->tables) || !array_key_exists($alias, $this->keys)) {
         throw new InvalidArgumentException(JText::sprintf('JDATABASEOBJECT_INVALID_TABLE', $alias));
     }
     // Check if the key is a column.
     if (isset($this->keys[$alias][$key])) {
         // Quote the column name.
         $column = $this->db->quoteName($this->keys[$alias][$key]);
     } else {
         // Escape the expression.
         $column = $this->db->escape($key);
     }
     // Check if we should use the table alias.
     if ($useAlias) {
         $return .= $this->db->quoteName($alias) . '.';
     }
     // Build the table expression.
     $return .= $column;
     return $return;
 }
開發者ID:prox91,項目名稱:joomla-dev,代碼行數:35,代碼來源:object.php

示例5: getEscaped

 /**
  * Get a database escaped string. For LIKE statemends: $db->Quote( $db->getEscaped( $text, true ) . '%', false )
  *
  * @param  string  $text
  * @param  boolean $escapeForLike : escape also % and _ wildcards for LIKE statements with % or _ in search strings  (since CB 1.2.3)
  * @return string
  */
 public function getEscaped($text, $escapeForLike = false)
 {
     return $this->_db->escape($text, $escapeForLike);
 }
開發者ID:bobozhangshao,項目名稱:HeartCare,代碼行數:11,代碼來源:CmsDatabaseDriver.php

示例6: getEscaped

 /**
  * Get a database escaped string. For LIKE statemends: $db->Quote( $db->getEscaped( $text, true ) . '%', false )
  *
  * @param  string  $text
  * @param  boolean $escapeForLike : escape also % and _ wildcards for LIKE statements with % or _ in search strings  (since CB 1.2.3)
  * @return string
  */
 function getEscaped($text, $escapeForLike = false)
 {
     if (checkJversion() >= 2) {
         $result = $this->_db->escape($text);
     } else {
         $result = $this->_db->getEscaped($text);
     }
     if ($escapeForLike) {
         $result = str_replace(array('%', '_'), array("\\%", "\\_"), $result);
     }
     return $result;
 }
開發者ID:rogatnev-nikita,項目名稱:cloudinterpreter,代碼行數:19,代碼來源:cb.database.php


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