本文整理汇总了PHP中JDatabase::getPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabase::getPrefix方法的具体用法?PHP JDatabase::getPrefix怎么用?PHP JDatabase::getPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabase
的用法示例。
在下文中一共展示了JDatabase::getPrefix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveRule
public function saveRule()
{
$refTab = JRequest::getVar('reference_table', '');
$pfx = $this->db->getPrefix();
$tab = $this->str_replace_first($refTab, $pfx, '');
$this->db->setQuery("\n\t\t\n\t\t\tInsert \n\t\t\tInto \n\t\t\t\t#__facileforms_integrator_rules\n\t\t\t(\n\t\t\t\tname,\n\t\t\t\tform_id,\n\t\t\t\treference_table,\n\t\t\t\ttype\n\t\t\t) \n\t\t\tValues\n\t\t\t(\n\t\t\t\t" . $this->db->Quote(JRequest::getVar('rule_name')) . ",\n\t\t\t\t" . $this->db->Quote(JRequest::getVar('form_id')) . ",\n\t\t\t\t" . $this->db->Quote($tab) . ",\n\t\t\t\t" . $this->db->Quote(JRequest::getVar('type')) . "\n\t\t\t)\n\t\t\n\t\t");
$this->db->query();
$ruleId = $this->db->insertid();
return $ruleId;
}
示例2: saveRule
public function saveRule(){
$refTab = JRequest::getVar('reference_table', '');
$pfx = $this->db->getPrefix();
$tab = $this->str_replace_first($refTab, $pfx, '');
$this->db->setQuery("
Insert
Into
#__facileforms_integrator_rules
(
name,
form_id,
reference_table,
type
)
Values
(
".$this->db->Quote(JRequest::getVar('rule_name')).",
".$this->db->Quote(JRequest::getVar('form_id')).",
".$this->db->Quote($tab).",
".$this->db->Quote(JRequest::getVar('type'))."
)
");
$this->db->query();
$ruleId = $this->db->insertid();
return $ruleId;
}
示例3: testGetPrefix
/**
* Tests the JDatabase::getPrefix method.
*
* @return void
*
* @since 11.4
*/
public function testGetPrefix()
{
$this->assertThat(
$this->db->getPrefix(),
$this->equalTo('&')
);
}
示例4: replacePrefix
/**
* Sostituisce #__ con il prefisso del database
* @param string $q
* @return string
*/
private function replacePrefix($q)
{
return str_replace("#__", $this->db->getPrefix(), $q);
}
示例5: replacePrefix
/**
* Quick utility method to replace the mysql prefix used in the joomla tables with the real prefix
*
* @param string $sql The sql query
* @param string $prefix The prefix to search for (default: #__)
*
* @return string The query with the real prefix
*
* @since 1.0.0
*/
public function replacePrefix($sql, $prefix = '#__')
{
return preg_replace('/' . preg_quote($prefix) . '/', $this->_database->getPrefix(), $sql);
}
示例6: __toString
/**
* Magic function to convert the query to a string.
* @return string The completed query.
*/
public function __toString()
{
$query = '';
switch ($this->type) {
case 'element':
$query .= (string) $this->element;
break;
case 'select':
if (is_null($this->select)) {
$this->select = '*';
}
$query .= (string) $this->select;
$query .= (string) $this->from;
if ($this->join) {
$this->join = array_unique($this->join);
foreach ($this->join as $join) {
$query .= (string) $join . PHP_EOL;
}
}
if ($this->where) {
$query .= (string) $this->where;
}
if ($this->group) {
$query .= (string) $this->group;
}
if ($this->having) {
$query .= (string) $this->having;
}
if ($this->order) {
$query .= (string) $this->order;
}
break;
case 'delete':
$query .= (string) $this->delete;
$query .= (string) $this->from;
if ($this->join) {
$this->join = array_unique($this->join);
foreach ($this->join as $join) {
$query .= (string) $join;
}
}
if ($this->where) {
$query .= (string) $this->where;
}
break;
case 'update':
$query .= (string) $this->update;
$query .= (string) $this->set;
if ($this->where) {
$query .= (string) $this->where;
}
break;
case 'insert':
$query .= (string) $this->insert;
// Set method
if ($this->set) {
$query .= (string) $this->set;
} elseif ($this->values) {
if ($this->columns) {
$query .= (string) $this->columns;
}
$query .= ' VALUES ';
$query .= (string) $this->values;
}
break;
case 'replace':
$query .= (string) $this->replace;
// Set method
if ($this->set) {
$query .= (string) $this->set;
} elseif ($this->values) {
if ($this->columns) {
$query .= (string) $this->columns;
}
$query .= ' VALUES ';
$query .= (string) $this->values;
}
break;
}
if ($this->limit) {
$query .= (string) $this->limit;
}
$query = str_replace('#__', $this->db->getPrefix(), $query);
return $query;
}