public void CountOfNonNullColumn() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns(Count.Of(e.ID).As(r.Value)); AssertSql("SELECT COUNT(ID) Value FROM Employee"); AssertRowCount(1); AssertRow(6); }
public void CountAll() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns(Count.All().As(r.Value)); AssertSql("SELECT COUNT(*) Value FROM Employee"); AssertRowCount(1); AssertRow(6); }
public void SelectMultipleScalarIntResults() { IntValueResults r1 = new IntValueResults(); IntValueResults r2 = new IntValueResults(); // // TODO: I'm not sure I like this. // // How about Select.Scalar<IntResult>().From(e)...? // Then Columns should only be called Column and it should be restricted // to IntColumn. Everything else could probably stay the same. // q = Select.Results(r1.Value). From(e). Columns(Select.Results(r2.Value). From(e). Columns(Max.Of(e.ID).As(r2.Value)). As(r1.Value)); AssertSql("SELECT (SELECT MAX(ID) Value FROM Employee) Value FROM Employee"); AssertRowCount(6); AssertRow(6); AssertRow(6); AssertRow(6); AssertRow(6); AssertRow(6); AssertRow(6); }
public void RawColumn() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns(Raw.Column("ABC").As(r.Value)); AssertSql("SELECT ABC Value FROM Employee"); }
public void MinusInSelect() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns((e.ID - e.DepartmentID).As(r.Value)); AssertSql("SELECT (ID - DepartmentID) Value FROM Employee"); AssertRowCount(6); AssertRow(0); AssertRow(1); AssertRow(2); AssertRow(2); AssertRow(2); AssertRow(DBNull.Value); }
public void MinOfNullColumnWithoutGroupBy() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns(Min.Of(e.DepartmentID).As(r.Value)); AssertSql("SELECT MIN(DepartmentID) Value FROM Employee"); AssertRowCount(1); AssertRow(1); }
public void SumOfNullColumn() { IntValueResults r = new IntValueResults(); q = Select.Results(r.Value). From(e). Columns(Sum.Of(e.DepartmentID).As(r.Value)); AssertSql("SELECT SUM(DepartmentID) Value FROM Employee"); AssertRowCount(1); AssertRow(8); }