Exemple #1
0
        private void ShiftLastCommentToNextStmt(Stmts stmts)
        {
            // 入力文の先頭のコメントを取得する
            // (先頭がコメントでない場合はnull)
            //string lastComment = this.GetTopComment();
            //bool lastAutoWhere = this.GetTopAutoWhere();
            string lastComment   = stmts[0].HeaderComment;
            bool   lastAutoWhere = stmts[0].AutoWhere;

            // SQL文の先頭のコメントをHeaderCommentに設定する
            foreach (var stmt in stmts)
            {
                stmt.HeaderComment = lastComment;
                stmt.AutoWhere     = lastAutoWhere;
                // SQL文の先頭のコメントは、直前のSQL文の末尾のコメントとして格納されている.
                // HeaderCommentと重複しないようにするため、これを削除する
                if (stmt.StmtSeparators > 0 && stmt.Comments.Count > 0)
                {
                    lastComment = stmt.Comments.Last;
                    stmt.Comments[stmt.Comments.Count - 1] = null;
                    lastAutoWhere = stmt.AutoWhere;
                }
                else
                {
                    lastComment   = null;
                    lastAutoWhere = true;
                }
            }

            // SQL文の末尾のコメントを格納する次のSQL文がない場合は、
            // NullStmtを新規に生成してこれに格納する.
            if (lastComment != null)
            {
                var nullStmt = new NullStmt(0, new Comments());
                nullStmt.HeaderComment = lastComment;
                stmts.Add(nullStmt);
            }
        }
Exemple #2
0
 virtual public void VisitAfter(NullStmt nullStmt)
 {
 }
Exemple #3
0
 virtual public void VisitBefore(NullStmt nullStmt)
 {
 }
 public void VisitAfter(NullStmt nullStmt)
 {
     _visitor.VisitAfter(nullStmt);
 }
 public void VisitBefore(NullStmt nullStmt)
 {
     _visitor.VisitBefore(nullStmt);
 }