当前位置: 首页>>代码示例>>Java>>正文


Java ResultSet.getShort方法代码示例

本文整理汇总了Java中java.sql.ResultSet.getShort方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.getShort方法的具体用法?Java ResultSet.getShort怎么用?Java ResultSet.getShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.ResultSet的用法示例。


在下文中一共展示了ResultSet.getShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fill

import java.sql.ResultSet; //导入方法依赖的package包/类
boolean fill(ResultSet rsProc)
{
	try
	{
		m_csCatalog = rsProc.getString("PROCEDURE_CAT");
		m_csName = rsProc.getString("PROCEDURE_NAME");
		m_csRemarks = rsProc.getString("REMARKS");
		m_sType = rsProc.getShort("PROCEDURE_TYPE");
		m_csSchem = rsProc.getString("PROCEDURE_SCHEM");
		return true;
	}
	catch(SQLException e)
	{
	}
	return false;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:17,代码来源:SQLClauseSPInfo.java

示例2: Challenge

import java.sql.ResultSet; //导入方法依赖的package包/类
public Challenge(ResultSet rs) throws SQLException
{
	challengeid = (UUID)rs.getObject("challengeid");
	eventid     = (UUID)rs.getObject("eventid");
	name        = rs.getString("name");
	depth       = rs.getShort("depth");
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:8,代码来源:Challenge.java

示例3: getType

import java.sql.ResultSet; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public Object getType(int index, ResultSet resultSet) throws Exception
{
	Class type = _columns[index].getType();
	
	if (type == String.class)
	{
		String str = resultSet.getString(index + 1);
		if (!Helper.isEmpty(str))
			return str;
	}
	else if (type == Integer.class)
	{
		return resultSet.getInt(index + 1);
	}
	else if (type == Short.class)
	{
		return resultSet.getShort(index + 1);
	}
	else if (type == Long.class)
	{
		return resultSet.getLong(index + 1);
	}
	else if (type == Double.class)
	{
		return resultSet.getDouble(index + 1);
	}
	
	return null;
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:31,代码来源:QueryColumnsInfo.java

示例4: PlayerNPC

import java.sql.ResultSet; //导入方法依赖的package包/类
public PlayerNPC(ResultSet rs) throws Exception {
    super(rs.getInt("ScriptId"), rs.getString("name"));
    hair = rs.getInt("hair");
    secondHair = hair;
    face = rs.getInt("face");
    secondFace = face;
    mapid = rs.getInt("map");
    skin = rs.getByte("skin");
    secondSkin = skin;
    charId = rs.getInt("charid");
    gender = rs.getByte("gender");
    secondGender = gender;
    job = rs.getShort("job");
    elf = rs.getInt("elf");
    faceMarking = rs.getInt("faceMarking");
    setCoords(rs.getInt("x"), rs.getInt("y"), rs.getInt("dir"), rs.getInt("Foothold"));
    String[] pet = rs.getString("pets").split(",");
    for (int i = 0; i < 3; i++) {
        if (pet[i] != null) {
            pets[i] = Integer.parseInt(pet[i]);
        } else {
            pets[i] = 0;
        }
    }

    Connection con = DatabaseConnection.getConnection();
    try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs_equip WHERE NpcId = ?")) {
        ps.setInt(1, getId());
        try (ResultSet rs2 = ps.executeQuery()) {
            while (rs2.next()) {
                equips.put(rs2.getByte("equippos"), rs2.getInt("equipid"));
                secondEquips.put(rs2.getByte("equippos"), rs2.getInt("equipid"));
            }
        }
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:37,代码来源:PlayerNPC.java

示例5: createATs

import java.sql.ResultSet; //导入方法依赖的package包/类
private static List<AT> createATs( ResultSet rs ) throws SQLException
{
	List<AT> ats = new ArrayList<AT>();
	while ( rs.next() )
	{
		int i = 0;
		Long atId = rs.getLong( ++i );
		Long creator = rs.getLong( ++i );
		String name = rs.getString( ++i );
		String description = rs.getString( ++i );
		short version = rs.getShort( ++i );
		byte[] stateBytes = decompressState(rs.getBytes( ++i ));
		int csize = rs.getInt( ++i );
		int dsize = rs.getInt( ++i );
		int c_user_stack_bytes = rs.getInt( ++i );
		int c_call_stack_bytes = rs.getInt( ++i );
		int creationBlockHeight = rs.getInt( ++i );
		int sleepBetween = rs.getInt( ++i );
		int nextHeight = rs.getInt( ++i );
		boolean freezeWhenSameBalance = rs.getBoolean( ++i );
		long minActivationAmount = rs.getLong(++i);
		byte[] ap_code = decompressState(rs.getBytes( ++i ));

		AT at = new AT( AT_API_Helper.getByteArray( atId ) , AT_API_Helper.getByteArray( creator ) , name , description , version ,
				stateBytes , csize , dsize , c_user_stack_bytes , c_call_stack_bytes , creationBlockHeight , sleepBetween , nextHeight ,
				freezeWhenSameBalance , minActivationAmount , ap_code );
		ats.add( at );

	}
	return ats;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:32,代码来源:AT.java

示例6: importPrimaryKeyOfTable

import java.sql.ResultSet; //导入方法依赖的package包/类
public void importPrimaryKeyOfTable(DBTable table, PKReceiver receiver) {
    LOGGER.debug("Importing primary keys for table '{}'", table);
    StopWatch watch = new StopWatch("importPrimaryKeyOfTable");
    ResultSet pkset = null;
    try {
     pkset = metaData.getPrimaryKeys(catalogName, schemaName, table.getName());
     TreeMap<Short, String> pkComponents = new TreeMap<Short, String>();
     String pkName = null;
     while (pkset.next()) {
     	String tableName = pkset.getString(3);
         if (!tableName.equals(table.getName())) // Bug fix for Firebird: 
         	continue;							// When querying X, it returns the pks of XY too
	
         String columnName = pkset.getString(4);
         short keySeq = pkset.getShort(5);
         pkComponents.put(keySeq, columnName);
         pkName = pkset.getString(6);
            LOGGER.debug("found pk column {}, {}, {}", new Object[] { columnName, keySeq, pkName });
     }
     if (pkComponents.size() > 0) {
      String[] columnNames = pkComponents.values().toArray(new String[pkComponents.size()]);
      receiver.receivePK(pkName, dialect.isDeterministicPKName(pkName), columnNames, table);
     }
    } catch (SQLException e) {
    	errorHandler.handleError("Error importing primary key of table " + table.getName());
    } finally {
    	DBUtil.close(pkset);
    }
    watch.stop();
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:31,代码来源:JDBCDBImporter.java

示例7: fill

import java.sql.ResultSet; //导入方法依赖的package包/类
public boolean fill(ResultSet rsParam)
{
	try
	{
		// Procedure identification
		m_colDescriptionInfo = new ColDescriptionInfo(); 
		m_csProcedureCatalog = rsParam.getString("PROCEDURE_CAT");
		m_csProcedureSchem = rsParam.getString("PROCEDURE_SCHEM");
		m_csProcedureName = rsParam.getString("PROCEDURE_NAME");
		
		// Kind of column / parameter
		m_sColType = rsParam.getShort("COLUMN_TYPE");
		
		m_colDescriptionInfo.m_csColName = rsParam.getString("COLUMN_NAME");
		m_colDescriptionInfo.m_nTypeId = rsParam.getInt("DATA_TYPE");
		m_colDescriptionInfo.m_nPrecision = rsParam.getInt("PRECISION");
		m_nLength = rsParam.getInt("LENGTH");
		
		m_sScale = rsParam.getShort("SCALE");
		m_sRadix = rsParam.getShort("RADIX");
		m_sNullable = rsParam.getShort("NULLABLE");
		m_csRemarks = rsParam.getString("REMARKS");
		
		return true;
	}
	catch(SQLException e)
	{
	}
	return false;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:31,代码来源:StoredProcParamDescBase.java

示例8: getResult

import java.sql.ResultSet; //导入方法依赖的package包/类
public Object getResult(ResultSet rs, int columnIndex) throws SQLException {

            short s = rs.getShort(columnIndex);
            if (rs.wasNull()) {
                return null;
            }
            else {
                return new Short(s);
            }
        }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:11,代码来源:DAOFactory.java

示例9: createIndexes

import java.sql.ResultSet; //导入方法依赖的package包/类
protected void createIndexes() {
    Map<String, Index> newIndexes = new LinkedHashMap<String, Index>();
    try {
        ResultSet rs = MetadataUtilities.getIndexInfo(
                jdbcSchema.getJDBCCatalog().getJDBCMetadata().getDmd(),
                jdbcSchema.getJDBCCatalog().getName(), jdbcSchema.getName(),
                name, false, true);
        if (rs != null) {
            try {
                JDBCIndex index = null;
                String currentIndexName = null;
                while (rs.next()) {
                    // Ignore Indices marked statistic
                    // explicit: TYPE == DatabaseMetaData or
                    // implicit: ORDINAL_POSITION == 0
                    // @see java.sql.DatabaseMetaData#getIndexInfo
                    if (rs.getShort("TYPE") //NOI18N
                            == DatabaseMetaData.tableIndexStatistic
                            || rs.getInt("ORDINAL_POSITION") == 0) { //NOI18N
                        continue;
                    }

                    String indexName = MetadataUtilities.trimmed(rs.getString("INDEX_NAME")); //NOI18N
                    if (index == null || !(currentIndexName.equals(indexName))) {
                        index = createJDBCIndex(indexName, rs);
                        LOGGER.log(Level.FINE, "Created index {0}", index); //NOI18N

                        newIndexes.put(index.getName(), index.getIndex());
                        currentIndexName = indexName;
                    }

                    JDBCIndexColumn idx = createJDBCIndexColumn(index, rs);
                    if (idx == null) {
                        LOGGER.log(Level.INFO, "Cannot create index column for {0} from {1}",  //NOI18N
                                new Object[]{indexName, rs});
                    } else {
                        IndexColumn col = idx.getIndexColumn();
                        index.addColumn(col);
                        LOGGER.log(Level.FINE, "Added column {0} to index {1}",   //NOI18N
                                new Object[]{col.getName(), indexName});
                    }
                }
            } finally {
                rs.close();
            }
        }
    } catch (SQLException e) {
        filterSQLException(e);
    }

    indexes = Collections.unmodifiableMap(newIndexes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:53,代码来源:JDBCTable.java

示例10: getValue

import java.sql.ResultSet; //导入方法依赖的package包/类
private static Object getValue(ResultSet resultSet, int type, int j,
    Calendar calendar) throws SQLException {
  switch (type) {
  case Types.BIGINT:
    final long aLong = resultSet.getLong(j + 1);
    return aLong == 0 && resultSet.wasNull() ? null : aLong;
  case Types.INTEGER:
    final int anInt = resultSet.getInt(j + 1);
    return anInt == 0 && resultSet.wasNull() ? null : anInt;
  case Types.SMALLINT:
    final short aShort = resultSet.getShort(j + 1);
    return aShort == 0 && resultSet.wasNull() ? null : aShort;
  case Types.TINYINT:
    final byte aByte = resultSet.getByte(j + 1);
    return aByte == 0 && resultSet.wasNull() ? null : aByte;
  case Types.DOUBLE:
  case Types.FLOAT:
    final double aDouble = resultSet.getDouble(j + 1);
    return aDouble == 0D && resultSet.wasNull() ? null : aDouble;
  case Types.REAL:
    final float aFloat = resultSet.getFloat(j + 1);
    return aFloat == 0D && resultSet.wasNull() ? null : aFloat;
  case Types.DATE:
    final Date aDate = resultSet.getDate(j + 1, calendar);
    return aDate == null
        ? null
        : (int) (aDate.getTime() / DateTimeUtils.MILLIS_PER_DAY);
  case Types.TIME:
    final Time aTime = resultSet.getTime(j + 1, calendar);
    return aTime == null
        ? null
        : (int) (aTime.getTime() % DateTimeUtils.MILLIS_PER_DAY);
  case Types.TIMESTAMP:
    final Timestamp aTimestamp = resultSet.getTimestamp(j + 1, calendar);
    return aTimestamp == null ? null : aTimestamp.getTime();
  case Types.ARRAY:
    final Array array = resultSet.getArray(j + 1);
    if (null == array) {
      return null;
    }
    try {
      // Recursively extracts an Array using its ResultSet-representation
      return extractUsingResultSet(array, calendar);
    } catch (UnsupportedOperationException | SQLFeatureNotSupportedException e) {
      // Not every database might implement Array.getResultSet(). This call
      // assumes a non-nested array (depends on the db if that's a valid assumption)
      return extractUsingArray(array, calendar);
    }
  case Types.STRUCT:
    Struct struct = resultSet.getObject(j + 1, Struct.class);
    Object[] attrs = struct.getAttributes();
    List<Object> list = new ArrayList<>(attrs.length);
    for (Object o : attrs) {
      list.add(o);
    }
    return list;
  default:
    return resultSet.getObject(j + 1);
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:61,代码来源:JdbcResultSet.java

示例11: getValue

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
protected Short getValue(ResultSet rs, int columnIndex)
        throws SQLException {
    return rs.getShort(columnIndex);
}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:6,代码来源:ConvertableEnumTypeHandler.java

示例12: createFromDB

import java.sql.ResultSet; //导入方法依赖的package包/类
public static MapleShop createFromDB(int id, boolean isShopId) {
    MapleShop ret = null;

    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    try {
        Connection con = DatabaseConnection.getConnection();
        PreparedStatement ps = con.prepareStatement(isShopId ? "SELECT * FROM shops WHERE shopid = ?" : "SELECT * FROM shops WHERE npcid = ?");
        int shopId;
        ps.setInt(1, id);
        ResultSet rs = ps.executeQuery();
        if (rs.next()) {
            shopId = rs.getInt("shopid");
            ret = new MapleShop(shopId, rs.getInt("npcid"));
            rs.close();
            ps.close();
        } else {
            rs.close();
            ps.close();
            return null;
        }
        ps = con.prepareStatement("SELECT * FROM shopitems WHERE shopid = ? ORDER BY position ASC");
        ps.setInt(1, shopId);
        rs = ps.executeQuery();
        List<Integer> recharges = new ArrayList<Integer>(rechargeableItems);
        while (rs.next()) {
            if (ii.itemExists(rs.getInt("itemid"))) {
                if ((GameConstants.isThrowingStar(rs.getInt("itemid"))) || (GameConstants.isBullet(rs.getInt("itemid")))) {
                    MapleShopItem starItem = new MapleShopItem((short) rs.getShort("buyable"), ii.getSlotMax(rs.getInt("itemid")), rs.getInt("itemid"), rs.getInt("price"), (short) rs.getInt("position"), rs.getInt("reqitem"), rs.getInt("reqitemq"), rs.getByte("rank"), rs.getInt("category"), rs.getInt("minLevel"), rs.getInt("expiration"), false);
                    ret.addItem(starItem);
                    if (rechargeableItems.contains(Integer.valueOf(starItem.getItemId()))) {
                        recharges.remove(Integer.valueOf(starItem.getItemId()));
                    }
                } else {
                    ret.addItem(new MapleShopItem((short) rs.getShort("buyable"), rs.getShort("quantity"), rs.getInt("itemid"), rs.getInt("price"), (short) rs.getInt("position"), rs.getInt("reqitem"), rs.getInt("reqitemq"), rs.getByte("rank"), rs.getInt("category"), rs.getInt("minLevel"), rs.getInt("expiration"), false)); //todo potential
                }
            }
        }
        for (Integer recharge : recharges) {
            ret.addItem(new MapleShopItem((short) 1, ii.getSlotMax(recharge.intValue()), recharge.intValue(), 0, (short) 0, 0, 0, (byte) 0, 0, 0, 0, false));
        }
        rs.close();
        ps.close();

        ps = con.prepareStatement("SELECT * FROM shopranks WHERE shopid = ? ORDER BY rank ASC");
        ps.setInt(1, shopId);
        rs = ps.executeQuery();
        while (rs.next()) {
            if (ii.itemExists(rs.getInt("itemid"))) {
                ret.ranks.add(new Pair<Integer, String>(Integer.valueOf(rs.getInt("itemid")), rs.getString("name")));
            }
        }
        rs.close();
        ps.close();
    } catch (SQLException e) {
        System.err.println("Could not load shop");
    }
    return ret;
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:59,代码来源:MapleShop.java

示例13: getNullableResult

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public Short getNullableResult(ResultSet rs, String columnName) throws SQLException {
	return rs.getShort(columnName);
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:5,代码来源:ShortTypeHandler.java

示例14: reader

import java.sql.ResultSet; //导入方法依赖的package包/类
public Object reader(ResultSet rs, int columnIndex) throws SQLException {
	return new Short(rs.getShort(columnIndex));
}
 
开发者ID:yswang0927,项目名称:ralasafe,代码行数:4,代码来源:ResultSetReader.java

示例15: loadTransaction

import java.sql.ResultSet; //导入方法依赖的package包/类
static TransactionImpl loadTransaction(Connection con, ResultSet rs) throws NxtException.ValidationException {
    try {

        byte type = rs.getByte("type");
        byte subtype = rs.getByte("subtype");
        int timestamp = rs.getInt("timestamp");
        short deadline = rs.getShort("deadline");
        byte[] senderPublicKey = rs.getBytes("sender_public_key");
        long amountNQT = rs.getLong("amount");
        long feeNQT = rs.getLong("fee");
        byte[] referencedTransactionFullHash = rs.getBytes("referenced_transaction_full_hash");
        int ecBlockHeight = rs.getInt("ec_block_height");
        long ecBlockId = rs.getLong("ec_block_id");
        byte[] signature = rs.getBytes("signature");
        long blockId = rs.getLong("block_id");
        int height = rs.getInt("height");
        long id = rs.getLong("id");
        long senderId = rs.getLong("sender_id");
        byte[] attachmentBytes = rs.getBytes("attachment_bytes");
        int blockTimestamp = rs.getInt("block_timestamp");
        byte[] fullHash = rs.getBytes("full_hash");
        byte version = rs.getByte("version");

        ByteBuffer buffer = null;
        if (attachmentBytes != null) {
            buffer = ByteBuffer.wrap(attachmentBytes);
            buffer.order(ByteOrder.LITTLE_ENDIAN);
        }

        TransactionType transactionType = TransactionType.findTransactionType(type, subtype);
        TransactionImpl.BuilderImpl builder = new TransactionImpl.BuilderImpl(version, senderPublicKey,
                amountNQT, feeNQT, timestamp, deadline,
                transactionType.parseAttachment(buffer, version))
                .referencedTransactionFullHash(referencedTransactionFullHash)
                .signature(signature)
                .blockId(blockId)
                .height(height)
                .id(id)
                .senderId(senderId)
                .blockTimestamp(blockTimestamp)
                .fullHash(fullHash);
        if (transactionType.hasRecipient()) {
            long recipientId = rs.getLong("recipient_id");
            if (! rs.wasNull()) {
                builder.recipientId(recipientId);
            }
        }
        if (rs.getBoolean("has_message")) {
            builder.message(new Appendix.Message(buffer, version));
        }
        if (rs.getBoolean("has_encrypted_message")) {
            builder.encryptedMessage(new Appendix.EncryptedMessage(buffer, version));
        }
        if (rs.getBoolean("has_public_key_announcement")) {
            builder.publicKeyAnnouncement(new Appendix.PublicKeyAnnouncement(buffer, version));
        }
        if (rs.getBoolean("has_encrypttoself_message")) {
            builder.encryptToSelfMessage(new Appendix.EncryptToSelfMessage(buffer, version));
        }
        if (version > 0) {
            builder.ecBlockHeight(ecBlockHeight);
            builder.ecBlockId(ecBlockId);
        }

        return builder.build();

    } catch (SQLException e) {
        throw new RuntimeException(e.toString(), e);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:71,代码来源:TransactionDb.java


注:本文中的java.sql.ResultSet.getShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。