Search in sources :

Example 11 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class InsertBase method insert_with_keys_listener.

@Test
@ExcludeIn({ CUBRID, SQLSERVER })
public void insert_with_keys_listener() throws SQLException {
    final AtomicBoolean result = new AtomicBoolean();
    SQLListener listener = new SQLBaseListener() {

        @Override
        public void end(SQLListenerContext context) {
            result.set(true);
        }
    };
    SQLInsertClause clause = insert(survey).set(survey.name, "Hello World");
    clause.addListener(listener);
    ResultSet rs = clause.executeWithKeys();
    assertFalse(result.get());
    assertTrue(rs.next());
    assertTrue(rs.getObject(1) != null);
    rs.close();
    assertTrue(result.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) ResultSet(java.sql.ResultSet) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 12 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class InsertBase method insert_with_subQuery_Via_Constructor.

@Test
// too slow
@ExcludeIn(FIREBIRD)
public void insert_with_subQuery_Via_Constructor() {
    int count = (int) query().from(survey).fetchCount();
    SQLInsertClause insert = insert(survey, query().from(survey2));
    insert.set(survey.id, survey2.id.add(20));
    insert.set(survey.name, survey2.name);
    assertEquals(count, insert.execute());
}
Also used : SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 13 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class SubqueriesBase method keys.

@Test
@ExcludeIn({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, SQLITE, SQLSERVER })
public void keys() {
    QEmployee employee2 = new QEmployee("employee2");
    ForeignKey<Employee> nameKey1 = new ForeignKey<Employee>(employee, ImmutableList.of(employee.firstname, employee.lastname), ImmutableList.of("a", "b"));
    ForeignKey<Employee> nameKey2 = new ForeignKey<Employee>(employee, ImmutableList.of(employee.firstname, employee.lastname), ImmutableList.of("a", "b"));
    query().from(employee).where(nameKey1.in(query().from(employee2).select(nameKey2.getProjection()))).select(employee.id).fetch();
}
Also used : Employee(com.querydsl.sql.domain.Employee) QEmployee(com.querydsl.sql.domain.QEmployee) QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 14 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class SubqueriesBase method list_in_query.

@Test
@ExcludeIn({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, SQLITE, SQLSERVER })
public void list_in_query() {
    QEmployee employee2 = new QEmployee("employee2");
    query().from(employee).where(Expressions.list(employee.id, employee.lastname).in(query().from(employee2).select(employee2.id, employee2.lastname))).select(employee.id).fetch();
}
Also used : QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 15 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class SubqueriesBase method subQuery_rightJoin.

@Test
@ExcludeIn(SQLITE)
public void subQuery_rightJoin() {
    SubQueryExpression<Integer> sq = query().from(employee2).select(employee2.id);
    QEmployee sqEmp = new QEmployee("sq");
    query().from(employee).rightJoin(sq, sqEmp).on(sqEmp.id.eq(employee.id)).select(employee.id).fetch();
}
Also used : QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Aggregations

ExcludeIn (com.querydsl.core.testutil.ExcludeIn)40 Test (org.junit.Test)38 Tuple (com.querydsl.core.Tuple)9 SQLInsertClause (com.querydsl.sql.dml.SQLInsertClause)6 ResultSet (java.sql.ResultSet)6 SAnimal (com.querydsl.jpa.domain.sql.SAnimal)4 QEmployee (com.querydsl.sql.domain.QEmployee)4 BigDecimal (java.math.BigDecimal)4 Date (java.sql.Date)4 Ignore (org.junit.Ignore)4 AbstractBaseTest (com.querydsl.sql.AbstractBaseTest)3 Group (com.querydsl.core.group.Group)2 IncludeIn (com.querydsl.core.testutil.IncludeIn)2 QCat (com.querydsl.jpa.domain.QCat)2 BigInteger (java.math.BigInteger)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ImmutableList (com.google.common.collect.ImmutableList)1 MockTuple (com.querydsl.core.group.MockTuple)1 StringPath (com.querydsl.core.types.dsl.StringPath)1 QBookMark (com.querydsl.jpa.domain4.QBookMark)1