示例#1
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("CONSTRAINT ");
            ConstraintName.WriteToStream(stream);

            stream.Write($" ");
            KeyType.WriteToStream(stream);

            if (ClusterExpr != null)
            {
                stream.Write(" ");
                ClusterExpr.WriteToStream(stream);
            }

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }

            if (OnPrimary != null)
            {
                stream.Write(" ");
                OnPrimary.WriteToStream(stream);
            }
        }
示例#2
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("INSERT ");
            if (!string.IsNullOrEmpty(IntoStr))
            {
                stream.Write($"{IntoStr.ToUpper()} ");
            }
            TableName.WriteToStream(stream);

            if (Columns != null && Columns.Count > 0)
            {
                stream.Write("(");
                Columns.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }

            stream.Write(" VALUES");
            stream.WriteLine();
            foreach (var values in ValuesList.Select((val, idx) => new { val, idx }))
            {
                if (values.idx != 0)
                {
                    stream.WriteLine(",");
                }
                stream.Write("(");
                values.val.WriteToStream(stream);
                stream.Write(")");
            }
        }
示例#3
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("INSERT INTO ");
            Table.WriteToStream(stream);

            if (ColumnsList != null && ColumnsList.Count > 0)
            {
                stream.Write("(");
                ColumnsList.WriteToStreamWithComma(stream);
                stream.Write(")");
            }

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }

            if (OutputList != null && OutputList.Count > 0)
            {
                stream.WriteLine();
                stream.Write("OUTPUT ");
                OutputList.WriteToStreamWithComma(stream);
            }

            if (OutputIntoExpr != null)
            {
                stream.WriteLine();
                OutputIntoExpr.WriteToStream(stream);
            }

            stream.WriteLine();
            SelectFromExpr.WriteToStream(stream);
        }
示例#4
0
 public override void WriteToStream(IndentStream stream)
 {
     stream.Write("CREATE USER ");
     UserName.WriteToStream(stream);
     stream.Write(" ");
     LoginName.WriteToStream(stream);
     if (WithExpr != null)
     {
         stream.Write(" ");
         WithExpr.WriteToStream(stream);
     }
 }
示例#5
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("ALTER INDEX ");
            IndexName.WriteToStream(stream);
            stream.Write(" ON ");
            TableName.WriteToStream(stream);
            stream.Write(" REBUILD");

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }
        }
示例#6
0
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("CREATE");

            if (IsUnique)
            {
                stream.Write(" UNIQUE");
            }

            stream.Write(" NONCLUSTERED INDEX ");
            IndexName.WriteToStream(stream);
            stream.Write(" ON ");
            TableName.WriteToStream(stream);
            stream.Write("(");
            ColumnList.WriteToStreamWithComma(stream);
            stream.Write(")");

            if (WhereExpr != null)
            {
                stream.Write(" WHERE (");
                WhereExpr.WriteToStream(stream);
                stream.Write(")");
            }

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }

            if (OnPrimary != null)
            {
                stream.Write(" ");
                OnPrimary.WriteToStream(stream);
            }

            if (IsSemicolon)
            {
                stream.Write(" ;");
            }
        }
        public override void WriteToStream(IndentStream stream)
        {
            stream.Write("CREATE CLUSTERED INDEX ");
            IndexName.WriteToStream(stream);
            stream.Write(" ON ");
            TableName.WriteToStream(stream);
            stream.Write("(");
            OnColumns.WriteToStreamWithComma(stream);
            stream.Write(")");

            if (WithExpr != null)
            {
                stream.Write(" ");
                WithExpr.WriteToStream(stream);
            }

            if (OnPartitionSchemeNameExpr != null)
            {
                stream.WriteLine();
                OnPartitionSchemeNameExpr.WriteToStream(stream);
            }
        }