001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.upgrade.util;
016    
017    import java.sql.Connection;
018    import java.sql.PreparedStatement;
019    import java.sql.ResultSet;
020    
021    /**
022     * @author Alexander Chow
023     * @author Brian Wing Shun Chan
024     */
025    public interface UpgradeTable {
026    
027            public void appendColumn(StringBuilder sb, Object value, boolean last)
028                    throws Exception;
029    
030            public void appendColumn(
031                            StringBuilder sb, ResultSet rs, String name, Integer type,
032                            boolean last)
033                    throws Exception;
034    
035            public void copyTable(
036                            Connection sourceConnection, Connection targetConnection)
037                    throws Exception;
038    
039            public String getCreateSQL() throws Exception;
040    
041            public String getDeleteSQL() throws Exception;
042    
043            public String[] getIndexesSQL() throws Exception;
044    
045            public String getInsertSQL() throws Exception;
046    
047            public String getSelectSQL() throws Exception;
048    
049            public String getTempFileName();
050    
051            public boolean isAllowUniqueIndexes() throws Exception;
052    
053            public boolean isDeleteTempFile();
054    
055            public void setAllowUniqueIndexes(boolean allowUniqueIndexes)
056                    throws Exception;
057    
058            public void setColumn(
059                            PreparedStatement ps, int index, Integer type, String value)
060                    throws Exception;
061    
062            public void setCreateSQL(String createSQL) throws Exception;
063    
064            public void setDeleteTempFile(boolean deleteTempFile);
065    
066            public void setIndexesSQL(String[] indexesSQL) throws Exception;
067    
068            public void updateTable() throws Exception;
069    
070    }