/** * Convert catalog.schema.table, schema.table or table into a TableLocation * instance. Non-specified schema or catalogs are converted to the empty * string. * * @param concatenatedTableLocation Table location [[Catalog.]Schema.]Table * @return Java beans for table location */ public static TableLocation parse(String concatenatedTableLocation) { return parse(concatenatedTableLocation, null); }
/** * Convert catalog.schema.table, schema.table or table into a TableLocation * instance. Non-specified schema or catalogs are converted to the empty * string. * * @param concatenatedTableLocation Table location [[Catalog.]Schema.]Table * @return Java beans for table location */ public static TableLocation parse(String concatenatedTableLocation) { return parse(concatenatedTableLocation, null); }
/** * Convert an input table String to a TableLocation * * @param connection Connection * @param inputTable Input table * @return corresponding TableLocation * @throws SQLException */ public static TableLocation parseInputTable(Connection connection, String inputTable) throws SQLException { return TableLocation.parse(inputTable, JDBCUtilities.isH2DataBase(connection.getMetaData())); }
/** * Convert an input table String to a TableLocation * * @param connection Connection * @param inputTable Input table * @return corresponding TableLocation * @throws SQLException */ public static TableLocation parseInputTable(Connection connection, String inputTable) throws SQLException { return TableLocation.parse(inputTable, JDBCUtilities.isH2DataBase(connection.getMetaData())); }
/** * Constructor * @param tableEditableElement Table editable element instance */ public MCLayerListener(TableEditableElement tableEditableElement) { this.tableEditableElement = tableEditableElement; editorTable = TableLocation.parse(tableEditableElement.getTableReference()); }
/** * @return Fence layer name with good capitalization */ private String getFenceLayerName(boolean isH2) { return TableLocation.parse(FENCE_LAYER_NAME, isH2).toString(isH2); }
public AskValidValue(DataSource ds,String tableReference, String fieldName) throws SQLException { super("Field '" + fieldName + "'", null, null); try(Connection connection = ds.getConnection()) { DatabaseMetaData meta = connection.getMetaData(); TableLocation location = TableLocation.parse(tableReference); try(ResultSet rs = meta.getColumns(location.getCatalog(), location.getSchema(), location.getTable(), fieldName)) { if(rs.next()) { this.fieldType = rs.getInt("DATA_TYPE"); } } } }
public AskValidValue(DataSource ds,String tableReference, String fieldName) throws SQLException { super("Field '" + fieldName + "'", null, null); try(Connection connection = ds.getConnection()) { DatabaseMetaData meta = connection.getMetaData(); TableLocation location = TableLocation.parse(tableReference); try(ResultSet rs = meta.getColumns(location.getCatalog(), location.getSchema(), location.getTable(), fieldName)) { if(rs.next()) { this.fieldType = rs.getInt("DATA_TYPE"); } } } }
@Override public boolean isTableExists(String tableName) throws SQLException { TableLocation tableLocation = TableLocation.parse(tableName); try (Connection connection = dataSource.getConnection(); ResultSet rs = connection.getMetaData().getTables(tableLocation.getCatalog(), tableLocation.getSchema(), tableLocation.getTable(), null)) { return rs.next(); } }
@Override public boolean hasTableEditListener(String tableIdentifier) { TableLocation table = TableLocation.parse(tableIdentifier, isH2); if("PUBLIC".equals(table.getSchema()) && !tableEditionListener.containsKey(table.toString(true))) { // Maybe schema is not given in listener table identifier table = new TableLocation("","",table.getTable()); } String parsedTable = table.toString(isH2); return tableEditionListener.containsKey(parsedTable); }
@Override public boolean hasTableEditListener(String tableIdentifier) { TableLocation table = TableLocation.parse(tableIdentifier, isH2); if("PUBLIC".equals(table.getSchema()) && !tableEditionListener.containsKey(table.toString(true))) { // Maybe schema is not given in listener table identifier table = new TableLocation("","",table.getTable()); } String parsedTable = table.toString(isH2); return tableEditionListener.containsKey(parsedTable); }
public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(ISO_FIELD_NAME, Types.INTEGER,10,0); return rs; } }
public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(ISO_FIELD_NAME, Types.INTEGER,10,0); return rs; } }
private static String getH2TriggerName(String table) { TableLocation tableIdentifier = TableLocation.parse(table, true); return new TableLocation(tableIdentifier.getCatalog(), tableIdentifier.getSchema(), "DM_"+tableIdentifier.getTable()).toString(true); } @Override
public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(ISO_FIELD_NAME, Types.INTEGER,10,0); return rs; } }
/** * Explode Geometry Collection into multiple geometries * @param connection * @param tableName the name of the input table * @param fieldName the name of geometry field. If null the first geometry column is used. * @return * @throws java.sql.SQLException */ public static ResultSet explode(Connection connection, String tableName, String fieldName) throws SQLException { ExplodeResultSet rowSource = new ExplodeResultSet(connection, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData())).toString(),fieldName); return rowSource.getResultSet(); }
/** * Return the exploded geometries as multiple rows * @return * @throws SQLException */ public ResultSet getResultSet() throws SQLException { SimpleResultSet rs = new SimpleResultSet(this); // Feed with fields TableUtilities.copyFields(connection, rs, TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()))); rs.addColumn(EXPLODE_FIELD, Types.INTEGER,10,0); return rs; } }
private ResultSet getFunctionData(DatabaseMetaData metaData) throws SQLException { TableLocation functionLocation = TableLocation.parse(functionName); return metaData.getProcedureColumns( functionLocation.getCatalog(null), functionLocation.getSchema(null), functionLocation.getTable(), null); }
/** * Return the table identifier in the best fit depending on database type * * @param requestedTable Catalog and schema used * @param tableName Table without quotes * @param isH2 True if H2, false if PostGRES * @return Find table identifier */ private static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) { return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(), TableLocation.parse(tableName, isH2).getTable()).toString(); }
/** * Return the table identifier in the best fit depending on database type * * @param requestedTable Catalog and schema used * @param tableName Table without quotes * @param isH2 True if H2, false if PostGRES * @return Find table identifier */ private static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) { return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(), TableLocation.parse(tableName, isH2).getTable()).toString(); }