public PartialFileHistory getFileHistoryWithFileVersions(String relativePath) { try { PreparedStatement preparedStatement = getStatement("filehistory.select.master.getFileHistoryWithFileVersions.sql"); preparedStatement.setString(1, relativePath); preparedStatement.setString(2, FileStatus.DELETED.toString()); ResultSet resultSet = preparedStatement.executeQuery(); PartialFileHistory fileHistory = null; while (resultSet.next()) { if (fileHistory == null) { FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id")); fileHistory = new PartialFileHistory(fileHistoryId); } FileVersion fileVersion = fileVersionDao.createFileVersionFromRow(resultSet); fileHistory.addFileVersion(fileVersion); } return fileHistory; } catch (SQLException e) { throw new RuntimeException(e); } }
public PartialFileHistory getFileHistoryWithLastVersion(String relativePath) { try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.getFileHistoryWithLastVersion.sql")) { preparedStatement.setString(1, relativePath); try (ResultSet resultSet = preparedStatement.executeQuery()) { if (resultSet.next()) { FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id")); FileVersion lastFileVersion = fileVersionDao.createFileVersionFromRow(resultSet); PartialFileHistory fileHistory = new PartialFileHistory(fileHistoryId); fileHistory.addFileVersion(lastFileVersion); return fileHistory; } } return null; } catch (SQLException e) { throw new RuntimeException(e); } } }
public PartialFileHistory getFileHistoryWithFileVersions(String relativePath) { return testDao.getFileHistoryWithFileVersions(relativePath); }
public PartialFileHistory getFileHistoryWithLastVersion(String relativePath) { return testDao.getFileHistoryWithLastVersion(relativePath); }
public TestSqlDatabase(Config config) { super(config); this.testDao = new TestSqlDao(config.createDatabaseConnection(false)); }