001/*
002 * HA-JDBC: High-Availability JDBC
003 * Copyright (C) 2012  Paul Ferraro
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Lesser General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Lesser General Public License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018package net.sf.hajdbc.sync;
019
020import java.sql.Connection;
021import java.sql.ResultSet;
022import java.sql.SQLException;
023
024/**
025 * @author Paul Ferraro
026 *
027 */
028public interface SynchronizationSupport
029{
030        /**
031         * Drop all foreign key constraints on the target database
032         * @throws SQLException if database error occurs
033         */
034        void dropForeignKeys() throws SQLException;
035        
036        /**
037         * Restores all foreign key constraints on the target database
038         * @throws SQLException if database error occurs
039         */
040        void restoreForeignKeys() throws SQLException;
041        
042        /**
043         * Synchronizes the sequences on the target database with the source database.
044         * @throws SQLException if database error occurs
045         */
046        void synchronizeSequences() throws SQLException;
047        
048        /**
049         * @throws SQLException
050         */
051        void synchronizeIdentityColumns() throws SQLException;
052
053        /**
054         * @throws SQLException
055         */
056        void dropUniqueConstraints() throws SQLException;
057        
058        /**
059         * @throws SQLException
060         */
061        void restoreUniqueConstraints() throws SQLException;
062        
063        /**
064         * Helper method for {@link java.sql.ResultSet#getObject(int)} with special handling for large objects.
065         * @param resultSet
066         * @param index
067         * @param type
068         * @return the object of the specified type at the specified index from the specified result set
069         * @throws SQLException
070         */
071        Object getObject(ResultSet resultSet, int index, int type) throws SQLException;
072        
073        void rollback(Connection connection);
074}