Permalink
Browse files

Fixed mysql and mysqli drivers to set NOT NULL as default for creatin…

…g fields. All other drivers were correct.
  • Loading branch information...
1 parent 32ad584 commit c5961e7d778d5a9361df4cfbc7da5fc4370d883f Adam Jackett committed with Phil Sturgeon Jul 23, 2011
Showing with 12 additions and 4 deletions.
  1. +6 −2 system/database/drivers/mysql/mysql_forge.php
  2. +6 −2 system/database/drivers/mysqli/mysqli_forge.php
View
8 system/database/drivers/mysql/mysql_forge.php
@@ -119,9 +119,13 @@ function _process_fields($fields)
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
- if (array_key_exists('NULL', $attributes))
+ if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
- $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+ $sql .= ' NULL';
+ }
+ else
+ {
+ $sql .= ' NOT NULL';
}
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
View
8 system/database/drivers/mysqli/mysqli_forge.php
@@ -104,9 +104,13 @@ function _process_fields($fields)
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
- if (array_key_exists('NULL', $attributes))
+ if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
- $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+ $sql .= ' NULL';
+ }
+ else
+ {
+ $sql .= ' NOT NULL';
}
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)

0 comments on commit c5961e7

Please sign in to comment.