选择语言 :

 Driver_Database_Driver_MySQL::quote_table

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 ] )
uses
Database::_quote_identifier
Database::table_prefix

参数列表

参数 类型 描述 默认值
$value mixed Table name or array(table, alias)
$auto_as_table unknown bool false
返回值
  • string
File: ./drivers/database/mysql/mysql.class.php
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);
}