本文整理汇总了PHP中JDatabaseDriver::replacePrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseDriver::replacePrefix方法的具体用法?PHP JDatabaseDriver::replacePrefix怎么用?PHP JDatabaseDriver::replacePrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseDriver
的用法示例。
在下文中一共展示了JDatabaseDriver::replacePrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testReplacePrefix
/**
* 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: testReplacePrefix
/**
* 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: replacePrefix
/**
* 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);
}