List of usage examples for java.sql ResultSet getBoolean
boolean getBoolean(String columnLabel) throws SQLException;
ResultSet
object as a boolean
in the Java programming language. From source file:com.l2jfree.gameserver.model.entity.Couple.java
public Couple(int coupleId) { _id = coupleId;//from ww w . j a v a 2 s . co m Connection con = null; try { PreparedStatement statement; ResultSet rs; con = L2DatabaseFactory.getInstance().getConnection(con); statement = con.prepareStatement("Select * from couples where id = ?"); statement.setInt(1, _id); rs = statement.executeQuery(); while (rs.next()) { _player1Id = rs.getInt("player1Id"); _player2Id = rs.getInt("player2Id"); _maried = rs.getBoolean("maried"); _affiancedDate = rs.getLong("affiancedDate"); _weddingDate = rs.getLong("weddingDate"); } statement.close(); } catch (Exception e) { _log.error("Exception: Couple.load(): " + e.getMessage(), e); } finally { L2DatabaseFactory.close(con); } }
From source file:com.leapfrog.academyspring.dao.impl.CourseDAOImpl.java
private Course mapData(ResultSet rs) throws SQLException { Course cor = new Course(); cor.setId(rs.getInt("id")); cor.setName(rs.getString("name")); cor.setDescription(rs.getString("description")); cor.setCourseDuration(rs.getInt("course_duration")); cor.setDurationType(rs.getString("duration_type")); cor.setFees(rs.getDouble("fees")); cor.setAddedDate(rs.getDate("added_date")); cor.setModifiedDate(rs.getDate("modified_date")); cor.setDeleteFlag(rs.getBoolean("delete_flag")); cor.setDeleteDate(rs.getDate("delete_date")); cor.setStatus(rs.getBoolean("status")); return cor;/*from w w w . j a v a 2 s . c om*/ }
From source file:com.alfaariss.oa.engine.authentication.jdbc.JDBCProfile.java
/** * Creates a profile object.//from www. j av a 2 s . c o m * @param oDataSource the JDBC datasource * @param oResultSet A resultset containing a row with profile information * @param sMethodTable methods table name * @param sProfilePropertiesTable authentication profile properties table name * @throws AuthenticationException if creation fails */ public JDBCProfile(DataSource oDataSource, ResultSet oResultSet, String sMethodTable, String sProfilePropertiesTable) throws AuthenticationException { super(); try { _logger = LogFactory.getLog(JDBCProfile.class); _sID = oResultSet.getString(COLUMN_PROFILE_ID); _sFriendlyName = oResultSet.getString(COLUMN_PROFILE_FRIENDLYNAME); _bEnabled = oResultSet.getBoolean(COLUMN_PROFILE_ENABLED); _listAuthenticationMethods = readMethods(oDataSource, sMethodTable); addProperties(oDataSource, sProfilePropertiesTable); } catch (Exception e) { _logger.fatal("Internal error during initialization", e); throw new AuthenticationException(SystemErrors.ERROR_INTERNAL); } }
From source file:com.onclave.testbench.jdbcTemplate.DAOSupport.StudentDAOImplementation.java
@Override public List<StudentPOJO> queryAllStudents() { List<StudentPOJO> students = this.jdbcTemplate.query(QueryStatements.QUERY_ALL_STUDENTS_SQL, new RowMapper<StudentPOJO>() { @Override// w ww .j a va 2 s . co m public StudentPOJO mapRow(ResultSet resultSet, int rowNum) throws SQLException { StudentPOJO student = new StudentPOJO(); student.setIdStudent(resultSet.getLong("IDStudents")); student.setName(resultSet.getString("studentName")); student.setRollNo(resultSet.getString("studentRollNo")); student.setEmail(resultSet.getString("studentEmail")); student.setActive(resultSet.getBoolean("studentActive")); student.setAge(resultSet.getInt("studentAge")); return student; } }); return students; }
From source file:com.butler.service.ProductDao.java
public List<Product> getCompeteProducts() { String sql = "select name,display_name,display_position,market_price,selling_price,size,type,visible,booking_only from product order by display_position"; return this.getJdbcTemplate().query(sql, new RowMapper() { @Override// w w w . j a v a 2 s . co m public Object mapRow(ResultSet rs, int i) throws SQLException { Product product = new Product(); product.setName(rs.getString("name")); product.setDisplayName(rs.getString("display_name")); product.setSellingPrice(rs.getFloat("selling_price")); product.setMarketPrice(rs.getFloat("market_price")); product.setSizeSpecification(rs.getString("size")); product.setType(rs.getString("type")); product.setVisible(rs.getBoolean("visible")); product.setDisplayPosition(rs.getInt("display_position")); product.setBookingOnly(rs.getBoolean("booking_only")); return product; } }); }
From source file:com.butler.service.ProductDao.java
public List<Product> getAllProducts() { String sql = "select name,display_name,market_price,selling_price,size,type,booking_only from product where visible=1 order by display_position,booking_only"; return this.getJdbcTemplate().query(sql, new RowMapper() { @Override/*from w w w.j a v a 2 s .c om*/ public Object mapRow(ResultSet rs, int i) throws SQLException { Product product = new Product(); product.setName(rs.getString("name")); product.setDisplayName(rs.getString("display_name")); product.setSellingPrice(rs.getFloat("selling_price")); product.setMarketPrice(rs.getFloat("market_price")); product.setSizeSpecification(rs.getString("size")); product.setType(rs.getString("type")); product.setBookingOnly(rs.getBoolean("booking_only")); return product; } }); }
From source file:com.springsource.greenhouse.invite.JdbcInviteRepository.java
private Invite queryForInvite(String token) throws NoSuchInviteException { try {//from w w w . j a va 2s.c o m return jdbcTemplate.queryForObject(SELECT_INVITE, new RowMapper<Invite>() { public Invite mapRow(ResultSet rs, int rowNum) throws SQLException { Invitee invitee = new Invitee(rs.getString("firstName"), rs.getString("lastName"), rs.getString("email")); ProfileReference sentBy = ProfileReference.textOnly(rs.getLong("sentById"), rs.getString("sentByUsername"), rs.getString("sentByFirstName"), rs.getString("sentByLastName")); return new Invite(invitee, sentBy, rs.getBoolean("accepted")); } }, token, token); } catch (EmptyResultDataAccessException e) { throw new NoSuchInviteException(token); } }
From source file:com.chaosinmotion.securechat.server.commands.GetMessages.java
public static ReturnResult processRequest(Login.UserInfo userinfo, JSONObject requestParams) throws ClassNotFoundException, SQLException, IOException { String deviceid = requestParams.optString("deviceid"); MessageReturnResult mrr = new MessageReturnResult(); /*//from w w w . j av a 2 s .co m * Save message to the database. */ Connection c = null; PreparedStatement ps = null; ResultSet rs = null; try { /* * Get the device ID for this device. Verify it belongs to the * user specified */ c = Database.get(); ps = c.prepareStatement("SELECT deviceid " + "FROM Devices " + "WHERE deviceuuid = ? AND userid = ?"); ps.setString(1, deviceid); ps.setInt(2, userinfo.getUserID()); rs = ps.executeQuery(); int deviceID = 0; if (rs.next()) { deviceID = rs.getInt(1); } rs.close(); ps.close(); if (deviceID == 0) { return new ReturnResult(Errors.ERROR_UNKNOWNDEVICE, "Unknown device"); } /* * Run query to get messages */ ps = c.prepareStatement("SELECT Messages.messageid, " + " Messages.senderid, " + " Users.username, " + " Messages.toflag, " + " Messages.received, " + " Messages.message " + "FROM Messages, Users " + "WHERE Messages.deviceid = ? " + " AND Messages.senderid = Users.userid"); ps.setInt(1, deviceID); rs = ps.executeQuery(); while (rs.next()) { int messageID = rs.getInt(1); int senderID = rs.getInt(2); String senderName = rs.getString(3); boolean toflag = rs.getBoolean(4); Timestamp received = rs.getTimestamp(5); byte[] message = rs.getBytes(6); mrr.addMessage(messageID, senderID, senderName, toflag, received, message); } /* * Return messages */ return mrr; } finally { if (rs != null) rs.close(); if (ps != null) ps.close(); if (c != null) c.close(); } }
From source file:com.karki.spring.dao.impl.CourseDaoImpl.java
private Course mapData(ResultSet rs) throws SQLException { Course course = new Course(); course.setId(rs.getInt("id")); course.setCourseName(rs.getString("course_name")); course.setCourseDescription(rs.getString("course_description")); course.setDurationType(rs.getString("duration_type")); course.setFees(rs.getDouble("fees")); course.setDuration(rs.getInt("duration")); course.setAddedDate(rs.getDate("added_date")); course.setModifiedDate(rs.getDate("modified_date")); course.setStatus(rs.getBoolean("status")); return course; }
From source file:mx.edu.um.escuela.dao.MaestroDaoJdbc.java
@Override public Maestro mapRow(ResultSet rs, int i) throws SQLException { Maestro maestro = new Maestro(); maestro.setId(rs.getLong("id")); maestro.setNomina(rs.getString("nomina")); maestro.setNombre(rs.getString("nombre")); maestro.setApellido(rs.getString("apellido")); if (rs.getDate("fecha_nacimiento") != null) { maestro.setFechaNacimiento(new Date(rs.getDate("fecha_nacimiento").getTime())); }/* w w w . jav a 2 s. c o m*/ maestro.setEsHombre(rs.getBoolean("es_hombre")); if (rs.getString("correo") != null) { maestro.setCorreo(rs.getString("correo")); } return maestro; }