Now we are able to generate all the module SQL (any RDBMS) with one
simple function call (final inserts are missing yet)
This commit is contained in:
@@ -692,6 +692,25 @@ class XMLDBStructure extends XMLDBObject {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return the SQL code needed to create the table for the specified DB and
|
||||
* prefix. Just one simple wrapper over generators.
|
||||
*/
|
||||
function getCreateStructureSQL ($dbtype, $prefix) {
|
||||
|
||||
$sqltext = '';
|
||||
|
||||
$classname = 'XMLDB' . $dbtype;
|
||||
$generator = new $classname();
|
||||
$generator->setPrefix($prefix);
|
||||
if ($tables = $this->getTables()) {
|
||||
foreach ($tables as $table) {
|
||||
$sqltext .= $generator->getCreateTableSQL($table) . "\n\n";
|
||||
}
|
||||
}
|
||||
return $sqltext;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -277,6 +277,7 @@ class XMLDBgenerator {
|
||||
}
|
||||
}
|
||||
/// Calculate the not null clause
|
||||
$notnull = '';
|
||||
if ($xmldb_field->getNotNull()) {
|
||||
$notnull = ' NOT NULL';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user