1.20.x schema.inc protected DatabaseSchema_mysql::cloneTableSql($source, $target)

Generate an array of query strings suitable for cloning a table.

Parameters

$source: The name of the table to be copied.

$target: The name of the new table to be created and populated with data.

Return value

An array of SQL statements to clone the table, including inserting data.:

Overrides DatabaseSchema::cloneTableSql

File

drivers/database_mysql/schema.inc, line 134
Database schema code for MySQL database servers.

Class

DatabaseSchema_mysql

Code

protected function cloneTableSql($source, $target) {
  $statements[] = 'CREATE TABLE ' . $target . ' LIKE ' . $source;
  $statements[] = 'INSERT ' . $target . ' SELECT * FROM ' . $source;

  return $statements;
}