當前位置: 首頁>>代碼示例>>Java>>正文


Java ResultSet.getDouble方法代碼示例

本文整理匯總了Java中java.sql.ResultSet.getDouble方法的典型用法代碼示例。如果您正苦於以下問題:Java ResultSet.getDouble方法的具體用法?Java ResultSet.getDouble怎麽用?Java ResultSet.getDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.sql.ResultSet的用法示例。


在下文中一共展示了ResultSet.getDouble方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: retreave

import java.sql.ResultSet; //導入方法依賴的package包/類
public static Empenho retreave(int id) throws SQLException {
    Statement stm
            = Database.createConnection().
                    createStatement();
    String sql = "SELECT * FROM empenhos where id = " + id;
    ResultSet rs = stm.executeQuery(sql);
    rs.next();
    ArrayList<EmpenhoItem> itens = EmpenhoItemDAO.retreaveByEmpenho(id);
    return new Empenho(id,
            FornecedorDAO.retreave(rs.getInt("fornecedor")),
            rs.getTimestamp("emissao"),
            rs.getString("numero"),
            rs.getString("observacao"),
            rs.getDouble("valor_total"),
            itens);

}
 
開發者ID:Montanheiro,項目名稱:SistemaAlmoxarifado,代碼行數:18,代碼來源:EmpenhoDAO.java

示例2: retreave

import java.sql.ResultSet; //導入方法依賴的package包/類
public static Produto retreave(int id) throws SQLException {
    Statement stm
            = Database.createConnection().
                    createStatement();
    String sql = "SELECT * FROM produtos where id = " + id;
    ResultSet rs = stm.executeQuery(sql);
    rs.next();
    Unidade un = UnidadeDAO.retreave(rs.getInt("unidade"));
    return new Produto(id,
            rs.getString("descricao"),
            un,
            rs.getDouble("estoque"),
            rs.getDouble("valor_total"),
            rs.getDouble("estoque_minimo"));

}
 
開發者ID:Montanheiro,項目名稱:SistemaAlmoxarifado,代碼行數:17,代碼來源:ProdutoDAO.java

示例3: mapRow

import java.sql.ResultSet; //導入方法依賴的package包/類
@Override
public Map<String, Object>  mapRow(ResultSet rs, int rowNum) throws SQLException {
	ResultSetMetaData rsmd = rs.getMetaData();
	int columnCount = rsmd.getColumnCount();
	Map mapOfColValues = createColumnMap(columnCount);
	for (int i = 1; i <= columnCount; i++) {
		String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i));
		key = key.toLowerCase();
		Object obj = null;
		String typename= rsmd.getColumnTypeName(i).toUpperCase();
		if("DECIMAL".equals(typename)){
			obj = rs.getDouble(i);
		}else{
			obj = getColumnValue(rs, i);
		}
		 
		mapOfColValues.put(key, obj);
	}
	return mapOfColValues;
}
 
開發者ID:yulele166,項目名稱:pub-service,代碼行數:21,代碼來源:MySqlColumnMapRowMapper.java

示例4: Run

import java.sql.ResultSet; //導入方法依賴的package包/類
/**
 * Extract run data from a SQL result set
 * @param rs the result set pointed at the row in question
 * @throws SQLException if an error occurs extracting run data
 */
