File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
src/org/nutz/dao/impl/sql/run Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -176,11 +176,21 @@ public void setSlaveDataSource(DataSource slaveDataSource) {
176176 protected DataSource selectDataSource (Transaction t , DataSource master , ConnCallback callback ) {
177177 if (this .slaveDataSource == null )
178178 return master ;
179- if (t == null && callback instanceof DaoInterceptorChain ) {
180- DaoInterceptorChain chain = (DaoInterceptorChain )callback ;
181- DaoStatement [] sts = chain .getDaoStatements ();
182- if (sts .length == 1 && (sts [0 ].isSelect () || sts [0 ].isForceExecQuery ())) {
183- return slaveDataSource ;
179+ if (meta .getType () == DB .PSQL ){
180+ if (callback instanceof DaoInterceptorChain ) {
181+ DaoInterceptorChain chain = (DaoInterceptorChain )callback ;
182+ DaoStatement [] sts = chain .getDaoStatements ();
183+ if (sts .length == 1 && (sts [0 ].isSelect () || sts [0 ].isForceExecQuery ())) {
184+ return slaveDataSource ;
185+ }
186+ }
187+ }else {
188+ if (t == null && callback instanceof DaoInterceptorChain ) {
189+ DaoInterceptorChain chain = (DaoInterceptorChain )callback ;
190+ DaoStatement [] sts = chain .getDaoStatements ();
191+ if (sts .length == 1 && (sts [0 ].isSelect () || sts [0 ].isForceExecQuery ())) {
192+ return slaveDataSource ;
193+ }
184194 }
185195 }
186196 return master ;
You can’t perform that action at this time.
0 commit comments