use of org.jooq.DSLContext in project jOOQ by jOOQ.
the class AbstractRoutine method executeSelectFromPOSTGRES.
private final int executeSelectFromPOSTGRES() {
DSLContext create = create(configuration);
List<Field<?>> fields = new ArrayList<Field<?>>();
if (returnParameter != null)
fields.add(DSL.field(DSL.name(getName()), returnParameter.getDataType()));
for (Parameter<?> p : outParameters) fields.add(DSL.field(DSL.name(p.getName()), p.getDataType()));
Result<?> result = create.select(fields).from("{0}", asField()).fetch();
int i = 0;
if (returnParameter != null)
outValues.put(returnParameter, returnParameter.getDataType().convert(result.getValue(0, i++)));
for (Parameter<?> p : outParameters) outValues.put(p, p.getDataType().convert(result.getValue(0, i++)));
return 0;
}
use of org.jooq.DSLContext in project jOOQ by jOOQ.
the class AbstractRoutine method executeSelectFromHSQLDB.
private final int executeSelectFromHSQLDB() {
DSLContext create = create(configuration);
Result<?> result = create.selectFrom(table(asField())).fetch();
outValues.put(returnParameter, result);
return 0;
}
use of org.jooq.DSLContext in project jOOQ by jOOQ.
the class MockArray method getResultSet0.
@SuppressWarnings("unchecked")
private ResultSet getResultSet0(T[] a) {
DSLContext create = DSL.using(dialect);
Field<Long> index = field(name("INDEX"), Long.class);
Field<T> value = (Field<T>) field(name("VALUE"), type.getComponentType());
Result<Record2<Long, T>> result = create.newResult(index, value);
for (int i = 0; i < a.length; i++) {
Record2<Long, T> record = create.newRecord(index, value);
record.setValue(index, i + 1L);
record.setValue(value, a[i]);
result.add(record);
}
return new MockResultSet(result);
}
use of org.jooq.DSLContext in project zipkin by openzipkin.
the class HasIpv6 method test.
static boolean test(DataSource datasource, DSLContexts context) {
try (Connection conn = datasource.getConnection()) {
DSLContext dsl = context.get(conn);
dsl.select(ZIPKIN_ANNOTATIONS.ENDPOINT_IPV6).from(ZIPKIN_ANNOTATIONS).limit(1).fetchAny();
return true;
} catch (DataAccessException e) {
if (e.sqlState().equals("42S22")) {
LOG.warning("zipkin_annotations.ipv6 doesn't exist, so Endpoint.ipv6 is not supported. " + "Execute: alter table zipkin_annotations add `endpoint_ipv6` BINARY(16)");
return false;
}
problemReading(e);
} catch (SQLException | RuntimeException e) {
problemReading(e);
}
return false;
}
use of org.jooq.DSLContext in project zipkin by openzipkin.
the class HasTraceIdHigh method test.
static boolean test(DataSource datasource, DSLContexts context) {
try (Connection conn = datasource.getConnection()) {
DSLContext dsl = context.get(conn);
dsl.select(ZIPKIN_SPANS.TRACE_ID_HIGH).from(ZIPKIN_SPANS).limit(1).fetchAny();
return true;
} catch (DataAccessException e) {
if (e.sqlState().equals("42S22")) {
LOG.warning(MESSAGE);
return false;
}
problemReading(e);
} catch (SQLException | RuntimeException e) {
problemReading(e);
}
return false;
}
Aggregations