Welcome Guest, Not a member yet? Register   Sign In
DBforge NOT NULL
#1

[eluser]Unknown[/eluser]
/system/database/drivers/mysqli/mysqli_forge.php and
/system/database/drivers/mysql/mysql_forge.php

both have a bug in creating a field. According to the manual:
Quote:null/true : to generate "NULL" in the field definition. Without this, the field will default to "NOT NULL".

However if the null key is not specified, it won't default to "NOT NULL". All other db drivers are correct.

replace:
Code:
if (array_key_exists('NULL', $attributes))
{
    $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
}

with:
Code:
if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
    $sql .= ' NULL';
}
else
{
    $sql .= ' NOT NULL';            
}
(copied from postgre_forge.php)

This fixes the problem and fields wil default to "NOT NULL".
Please correct me if I didn't understand the manual correctly or this problem isn't reproducible.




Theme © iAndrew 2016 - Forum software by © MyBB