Changeset 15901
- Timestamp:
- 04/13/18 11:11:51 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2911_TSQLSymbolicExpressionFormatter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs
r15900 r15901 93 93 //Generate function header 94 94 strBuilder.Append("CREATE FUNCTION dbo.REGRESSIONMODEL("); 95 strBuilder.Append(string.Join(", ", sortedVarcharIdentifiers.Select(n => String.Format("{0} NVARCHAR(max)",n))));95 strBuilder.Append(string.Join(", ", sortedVarcharIdentifiers.Select(n => string.Format("{0} NVARCHAR(max)",n)))); 96 96 if (varcharVarNames.Any() && floatVarNames.Any()) 97 97 strBuilder.Append(","); 98 strBuilder.Append(string.Join(", ", sortedFloatIdentifiers.Select(n => String.Format("{0} FLOAT",n))));98 strBuilder.Append(string.Join(", ", sortedFloatIdentifiers.Select(n => string.Format("{0} FLOAT",n)))); 99 99 strBuilder.AppendLine(")"); 100 100 … … 106 106 strBuilder.AppendLineIndented(1, "-- added variable declaration for convenience"); 107 107 foreach (var name in sortedVarcharIdentifiers) 108 strBuilder.AppendLineIndented(1, String.Format("-- DECLARE {0} NVARCHAR(max) = ''", name));108 strBuilder.AppendLineIndented(1, string.Format("-- DECLARE {0} NVARCHAR(max) = ''", name)); 109 109 foreach (var name in sortedFloatIdentifiers) 110 strBuilder.AppendLineIndented(1, String.Format("-- DECLARE {0} FLOAT = 0.0", name));110 strBuilder.AppendLineIndented(1, string.Format("-- DECLARE {0} FLOAT = 0.0", name)); 111 111 strBuilder.AppendLineIndented(1, "-- SELECT"); 112 112 strBuilder.AppendLine("RETURN "); … … 142 142 FormatOperator(level, node, "OR", strBuilder); 143 143 } else if (node.Symbol is Xor) { 144 throw new NotSupportedException( String.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name));144 throw new NotSupportedException(string.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name)); 145 145 } else if (node.Symbol is Sine) { 146 146 FormatFunction(level, node, "SIN", strBuilder); … … 172 172 } else if (node.Symbol is BinaryFactorVariable) { 173 173 var binFactorNode = node as BinaryFactorVariableTreeNode; 174 throw new NotSupportedException( String.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name));174 throw new NotSupportedException(string.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name)); 175 175 } else { 176 176 throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for TSQL symbolic expression tree formatter."); … … 267 267 private void FormatFactor(int level, FactorVariableTreeNode node, StringBuilder strBuilder) { 268 268 strBuilder.AppendLine("( "); 269 strBuilder.AppendLineIndented(level + 1, String.Format("CASE {0}", VariableName2Identifier(node.VariableName)));269 strBuilder.AppendLineIndented(level + 1, string.Format("CASE {0}", VariableName2Identifier(node.VariableName))); 270 270 foreach (var name in node.Symbol.GetVariableValues(node.VariableName)) { 271 strBuilder.AppendLineIndented(level + 2, String.Format("WHEN '{0}' THEN {1}", name, node.GetValue(name).ToString(CultureInfo.InvariantCulture)));271 strBuilder.AppendLineIndented(level + 2, string.Format("WHEN '{0}' THEN {1}", name, node.GetValue(name).ToString(CultureInfo.InvariantCulture))); 272 272 } 273 273 strBuilder.AppendLineIndented(level + 1, "ELSE NULL END");
Note: See TracChangeset
for help on using the changeset viewer.