1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
package org.kuali.rice.kns.dao.jdbc; |
14 | |
|
15 | |
import org.apache.log4j.Logger; |
16 | |
import org.kuali.rice.kns.dao.PostDataLoadEncryptionDao; |
17 | |
|
18 | 0 | public class PostDataLoadEncryptionDaoJdbc extends PlatformAwareDaoBaseJdbc implements PostDataLoadEncryptionDao { |
19 | 0 | private static final Logger LOG = Logger.getLogger(PostDataLoadEncryptionDaoJdbc.class); |
20 | |
|
21 | |
private void executeSql(String sql) { |
22 | 0 | LOG.info("Executing sql: " + sql); |
23 | 0 | getJdbcTemplate().execute(sql); |
24 | 0 | } |
25 | |
|
26 | |
public void createBackupTable(String tableName) { |
27 | 0 | executeSql(getDbPlatform().getCreateTableFromTableSql(tableName + "_bak", tableName)); |
28 | 0 | } |
29 | |
|
30 | |
public void truncateTable(String tableName) { |
31 | 0 | executeSql(getDbPlatform().getTruncateTableSql(tableName)); |
32 | 0 | } |
33 | |
|
34 | |
public void restoreTableFromBackup(String tableName) { |
35 | 0 | truncateTable(tableName); |
36 | 0 | executeSql(getDbPlatform().getInsertDataFromTableSql(tableName, tableName + "_bak")); |
37 | 0 | } |
38 | |
|
39 | |
public void dropBackupTable(String tableName) { |
40 | 0 | executeSql(getDbPlatform().getDropTableSql(tableName + "_bak")); |
41 | 0 | } |
42 | |
} |