Tweaks to the MDB2SchemaReader

This commit is contained in:
Bart Visscher 2013-07-18 20:28:57 +02:00
parent 5549c77ec5
commit e2b6781cf9
3 changed files with 8 additions and 3 deletions

@ -1 +1 @@
Subproject commit c8623cc80d47022cb25874b69849cd2f57fd4874 Subproject commit 25e8568d41a9b9a6d1662ccf33058822a890e7f5

View File

@ -383,7 +383,7 @@
<name>user</name> <name>user</name>
<type>text</type> <type>text</type>
<default></default> <default></default>
<notnull>false</notnull> <notnull>true</notnull>
<length>64</length> <length>64</length>
</field> </field>

View File

@ -148,6 +148,8 @@ class OC_DB_MDB2SchemaReader {
if (empty($options['notnull']) || !$options['notnull']) { if (empty($options['notnull']) || !$options['notnull']) {
unset($options['default']); unset($options['default']);
$options['notnull'] = false; $options['notnull'] = false;
} else {
$options['default'] = '';
} }
if ($type == 'integer') { if ($type == 'integer') {
$options['default'] = 0; $options['default'] = 0;
@ -165,9 +167,12 @@ class OC_DB_MDB2SchemaReader {
$type = 'bigint'; $type = 'bigint';
} }
} }
$table->addColumn($name, $type, $options);
if (!empty($options['autoincrement']) if (!empty($options['autoincrement'])
&& !empty($options['notnull'])) { && !empty($options['notnull'])) {
$options['primary'] = true;
}
$table->addColumn($name, $type, $options);
if (!empty($options['primary']) && $options['primary']) {
$table->setPrimaryKey(array($name)); $table->setPrimaryKey(array($name));
} }
} }