WPSEO_Database_Proxy::create_table()publicYoast 1.0

Creates a table to the database.

Метод класса: WPSEO_Database_Proxy{}

Хуков нет.

Возвращает

true|false. True when creation is successful.

Использование

$WPSEO_Database_Proxy = new WPSEO_Database_Proxy();
$WPSEO_Database_Proxy->create_table( $columns, $indexes );
$columns(массив) (обязательный)
The columns to create.
$indexes(массив)
The indexes to use.
По умолчанию: []

Код WPSEO_Database_Proxy::create_table() Yoast 22.3

public function create_table( array $columns, array $indexes = [] ) {
	$create_table = sprintf(
		'CREATE TABLE IF NOT EXISTS %1$s ( %2$s ) %3$s',
		$this->get_table_name(),
		implode( ',', array_merge( $columns, $indexes ) ),
		$this->database->get_charset_collate()
	);

	$this->pre_execution();

	$is_created = (bool) $this->database->query( $create_table );

	$this->post_execution();

	return $is_created;
}