use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class TypesBase method dump_types.
@Test
@ExcludeIn({ CUBRID, POSTGRESQL, TERADATA })
public void dump_types() throws SQLException {
Connection conn = Connections.getConnection();
DatabaseMetaData md = conn.getMetaData();
// types
ResultSet rs = md.getUDTs(null, null, null, null);
try {
while (rs.next()) {
// cat, schema, name, classname, datatype, remarks, base_type
String cat = rs.getString(1);
String schema = rs.getString(2);
String name = rs.getString(3);
String classname = rs.getString(4);
String datatype = rs.getString(5);
String remarks = rs.getString(6);
String baseType = rs.getString(7);
System.out.println(name + " " + classname + " " + datatype + " " + remarks + " " + baseType);
// attributes
ResultSet rs2 = md.getAttributes(cat, schema, name, null);
try {
while (rs2.next()) {
// cat, schema, name, attr_name, data_type, attr_type_name, attr_size
// decimal_digits, num_prec_radix, nullable, remarks, attr_def, sql_data_type, ordinal_position
// ...
String cat2 = rs2.getString(1);
String schema2 = rs2.getString(2);
String name2 = rs2.getString(3);
String attrName2 = rs2.getString(4);
String dataType2 = rs2.getString(5);
String attrTypeName2 = rs2.getString(6);
String attrSize2 = rs2.getString(7);
System.out.println(" " + attrName2 + " " + dataType2 + " " + attrTypeName2 + " " + attrSize2);
}
} finally {
rs2.close();
}
}
} finally {
rs.close();
}
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class UnionBase method union5.
// FIXME for CUBRID
// Teradata: The ORDER BY clause must contain only integer constants.
@SuppressWarnings("unchecked")
@Test
@ExcludeIn({ DERBY, CUBRID, FIREBIRD, TERADATA })
// FIXME
@Ignore
public void union5() {
/* (select e.ID, e.FIRSTNAME, superior.ID as sup_id, superior.FIRSTNAME as sup_name
* from EMPLOYEE e join EMPLOYEE superior on e.SUPERIOR_ID = superior.ID)
* union
* (select e.ID, e.FIRSTNAME, null, null from EMPLOYEE e)
* order by ID asc
*/
QEmployee superior = new QEmployee("superior");
SubQueryExpression<Tuple> sq1 = query().from(employee).join(employee.superiorIdKey, superior).select(employee.id, employee.firstname, superior.id.as("sup_id"), superior.firstname.as("sup_name"));
SubQueryExpression<Tuple> sq2 = query().from(employee).select(employee.id, employee.firstname, null, null);
List<Tuple> results = query().union(sq1, sq2).orderBy(employee.id.asc()).fetch();
for (Tuple result : results) {
System.err.println(Arrays.asList(result));
}
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class InsertBase method insert_dates.
@Test
// https://bitbucket.org/xerial/sqlite-jdbc/issue/133/prepstmtsetdate-int-date-calendar-seems
@ExcludeIn(SQLITE)
public void insert_dates() {
QDateTest dateTest = QDateTest.qDateTest;
LocalDate localDate = new LocalDate(1978, 1, 2);
Path<LocalDate> localDateProperty = ExpressionUtils.path(LocalDate.class, "DATE_TEST");
Path<DateTime> dateTimeProperty = ExpressionUtils.path(DateTime.class, "DATE_TEST");
SQLInsertClause insert = insert(dateTest);
insert.set(localDateProperty, localDate);
insert.execute();
Tuple result = query().from(dateTest).select(dateTest.dateTest.year(), dateTest.dateTest.month(), dateTest.dateTest.dayOfMonth(), dateTimeProperty).fetchFirst();
assertEquals(Integer.valueOf(1978), result.get(0, Integer.class));
assertEquals(Integer.valueOf(1), result.get(1, Integer.class));
assertEquals(Integer.valueOf(2), result.get(2, Integer.class));
DateTime dateTime = result.get(dateTimeProperty);
if (target == CUBRID) {
// XXX Cubrid adds random milliseconds for some reason
dateTime = dateTime.withMillisOfSecond(0);
}
assertEquals(localDate.toDateTimeAtStartOfDay(), dateTime);
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class MergeBase method merge_with_keys_listener.
@Test
@ExcludeIn({ H2, CUBRID, SQLSERVER })
public void merge_with_keys_listener() throws SQLException {
final AtomicBoolean result = new AtomicBoolean();
SQLListener listener = new SQLBaseListener() {
@Override
public void end(SQLListenerContext context) {
result.set(true);
}
};
SQLMergeClause clause = merge(survey).keys(survey.id).set(survey.id, 7).set(survey.name, "Hello World");
clause.addListener(listener);
ResultSet rs = clause.executeWithKeys();
assertTrue(rs.next());
assertTrue(rs.getObject(1) != null);
rs.close();
assertTrue(result.get());
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class SelectBase method date_add.
@Test
@ExcludeIn({ SQLITE })
public void date_add() {
SQLQuery<?> query = query().from(employee);
Date date1 = query.select(employee.datefield).fetchFirst();
Date date2 = query.select(SQLExpressions.addYears(employee.datefield, 1)).fetchFirst();
Date date3 = query.select(SQLExpressions.addMonths(employee.datefield, 1)).fetchFirst();
Date date4 = query.select(SQLExpressions.addDays(employee.datefield, 1)).fetchFirst();
assertTrue(date2.getTime() > date1.getTime());
assertTrue(date3.getTime() > date1.getTime());
assertTrue(date4.getTime() > date1.getTime());
}
Aggregations