Ejemplo n.º 1
0
        public void GetSubselectStringWithFormulaProperty()
        {
            SqlString sql =
                SqlString.Parse("select (select foo from bar where foo=col order by foo) from table where col = ? order by col");

            Assert.AreEqual(" from table where col = ? ", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 2
0
        public void GetSubselectStringWithSubselectInWhere()
        {
            SqlString sql =
                SqlString.Parse(
                    "select (select foo from bar where foo=col order by foo) from table where col = (select yadda from blah where yadda=x order by yadda) order by col");

            Assert.AreEqual(" from table where col = (select yadda from blah where yadda=x order by yadda) ",
                            sql.GetSubselectString().ToString());
        }
Ejemplo n.º 3
0
        private static int GetFromIndex(SqlString querySqlString)
        {
            string subselect = querySqlString.GetSubselectString().ToString();
            int    fromIndex = querySqlString.IndexOfCaseInsensitive(subselect);

            if (fromIndex == -1)
            {
                fromIndex = querySqlString.ToString().ToLowerInvariant().IndexOf(subselect.ToLowerInvariant());
            }
            return(fromIndex);
        }
        private int GetFromIndex()
        {
            string subselect = _sourceQuery.GetSubselectString().ToString();
            int    fromIndex = _sourceQuery.IndexOfCaseInsensitive(subselect);

            if (fromIndex == -1)
            {
                fromIndex = _sourceQuery.ToString().ToLowerInvariant().IndexOf(subselect.ToLowerInvariant());
            }
            return(fromIndex);
        }
Ejemplo n.º 5
0
        public void GetSubselectStringWithOrderByInSubselect()
        {
            SqlString sql = SqlString.Parse("select col from table where (col = test) and id in (select id from foo order by bar)");

            Assert.AreEqual(" from table where (col = test) and id in (select id from foo order by bar)", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 6
0
        public void GetSubselectStringWithParenthesisOnlyInWhere()
        {
            SqlString sql = SqlString.Parse("select col from table where (col = test) order by col");

            Assert.AreEqual(" from table where (col = test) ", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 7
0
        public void GetSubselectStringSimpleParameterInMiddle()
        {
            SqlString sql = SqlString.Parse("select col from table where col = ? and foo = bar order by col");

            Assert.AreEqual(" from table where col = ? and foo = bar ", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 8
0
        public void GetSubselectStringSimpleEndsWithParameter()
        {
            SqlString sql = SqlString.Parse("select col from table where col = ? order by col");

            Assert.AreEqual(" from table where col = ? ", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 9
0
        public void GetSubselectStringParameterInOrderBy()
        {
            SqlString sql = SqlString.Parse("select col from table where col = test order by ? asc");

            Assert.AreEqual(" from table where col = test ", sql.GetSubselectString().ToString());
        }
Ejemplo n.º 10
0
        public void GetSubselectStringSimple()
        {
            SqlString sql = SqlString.Parse("select col from table where col = test order by col");

            Assert.AreEqual(" from table where col = test ", sql.GetSubselectString().ToString());
        }