diff --git a/phpgwapi/inc/class.schema_proc.inc.php b/phpgwapi/inc/class.schema_proc.inc.php
index 93981a847c..2b3e030d04 100644
--- a/phpgwapi/inc/class.schema_proc.inc.php
+++ b/phpgwapi/inc/class.schema_proc.inc.php
@@ -348,7 +348,6 @@
$sType = '';
$iPrecision = 0;
$iScale = 0;
- $sDefault = '';
$bNullable = true;
reset($aField);
@@ -365,35 +364,29 @@
case 'scale':
$iScale = (int)$vAttrVal;
break;
- case 'default':
- $sDefault = $vAttrVal;
- if($DEBUG) { echo'
_GetFieldSQL(): Default="' . $sDefault . '"'; }
- break;
case 'nullable':
$bNullable = $vAttrVal;
break;
+ default:
+ break;
}
}
// Translate the type for the DBMS
if($sFieldSQL = $this->m_oTranslator->TranslateType($sType, $iPrecision, $iScale))
{
- if($bNullable == False)
+ if(!$bNullable)
{
$sFieldSQL .= ' NOT NULL';
}
- if($sDefault != '')
+ if(isset($aField['default']))
{
- if($DEBUG) { echo'
_GetFieldSQL(): Calling TranslateDefault for "' . $sDefault . '"'; }
+ if($DEBUG) { echo'
_GetFieldSQL(): Calling TranslateDefault for "' . $aField['default'] . '"'; }
// Get default DDL - useful for differences in date defaults (eg, now() vs. getdate())
- $sTranslatedDefault = $this->m_oTranslator->TranslateDefault($sDefault);
+ $sTranslatedDefault = $aField['default'] == '0' ? $aField['default'] : $this->m_oTranslator->TranslateDefault($aField['default']);
$sFieldSQL .= " DEFAULT '$sTranslatedDefault'";
}
- elseif($sDefault == '0')
- {
- $sFieldSQL .= " DEFAULT '0'";
- }
if($DEBUG) { echo'
_GetFieldSQL(): Outgoing SQL: ' . $sFieldSQL; }
return true;
}