コード例 #1
0
	/**
	 * Tests the JDatabaseDriver::replacePrefix method.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 */
	public function testReplacePrefix()
	{
		$this->assertThat(
			$this->db->replacePrefix('SELECT * FROM #__dbtest'),
			$this->equalTo('SELECT * FROM &dbtest'),
			'replacePrefix method should return the query string with the #__ prefix replaced by the actual table prefix.'
		);
	}
コード例 #2
0
 /**
  * Tests the JDatabaseDriver::replacePrefix method.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function testReplacePrefix()
 {
     $this->assertEquals('SELECT * FROM &dbtest', $this->db->replacePrefix('SELECT * FROM #__dbtest'), 'replacePrefix method should return the query string with the #__ prefix replaced by the actual table prefix.');
     // Prefix in quoted values not replaced, see https://github.com/joomla/joomla-cms/issues/7162
     $this->assertEquals("SHOW TABLE STATUS LIKE '#__table'", $this->db->replacePrefix("SHOW TABLE STATUS LIKE '#__table'"), 'replacePrefix method should not change the #__ prefix in a quoted value.');
 }
コード例 #3
0
 /**
  * Replace $prefix with $this->getPrefix() in $sql
  *
  * @param  string $sql    SQL query
  * @param  string $prefix Common table prefix
  * @return string
  */
 public function replacePrefix($sql, $prefix = '#__')
 {
     return $this->_db->replacePrefix($sql, $prefix);
 }