Explorar o código

Completion of [3668]: #1116 (and #1117): default values for ENUMs must always be expressed as strings.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3683 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=9) %!d(string=hai) anos
pai
achega
960f0562b0
Modificáronse 1 ficheiros con 10 adicións e 2 borrados
  1. 10 2
      core/cmdbsource.class.inc.php

+ 10 - 2
core/cmdbsource.class.inc.php

@@ -554,8 +554,16 @@ class CMDBSource
 		}
 		if (is_numeric($aFieldData["Default"]))
 		{
-			$default = $aFieldData["Default"] + 0; // Coerce to a numeric variable
-			$sRet .= ' DEFAULT '.self::Quote($default);
+			if (strtolower(substr($aFieldData["Type"], 0, 5)) == 'enum(')
+			{
+				// Force quotes to match the column declaration statement
+				$sRet .= ' DEFAULT '.self::Quote($aFieldData["Default"], true);
+			}
+			else
+			{
+				$default = $aFieldData["Default"] + 0; // Coerce to a numeric variable
+				$sRet .= ' DEFAULT '.self::Quote($default);
+			}
 		}
 		elseif (is_string($aFieldData["Default"]) == 'string')
 		{