Quote a database table name and adds the table prefix if needed.
$table = $db->quote_table($table);
string Driver_Database_Driver_MySQL::quote_table( mixed $value [, $auto_as_table = bool false ] )
参数列表
参数 类型 描述 默认值 $value
mixed
Table name or array(table, alias) $auto_as_table
unknown
bool false
string
public function quote_table($value,$auto_as_table=false)
{
// Assign the table by reference from the value
if (is_array($value))
{
$table = & $value[0];
}
else
{
$table = & $value;
}
if ($this->config['table_prefix'] && is_string($table) && strpos($table, '.') === false)
{
if (stripos($table, ' AS ')!==false)
{
$table = $this->config['table_prefix'] . $table;
}
else
{
$table = $this->config['table_prefix'] . $table . ($auto_as_table?' AS '.$table:'');
}
}
return $this->_quote_identifier($value);
}