public DatabaseWrapper(DatabaseDescription dbDesc) { this.dbDesc = dbDesc; for (Table fld : dbDesc.getTables()) { ITable iFld = new TableWrapper(this, fld); sortedTables.add(iFld); } }
public DumpFileVisitor(String dbName) { this.db = new DatabaseDescription(dbName); }
@Override public String getName() { return dbDesc.getDbName(); }
public static DatabaseDescription deserialize(InputStream in, String name) throws IOException { DatabaseDescription db = new DatabaseDescription(name); try (InputStreamReader isr = new InputStreamReader(in); BufferedReader reader = new BufferedReader(isr)) { String line = null; while ((line = reader.readLine()) != null) { if (line.startsWith("S")) { db.addSequence(new Sequence(line.substring(1))); } else if (line.startsWith("T")) { currTbl = new Table(line.substring(1)); db.addTable(currTbl); } else if (line.startsWith("F")) {
Files.getNameWithoutExtension(file.filename())); sensorContext.newMeasure().on(file).forMetric((Metric) OpenEdgeMetrics.NUM_TABLES).withValue( desc.getTables().size()).save(); sensorContext.newMeasure().on(file).forMetric((Metric) OpenEdgeMetrics.NUM_SEQUENCES).withValue( desc.getSequences().size()).save(); for (Table tab : desc.getTables()) { numFlds += tab.getFields().size(); numIdx += tab.getIndexes().size();
LOG.debug("SonarLint side, using serialized file"); try (InputStream is = new FileInputStream(serFile)) { desc = DatabaseDescription.deserialize(is, dbName); } catch (IOException caught) { LOG.error("Unable to deserialize from '" + serFile + "', deleting file", caught); desc.serialize(os); } catch (IOException caught) { LOG.error("Unable to serialize to '" + serFile + "'", caught);
@Override public Void visitAddTable(AddTableContext ctx) { Table table = new Table(ctx.table.getText()); table.setFirstLine(ctx.getStart().getLine()); table.setLastLine(ctx.getStop().getLine()); tables.push(table); db.addTable(table); return visitChildren(ctx); }
@Override public Void visitAddSequence(AddSequenceContext ctx) { Sequence seq = new Sequence(ctx.sequence.getText()); seq.setFirstLine(ctx.getStart().getLine()); seq.setLastLine(ctx.getStop().getLine()); sequences.push(seq); db.addSequence(seq); return visitChildren(ctx); }
@Override public Void visitUpdateIndexBP(UpdateIndexBPContext ctx) { String tableName = ctx.table.getText(); String indexName = ctx.index.getText(); Table table = db.getTable(tableName); if (table != null) { Index index = table.getIndex(indexName); if (index != null) { index.setBufferPool(ctx.value.getText()); } } return null; }
private Collection<IDatabase> readSchemaFromProp2(Configuration config, FileSystem fileSystem) { Collection<IDatabase> dbs = new ArrayList<>(); for (String str : Splitter.on(',').trimResults().omitEmptyStrings().split( config.get(Constants.SLINT_DATABASES).orElse(""))) { String dbName = FilenameUtils.getBaseName(str); LOG.debug("Parsing '{}' with db name {}", str, dbName); try (InputStream is = new FileInputStream(new File(str))) { dbs.add(new DatabaseWrapper(DatabaseDescription.deserialize(is, dbName))); } catch (IOException caught) { LOG.error("Unable to deserialize from '" + str + "'", caught); } } return dbs; }
public static DatabaseDescription deserialize(InputStream in, String name) throws IOException { DatabaseDescription db = new DatabaseDescription(name); try (InputStreamReader isr = new InputStreamReader(in); BufferedReader reader = new BufferedReader(isr)) { String line = null; while ((line = reader.readLine()) != null) { if (line.startsWith("S")) { db.addSequence(new Sequence(line.substring(1))); } else if (line.startsWith("T")) { currTbl = new Table(line.substring(1)); db.addTable(currTbl); } else if (line.startsWith("F")) {
@Override public Void visitAddTable(AddTableContext ctx) { Table table = new Table(ctx.table.getText()); table.setFirstLine(ctx.getStart().getLine()); table.setLastLine(ctx.getStop().getLine()); tables.push(table); db.addTable(table); return visitChildren(ctx); }
@Override public Void visitAddSequence(AddSequenceContext ctx) { Sequence seq = new Sequence(ctx.sequence.getText()); seq.setFirstLine(ctx.getStart().getLine()); seq.setLastLine(ctx.getStop().getLine()); sequences.push(seq); db.addSequence(seq); return visitChildren(ctx); }
@Override public Void visitUpdateIndexBP(UpdateIndexBPContext ctx) { String tableName = ctx.table.getText(); String indexName = ctx.index.getText(); Table table = db.getTable(tableName); if (table != null) { Index index = table.getIndex(indexName); if (index != null) { index.setBufferPool(ctx.value.getText()); } } return null; }
public DatabaseWrapper(DatabaseDescription dbDesc) { this.dbDesc = dbDesc; for (Table fld : dbDesc.getTables()) { ITable iFld = new TableWrapper(this, fld); sortedTables.add(iFld); } }
@Override public String getName() { return dbDesc.getDbName(); }
public DumpFileVisitor(String dbName) { this.db = new DatabaseDescription(dbName); }