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:
stronk7
2006-08-17 00:16:34 +00:00
parent f075bac4f7
commit 848caec8c2
2 changed files with 20 additions and 0 deletions
@@ -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';
}