Ejemplo n.º 1
0
        private void Parse()
        {
            string sql = this.ValidateStrings();

            if (string.IsNullOrEmpty(sql))
            {
                return;
            }
            sql            = ValidateBrackets(sql);
            this.QueryTree = this.CreateQueryTree(sql);
            //quebrar em espaços
            //identificar statements
        }
Ejemplo n.º 2
0
        private QueryTree TextToQueryTree(string validSQL, int lastOpenBracket, int closeBracketIndex)
        {
            string sql = validSQL.Substring(lastOpenBracket + 1, closeBracketIndex);

            QueryTree qTree = new QueryTree
            {
                Query      = sql,
                StartIndex = lastOpenBracket,
                EndIndex   = closeBracketIndex
            };

            return(qTree);
        }
Ejemplo n.º 3
0
        private QueryTree CreateQueryTree(string validSQL)
        {
            QueryTree queryTree = new QueryTree();

            if (this.charDictionary.TryGetValue('(', out _))
            {
                queryTree = this.CreateQueryTreeRecursivaly(validSQL, new List <QueryTree>(), 0);
            }
            else
            {
                QueryTree.Query = validSQL;
            }


            return(queryTree);
        }
Ejemplo n.º 4
0
 public bool IsInsideMyInterval(QueryTree queryTree)
 {
     //vai dar errado pq o intervalo mudou quando eu removi o texto anterior
     return(this.StartIndex < queryTree.StartIndex &&
            this.EndIndex > queryTree.EndIndex);
 }
Ejemplo n.º 5
0
 public QueryTree(QueryTree parent)
 {
     this.Parent = parent;
     this.Height = this.Parent.Height + 1;
 }