// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
//     private static final long serialVersionUID = 4178101927323891639L;
//     private String name;
//     private int statementCount = -1;
//     private File file;
// 
//     public enum DbState {
//         COMMITTED, IN_PROGRESS, NOT_AVAILABLE
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getStatementCount() {
//         return statementCount;
//     }
// 
//     public void setStatementCount(int statementCount) {
//         this.statementCount = statementCount;
//     }
// 
//     public File getFile() {
//         return file;
//     }
// 
//     public void setFile(File file) {
//         this.file = file;
//     }
// 
//     public abstract void setDbDate(Date dbDate);
// 
//     public abstract void setDbState(DbState dbState);
// 
//     public abstract Date getDbDate();
// 
//     public abstract DbState getDbState();
// 
//     public abstract boolean canApply();
// 
//     public String toString() {
//         return super.toString() + "-" + name;
//     }
// 
//     public static String normalizeName(String name) {
//         String nameLC = name.toLowerCase();
//         while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
//             int dot = nameLC.lastIndexOf('.');
//             nameLC = nameLC.substring(0, dot);
//         }
//         return name.substring(0, nameLC.length());
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/RollbackPatch.java
// public class RollbackPatch extends AbstractPatch {
//     private final Patch patch;
//     private final File originalPatchFile;
//     private boolean missing;
// 
//     public RollbackPatch(Patch patch) {
//         super.setName(patch.getName());
//         this.originalPatchFile = patch.getFile();
//         this.missing = true;
//         this.patch = patch;
//     }
// 
//     public RollbackPatch(Patch patch, File rollbackFile, int rollbackStatementsCount) {
//         this(patch);
//         super.setFile(rollbackFile);
//         super.setStatementCount(rollbackStatementsCount);
//         this.missing = false;
//     }
// 
// 
//     public void setFile(File file) {
//         throw new AssertionError("DO NOT USE IT! It shouldn't be invoked.");
//     }
// 
//     @Override
//     public void setDbDate(Date dbDate) {
//         patch.setDbDate(dbDate);
//     }
// 
//     @Override
//     public void setDbState(DbState dbState) {
//         patch.setDbState(dbState);
//     }
// 
//     @Override
//     public Date getDbDate() {
//         return patch.getDbDate();
//     }
// 
//     @Override
//     public DbState getDbState() {
//         return patch.getDbState();
//     }
// 
//     public File getOriginalPatchFile() {
//         return originalPatchFile;
//     }
// 
//     public boolean isMissing() {
//         return missing;
//     }
// 
// 
//     public boolean canApply() {
//         return !isMissing() && getStatementCount() > 0 && getDbState() == DbState.COMMITTED;
//     }
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
// 
//     private CloseUtil() {
//     }
// 
//     public static void close(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Statement statement) {
//         try {
//             if (statement != null) {
//                 statement.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Connection conn) {
//         try {
//             if (conn != null) {
//                 conn.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(ResultSet rs) {
//         try {
//             if (rs != null) {
//                 rs.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
// }


import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.Patch;
import org.jsoftware.dbpatch.config.RollbackPatch;
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.impl.PatchStatement;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;
    }

    public void lock(Connection con, long timeout) throws SQLException {
//		ResultSet rs = con.createStatement().executeQuery("SELECT patch_db_date FROM " + DBPATCH_TABLE_NAME + " WHERE patch_name IS NULL");
//		try {
//			if (! rs.next()) {
//				throw new RuntimeException("No empty row in " + DBPATCH_TABLE_NAME + " table.");
//			}
//			if (rs.getTimestamp(1) == null) {
//				PreparedStatement ps = con.prepareStatement("UPDATE " + DBPATCH_TABLE_NAME + " SET patch_db_date = ? WHERE patch_name IS NULL");
//				ps.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
//				ps.execute();
//				ps.close();
//				con.commit();
//			} else {
//				throw new SQLException("Database is locked.");
//			}
//		} finally {
//			rs.close();
//		}
    }

    public void releaseLock(Connection con) throws SQLException {
//		Statement stm = con.createStatement();
//		stm.executeUpdate("UPDATE " + DBPATCH_TABLE_NAME + " SET patch_db_date = NULL WHERE patch_name IS NULL");
//		stm.close();
//		con.commit();
    }

    public void savePatchInfoPrepare(Connection con, Patch patch) throws SQLException {
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractPatch.java
// public abstract class AbstractPatch implements Serializable {
//     private static final long serialVersionUID = 4178101927323891639L;
//     private String name;
//     private int statementCount = -1;
//     private File file;
// 
//     public enum DbState {
//         COMMITTED, IN_PROGRESS, NOT_AVAILABLE
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getStatementCount() {
//         return statementCount;
//     }
// 
//     public void setStatementCount(int statementCount) {
//         this.statementCount = statementCount;
//     }
// 
//     public File getFile() {
//         return file;
//     }
// 
//     public void setFile(File file) {
//         this.file = file;
//     }
// 
//     public abstract void setDbDate(Date dbDate);
// 
//     public abstract void setDbState(DbState dbState);
// 
//     public abstract Date getDbDate();
// 
//     public abstract DbState getDbState();
// 
//     public abstract boolean canApply();
// 
//     public String toString() {
//         return super.toString() + "-" + name;
//     }
// 
//     public static String normalizeName(String name) {
//         String nameLC = name.toLowerCase();
//         while (nameLC.endsWith(".sql") || nameLC.endsWith(".undo") || nameLC.endsWith(".rollback")) {
//             int dot = nameLC.lastIndexOf('.');
//             nameLC = nameLC.substring(0, dot);
//         }
//         return name.substring(0, nameLC.length());
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/RollbackPatch.java
// public class RollbackPatch extends AbstractPatch {
//     private final Patch patch;
//     private final File originalPatchFile;
//     private boolean missing;
// 
//     public RollbackPatch(Patch patch) {
//         super.setName(patch.getName());
//         this.originalPatchFile = patch.getFile();
//         this.missing = true;
//         this.patch = patch;
//     }
// 
//     public RollbackPatch(Patch patch, File rollbackFile, int rollbackStatementsCount) {
//         this(patch);
//         super.setFile(rollbackFile);
//         super.setStatementCount(rollbackStatementsCount);
//         this.missing = false;
//     }
// 
// 
//     public void setFile(File file) {
//         throw new AssertionError("DO NOT USE IT! It shouldn't be invoked.");
//     }
// 
//     @Override
//     public void setDbDate(Date dbDate) {
//         patch.setDbDate(dbDate);
//     }
// 
//     @Override
//     public void setDbState(DbState dbState) {
//         patch.setDbState(dbState);
//     }
// 
//     @Override
//     public Date getDbDate() {
//         return patch.getDbDate();
//     }
// 
//     @Override
//     public DbState getDbState() {
//         return patch.getDbState();
//     }
// 
//     public File getOriginalPatchFile() {
//         return originalPatchFile;
//     }
// 
//     public boolean isMissing() {
//         return missing;
//     }
// 
// 
//     public boolean canApply() {
//         return !isMissing() && getStatementCount() > 0 && getDbState() == DbState.COMMITTED;
//     }
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
// 
//     private CloseUtil() {
//     }
// 
//     public static void close(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Statement statement) {
//         try {
//             if (statement != null) {
//                 statement.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Connection conn) {
//         try {
//             if (conn != null) {
//                 conn.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(ResultSet rs) {
//         try {
//             if (rs != null) {
//                 rs.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
// }


// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/dialect/DefaultDialect.java
import org.jsoftware.dbpatch.config.AbstractPatch;
import org.jsoftware.dbpatch.config.Patch;
import org.jsoftware.dbpatch.config.RollbackPatch;
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.impl.PatchStatement;
import org.jsoftware.dbpatch.log.LogFactory;
import java.sql.*;

    }

    public void lock(Connection con, long timeout) throws SQLException {
//		ResultSet rs = con.createStatement().executeQuery("SELECT patch_db_date FROM " + DBPATCH_TABLE_NAME + " WHERE patch_name IS NULL");
//		try {
//			if (! rs.next()) {
//				throw new RuntimeException("No empty row in " + DBPATCH_TABLE_NAME + " table.");
//			}
//			if (rs.getTimestamp(1) == null) {
//				PreparedStatement ps = con.prepareStatement("UPDATE " + DBPATCH_TABLE_NAME + " SET patch_db_date = ? WHERE patch_name IS NULL");
//				ps.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
//				ps.execute();
//				ps.close();
//				con.commit();
//			} else {
//				throw new SQLException("Database is locked.");
//			}
//		} finally {
//			rs.close();
//		}
    }

    public void releaseLock(Connection con) throws SQLException {
//		Statement stm = con.createStatement();
//		stm.executeUpdate("UPDATE " + DBPATCH_TABLE_NAME + " SET patch_db_date = NULL WHERE patch_name IS NULL");
//		stm.close();
//		con.commit();
    }

    public void savePatchInfoPrepare(Connection con, Patch patch) throws SQLException {
        PreparedStatement ps = null;