Connection::prefixTables

public function Connection::prefixTables

public Connection::prefixTables($sql)

Appends a database prefix to all tables in a query.

Queries sent to Drupal should wrap all table names in curly brackets. This function searches for this syntax and adds Drupal's table prefix to all tables, allowing Drupal to coexist with other systems in the same database and/or schema if necessary.

Parameters

string $sql: A string containing a partial or entire SQL query.

Return value

string The properly-prefixed string.

File

core/lib/Drupal/Core/Database/Connection.php, line 326

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function prefixTables($sql) {
  return str_replace($this->prefixSearch, $this->prefixReplace, $sql);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Connection.php/function/Connection::prefixTables/8.1.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部