Now the "AFTER" clause is supported by add_field()

This commit is contained in:
stronk7 2006-09-12 22:58:04 +00:00
parent 48c2be79be
commit f0b50bbe89
2 changed files with 12 additions and 2 deletions

View File

@ -72,6 +72,8 @@ class XMLDBgenerator {
var $add_table_comments = true; // Does the generator need to add code for table comments
var $add_after_clause = false; // Does the generator need to add the after clause for fields
var $prefix_on_names = true; //Does the generator need to prepend the prefix to all the key/index/sequence/trigger/check names
var $names_max_length = 30; //Max length for key/index/sequence/trigger/check names (keep 30 for all!)
@ -137,7 +139,8 @@ class XMLDBgenerator {
}
/// Add the fields, separated by commas
foreach ($xmldb_fields as $xmldb_field) {
$table .= "\n " . $this->getFieldSQL($xmldb_field) . ',';
$table .= "\n " . $this->getFieldSQL($xmldb_field);
$table .= ',';
}
/// Add the keys, separated by commas
if ($xmldb_keys = $xmldb_table->getKeys()) {
@ -464,7 +467,12 @@ class XMLDBgenerator {
$tablename = $this->getEncQuoted($this->prefix . $xmldb_table->getName());
/// Build the standard alter table add
$results[] = 'ALTER TABLE ' . $tablename . ' ADD ' . $this->getFieldSQL($xmldb_field);
$altertable = 'ALTER TABLE ' . $tablename . ' ADD ' . $this->getFieldSQL($xmldb_field);
/// Add the after clause if necesary
if ($this->add_after_clause && $xmldb_field->getPrevious()) {
$altertable .= ' after ' . $this->getEncQuoted($xmldb_field->getPrevious());
}
$results[] = $altertable;
/// If the DB has extra enum code
if ($this->enum_extra_code) {

View File

@ -48,6 +48,8 @@ class XMLDBmysql extends XMLDBGenerator {
var $enum_extra_code = false; //Does the generator need to add extra code to generate code for the enums in the table
var $add_after_clause = true; // Does the generator need to add the after clause for fields
var $concat_character = null; //Characters to be used as concatenation operator. If not defined
//MySQL CONCAT function will be use