コード例 #1
0
        /// <summary>
        /// 写入单个数据源对象。
        /// </summary>
        /// <param name="writer">语句写入器。</param>
        /// <param name="fragment">写入语句。</param>
        protected virtual void WriteFragmentForSource(SqlWriter writer, ISqlFragment fragment)
        {
            var source = (SourceFragment)fragment;

            if (source.Join.HasValue)
            {
                WriteFragmentForSourceJoin(writer, source);
                WriteFragmentForSourceContent(writer, source);
                WriteFragmentForSourceCondition(writer, source);
            }
            else
            {
                WriteFragmentForSourceContent(writer, source);
            }
        }
コード例 #2
0
 /// <summary>
 /// 写入数据源内容。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="source">数据源语句。</param>
 protected virtual void WriteFragmentForSourceContent(SqlWriter writer, ISourceFragment source)
 {
     if (source is SelectFragment || source is SetFragment)
     {
         writer.Write('(');
         source.WriteSql(writer);
         writer.Write(')');
     }
     else
     {
         source.WriteSql(writer);
     }
     if (!(source is InheritFragment))
     {
         writer.Write(" AS ");
         writer.Write(source.AliasName);
     }
 }
コード例 #3
0
        private void WriteBinaryForSimple(SqlWriter writer, ISqlFragment fragment)
        {
            var binary = (BinaryFragment)fragment;

            binary.Left.WriteSql(writer);
            switch (binary.Kind)
            {
            case EBinaryKind.AndAlso: break;

            case EBinaryKind.OrElse: break;

            case EBinaryKind.Add: writer.Write(" + "); break;

            case EBinaryKind.Subtract: writer.Write(" - "); break;

            case EBinaryKind.Multiply: writer.Write(" * "); break;

            case EBinaryKind.Divide: writer.Write(" / "); break;

            case EBinaryKind.Modulo: writer.Write(" % "); break;

            case EBinaryKind.And: writer.Write(" & "); break;

            case EBinaryKind.Or: writer.Write(" | "); break;

            case EBinaryKind.ExclusiveOr: writer.Write(" ^ "); break;

            case EBinaryKind.Equal: writer.Write(" = "); break;

            case EBinaryKind.NotEqual: writer.Write(" != "); break;

            case EBinaryKind.GreaterThanOrEqual: writer.Write(" >= "); break;

            case EBinaryKind.GreaterThan: writer.Write(" > "); break;

            case EBinaryKind.LessThan: writer.Write(" < "); break;

            case EBinaryKind.LessThanOrEqual: writer.Write(" <= "); break;
            }
            binary.Right.WriteSql(writer);
        }
コード例 #4
0
 /// <summary>
 /// 写入参数名称。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="name">名称。</param>
 public virtual void WriteParameterName(SqlWriter writer, string name)
 {
     writer.Write('@');
     writer.Write(name);
 }
コード例 #5
0
 /// <summary>
 /// 写入别名。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="name">名称。</param>
 public virtual void WriteAliasName(SqlWriter writer, string name)
 {
     writer.Write(" AS ");
     writer.Write(name);
 }
コード例 #6
0
 /// <summary>
 /// 写入数据库安全名称。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="name">名称。</param>
 public abstract void WriteDbName(SqlWriter writer, string name);
コード例 #7
0
 /// <summary>
 /// 写入语句终止符。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="fragment">当前语句。</param>
 public virtual void WriteTerminator(SqlWriter writer, ISqlFragment fragment) => writer.Write(';');
コード例 #8
0
ファイル: GenerateContext.cs プロジェクト: liuyuliuyu520/Mego
 /// <summary>
 /// 写入语句结束符。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="fragment">片段对象。</param>
 internal void WriteTerminator(SqlWriter writer, ISqlFragment fragment)
 {
     _FragmentWriter.WriteTerminator(writer, fragment);
 }
コード例 #9
0
ファイル: GenerateContext.cs プロジェクト: liuyuliuyu520/Mego
 /// <summary>
 /// 写入语句片段。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="fragment">片段对象。</param>
 internal void WriteFragment(SqlWriter writer, ISqlFragment fragment)
 {
     _FragmentWriter.WriteFragment(writer, fragment);
 }
コード例 #10
0
 /// <summary>
 /// 写入数据库对象名称。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="name">名称。</param>
 /// <param name="schema">架构名。</param>
 public abstract void WriteDbObject(SqlWriter writer, string name, string schema);