Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public FileInformation getFileInformationByPath(String path, int accountID){
- String sqlCommand = "SELECT * FROM [FileInformation] WHERE accountId = ?"
- + " and absolutePath = ?";
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- FileInformation fileInformation = null;
- try {
- conn = db.getConnection();
- ps = conn.prepareStatement(sqlCommand);
- ps.setInt(1, accountID);
- ps.setString(2, path);
- rs = ps.executeQuery();
- if (rs.next()){
- int id = rs.getInt("id");
- String absolutePath = rs.getString("absolutePath");
- boolean directory = rs.getBoolean("isDirectory");
- String remoteFileId = rs.getString("remoteFileId");
- boolean root = rs.getBoolean("isRoot");
- int status = rs.getInt("status");
- Date lastModifiedTime = new Date(rs.getTimestamp("lastModifiedTime").getTime());
- int accountId = rs.getInt("accountId");
- fileInformation = new FileInformation(id, absolutePath, directory,
- remoteFileId, root, status,
- lastModifiedTime, accountId);
- }
- } catch (Exception ex) {
- Logger.getLogger(FileInformationDAO.class.getName()).log(Level.SEVERE, null, ex);
- } finally {
- close.closeResultSet(rs);
- close.closePreparedStatement(ps);
- close.closeConnection(conn);
- }
- return fileInformation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement