protected void ParseSql() { string sql = _tokenizer.Token; if (IsElseMode()) { sql = sql.Replace("--", string.Empty); } INode node = Peek(); if ((node is InternalIfNode || node is ElseNode) && node.ChildSize == 0) { InternalSqlTokenizer st = new InternalSqlTokenizer(sql); st.SkipWhitespace(); string token = st.SkipToken(); st.SkipWhitespace(); if ("AND".Equals(token.ToUpper()) || "OR".Equals(token.ToUpper())) { node.AddChild(new PrefixSqlNode(st.Before, st.After)); } else { node.AddChild(new SqlNode(sql)); } } else { node.AddChild(new SqlNode(sql)); } }
// =============================================================================== // Constructor // =========== public InternalSqlParser(String sql, bool blockNullParameter) { sql = sql.Trim(); if (sql.EndsWith(";")) { sql = sql.Substring(0, sql.Length - 1); } _specifiedSql = sql; _blockNullParameter = blockNullParameter; _tokenizer = new InternalSqlTokenizer(sql); }