| 1 | |
package uk.ac.ebi.intenz.mapper; |
| 2 | |
|
| 3 | |
import java.sql.CallableStatement; |
| 4 | |
import java.sql.Connection; |
| 5 | |
import java.sql.SQLException; |
| 6 | |
import java.sql.Types; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
public class AuditPackageMapper { |
| 15 | |
|
| 16 | |
public static final String STANDARD_REMARK = "Update by web application."; |
| 17 | |
|
| 18 | 1 | public AuditPackageMapper() { |
| 19 | 1 | } |
| 20 | |
|
| 21 | |
private String callStatement() { |
| 22 | 2 | return "{CALL enzyme.auditpackage.setremark(?)}"; |
| 23 | |
} |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
public void setRemark(String remark, Connection con) throws SQLException { |
| 33 | 2 | CallableStatement cStmt = null; |
| 34 | |
|
| 35 | |
try { |
| 36 | 2 | cStmt = con.prepareCall(callStatement()); |
| 37 | 2 | if (remark == null){ |
| 38 | 1 | cStmt.setNull(1, Types.VARCHAR); |
| 39 | |
} else { |
| 40 | 1 | cStmt.setString(1, remark); |
| 41 | |
} |
| 42 | 2 | cStmt.executeUpdate(); |
| 43 | |
} finally { |
| 44 | 2 | cStmt.close(); |
| 45 | 2 | } |
| 46 | 2 | } |
| 47 | |
|
| 48 | |
} |