public Run(ResultSet rs) throws SQLException
{
	super(rs);
	eventid = (UUID)rs.getObject("eventid");
	carid   = (UUID)rs.getObject("carid");
	course  = rs.getInt("course");
	run     = rs.getInt("run");
	cones   = rs.getInt("cones");
	gates   = rs.getInt("gates");
	status  = rs.getString("status");
	raw     = rs.getDouble("raw");
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:18,代碼來源:Run.java

示例5: activateTool

import java.sql.ResultSet; //導入方法依賴的package包/類
/**
    * Activates/de-activates tool in db based on the flag
    * 
    * @param toolSig
    *            The signature of the tool to activate/de-activate
    * @param flag
    *            Set to 1 for activate, 0 for de-activate
    * @throws SQLException
    */
   public void activateTool(String toolSig, int flag) throws SQLException {
Connection conn = getConnection();
PreparedStatement stmt = null;
ResultSet results = null;
try {
    stmt = conn.prepareStatement(
	    "UPDATE lams_tool SET valid_flag = " + flag + " WHERE tool_signature  = \"" + toolSig + "\"");
    stmt.execute();

    stmt = conn.prepareStatement(
	    "SELECT learning_library_id FROM lams_tool WHERE tool_signature=\"" + toolSignature + "\"");
    results = stmt.executeQuery();

    if (results.first()) {
	double llid = results.getDouble("learning_library_id");

	stmt = conn.prepareStatement("UPDATE lams_learning_library SET valid_flag = " + flag
		+ " WHERE learning_library_id  = \"" + llid + "\"");
	stmt.execute();
    }
} catch (SQLException se) {
    throw new DeployException("Could not activate/de-activate tool for update");
} finally {
    DbUtils.closeQuietly(stmt);
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:36,代碼來源:ToolDBUpdater.java

示例6: getResult

import java.sql.ResultSet; //導入方法依賴的package包/類
public Object getResult(ResultSet rs, String columnName) throws SQLException {

            double d = rs.getDouble(columnName);
            if (rs.wasNull()) {
                return null;
            }
            else {
                return new Double(d);
            }
        }
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:11,代碼來源:DAOFactory.java

示例7: loadClans

import java.sql.ResultSet; //導入方法依賴的package包/類
@Override
protected void loadClans() {
    ResultSet clansResultSet = databaseConnectionOwner.executeQuery(GET_CLANS_QUERY);
    if (clansResultSet != null) {
        try {
            while (clansResultSet.next()) {
                int clanID = clansResultSet.getInt("clan_id");
                String clanTag = clansResultSet.getString("clantag");
                String clanName = clansResultSet.getString("clanname");
                int ownerID = clansResultSet.getInt("clanplayer_id_owner");
                String tagColorId = clansResultSet.getString("tagcolor");
                boolean allowAllyInvites = clansResultSet.getBoolean("allow_ally_invites");
                boolean ffProtection = clansResultSet.getBoolean("ff_protection");
                long creationTime = clansResultSet.getLong("creation_time");

                String homeWorld = clansResultSet.getString("clanhome_world");
                double homeX = clansResultSet.getDouble("clanhome_x");
                double homeY = clansResultSet.getDouble("clanhome_y");
                double homeZ = clansResultSet.getDouble("clanhome_z");
                float homeYaw = clansResultSet.getFloat("clanhome_yaw");
                float homePitch = clansResultSet.getFloat("clanhome_pitch");

                int homeSetTimes = clansResultSet.getInt("clanhome_set_times");
                long homeLastSetTimeStamp = clansResultSet.getLong("clanhome_set_timestamp");

                String bankId = clansResultSet.getString("bank_id");

                super.loadedClan(clanID, clanTag, clanName, ownerID, tagColorId, allowAllyInvites, ffProtection, creationTime, homeWorld, homeX,
                        homeY, homeZ, homeYaw, homePitch, homeSetTimes, homeLastSetTimeStamp, bankId);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:iLefty,項目名稱:mcClans,代碼行數:36,代碼來源:DatabaseLoader.java

示例8: retreave

import java.sql.ResultSet; //導入方法依賴的package包/類
public static SaidaProduto retreave(int id) throws SQLException {
    Statement stm
            = Database.createConnection().
                    createStatement();
    String sql = "SELECT * FROM saidas_produtos where id = " + id;
    ResultSet rs = stm.executeQuery(sql);
    rs.next();
    return new SaidaProduto(id,
            RequisicaoProdutoDAO.retreave(rs.getInt("produto_requisicao")),
            rs.getDouble("quantidade"),
            rs.getTimestamp("data"));
}
 
開發者ID:Montanheiro,項目名稱:SistemaAlmoxarifado,代碼行數:13,代碼來源:SaidaProdutoDAO.java

示例9: retreave

import java.sql.ResultSet; //導入方法依賴的package包/類
public static EntradaItem retreave(int id) throws SQLException {
    Statement stm
            = Database.createConnection().
                    createStatement();
    String sql = "SELECT * FROM entrada_itens where id = " + id;
    ResultSet rs = stm.executeQuery(sql);
    rs.next();
    return new EntradaItem(id,
            ProdutoDAO.retreave(rs.getInt("produto")),
            rs.getInt("entrada"),
            rs.getDouble("quantidade"),
            rs.getTimestamp("validade"),
            rs.getString("lote"),
            rs.getDouble("valor_unitario"));
}
 
開發者ID:Montanheiro,項目名稱:SistemaAlmoxarifado,代碼行數:16,代碼來源:EntradaItemDAO.java

示例10: readDouble

import java.sql.ResultSet; //導入方法依賴的package包/類
public static Double readDouble(int colNum, ResultSet r) throws SQLException {
  double val;
  val = r.getDouble(colNum);
  if (r.wasNull()) {
    return null;
  } else {
    return Double.valueOf(val);
  }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:10,代碼來源:JdbcWritableBridge.java

示例11: getHoldingDataFromResultSet

import java.sql.ResultSet; //導入方法依賴的package包/類
private HoldingDataBean getHoldingDataFromResultSet(ResultSet rs)
		throws Exception {
	HoldingDataBean holdingData = null;

	holdingData = new HoldingDataBean(new Integer(rs.getInt("holdingID")),
			rs.getDouble("quantity"), rs.getBigDecimal("purchasePrice"), rs
					.getTimestamp("purchaseDate"), rs
					.getString("quote_symbol"));
	return holdingData;
}
 
開發者ID:WASdev,項目名稱:sample.daytrader3,代碼行數:11,代碼來源:TradeDirect.java

示例12: ChallengeRound

import java.sql.ResultSet; //導入方法依賴的package包/類
public ChallengeRound(ResultSet rs) throws SQLException
{
	challengeid  = (UUID)rs.getObject("challengeid");
	round        = rs.getInt("round");
	car1         = new ChallengeRound.RoundEntrant();
	car1.carid   = (UUID)rs.getObject("car1id");
	car1.dial    = rs.getDouble("car1dial");
	car2         = new ChallengeRound.RoundEntrant();
	car2.carid   = (UUID)rs.getObject("car2id");
	car2.dial    = rs.getDouble("car2dial");
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:12,代碼來源:ChallengeRound.java

示例13: getValue

import java.sql.ResultSet; //導入方法依賴的package包/類
@Override
public OptionalDouble getValue(final JavaType type, final ResultSet rs, final int columnIndex,
		final PropertyMapperManager mapperManager)
		throws SQLException {
	double value = rs.getDouble(columnIndex);
	if (!rs.wasNull()) {
		return OptionalDouble.of(value);
	} else {
		return OptionalDouble.empty();
	}
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:12,代碼來源:OptionalDoublePropertyMapper.java

示例14: Payment

import java.sql.ResultSet; //導入方法依賴的package包/類
public Payment(ResultSet rs) throws SQLException
{
    payid    = (UUID)rs.getObject("payid");
    eventid  = (UUID)rs.getObject("eventid");
    carid    = (UUID)rs.getObject("carid");
    refid    = rs.getString("refid");
    txtype   = rs.getString("txtype");
    txid     = rs.getString("txid");
    txtime   = rs.getTimestamp("txtime", Database.utc);
    itemname = rs.getString("itemname");
    amount   = rs.getDouble("amount");
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:13,代碼來源:Payment.java

示例15: split

import java.sql.ResultSet; //導入方法依賴的package包/類
public List<InputSplit> split(long numSplits, ResultSet results,
    String colName, DBConfiguration dbConf) throws SQLException {

  LOG.warn("Generating splits for a floating-point index column. Due to the");
  LOG.warn("imprecise representation of floating-point values in Java, this");
  LOG.warn("may result in an incomplete import.");
  LOG.warn("You are strongly encouraged to choose an integral split column.");

  List<InputSplit> splits = new ArrayList<InputSplit>();

  if (results.getString(1) == null && results.getString(2) == null) {
    // Range is null to null. Return a null split accordingly.
    splits.add(new DataDrivenDBInputFormat.DataDrivenDBInputSplit(
            type, colName, DataPullConstants.QUERY_COND_IS_NULL, null, DataPullConstants.QUERY_COND_IS_NULL, null));
    return splits;
  }

  double minVal = results.getDouble(1);
  double maxVal = results.getDouble(2);

  // Use this as a hint. May need an extra task if the size doesn't
  // divide cleanly.
  double splitSize = (maxVal - minVal) / (double) numSplits;

  if (splitSize < MIN_INCREMENT) {
    splitSize = MIN_INCREMENT;
  }

  double curLower = minVal;
  double curUpper = curLower + splitSize;

  while (curUpper < maxVal) {
    splits.add(new DataDrivenDBInputFormat.DataDrivenDBInputSplit(
            type, colName, " >= ", curLower, " < ", curUpper));

    curLower = curUpper;
    curUpper += splitSize;
  }

  // Catch any overage and create the closed interval for the last split.
  if (curLower <= maxVal || splits.size() == 1) {
    splits.add(new DataDrivenDBInputFormat.DataDrivenDBInputSplit(
            type, colName, " >= ", curUpper, " <= ", maxVal));
  }

  if (results.getString(1) == null || results.getString(2) == null) {
    // At least one extrema is null; add a null split.
    splits.add(new DataDrivenDBInputFormat.DataDrivenDBInputSplit(
            type, colName, DataPullConstants.QUERY_COND_IS_NULL, null, DataPullConstants.QUERY_COND_IS_NULL, null));
  }

  return splits;
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:54,代碼來源:FloatSplitter.java


注:本文中的java.sql.ResultSet.getDouble方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。