当前位置: 首页>>代码示例>>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;未经允许,请勿转载。