@Override public CheckResult check() { try (Connection conn = datasource.getConnection()) { if (!context.get(conn).meta().getSchemas().contains(DEFAULT_CATALOG.ZIPKIN)) { throw new IllegalStateException("Zipkin schema is missing"); } } catch (SQLException | RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
public void update() { tables = new LinkedHashMap<>(); cachedTables = new LinkedHashMap<>(); for (Table<?> table : dsl.meta().getTables()) { if (!(table.toString().startsWith(tablePrefix))) { // table not in current catalog or schema continue; } tables.put(table.getName(), table); } }
public static boolean tableExists(DSLContext context, Table table) { for (Table t : context.meta().getTables()) { if (t.getName().equalsIgnoreCase(table.getName())) { return true; } } return false; } }
private List<Schema> getSchemasFromMeta() { if (schemas == null) { schemas = new ArrayList<Schema>(); for (Schema schema : create().meta().getSchemas()) if (getInputSchemata().contains(schema.getName())) schemas.add(schema); } return schemas; }
public MappingQueryGenerator(DSLContext dslContext, final String tableName) { Meta meta = dslContext.meta(); for (Table table : meta.getTables()) { System.out.println(table.getName()); if (table.getName().equalsIgnoreCase(tableName)) { this.table = table; break; } } if (this.table == null) { throw new JDBCSinkException("Table not found: " + tableName); } }
public void checkOrCreate( DSLContext dsl, Meta jooqMeta, DatabaseMetaData jdbcMeta, DatabaseInterface databaseInterface ) throws SQLException, InvalidDatabaseException { Schema torodbSchema = null; for (Schema schema : jooqMeta.getSchemas()) { if (TORODB_SCHEMA.equals(schema.getName())) { torodbSchema = schema; break; } } if (torodbSchema == null) { LOGGER.info("Schema '{}' not found. Creating it...", TORODB_SCHEMA); createSchema(dsl, databaseInterface); LOGGER.info("Schema '{}' created", TORODB_SCHEMA); } else { LOGGER.info("Schema '{}' found. Checking it...", TORODB_SCHEMA); checkSchema(torodbSchema, databaseInterface); LOGGER.info("Schema '{}' checked", TORODB_SCHEMA); } }
if (context.meta().getTables().stream() .filter(t -> t.getName().equals(recordTable.getName())) .findFirst()
if (jooqMeta != null) { Schema standardSchema = null; for (Schema schema : jooqMeta.getSchemas()) { if (schema.getName().equals(schemaName)) { standardSchema = schema;
@Override public void clear(Class component) throws DaoException { if (!tableExists()) { return; } DSLContext context = getJooq(); try { if (!context.meta().getTables().contains(Tables.META_INFO)) { return; } context.delete(Tables.META_INFO) .where(Tables.META_INFO.COMPONENT.eq(component.getSimpleName())) .execute(); } finally { freeJooq(context); } }
&& dsl.meta().getSchemas().stream().noneMatch( s -> schema.getName().equalsIgnoreCase( s.getName() ) ) )
existingTables = context.meta().getTables().stream() .map(t -> t.getName().toLowerCase(Locale.ENGLISH)) .collect(Collectors.toSet());