DataJdbcSource增加preConstruct方法,方便重载
This commit is contained in:
@@ -52,6 +52,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, DataC
|
|||||||
protected final BiFunction<DataSource, Class, List> fullloader = (s, t) -> querySheet(false, false, t, null, null, (FilterNode) null).list(true);
|
protected final BiFunction<DataSource, Class, List> fullloader = (s, t) -> querySheet(false, false, t, null, null, (FilterNode) null).list(true);
|
||||||
|
|
||||||
public DataJdbcSource(String unitName, Properties readprop, Properties writeprop) {
|
public DataJdbcSource(String unitName, Properties readprop, Properties writeprop) {
|
||||||
|
this.preConstruct(unitName, readprop, writeprop);
|
||||||
this.name = unitName;
|
this.name = unitName;
|
||||||
this.conf = null;
|
this.conf = null;
|
||||||
this.readPool = new PoolJdbcSource(this, "read", readprop);
|
this.readPool = new PoolJdbcSource(this, "read", readprop);
|
||||||
@@ -59,6 +60,10 @@ public class DataJdbcSource extends AbstractService implements DataSource, DataC
|
|||||||
this.cacheForbidden = "NONE".equalsIgnoreCase(readprop.getProperty(JDBC_CACHE_MODE));
|
this.cacheForbidden = "NONE".equalsIgnoreCase(readprop.getProperty(JDBC_CACHE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//构造前调用
|
||||||
|
protected void preConstruct(String unitName, Properties readprop, Properties writeprop) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String resourceName() {
|
public final String resourceName() {
|
||||||
return name;
|
return name;
|
||||||
@@ -2341,7 +2346,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, DataC
|
|||||||
final Statement statement = conn.createStatement();
|
final Statement statement = conn.createStatement();
|
||||||
//final PreparedStatement statement = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
//final PreparedStatement statement = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
final ResultSet set = statement.executeQuery(sql);// ps.executeQuery();
|
final ResultSet set = statement.executeQuery(sql);// ps.executeQuery();
|
||||||
consumer.accept(set);
|
consumer.accept(set);
|
||||||
set.close();
|
set.close();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user