SqlGenerator_BinaryWithMethodHandlers.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using Ant.Core;
  2. using Ant.DbExpressions;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Text;
  10. namespace Ant.Oracle
  11. {
  12. partial class SqlGenerator : DbExpressionVisitor<DbExpression>
  13. {
  14. static Dictionary<MethodInfo, Action<DbBinaryExpression, SqlGenerator>> InitBinaryWithMethodHandlers()
  15. {
  16. var binaryWithMethodHandlers = new Dictionary<MethodInfo, Action<DbBinaryExpression, SqlGenerator>>();
  17. binaryWithMethodHandlers.Add(UtilConstants.MethodInfo_String_Concat_String_String, StringConcat);
  18. binaryWithMethodHandlers.Add(UtilConstants.MethodInfo_String_Concat_Object_Object, StringConcat);
  19. var ret = Utils.Clone(binaryWithMethodHandlers);
  20. return ret;
  21. }
  22. static void StringConcat(DbBinaryExpression exp, SqlGenerator generator)
  23. {
  24. generator._sqlBuilder.Append("CONCAT(");
  25. exp.Left.Accept(generator);
  26. generator._sqlBuilder.Append(",");
  27. exp.Right.Accept(generator);
  28. generator._sqlBuilder.Append(")");
  29. }
  30. }
  31. }