public PreparedStatementBuilder set(Date d) throws SQLException { log(d); ps.setDate(pos++, d != null ? new java.sql.Date(d.getTime()) : null); return this; }
public PreparedStatementBuilder set(Double d) throws SQLException { log(d); if (d != null) { ps.setDouble(pos++, d); } else { ps.setNull(pos++, Types.DOUBLE); } return this; }
public PreparedStatementBuilder set(Integer i) throws SQLException { log(i); if (i != null) { ps.setInt(pos++, i); } else { ps.setNull(pos++, Types.INTEGER); } return this; }
.set(entry.getTileRow()) .set(entry.getGrid()) .log(Level.FINE) .statement(); } else { .set(entry.getTileColumn()) .set(entry.getTileRow()) .log(Level.FINE) .statement(); .set(gridDataEntry.getKey()) .set(gridDataEntry.getValue()) .log(Level.FINE) .statement(); } else { .set(entry.getTileRow()) .set(gridDataEntry.getKey()) .log(Level.FINE) .statement();
prepare(cx, "SELECT name FROM sqlite_master WHERE type='table' AND name=? ") .set(tableName) .log(Level.FINE) .statement();
.set(tile.getRow()) .set(tile.getData()) .log(Level.FINE) .statement(); try {
.set(e.isZ()) .set(e.isM()) .log(Level.FINE) .statement(); try {
.set(entry.getTileColumn()) .set(entry.getTileRow()) .log(Level.FINE) .statement(); ResultSet rs = ps.executeQuery();
private CoordinateReferenceSystem getCRS(int srid) { try { try (Connection cx = connPool.getConnection()) { try (PreparedStatement ps = cx.prepareStatement( String.format( "SELECT definition FROM %s WHERE srs_id = ?", SPATIAL_REF_SYS))) { try (ResultSet rs = prepare(ps).set(srid).log(Level.FINE).statement().executeQuery()) { if (rs.next()) { try { return CRS.parseWKT(rs.getString("definition")); } catch (FactoryException e) { LOGGER.log(Level.FINE, "Error parsing CRS definitions!", e); } } } } } } catch (SQLException e) { throw new RuntimeException(e); } return null; }
protected void saveMetaDataEntry(String name, String value, Connection cx) throws SQLException { PreparedStatement ps; if (disableJournal) { disableJournal(cx); } if (value != null) { ps = prepare(cx, format("INSERT OR REPLACE INTO %s VALUES (?,?)", TABLE_METADATA)) .set(name) .set(value) .log(Level.FINE) .statement(); } else { ps = prepare(cx, format("DELETE FROM %s WHERE NAME = ?", TABLE_METADATA)) .set(name) .log(Level.FINE) .statement(); } ps.execute(); ps.close(); }
void deleteGeometryColumnsEntry(FeatureEntry e) throws IOException { String sql = format("DELETE FROM %s WHERE table_name = ?", GEOMETRY_COLUMNS); try { Connection cx = connPool.getConnection(); try { PreparedStatement ps = prepare(cx, sql).set(e.getTableName()).log(Level.FINE).statement(); try { ps.execute(); } finally { close(ps); } } finally { close(cx); } } catch (SQLException ex) { throw new IOException(ex); } }
protected String loadMetaDataEntry(String name, Connection cx) throws SQLException { PreparedStatement ps; ps = prepare(cx, format("SELECT VALUE FROM %s WHERE NAME = ?", TABLE_METADATA)) .set(name) .log(Level.FINE) .statement(); ResultSet rs = ps.executeQuery(); String result = null; if (rs.next()) { result = rs.getString(1); } rs.close(); ps.close(); return result; }
void deleteGeoPackageContentsEntry(Entry e) throws IOException { String sql = format("DELETE FROM %s WHERE table_name = ?", GEOPACKAGE_CONTENTS); try { Connection cx = connPool.getConnection(); try { PreparedStatement ps = prepare(cx, sql).set(e.getTableName()).log(Level.FINE).statement(); try { ps.execute(); } finally { close(ps); } } finally { close(cx); } } catch (SQLException ex) { throw new IOException(ex); } }
public static enum DataType { Feature("features"), Raster("rasters"), Tile("tiles"), FeatureWithRaster("featuresWithRasters"); String value; DataType(String value) { this.value = value; } public String value() { return value; } }
public PreparedStatementBuilder set(byte[] b) throws SQLException { log(b); ps.setBytes(pos++, b); // ps.setBinaryStream(pos++, is); return this; }
public PreparedStatementBuilder set(Boolean b) throws SQLException { log(b); ps.setBoolean(pos++, b); return this; }
public PreparedStatementBuilder set(String s) throws SQLException { log(s); ps.setString(pos++, s); return this; }
public PreparedStatementBuilder set(Long l) throws SQLException { log(l); ps.setLong(pos++, l); return this; }