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


PHP JDatabaseQuery::escape方法代码示例

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


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

示例1: testEscapeException

	/**
	 * Tests the JDatabaseQuery::escape method for an expected exception.
	 *
	 * @return  void
	 *
	 * @covers             JDatabaseQuery::escape
	 * @expectedException  RuntimeException
	 * @since              11.3
	 */
	public function testEscapeException()
	{
		// Override the internal database for testing.
		$this->_instance->db = new stdClass;

		$this->_instance->escape('foo');
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:16,代码来源:JDatabaseQueryTest.php

示例2: toDatabase

 /**
  * Adds fields on this event to a query being prepared to go into the database
  * @param JDatabaseQuery &$query Query being prepared. Modified in place.
  */
 public function toDatabase(JDatabaseQuery &$query)
 {
     foreach ($this->dbmappings as $var => $dbField) {
         if (isset($this->{$var})) {
             $query->set($dbField . " = '" . $query->escape($this->{$var}) . "'");
         }
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:12,代码来源:SWGBaseModel.php

示例3: sqlValues

 /**
  * Converts an array of values to a string that can be used in SQL to set
  * the according values in a query.
  *
  * @param   array           $data  Values that should be processed.
  * @param   JDatabaseQuery  $q     Optional query object for escaping.
  *
  * @return array
  */
 public static function sqlValues($data, $q = null)
 {
     $output = array();
     foreach ($data as $key => $value) {
         if ($value !== null) {
             if ($q) {
                 $value = $q->escape($value);
             }
             $output[] = $key . ' = "' . $value . '"';
         }
     }
     return $output;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:22,代码来源:helper.php

示例4: toDatabase

 public function toDatabase(JDatabaseQuery &$query)
 {
     $query->set("on_date = '" . $query->escape(strftime("%Y-%m-%d", $this->start)) . "'");
     if (date("Hi", $this->start) != 0) {
         $query->set("starttime = '" . $query->escape(strftime("%H:%M", $this->start)) . "'");
     } else {
         $query->set("starttime = NULL");
     }
     if (!empty($this->end)) {
         $query->set("endtime = '" . $query->escape(strftime("%H:%M", $this->end)) . "'");
     } else {
         $query->set("endtime = NULL");
     }
     if (!empty($this->newMemberStart)) {
         $query->set("newmemberstart = '" . $query->escape(strftime("%H:%M", $this->newMemberStart)) . "'");
     } else {
         $query->set("newmemberstart = NULL");
     }
     if (!empty($this->newMemberEnd)) {
         $query->set("newmemberend = '" . $query->escape(strftime("%H:%M", $this->newMemberEnd)) . "'");
     } else {
         $query->set("newmemberend = NULL");
     }
     $query->set("version = " . $this->alterations->version);
     $query->set("lastmodified = '" . $query->escape($this->alterations->lastModified) . "'");
     $query->set('detailsaltered = ' . (int) $this->alterations->details);
     $query->set('cancelled = ' . (int) $this->alterations->cancelled);
     $query->set('placetimealtered = ' . (int) $this->alterations->placeTime);
     $query->set('organiseraltered = ' . (int) $this->alterations->organiser);
     $query->set('datealtered = ' . (int) $this->alterations->date);
     if (!empty($this->latLng)) {
         $query->set("latitude = " . $this->latLng->lat);
         $query->set("longitude = " . $this->latLng->lng);
     } else {
         $query->set("latitude = NULL");
         $query->set("longitude = NULL");
     }
     parent::toDatabase($query);
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:39,代码来源:Social.php

示例5: testEscapeException

 /**
  * Tests the JDatabaseQuery::escape method for an expected exception.
  *
  * @return  void
  *
  * @expectedException  RuntimeException
  * @since              11.3
  */
 public function testEscapeException()
 {
     // Override the internal database for testing.
     TestReflection::setValue($this->_instance, 'db', new stdClass());
     $this->_instance->escape('foo');
 }
开发者ID:akirsoft,项目名称:joomla-cms,代码行数:14,代码来源:JDatabaseQueryTest.php


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