function schema_sql in Schema 5
Same name and namespace in other branches
- 6 schema.module \schema_sql()
- 7 schema.pages.inc \schema_sql()
File
- ./
schema.module, line 702
Code
function schema_sql($engine = NULL) {
$schema = drupal_get_schema(NULL, TRUE);
$sql = '';
foreach ($schema as $name => $table) {
if (substr($name, 0, 1) == '#') {
continue;
}
if ($engine) {
$stmts = call_user_func('schema_' . $engine . '_create_table_sql', $table);
}
else {
$stmts = db_create_table_sql($name, $table);
}
$sql .= implode(";\n", $stmts) . ";\n\n";
}
$output = <<<EOT
<p>This page shows the CREATE TABLE statements that the Schema module
generates for the selected database engine for each table defined by a
module. It is for debugging purposes.</p>
<textarea style="width:100%" rows="30">{<span class="php-variable">$sql</span>}</textarea>
EOT;
return $output;
}