function schema_sql in Schema 7
Same name and namespace in other branches
- 5 schema.module \schema_sql()
- 6 schema.module \schema_sql()
"SQL" menu callback.
1 string reference to 'schema_sql'
- schema_menu in ./
schema.module - Implements hook_menu().
File
- ./
schema.pages.inc, line 227 - Page callbacks for the Schema module.
Code
function schema_sql($engine = NULL) {
$schema = schema_get_schema();
$connection = Database::getConnection();
$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 = schema_dbobject()
->getCreateTableSql($name, $table);
}
$sql .= implode(";\n", $stmts) . ";\n\n";
}
return "<textarea style=\"width:100%\" rows=\"30\">{$sql}</textarea>";
}