CalciteAssert.hr().connect(); assertThat(connection.isClosed(), is(false)); for (Meta.DatabaseProperty p : Meta.DatabaseProperty.values()) { switch (p) { case GET_NUMERIC_FUNCTIONS:
HashMap<Meta.DatabaseProperty, Object> properties = new HashMap<>(); for (Responses.DatabasePropertyElement property : msg.getPropsList()) { final Meta.DatabaseProperty dbProp = Meta.DatabaseProperty.fromProto(property.getKey()); final Common.TypedValue value = property.getValue();
<T> DatabaseProperty(T defaultValue) { this.defaultValue = defaultValue; final String methodName = AvaticaUtils.toCamelCase(name()); Method localMethod = null; try { localMethod = DatabaseMetaData.class.getMethod(methodName); } catch (NoSuchMethodException e) { // Pass, localMethod stays null. } if (null == localMethod) { this.method = null; this.type = null; this.isJdbc = false; } else { this.method = localMethod; this.type = AvaticaUtils.box(method.getReturnType()); this.isJdbc = true; } // It's either: 1) not a JDBC method, 2) has no default value, // 3) the defaultValue is of the expected type assert !isJdbc || defaultValue == null || defaultValue.getClass() == type; }
for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) { propertyMap.put(prop, prop.defaultValue);
for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) { propertyMap.put(prop, prop.defaultValue);
for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) { propertyMap.put(prop, prop.defaultValue);
.setKey(entry.getKey().toProto()).setValue(valueBuilder.build()));
HashMap<Meta.DatabaseProperty, Object> properties = new HashMap<>(); for (Responses.DatabasePropertyElement property : msg.getPropsList()) { final Meta.DatabaseProperty dbProp = Meta.DatabaseProperty.fromProto(property.getKey()); final Common.TypedValue value = property.getValue();
.setKey(entry.getKey().toProto()).setValue(valueBuilder.build()));
final Meta.DatabaseProperty dbProp = Meta.DatabaseProperty.fromProto(property.getKey()); final Common.TypedValue value = property.getValue();
.setKey(entry.getKey().toProto()).setValue(valueBuilder.build()));
CalciteAssert.hr().connect(); assertThat(connection.isClosed(), is(false)); for (Meta.DatabaseProperty p : Meta.DatabaseProperty.values()) { switch (p) { case GET_NUMERIC_FUNCTIONS:
<T> DatabaseProperty(T defaultValue) { this.defaultValue = defaultValue; final String methodName = AvaticaUtils.toCamelCase(name()); Method localMethod = null; try { localMethod = DatabaseMetaData.class.getMethod(methodName); } catch (NoSuchMethodException e) { // Pass, localMethod stays null. } if (null == localMethod) { this.method = null; this.type = null; this.isJdbc = false; } else { this.method = localMethod; this.type = AvaticaUtils.box(method.getReturnType()); this.isJdbc = true; } // It's either: 1) not a JDBC method, 2) has no default value, // 3) the defaultValue is of the expected type assert !isJdbc || defaultValue == null || defaultValue.getClass() == type; }
public static DatabaseProperty fromProto(Common.DatabaseProperty proto) { return DatabaseProperty.valueOf(proto.getName()); }
public static DatabaseProperty fromProto(Common.DatabaseProperty proto) { return DatabaseProperty.valueOf(proto.getName()); }
public static DatabaseProperty fromProto(Common.DatabaseProperty proto) { return DatabaseProperty.valueOf(proto.getName()); }
@Override public Properties getRemoteAvaticaProperties() { Map<DatabaseProperty, Object> propertyMap = connection.invokeWithRetries( new CallableWithoutException<Map<DatabaseProperty, Object>>() { public Map<DatabaseProperty, Object> call() { return connection.meta.getDatabaseProperties(connection.handle); } }); final Properties properties = new Properties(); for (Entry<DatabaseProperty, Object> entry: propertyMap.entrySet()) { properties.setProperty(entry.getKey().name(), entry.getValue().toString()); } return properties; }
public Common.DatabaseProperty toProto() { return Common.DatabaseProperty.newBuilder().setName(name()).build(); } }
public Common.DatabaseProperty toProto() { return Common.DatabaseProperty.newBuilder().setName(name()).build(); } }
public Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle ch) { try { final Map<DatabaseProperty, Object> map = new HashMap<>(); final Connection conn = getConnection(ch.id); final DatabaseMetaData metaData = conn.getMetaData(); for (DatabaseProperty p : DatabaseProperty.values()) { addProperty(map, metaData, p); } return map; } catch (SQLException e) { throw new RuntimeException(e); } }