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()); }
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()); }
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); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }