﻿// Decompiled with JetBrains decompiler
// Type: System.Data.SqlClient.SqlServerEscapeHelper
// Assembly: System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: A0A8E655-5215-4802-816D-C9E5EBD7DA5D
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll

using System.Data.Common;
using System.Text;

namespace System.Data.SqlClient
{
  internal static class SqlServerEscapeHelper
  {
    internal static string EscapeIdentifier(string name)
    {
      return "[" + name.Replace("]", "]]") + "]";
    }

    internal static void EscapeIdentifier(StringBuilder builder, string name)
    {
      builder.Append("[");
      builder.Append(name.Replace("]", "]]"));
      builder.Append("]");
    }

    internal static string EscapeStringAsLiteral(string input)
    {
      return input.Replace("'", "''");
    }

    internal static string MakeStringLiteral(string input)
    {
      if (ADP.IsEmpty(input))
        return "''";
      return "'" + SqlServerEscapeHelper.EscapeStringAsLiteral(input) + "'";
    }
  }
}
