Skip to content

Commit

Permalink
Merge pull request #29 from oldskool/fluxbb-1.4
Browse files Browse the repository at this point in the history
Fluxbb 1.4
  • Loading branch information
Jan Dorsman committed Mar 26, 2012
2 parents e711d6b + 7537e46 commit e3ef339
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/dblayer/mysqli_innodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ function add_field($table_name, $field_name, $field_type, $allow_null, $default_

$field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);

if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
if (!is_null($default_value) && !is_int($default_value) && !is_float($default_value))
$default_value = '\''.$this->escape($default_value).'\'';

return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) ? true : false;
return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').(!is_null($default_value) ? ' DEFAULT '.$default_value : ' ').(!is_null($after_field) ? ' AFTER '.$after_field : '')) ? true : false;
}


Expand All @@ -352,10 +352,10 @@ function alter_field($table_name, $field_name, $field_type, $allow_null, $defaul

$field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type);

if ($default_value !== null && !is_int($default_value) && !is_float($default_value))
if (!is_null($default_value) && !is_int($default_value) && !is_float($default_value))
$default_value = '\''.$this->escape($default_value).'\'';

return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) ? true : false;
return $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').(!is_null($default_value) ? ' DEFAULT '.$default_value : ' ').(!is_null($after_field) ? ' AFTER '.$after_field : '')) ? true : false;
}


Expand Down

0 comments on commit e3ef339

Please sign in to comment.