|
12 | 12 | import org.nutz.dao.DatabaseMeta; |
13 | 13 | import org.nutz.dao.impl.DaoRunner; |
14 | 14 | import org.nutz.dao.sql.DaoStatement; |
| 15 | +import org.nutz.lang.Configurable; |
| 16 | +import org.nutz.lang.util.NutMap; |
15 | 17 | import org.nutz.log.Log; |
16 | 18 | import org.nutz.log.Logs; |
17 | 19 | import org.nutz.trans.Atom; |
|
23 | 25 | * @author wendal |
24 | 26 | * |
25 | 27 | */ |
26 | | -public class NutDaoRunner implements DaoRunner { |
| 28 | +public class NutDaoRunner implements DaoRunner, Configurable { |
27 | 29 |
|
28 | 30 | private static final Log log = Logs.get(); |
29 | 31 |
|
30 | 32 | protected DataSource slaveDataSource; |
31 | 33 |
|
| 34 | + protected boolean supportSavePoint = true; |
| 35 | + |
32 | 36 | public void run(final DataSource dataSource, final ConnCallback callback) { |
33 | 37 | if (callback instanceof DaoInterceptorChain) { |
34 | 38 | DaoInterceptorChain chain = (DaoInterceptorChain)callback; |
@@ -99,7 +103,7 @@ protected void _runWithTransaction(Transaction t, DataSource dataSource, ConnCal |
99 | 103 | Savepoint sp = null; |
100 | 104 | try { |
101 | 105 | conn = t.getConnection(selectDataSource(t, dataSource, callback)); |
102 | | - if (meta != null && meta.isPostgresql()) { |
| 106 | + if (supportSavePoint && meta != null && meta.isPostgresql()) { |
103 | 107 | sp = conn.setSavepoint(); |
104 | 108 | } |
105 | 109 | runCallback(conn, callback); |
@@ -181,4 +185,9 @@ protected DataSource selectDataSource(Transaction t, DataSource master, ConnCall |
181 | 185 | } |
182 | 186 | return master; |
183 | 187 | } |
| 188 | + |
| 189 | + @Override |
| 190 | + public void setupProperties(NutMap conf) { |
| 191 | + supportSavePoint = conf.getBoolean("nutz.dao.jdbc.psql.supportSavePoint", true); |
| 192 | + } |
184 | 193 | } |
0 commit comments