public void TestConditionHavingString() { var sqlRaw = "select * from test"; var nsql = new NSQLQuery(sqlRaw); var texto = "nome do cliente"; nsql.Having("coluna1", Op.IGUAL, texto); nsql.Having("coluna2", Op.Diferente, texto); Assert.AreEqual(nsql.ToSql(), sqlRaw + " HAVING coluna1 = 'nome do cliente' AND coluna2 != 'nome do cliente'", true); }
public void TestConditionHavingNumber() { var sqlRaw = "select * from test"; var nsql = new NSQLQuery(sqlRaw); var numero = 10; nsql.Having("coluna1", Op.IGUAL, numero); nsql.Having("coluna2", Op.Diferente, numero); Assert.AreEqual(nsql.ToSql(), sqlRaw + " HAVING coluna1 = 10 AND coluna2 != 10", true); }
public void TestConditionWhereJoinHaving() { // Query Principal var sqlRaw = "select * from test"; var nsql = new NSQLQuery(sqlRaw); // Query 2 var nSubSql = new NSQLQuery(); nSubSql.Having("coluna1", Op.IGUAL, "TESTE"); // Adiciona sub query nsql.JoinHaving(nSubSql); var expected = "select * from test HAVING coluna1 = 'TESTE'"; Assert.AreEqual(expected, nsql.ToSql(), true); }