List of usage examples for java.sql ResultSet getDouble
double getDouble(String columnLabel) throws SQLException;
ResultSet
object as a double
in the Java programming language. From source file:no.magott.training.ex2.ExchangeRateRowMapper.java
@Override public ExchangeRate mapRow(ResultSet rs, int rowNum) throws SQLException { ExchangeRate exchangeRate = new ExchangeRate(); exchangeRate.setId(rs.getInt("ID")); exchangeRate.setExchangeRate(rs.getDouble("EXCHANGE_RATE")); exchangeRate.setDate(rs.getDate("EXCHANGE_DATE")); exchangeRate.setFrom(rs.getString("FROM_CURRENCY")); exchangeRate.setTo(rs.getString("TO_CURRENCY")); return exchangeRate; }
From source file:com.teamexception.reseravationmaven.mapper.ServiceVehicleTypeMapper.java
public VehicleServiceType mapRow(ResultSet rs, int rowNum) throws SQLException { VehicleServiceType vehicleType = new VehicleServiceType(rs.getString("vehicleName"), rs.getString("serviceId"), rs.getInt("duration"), rs.getDouble("cost")); System.out.println("ssssssssssssssssssssssssss"); return vehicleType; }
From source file:io.kahu.hawaii.util.spring.AbstractDBRepository.java
protected Double getDouble(final ResultSet rs, final int columnIndex) throws SQLException { double result = rs.getDouble(columnIndex); return rs.wasNull() ? null : result; }
From source file:io.kahu.hawaii.util.spring.AbstractDBRepository.java
protected Double getDouble(final ResultSet rs, final String columnLabel) throws SQLException { double result = rs.getDouble(columnLabel); return rs.wasNull() ? null : result; }
From source file:id.aas.apps.mvc.view.frameChart.java
public void setChartBar() throws SQLException { double Lunas = 0; double Casbon = 0; String queryLunas = "SELECT SUM(total_tagihan) from transaksi where keterangan='Lunas'"; String queryCasbon = "SELECT SUM(total_tagihan) from transaksi where keterangan='Cash Bon'"; ConnectionDB.InstanceDB.openConnection(); ResultSet rs = ConnectionDB.InstanceDB.RunSelectQuery(queryLunas); while (rs.next()) { Lunas = rs.getDouble(1); }// w w w . ja v a2 s .com System.out.println(Lunas); ResultSet rs1 = ConnectionDB.InstanceDB.RunSelectQuery(queryCasbon); while (rs1.next()) { Casbon = rs1.getDouble(1); } System.out.println(Casbon); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(Lunas, "Lunas", "Catatan Uang Pendapatan"); dataset.setValue(Casbon, "Cash Bon", "Catatan Uang Pendapatan"); JFreeChart chart = ChartFactory.createBarChart3D("Catatan Uang Pendapatan dan Piutang", "Keterangan Pembayaran", "Jumlah Uang", dataset); ChartPanel cPanel = new ChartPanel(chart); panel1.add(cPanel); }
From source file:com.javacodegags.waterflooding.model.ResultImplemented.java
@Override public List<Result> getAll() { String sql = "SELECT * FROM results"; List<Result> listCaption = jdbcTemplate.query(sql, new RowMapper<Result>() { @Override// w w w . jav a 2 s . c om public Result mapRow(ResultSet rs, int rowNum) throws SQLException { Result result = new Result(); result.setId(rs.getInt("id")); result.setMinimum(rs.getDouble("minimum")); result.setAverage(rs.getDouble("average")); return result; } }); return listCaption; }
From source file:com.autentia.tnt.bill.migration.support.OriginalInformationRecoverer.java
/** * Recupera la suma total de todos los conceptos de todas las facturas del tipo que se envie por parametro * @param billType tipo de factura/*from w ww. j a v a2s. co m*/ */ public static double getTotalFacturasOriginal(String billType) throws Exception { Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; LineNumberReader file = null; double result = -1; try { log.info("RECOVERING TOTAL FACTURAS " + billType + " ORIGINALES"); // connect to database Class.forName(BillToBillPaymentMigration.DATABASE_DRIVER); con = DriverManager.getConnection(BillToBillPaymentMigration.DATABASE_CONNECTION, BillToBillPaymentMigration.DATABASE_USER, BillToBillPaymentMigration.DATABASE_PASS); //NOSONAR con.setAutoCommit(false); // DATABASE_PASS vacio String sql = "SELECT sum((bb.units*bb.amount)*(1+(bb.iva/100))) as total from Bill b left join BillBreakDown bb on b.id=bb.billId, Organization o, Project p where b.projectId = p.id and p.organizationId = o.id and b.billType= ?"; pstmt = con.prepareStatement(sql); pstmt.setString(1, billType); rs = pstmt.executeQuery(); while (rs.next()) { result = rs.getDouble(1); log.info("\t" + result); } con.commit(); } catch (Exception e) { log.error("FAILED: WILL BE ROLLED BACK: ", e); if (con != null) { con.rollback(); } } finally { cierraFichero(file); liberaConexion(con, pstmt, rs); } return result; }
From source file:com.oltpbenchmark.benchmarks.auctionmark.AuctionMarkProfile.java
private static final void loadItems(AuctionMarkProfile profile, ResultSet vt) throws SQLException { int ctr = 0;//from ww w .j av a 2 s. c o m while (vt.next()) { int col = 1; ItemId i_id = new ItemId(vt.getLong(col++)); double i_current_price = vt.getDouble(col++); Timestamp i_end_date = vt.getTimestamp(col++); int i_num_bids = (int) vt.getLong(col++); // IMPORTANT: Do not set the status here so that we make sure that // it is added to the right queue ItemInfo itemInfo = new ItemInfo(i_id, i_current_price, i_end_date, i_num_bids); profile.addItemToProperQueue(itemInfo, false); ctr++; } // WHILE if (LOG.isDebugEnabled()) LOG.debug(String.format("Loaded %d records from %s", ctr, AuctionMarkConstants.TABLENAME_ITEM)); }
From source file:entity.ProdukMapper.java
@Override public Produk mapRow(ResultSet rs, int i) throws SQLException { Produk temp = new Produk(); temp.setId(rs.getInt("id")); temp.setKode(rs.getString("kode")); temp.setNama(rs.getString("nama")); temp.setHarga(rs.getDouble("harga")); temp.setKategori(this.kategoriDAO.getById(rs.getInt("id_kategori"))); return temp;//from ww w . jav a 2 s .c o m }
From source file:graficos.GenerarGraficoFinanciero.java
public void crear() { try {/*from w w w. j av a2s.com*/ Dba db = new Dba(pathdb); db.conectar(); String sql = "select IdCategoria, Nombre from Categoria"; db.prepare(sql); db.query.execute(); ResultSet rs = db.query.getResultSet(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String fechai = periodo.substring(0, 10) + " 00:00:00"; String fechaf = periodo.substring(13, 23) + " 00:00:00"; while (rs.next()) { String sql1 = "select Monto from PagoCliente join FichaCliente on PagoCliente.IdFichaCliente=FichaCliente.IdFichaCliente" + " join Reservacion on Reservacion.IdReservacion=FichaCliente.IdReservacion join Habitacion on Reservacion.IdHabitacion=" + "Habitacion.IdHabitacion where Habitacion.IdCategoria=" + rs.getInt(1) + " and FichaCliente.FechaSalida>='" + fechai + "' and" + " FichaCliente.FechaSalida<='" + fechaf + "'"; db.prepare(sql1); db.query.execute(); ResultSet rs1 = db.query.getResultSet(); Double monto = 0.0; while (rs1.next()) { monto += rs1.getDouble(1); } dataset.setValue(monto, "Ingresos", rs.getString(2)); } JFreeChart chart = ChartFactory.createBarChart3D( "Comparacin de Ingresos por Categora\nPeriodo:" + periodo, "Categora", "Ingresos", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); try { ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300); } catch (Exception ee) { System.err.println(ee.toString()); System.err.println("Problem occurred creating chart."); } db.desconectar(); } catch (Exception e) { } }