Search in sources :

Example 6 with SqlSelect

use of org.folio.cql2pgjson.model.SqlSelect in project raml-module-builder by folio-org.

the class CQL2PgJSONTest method optimizedOR.

@Test
public void optimizedOR() throws QueryValidationException {
    SqlSelect s = cql2pgJson.toSql("name=* OR email=*");
    assertEquals("true", s.getWhere());
    s = cql2pgJson.toSql("name=* OR email=* OR zip=*");
    assertEquals("true", s.getWhere());
    // any that has a name
    s = cql2pgJson.toSql("name=\"\"");
    assertEquals("users.user_data->>'name' ~ ''", s.getWhere());
    s = cql2pgJson.toSql("name=\"\" OR email=\"\"");
    assertEquals("(users.user_data->>'name' ~ '') OR (users.user_data->>'email' ~ '')", s.getWhere());
}
Also used : SqlSelect(org.folio.cql2pgjson.model.SqlSelect) Test(org.junit.Test)

Aggregations

SqlSelect (org.folio.cql2pgjson.model.SqlSelect)6 Test (org.junit.Test)3 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 QueryValidationException (org.folio.cql2pgjson.exception.QueryValidationException)1 CqlModifiers (org.folio.cql2pgjson.model.CqlModifiers)1 DbIndex (org.folio.cql2pgjson.model.DbIndex)1 IndexTextAndJsonValues (org.folio.cql2pgjson.model.IndexTextAndJsonValues)1 ModifierSet (org.z3950.zing.cql.ModifierSet)1