Permalink
Browse files

Merge pull request #845 from c-schmitz/master

Fixed issue #842: Active Records insert fails in MSSQL if a column has a default value of (NULL)
  • Loading branch information...
2 parents 132f351 + 8b54782 commit 5f089a2b43ca0e5df25161cd29a76f2f8f3966d8 @qiangxue qiangxue committed Jun 20, 2012
Showing with 18 additions and 0 deletions.
  1. +1 −0 CHANGELOG
  2. +17 −0 framework/db/schema/mssql/CMssqlColumnSchema.php
View
@@ -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)
@@ -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

0 comments on commit 5f089a2

Please sign in to comment.