private void callClearDownStoredProc(Connection connection, String projectId) throws SQLException { if (connection != null) { ReleaseHistory version = new ReleaseHistory(VersionNumber.getCurrentVersion()); CallableStatement callableStatement = connection.prepareCall(String.format("CALL sp_clear_down_tables_v%d_%d(?)", version.majorVersion, version.minorVersion)); callableStatement.setString("projectId", projectId); callableStatement.execute(); } } }
VersionNumber.isSupportedVersion(historyItem); versionCheckStatus = new VersionCheckStatus(RepositoryType.COREPOLICY);
public static void isSupportedVersion(ReleaseHistory releaseHistory) throws Exception { // Now check that this release history item, is the same as our current one. ReleaseHistory currentRelease = new ReleaseHistory( VersionNumber.getCurrentVersion() ); String supportedDatabaseVersionStr = Resources.toString(VersionNumber.class.getResource("/supported-database-version"), Charsets.UTF_8); ReleaseHistory supportedDatabaseVersion = new ReleaseHistory(supportedDatabaseVersionStr); if(supportedDatabaseVersion.majorVersion == releaseHistory.majorVersion && supportedDatabaseVersion.minorVersion == releaseHistory.minorVersion && supportedDatabaseVersion.revision == releaseHistory.revision){ return; } // check based on first 3 parts of our release entry, that we support this DB. // It must match! if (!(( currentRelease.majorVersion == releaseHistory.majorVersion ) && ( currentRelease.minorVersion == releaseHistory.minorVersion ) && ( currentRelease.revision == releaseHistory.revision ) )) { throw new Exception("Current DB Version: '" + releaseHistory.version() + "' Revision: '" + releaseHistory.revisionComment + "', isn't supported by api version: '" + currentRelease.version() + "'."); } } }