コード例 #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());
        }
コード例 #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());
        }
コード例 #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);
        }
コード例 #4
0
        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);
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }