Skip to content

Commit

Permalink
Fixes issue #842: Active Records insert fails in MSSQL if a column ha…
Browse files Browse the repository at this point in the history
…s a default value of (NULL)
  • Loading branch information
c-schmitz committed Jun 19, 2012
1 parent 14eec55 commit 8b54782
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -24,6 +24,7 @@ Version 1.1.11 work in progress
- Bug #697: Fixed WSDLGenerator now generating proper namespace for certain complexTypes (BBoom)
- Bug #749: CActiveRecord::refresh() did not work in afterSave() for new records, will now always refresh, when db entry exists (cebe)
- Bug #769: Fixed the bug that $.fn.yiiGridView.getSelection was not working always if a custom CGridView::template was used (mdomba)
- Bug #842: Active Records insert fails in MSSQL if a column has a default value of (NULL) (c-schmitz)
- Bug: Fixed CMenu::isItemActive() to work properly when there is a hash in the item's url (SlKelevro)
- Bug: Added missing return statement to CAuthItem->revoke() (mdomba)
- Bug: CHtml::resolveValue() ignoring of array elements accessor at the beginning of the $attribute argument now works properly (resurtm)
Expand Down
17 changes: 17 additions & 0 deletions framework/db/schema/mssql/CMssqlColumnSchema.php
Expand Up @@ -19,6 +19,23 @@
*/
class CMssqlColumnSchema extends CDbColumnSchema
{

/**
* Initializes the column with its DB type and default value.
* This sets up the column's PHP type, size, precision, scale as well as default value.
* @param string $dbType the column's DB type
* @param mixed $defaultValue the default value
*/
public function init($dbType, $defaultValue)
{
if ($defaultValue=='(NULL)')
{
$defaultValue=null;
}
parent::init($dbType, $defaultValue);
}


/**
* Extracts the PHP type from DB type.
* @param string $dbType DB type
Expand Down

0 comments on commit 8b54782

Please sign in to comment.