本文整理汇总了Java中java.sql.ResultSet.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.getBoolean方法的具体用法?Java ResultSet.getBoolean怎么用?Java ResultSet.getBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.ResultSet
的用法示例。
在下文中一共展示了ResultSet.getBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public Claim map(int index, ResultSet result, StatementContext ctx) throws SQLException {
return new Claim(
result.getLong("id"),
result.getString("submitter_id"),
result.getString("letter_holder_id"),
result.getString("defendant_id"),
result.getString("external_id"),
result.getString("reference_number"),
toClaimData(result.getString("claim")),
toLocalDateTimeFromUTC(result.getTimestamp("created_at")),
result.getTimestamp("issued_on").toLocalDateTime().toLocalDate(),
result.getTimestamp("response_deadline").toLocalDateTime().toLocalDate(),
result.getBoolean("more_time_requested"),
result.getString("submitter_email"),
toNullableLocalDateTimeFromUTC(result.getTimestamp("responded_at")),
toNullableResponseData(result.getString("response")),
result.getString("defendant_email"),
toNullableCountyCourtJudgment(result.getString("county_court_judgment")),
toNullableLocalDateTimeFromUTC(result.getTimestamp("county_court_judgment_requested_at")),
toNullableSettlement(result.getString("settlement")),
toNullableLocalDateTimeFromUTC(result.getTimestamp("settlement_reached_at")),
result.getString("sealed_claim_document_management_self_path")
);
}
示例2: Passenger
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* constructor with the id
* @param passNo : passport number
*/
public Passenger(String passNo){
conn = DBConnect.connect();
PreparedStatement pst;
try {
String sql = "SELECT * FROM `passenger` WHERE `pass_no`=?";
pst=conn.prepareStatement(sql);
pst.setString(1,passNo);
ResultSet rs;
rs = pst.executeQuery();
if (!rs.isBeforeFirst() ) {
return;
}
while (rs.next()) {
this.tel = rs.getString("tel");
this.paddress = rs.getString("paddress");
this.fname = rs.getString("fname");
this.lname = rs.getString("lname");
this.pass_no = rs.getString("pass_no");
this.password = rs.getString("password");
this.dob = rs.getDate("dob");
this.active = rs.getBoolean("active");
this.exist = true;
}
} catch (SQLException e) {
System.out.println("Error : while excicuting prepared statement");
System.out.println(e);
System.out.println(e.getErrorCode());
}
}
示例3: getPermission
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* Loads a {@link Permission} object from the database.
* @param target the target to query.
* @param permissionString the permission to query.
* @return the {@link Permission Permission object} with a negation value or null if it does not exist.
*/
public Permission getPermission(PermissionTarget target, String permissionString) {
try {
PreparedStatement selectStatement = MySQL.getConnection()
.prepareStatement("SELECT `negated` FROM `" + TABLE + "` " +
"WHERE `guildid` = ? " +
"AND `type` = ? " +
"AND `id` = ? " +
"AND `permission` = ?;");
selectStatement.setLong(1, target.getGuild().getIdLong());
selectStatement.setString(2, String.valueOf(target.getType().getIdentifier()));
selectStatement.setLong(3, target.getId());
selectStatement.setString(4, permissionString);
ResultSet queryResult = selectStatement.executeQuery();
return queryResult.next()
? new Permission(permissionString, queryResult.getBoolean("negated")) // entry with negation value
: null; // no entry
} catch (SQLException e) {
throw new RuntimeException("An unknown error has occurred while fetching database information.", e);
}
}
示例4: objectExits
import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public boolean objectExits(String key) {
if (DEBUG)
plugin.getLogger().info("DEBUG: checking if " + key + " exists in the database");
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String query = "SELECT IF ( EXISTS( SELECT * FROM `" + type.getCanonicalName() + "` WHERE `uniqueId` = ?), 1, 0)";
//String query = "SELECT * FROM `" + type.getCanonicalName() + "` WHERE uniqueId = ?";
try {
connection = databaseConnecter.createConnection();
preparedStatement = connection.prepareStatement(query);
preparedStatement.setString(1, key);
resultSet = preparedStatement.executeQuery();
if (DEBUG)
plugin.getLogger().info("DEBUG: object exists sql " + preparedStatement.toString());
if (resultSet.next()) {
if (DEBUG)
plugin.getLogger().info("DEBUG: result is " + resultSet.getBoolean(1));
return resultSet.getBoolean(1);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
MySQLDatabaseResourceCloser.close(resultSet);
MySQLDatabaseResourceCloser.close(preparedStatement);
MySQLDatabaseResourceCloser.close(connection);
}
return false;
}
示例5: testGetBoolean
import java.sql.ResultSet; //导入方法依赖的package包/类
public void testGetBoolean(ResultSet resultSet) throws SQLException {
try {
resultSet.getBoolean(ordinal);
fail("Was expecting to throw SQLDataException");
} catch (Exception e) {
assertThat(e, isA((Class) SQLDataException.class)); // success
}
}
示例6: mapRow
import java.sql.ResultSet; //导入方法依赖的package包/类
public Artist mapRow(ResultSet rs, int rowNum) throws SQLException {
return new Artist(
rs.getInt(1),
rs.getString(2),
rs.getString(3),
rs.getInt(4),
rs.getTimestamp(5),
rs.getBoolean(6),
rs.getInt(7));
}
示例7: readResult
import java.sql.ResultSet; //导入方法依赖的package包/类
protected void readResult(ResultSet results) throws SQLException {
while (results.next()) {
Vector3i pos = new Vector3i(results.getInt("x"), results.getInt("y"), results.getInt("z"));
UUID world = UUID.fromString(results.getString("world"));
ActionType type = ActionType.valueCache[results.getByte("type")];
String cause = results.getString("cause");
String data = results.getString("data");
ItemType item = Sponge.getRegistry().getType(ItemType.class, results.getString("AS_Id.value")).get();
int count = results.getByte("count");
int slot = results.getInt("slot");
boolean rolledBack = results.getBoolean("rolled_back");
long timestamp = results.getLong("time");
lines.add(new LookupLine(pos, world, type, cause, data, item, count, slot, rolledBack, timestamp));
}
}
示例8: Goods
import java.sql.ResultSet; //导入方法依赖的package包/类
private Goods(ResultSet rs) throws SQLException {
this.id = rs.getLong("id");
this.dbKey = goodsDbKeyFactory.newKey(this.id);
this.sellerId = rs.getLong("seller_id");
this.name = rs.getString("name");
this.description = rs.getString("description");
this.tags = rs.getString("tags");
this.quantity = rs.getInt("quantity");
this.priceNQT = rs.getLong("price");
this.delisted = rs.getBoolean("delisted");
this.timestamp = rs.getInt("timestamp");
}
示例9: getContact
import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public Contact getContact(Connection txn, ContactId c) throws DbException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = "SELECT authorId, name, publicKey,"
+ " localAuthorId, verified, active"
+ " FROM contacts"
+ " WHERE contactId = ?";
ps = txn.prepareStatement(sql);
ps.setInt(1, c.getInt());
rs = ps.executeQuery();
if (!rs.next()) throw new DbStateException();
AuthorId authorId = new AuthorId(rs.getBytes(1));
String name = rs.getString(2);
byte[] publicKey = rs.getBytes(3);
AuthorId localAuthorId = new AuthorId(rs.getBytes(4));
boolean verified = rs.getBoolean(5);
boolean active = rs.getBoolean(6);
rs.close();
ps.close();
Author author = new Author(authorId, name, publicKey);
return new Contact(c, author, localAuthorId, verified, active);
} catch (SQLException e) {
tryToClose(rs);
tryToClose(ps);
throw new DbException(e);
}
}
示例10: loadClanPlayers
import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
protected void loadClanPlayers() {
ResultSet clanPlayersResultSet = databaseConnectionOwner.executeQuery(GET_CLANPLAYERS_QUERY);
if (clanPlayersResultSet != null) {
try {
while (clanPlayersResultSet.next()) {
String playerName = clanPlayersResultSet.getString("playername");
int clanPlayerID = clanPlayersResultSet.getInt("clanplayer_id");
long uuidMostSigBits = clanPlayersResultSet.getLong("uuid_most_sig_bits");
long uuidLeastSigBits = clanPlayersResultSet.getLong("uuid_least_sig_bits");
int rankID = clanPlayersResultSet.getInt("rank_id");
int clanID = clanPlayersResultSet.getInt("clan_id");
int killsHigh = clanPlayersResultSet.getInt("kills_high");
int killsMedium = clanPlayersResultSet.getInt("kills_medium");
int killsLow = clanPlayersResultSet.getInt("kills_low");
int deathsHigh = clanPlayersResultSet.getInt("deaths_high");
int deathsMedium = clanPlayersResultSet.getInt("deaths_medium");
int deathsLow = clanPlayersResultSet.getInt("deaths_low");
boolean ffProtection = clanPlayersResultSet.getBoolean("ff_protection");
long lastOnlineTime = clanPlayersResultSet.getLong("last_online_time");
super.loadedClanPlayer(clanPlayerID, uuidMostSigBits, uuidLeastSigBits, playerName, clanID, rankID, killsHigh, killsMedium,
killsLow, deathsHigh, deathsMedium, deathsLow, ffProtection, lastOnlineTime);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例11: getOutStatus
import java.sql.ResultSet; //导入方法依赖的package包/类
public static boolean[] getOutStatus(String id) throws SQLException {
boolean[] list = new boolean[2];
String uid = getUid(id);
ResultSet rs = DB.executeQuery("SELECT sat, sun FROM goingout_apply WHERE uid=?", uid);
if (rs.next()) {
list[0] = rs.getBoolean(1);
list[1] = rs.getBoolean(2);
}
return list;
}
示例12: mapRow
import java.sql.ResultSet; //导入方法依赖的package包/类
private UserSetting mapRow(ResultSet rs) throws SQLException, ParseException {
UserSetting us = new UserSetting();
us.user.uid = rs.getLong("uid");
us.user.username = rs.getString("username");
us.user.password = rs.getString("password");
us.examCode = rs.getString("examCode");
us.testCentersCriteria.put("countryCode", rs.getString("countryCode"));
us.testCentersCriteria.put("city", rs.getString("city"));
us.testCentersCriteria.put("stateCode", rs.getString("stateCode"));
us.apptSearchRule.type = rs.getInt("type");
us.apptSearchRule.startCalendar = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
us.apptSearchRule.startCalendar.setTime(sdf.parse(rs.getString("startCalendar")));
String endCalendar = rs.getString("endCalendar");
if(StringUtils.isNotEmpty(endCalendar)) {
us.apptSearchRule.endCalendar = Calendar.getInstance();
us.apptSearchRule.endCalendar.setTime(sdf.parse(endCalendar));
}
us.applyType = rs.getInt("applyType");
us.paramVoucherNumber = rs.getString("paramVoucherNumber");
us.creditCard.put("paymentType", rs.getInt("paymentType"));
us.creditCard.put("cardNumber", rs.getString("cardNumber"));
us.creditCard.put("cardHoldersName", rs.getString("cardHoldersName"));
us.creditCard.put("cardExpYear", rs.getInt("cardExpYear"));
us.creditCard.put("cardExpMonth", rs.getInt("cardExpMonth"));
us.creditCard.put("cardSecCode", rs.getString("cardSecCode"));
us.searchSeatOnly = rs.getBoolean("searchSeatOnly");
us.loopRequestIntervalMS = rs.getLong("loopRequestIntervalMS");
return us;
}
示例13: Poll
import java.sql.ResultSet; //导入方法依赖的package包/类
private Poll(ResultSet rs) throws SQLException {
this.id = rs.getLong("id");
this.dbKey = pollDbKeyFactory.newKey(this.id);
this.name = rs.getString("name");
this.description = rs.getString("description");
this.options = (String[])rs.getArray("options").getArray();
this.minNumberOfOptions = rs.getByte("min_num_options");
this.maxNumberOfOptions = rs.getByte("max_num_options");
this.optionsAreBinary = rs.getBoolean("binary_options");
}
示例14: loadCategoryFromObject
import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public void loadCategoryFromObject ( Object o ) {
ResultSet rs = ( ResultSet ) o ;
try {
while (rs.next()) {
final ShopInfo info = new ShopInfo(rs.getInt("id"), rs.getInt("id"), rs.getInt("rating"), rs.getString("UUID"), rs.getString("ownerName"), rs.getString("name"), rs.getBoolean("isFreezed"), rs.getString("freezer"), rs.getString("freezReason"), true, rs.getString("moneyType"));
this.addMerch(info);
}
} catch (SQLException e) {
e.printStackTrace();
}
MineDonate . logInfo ( "Loaded " + m_Merch . size() + " merch in " + toString ( ) ) ;
}
示例15: getUserMeetings
import java.sql.ResultSet; //导入方法依赖的package包/类
@SuppressWarnings("resource") // got warning about stm in case 3 not being closed
@Override
public ArrayList<Meeting> getUserMeetings(int id) throws SQLException {
ArrayList<Meeting> meeting = new ArrayList<Meeting>();
Meeting meet = null;
PreparedStatement stm = c.prepareStatement(SQLStatements.selectUserById);
stm.setInt(1, id);
ResultSet rs = stm.executeQuery();
if (rs.next()) {
int type = rs.getInt(DataContract.UsersTable.COL_TYPE);
switch (type) {
case 2:// Mentor
stm = c.prepareStatement(SQLStatements.selectMeetingsByMentorId);
break;
case 3:// Mentee
stm = c.prepareStatement(SQLStatements.selectMeetingsByMenteeId);
break;
default:
// TODO: LOG ERROR
rs.close();
stm.close();
return null;
}
}
stm.setInt(1, id);
rs = stm.executeQuery();
while (rs.next()) {
java.sql.Date SDate = rs.getDate(DataContract.MeetingTable.COL_DATE);
meet = new Meeting(rs.getInt(DataContract.MeetingTable.COL_ACTIVITYID),
rs.getInt(DataContract.MeetingTable.COL_PAIRID), rs.getInt(DataContract.MeetingTable.COL_MENTORID),
rs.getInt(DataContract.MeetingTable.COL_MENTEEID), rs.getString(DataContract.MeetingTable.COL_NOTE),
meetingStatus.valueOf(rs.getInt(DataContract.MeetingTable.COL_STATUS)),
rs.getString(DataContract.MeetingTable.COL_MENTEEREPORT),
rs.getString(DataContract.MeetingTable.COL_MENTORREPORT),
rs.getString(DataContract.MeetingTable.COL_MENTEEPRIVREPORT),
rs.getString(DataContract.MeetingTable.COL_MENTORPRIVREPORT),
meetingType.getByValue(rs.getInt(DataContract.MeetingTable.COL_MEETINGTYPE)),
rs.getString(DataContract.MeetingTable.COL_SUBJECT),
rs.getString(DataContract.MeetingTable.COL_LOCATION), SDate.getTime(),
rs.getTime(DataContract.MeetingTable.COL_STARTINGTIME),
rs.getTime(DataContract.MeetingTable.COL_ENDINGTIME),
rs.getBoolean(DataContract.MeetingTable.COL_MENTORCOMPLETE),
rs.getBoolean(DataContract.MeetingTable.COL_MENTEECOMPLETE));
meeting.add(meet);
}
rs.close();
stm.close();
return meeting;
}