public void Test_All() { var sql = Db <DB> .Sql(db => Select(All(), Asterisk()). From(db.tbl_remuneration)); var datas = _connection.Query <Remuneration>(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT ALL * FROM tbl_remuneration"); }
public void Test_Asterisk_3() { var sql = Db <DB> .Sql(db => Select(Asterisk <Staff>()). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff"); }
public void Test_Union_All_Start() { var sql = Db<DB>.Sql(db => Select(Asterisk(db.tbl_staff)).From(db.tbl_staff) + Union(All()) + Select(Asterisk(db.tbl_staff)).From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff UNION ALL SELECT * FROM tbl_staff"); }
public void Test_Intersect_Start() { var sql = Db<DB>.Sql(db => Select(Asterisk(db.tbl_staff)).From(db.tbl_staff) + Intersect() + Select(Asterisk(db.tbl_staff)).From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff INTERSECT SELECT * FROM tbl_staff"); }
public void Test_Atan() { var sql = Db<DB>.Sql(db => Select(new { Val1 = Atan(1), }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT ATAN(@p_0) AS Val1 FROM tbl_staff", (double)1); }
public void Test_Radians() { var sql = Db<DB>.Sql(db => Select(new { Val1 = Radians(1), }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT RADIANS(@p_0) AS Val1 FROM tbl_staff", (decimal)1); }
public void Test_Power() { var sql = Db<DB>.Sql(db => Select(new { Val1 = Power(1, 2), }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT POWER(@p_0, @p_1) AS Val1 FROM tbl_staff", (double)1, 2); }
public void Test_PI() { var sql = Db<DB>.Sql(db => Select(new { Val1 = PI(), }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT PI() AS Val1 FROM tbl_staff"); }
public void Test_Asc_Desc() { var sql = Db <DB> .Sql(db => Select(Asterisk(db.tbl_staff)). From(db.tbl_staff). OrderBy(Asc(db.tbl_staff.id), Desc(db.tbl_staff.name))); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff ORDER BY tbl_staff.id ASC, tbl_staff.name DESC" ); }
public void Test_Minus_Start() { var sql = Db<DB>.Sql(db => Select(Asterisk(db.tbl_staff)).From(db.tbl_staff) + Minus() + Select(Asterisk(db.tbl_staff)).From(db.tbl_staff).Where(db.tbl_staff.id == 1)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff MINUS SELECT * FROM tbl_staff WHERE tbl_staff.id = @p_0", 1); }
public void Test_Except_All() { var sql = Db<DB>.Sql(db => Select(Asterisk(db.tbl_staff)).From(db.tbl_staff). Except(All()). Select(Asterisk(db.tbl_staff)).From(db.tbl_staff).Where(db.tbl_staff.id == 1)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT * FROM tbl_staff EXCEPT ALL SELECT * FROM tbl_staff WHERE tbl_staff.id = @p_0", 1); }
public void Test_Sign() { var sql = Db<DB>.Sql(db => Select(new { Val1 = Sign((long)1), Val2 = Sign(1), Val3 = Sign((decimal)1), Val4 = Sign((double)1), }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT SIGN(@p_0) AS Val1, SIGN(@p_1) AS Val2, SIGN(@p_2) AS Val3, SIGN(@p_3) AS Val4 FROM tbl_staff", (long)1, 1, (decimal)1, (double)1); }
public void Test_Round() { var sql = Db<DB>.Sql(db => Select(new { Val1 = Round((long)2, 3), Val2 = Round(2, 3), Val3 = Round((decimal)2, 3), Val4 = Round((double)2, 3) }). From(db.tbl_staff)); var datas = _connection.Query(sql).ToList(); Assert.IsTrue(0 < datas.Count); AssertEx.AreEqual(sql, _connection, @"SELECT ROUND(@p_0, @p_1) AS Val1, ROUND(@p_2, @p_3) AS Val2, ROUND(@p_4, @p_5) AS Val3, ROUND(@p_6, @p_7) AS Val4 FROM tbl_staff", (long)2, 3, 2, 3, (decimal)2, 3, (double)2, 3); }