/** * Find geometry fields name of a table. * @param connection Active connection * @param location Table location * @return A list of Geometry fields name * @throws SQLException */ public static List<String> getGeometryFields(Connection connection,TableLocation location) throws SQLException { return getGeometryFields(connection, location.getCatalog(), location.getSchema(), location.getTable()); }
/** * 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); }
/** * 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(); }
/** * Suffix a TableLocation * * @param inputTable Input table * @param suffix Suffix * @return suffixed TableLocation */ public static TableLocation suffixTableLocation(TableLocation inputTable, String suffix) { return new TableLocation(inputTable.getCatalog(), inputTable.getSchema(), inputTable.getTable() + suffix); }
private static void checkGeometryType(Connection connection, TableLocation tableName, int spatialFieldIndex) throws SQLException { final String fieldName = JDBCUtilities.getFieldName(connection.getMetaData(), tableName.getTable(), spatialFieldIndex); int geomType = SFSUtilities.getGeometryType(connection, tableName, fieldName); if (geomType != GeometryTypeCodes.LINESTRING) { throw new IllegalArgumentException(TYPE_ERROR + SFSUtilities.getGeometryTypeNameFromCode(geomType)); } }
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; } }
/** * 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())); }
@Override public String getTable() { return location.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(); }
/** * Find geometry fields name of a table. * @param connection Active connection * @param location Table location * @return A list of Geometry fields name * @throws SQLException */ public static List<String> getGeometryFields(Connection connection,TableLocation location) throws SQLException { return getGeometryFields(connection, location.getCatalog(), location.getSchema(), location.getTable()); }
private static void checkGeometryType(Connection connection, TableLocation tableName, int spatialFieldIndex) throws SQLException { final String fieldName = JDBCUtilities.getFieldName(connection.getMetaData(), tableName.getTable(), spatialFieldIndex); int geomType = SFSUtilities.getGeometryType(connection, tableName, fieldName); if (geomType != GeometryTypeCodes.LINESTRING) { throw new IllegalArgumentException(TYPE_ERROR + SFSUtilities.getGeometryTypeNameFromCode(geomType)); } }
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; } }
/** * 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 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); }
/** * 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 */ public static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) { return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(), TableLocation.parse(tableName, isH2).getTable()).toString(); } }
/** * Find geometry fields name of a table. * * @param connection Active connection * @param location Table location * * @return A list of Geometry fields name * * @throws SQLException */ public static List<String> getGeometryFields(Connection connection,TableLocation location) throws SQLException { return getGeometryFields(connection, location.getCatalog(), location.getSchema(), location.getTable()); }
private static void checkGeometryType(Connection connection, TableLocation tableName, int spatialFieldIndex) throws SQLException { final String fieldName = JDBCUtilities.getFieldName(connection.getMetaData(), tableName.getTable(), spatialFieldIndex); int geomType = SFSUtilities.getGeometryType(connection, tableName, fieldName); if (geomType != GeometryTypeCodes.LINESTRING) { throw new IllegalArgumentException(TYPE_ERROR + SFSUtilities.getGeometryTypeNameFromCode(geomType)); } }
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; } }
/** * 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); }