程序包 com.sh.javax
类 DataCenterBase
java.lang.Object
com.sh.javax.DataCenterBase
- 所有已实现的接口:
DataCenter
- 直接已知子类:
ESDataCenter,ExDataCenter,JDBCDataCenter,MainDataCenter,ReportDataCenter,SQueryDataCenter
Description: 数据库连接基类,处理一些公共的方法
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
字段概要
字段修饰符和类型字段说明protected String[]protected Exceptionprotected Object[]protected intprotected Stringprotected longprotected Map<String,BatchUpdate> protected Timerprotected CheckDCConnectStatusTimerprotected Connectionstatic final Stringprotected longprotected DCEventRetprotected booleanprotected longstatic final intstatic final Stringprotected booleanprotected booleanprotected longstatic final Stringprotected org.apache.logging.log4j.Loggerstatic final Stringprotected intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic boolean -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected void打印日志protected void_printParamLog(String[] colsType, Object[] obj) 输出参数信息String[]添加批量操作protected String[]beginBatchUpdateByParams(Connection con, String sql, String[] colsType, int refreshCount) 开始进行批量更新,目前只针对带参数类型voidbeginStatement(Statement statement) voidprotected StringcheckErrorMsg(String message) 处理错误信息的特殊字符(双引号),若为SQL异常,则返回ORACLE错误代码查看是否观察者boolean检查连接,如果连接无效了,则自动重新连接voidclose()voidvoidcloseStatement(Statement statement) protected StringconvertClobString(Clob clob) 转换CLOB对象protected ObjectconvertGetPropType(Object obj, SHColumnType colType, String dateFormat) 默认类型转换protected static StringconvertPwd(String pwd) 转换密码convertRsToDs(ResultSet rs, int start, int end) 将JDBC数据集转化称DatastoreconvertRsToDs(ResultSet rs, String sql, String[] colsType, Object[] obj, long startTime) 将整个数据集都转化称Datastoreprotected ObjectconvertSetPropType(Object obj, SHColumnType colType, Class fieldType, String dateFormat, String numberFormat) 默认转换返回数据类型(setXXX方法的参数)String[]createColsTypeByValue(Object[] value) 通过参数值自动生成参数类型创建查询的SQL生成工具对象为创建查询的SQL生成工具对象为protected String用属性值替换SQL中@userId@中的值创建添加、修改、删除的SQL生成工具对象为String[]结束批量更新操作String[]endBatchUpdateByParams(String key, boolean commit) 结束批量更新操作voidfinishStatement(Statement statement) protected voidgetAllField(Class clazz, List fieldList) 查找所有属性,包括父对象int获取自增长列 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行update setAutoGetGeneratedKey(false) int key = getAutoGeneratedKey() ;long获取自增长列 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行update setAutoGetGeneratedKey(false) long key = getAutoGeneratedKey2() ;获取自增长列并转化为String类型 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行带insert的且有自增长列的操作 setAutoGetGeneratedKey(false) String key == getAutoGeneratedKeyStr() ;getBatchUpdate(String key) getCacheDs(String key) 获取初始化实例类信息获取连接longDC类型获取redislong最后一次执行时长long获取空闲时间获取最近一次执行的SQL语句int获取最后一次影响行数protected ObjectgetObjectByColumnType(SHColumnType columnType, String flag) 获取七种数据类型的Class对象protected Object[]getObjectValue(Object obj, String operateType, boolean commit) 构造执行更新所需要的的sql/colsType/objValueint获取查询超时时长boolean是否记录DC日志标志boolean是否已经建立连接protected DataSource初始化外部连接static voidinitExternalDataSource(DataSource datasource, Class<?> clazz) 初始化外部连接booleanisClosed()判断连接是否关闭,只在连接调用close方法后才会返回trueprotected booleanisContainCascade(CascadeType[] cts, CascadeType ct) 判断是否包含级联操作protected booleanisContainStr(String[] array, String str, boolean ignoreCase) 判断某一个字符串是否存在于String数组之中boolean是否正在执行protected boolean判断查询是否支持结果集 ResultSet.TYPE_SCROLL_INSENSITIVE 类型booleanisTooLongIdle(long idleTimeout) 判断是否空闲太久booleanbooleanisValid()判断连接是否有效,默认等待验证连接秒数:5sbooleanisValid(int timeout) 判断连接是否有效protected booleanloadConfig(String name) 从配置文件中获取默认的数据库连接参数protected static booleanloadConfig(String name, String sector) 已过时。protected voidprintGetConnectLog(long startTime, String from) 记录获取连接的时长printLog()printLog(org.apache.logging.log4j.Logger log4j) printLog(org.slf4j.Logger log) processKey(String sql, String key, String[] colsType, Object[] obj) voidputCacheDs(String key, Datastore ds) String[]refreshBatchUpdate(String key) 刷新批量更新String[]replaceObject(Object obj, boolean commit) retrieveByParams2(String sql, List<Object> objList) retrieveByParams2(String sql, List<Object> objList, boolean isCache) 带参数查询数据集带参数查询数据集retrieveObjByParams2(String sql, List<String> colsTypeList, List<Object> colsValueList, Class queryObj) 查询对象voidsetAutoGetGeneratedKey(boolean getGeneratedKeys) 设置自获取序列号voidsetCheckTimerSchedule(long delay, boolean forceDisconnect) 设置定时检查的间隔时间参数voidsetCheckTimerSchedule(long delay, String flag) 设置定时检查的间隔时间参数voidsetCheckTimerSchedule(long delay, String flag, boolean forceDisconnect) 设置定时检查的间隔时间参数booleansetConnection(Connection conn) 对于外部传入Connection连接的情况,必须设置voidsetConnectState(boolean isConnected) 设置连接是否已经建立protected voidsetExtProperty(String extPro, org.apache.commons.dbcp2.BasicDataSource ds, com.alibaba.druid.pool.DruidDataSource dds) protected void设置自增长列voidsetInitClassInfo(String initClassInfo) 设置初始化实例类 主要用于日志输出voidsetJDBCParam(String driver, String url, String user, String password) 设置配置的连接信息voidprotected intsetParams(PreparedStatement pstmt, String[] colsType, Object[] obj) 设置PreparedStatement的参数protected intsetParams(PreparedStatement pstmt, String[] colsType, Object[] obj, int pos) 设置PreparedStatement的参数protected StringsetProcParams(CallableStatement csmt, String[] colsType, Object[] obj, int[] paramType) 设置CallableStatement的参数(存储过程)voidsetQueryTimeout(int queryTimeout) 设置查询超时时间,0表示无限制voidsetUpdateSilence(boolean isUpdateSilence) 设置此连接是否为安静模式,即执行update时不会通知缓存等事件voidsetWriteEnable(boolean enable) 设置DC日志protected voidprotected voidString[]用参数的方式更新数据库voidwatcherRetrieveFinish(DCWatcher watcher, String key, Datastore ds) 查询结束通知观察者protected voidwriteDetail(String sql, long executeLen, boolean isCacheData, Datastore ds) 记录SQL执行日志protected voidwriteDetailByParam(String sql, String[] colsType, Object[] obj, long executeLen, boolean isCacheData, Datastore ds) 记录SQL执行日志protected voidwriteExeDetail(String sql, boolean isCacheData, Datastore ds) 记录SQL执行日志protected voidwriteExeDetail(String sql, long startTime, boolean isCacheData, Datastore ds) 记录SQL执行日志protected voidwriteExeDetail(String sql, long startTime, long endTime, boolean isCacheData, Datastore ds) 记录SQL执行日志从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 com.sh.javax.DataCenter
addObject, addObject, beginBatchUpdateByParams, beginBatchUpdateByParams, commit, connect, connect, disconnect, disconnect, getCacheDcType, getDBType, getDriverName, getJDBCPassword, getJDBCUrl, getJDBCUserId, getNewConnection, isExDataCenter, isMainDataCenter, isReportDataCenter, replaceObject, retrieve, retrieve, retrieve, retrieve, retrieveByParams, retrieveByParams, retrieveByParams, retrieveByParams, retrieveByStoreProc, retrieveByStoreProc, retrieveListByStoreProc, retrieveObj, retrieveObj, retrieveObjByParams, retrieveObjByParams, retrieveObjByParams, retrieveObjList, retrieveObjList, retrieveObjList, retrieveObjList, retrieveObjList, rollback, setAutoCommit, setConfig, setConfig, update, update, update, updateByParams, updateByParams, updateByParams, updateByParams, updateByParams, updateByParams, updateByStoreProc, updateByStoreProc, updateByStoreProc, updateByStoreProc, updateByStoreProc, updateByStoreProc, updateByStoreProc, updateObject, updateObject
-
字段详细资料
-
POOL_CONN
- 另请参阅:
-
CONFIG_CONN
- 另请参阅:
-
LOCAL_CONN
- 另请参阅:
-
External_CONN
- 另请参阅:
-
UNDEFINE
public static final int UNDEFINE- 另请参阅:
-
SH_POOL
public static final int SH_POOL- 另请参阅:
-
STRUTS_POOL
public static final int STRUTS_POOL- 另请参阅:
-
TOMCAT_POOL
public static final int TOMCAT_POOL- 另请参阅:
-
WEBLOGIC_POOL
public static final int WEBLOGIC_POOL- 另请参阅:
-
SH_BASIC_POOL
public static final int SH_BASIC_POOL- 另请参阅:
-
SH_DRUID
public static final int SH_DRUID- 另请参阅:
-
External
public static final int External- 另请参阅:
-
con
-
batchMap
-
log4j
protected org.apache.logging.log4j.Logger log4j -
executeLen
protected long executeLen -
queryTimeout
protected int queryTimeout -
writeLogFlag
public static boolean writeLogFlag -
executeAutoGeneratedKeys
protected boolean executeAutoGeneratedKeys -
autoGeneratedKey
protected long autoGeneratedKey -
eventRet
-
_lastException
-
connectStartTime
protected long connectStartTime -
checkTimerInstance
-
checkTimer
-
isUpdateSilence
protected boolean isUpdateSilence -
lastExecuteTime
protected long lastExecuteTime -
isExcute
protected boolean isExcute -
_lastSql
-
_lastColType
-
_lastObj
-
_lastRowCount
protected int _lastRowCount
-
-
构造器详细资料
-
DataCenterBase
public DataCenterBase()
-
-
方法详细资料
-
setParam
- 指定者:
setParam在接口中DataCenter
-
getParam
- 指定者:
getParam在接口中DataCenter
-
isExecute
public boolean isExecute()是否正在执行- 指定者:
isExecute在接口中DataCenter- 返回:
- true|false
-
isTooLongIdle
public boolean isTooLongIdle(long idleTimeout) 判断是否空闲太久- 指定者:
isTooLongIdle在接口中DataCenter- 参数:
idleTimeout- 空闲超时时长- 返回:
- boolean true|false
-
getIdleTime
public long getIdleTime()获取空闲时间- 指定者:
getIdleTime在接口中DataCenter- 返回:
- 空闲时长,单位:毫秒
-
getLastExecuteSql
获取最近一次执行的SQL语句- 指定者:
getLastExecuteSql在接口中DataCenter- 返回:
- String
-
setExtProperty
protected void setExtProperty(String extPro, org.apache.commons.dbcp2.BasicDataSource ds, com.alibaba.druid.pool.DruidDataSource dds) -
checkRetrieveWatcher
查看是否观察者- 参数:
key- String- 返回:
- DCWatcher
-
watcherRetrieveFinish
查询结束通知观察者- 参数:
watcher- DCWatcherkey- Stringds- Datastore
-
getLastRowCount
public int getLastRowCount()从接口复制的说明:DataCenter获取最后一次影响行数- 指定者:
getLastRowCount在接口中DataCenter- 返回:
-
beginStatement
-
finishStatement
-
closeStatement
-
setCheckTimerSchedule
设置定时检查的间隔时间参数- 指定者:
setCheckTimerSchedule在接口中DataCenter- 参数:
delay- 间隔时间,单独产:毫秒flag- 状态标识,用于业务判断
-
setCheckTimerSchedule
public void setCheckTimerSchedule(long delay, boolean forceDisconnect) 从接口复制的说明:DataCenter设置定时检查的间隔时间参数- 指定者:
setCheckTimerSchedule在接口中DataCenter- 参数:
delay- 间隔时间,单独产:毫秒
-
setCheckTimerSchedule
设置定时检查的间隔时间参数- 指定者:
setCheckTimerSchedule在接口中DataCenter- 参数:
delay- 间隔时间,单独产:毫秒flag- 状态标识,用于业务判断forceDisconnect- 到达时间后是否强制关闭,默认:false
-
toConnectBase
protected void toConnectBase() -
toDisconnectBase
protected void toDisconnectBase() -
getLastException
- 指定者:
getLastException在接口中DataCenter
-
isSupportResultSetTypeScrollInsensitive
protected boolean isSupportResultSetTypeScrollInsensitive()判断查询是否支持结果集 ResultSet.TYPE_SCROLL_INSENSITIVE 类型- 返回:
-
convertPwd
转换密码- 参数:
pwd-- 返回:
-
setConnection
对于外部传入Connection连接的情况,必须设置- 指定者:
setConnection在接口中DataCenter- 参数:
conn- JDBC连接 注意:1)如果已经获取连接再次调用时,必须disconnect后再设置,否则无效 2)通过setConnection设置连接时,不需要调用connect方法- 返回:
- boolean
-
getConnection
获取连接- 指定者:
getConnection在接口中DataCenter- 返回:
- Connection 连接对象
-
setAutoGetGeneratedKey
public void setAutoGetGeneratedKey(boolean getGeneratedKeys) 设置自获取序列号- 指定者:
setAutoGetGeneratedKey在接口中DataCenter- 参数:
getGeneratedKeys- boolean
-
setGeneratedKeys
设置自增长列- 参数:
rs-
-
getAutoGeneratedKey
public int getAutoGeneratedKey()获取自增长列 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行update setAutoGetGeneratedKey(false) int key = getAutoGeneratedKey() ;- 指定者:
getAutoGeneratedKey在接口中DataCenter- 返回:
- 自增长值
-
getAutoGeneratedKey2
public long getAutoGeneratedKey2()获取自增长列 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行update setAutoGetGeneratedKey(false) long key = getAutoGeneratedKey2() ;- 指定者:
getAutoGeneratedKey2在接口中DataCenter- 返回:
- 自增长值
-
getAutoGeneratedKeyStr
从接口复制的说明:DataCenter获取自增长列并转化为String类型 在执行查询前,需要做的操作有: setAutoGetGeneratedKey(true) //执行带insert的且有自增长列的操作 setAutoGetGeneratedKey(false) String key == getAutoGeneratedKeyStr() ;- 指定者:
getAutoGeneratedKeyStr在接口中DataCenter- 返回:
- 自增长键值
-
hasConnected
public boolean hasConnected()是否已经建立连接- 指定者:
hasConnected在接口中DataCenter- 返回:
- boolean
-
setConnectState
public void setConnectState(boolean isConnected) 设置连接是否已经建立- 参数:
isConnected- boolean
-
isValid
public boolean isValid(int timeout) 判断连接是否有效- 指定者:
isValid在接口中DataCenter- 参数:
timeout- 指定等待验证连接的秒数- 返回:
- true 有效 false 无效
- 抛出:
Exception- Exception
-
isValid
public boolean isValid()判断连接是否有效,默认等待验证连接秒数:5s- 指定者:
isValid在接口中DataCenter- 返回:
- true 有效 false 无效
-
checkValidAndReset
public boolean checkValidAndReset()检查连接,如果连接无效了,则自动重新连接- 指定者:
checkValidAndReset在接口中DataCenter- 返回:
- boolean
-
isClosed
public boolean isClosed()判断连接是否关闭,只在连接调用close方法后才会返回true- 指定者:
isClosed在接口中DataCenter- 返回:
- true 已关闭 false 未关闭
- 抛出:
Exception- Exception
-
setQueryTimeout
public void setQueryTimeout(int queryTimeout) 设置查询超时时间,0表示无限制- 指定者:
setQueryTimeout在接口中DataCenter- 参数:
queryTimeout- 超时时长 单位:秒
-
getQueryTimeout
public int getQueryTimeout()获取查询超时时长- 指定者:
getQueryTimeout在接口中DataCenter- 返回:
- 超时时长,0表示无限制 单位:秒
-
setWriteEnable
public void setWriteEnable(boolean enable) 设置DC日志- 指定者:
setWriteEnable在接口中DataCenter- 参数:
enable- true|false
-
getWriteEnable
public boolean getWriteEnable()是否记录DC日志标志- 指定者:
getWriteEnable在接口中DataCenter- 返回:
- boolean
-
setInitClassInfo
设置初始化实例类 主要用于日志输出- 指定者:
setInitClassInfo在接口中DataCenter- 参数:
initClassInfo- 实例化类信息描述
-
getClassInfo
获取初始化实例类信息- 返回:
- String
-
getDcType
DC类型- 返回:
- 连接类型
-
printLog
- 指定者:
printLog在接口中DataCenter
-
printLog
- 指定者:
printLog在接口中DataCenter
-
printLog
- 指定者:
printLog在接口中DataCenter
-
printLog
- 指定者:
printLog在接口中DataCenter
-
_printLog
打印日志- 参数:
sql- 执行SQL
-
_printParamLog
输出参数信息- 参数:
obj-
-
writeExeDetail
记录SQL执行日志- 参数:
sql- 执行SQL
-
writeExeDetail
记录SQL执行日志- 参数:
sql- 执行SQLstartTime- 执行开始时间
-
writeExeDetail
protected void writeExeDetail(String sql, long startTime, long endTime, boolean isCacheData, Datastore ds) 记录SQL执行日志- 参数:
sql- 执行SQLstartTime- 执行开始时间endTime- 执行结束时间
-
writeDetail
记录SQL执行日志- 参数:
sql- 执行SQLrangeTime- 执行时长
-
writeDetailByParam
protected void writeDetailByParam(String sql, String[] colsType, Object[] obj, long executeLen, boolean isCacheData, Datastore ds) 记录SQL执行日志- 参数:
sql-rangeTime-
-
printGetConnectLog
记录获取连接的时长- 参数:
startTime-
-
convertRsToDs
将JDBC数据集转化称Datastore- 参数:
rs- JDBC数据集start- 起始行,小于1时设置成1end- 结束行,小于1或者大于最大行数的时候设置成最大行- 返回:
- Datastore
-
convertRsToDs
public Datastore convertRsToDs(ResultSet rs, String sql, String[] colsType, Object[] obj, long startTime) 将整个数据集都转化称Datastore- 参数:
rs- JDBC数据集sql- 执行SQLcolsType- 参数类型obj- 参数值startTime- 开始时间- 返回:
- Datastore
-
getAllField
查找所有属性,包括父对象- 参数:
clazz-fieldList- 返回一个包含Field对象的结果集
-
convertSetPropType
protected Object convertSetPropType(Object obj, SHColumnType colType, Class fieldType, String dateFormat, String numberFormat) throws Exception 默认转换返回数据类型(setXXX方法的参数)- 参数:
obj-colType-fieldType-dateFormat-- 返回:
- 抛出:
Exception
-
convertClobString
转换CLOB对象- 参数:
clob-- 返回:
- 抛出:
Exception
-
getObjectByColumnType
获取七种数据类型的Class对象- 参数:
columnType-- 返回:
-
isContainCascade
判断是否包含级联操作- 参数:
cts-ct-- 返回:
-
convertGetPropType
protected Object convertGetPropType(Object obj, SHColumnType colType, String dateFormat) throws Exception 默认类型转换- 参数:
obj-colType-- 返回:
- 抛出:
Exception
-
isContainStr
判断某一个字符串是否存在于String数组之中- 参数:
array- 字符数组str- 字符串ignoreCase- 是否忽略大小写- 返回:
- true存在、false不存在
-
setParams
设置PreparedStatement的参数- 参数:
pstmt- PreparedStatement对象colsType- 列类型信息 (string:对应于数据库string型;timestamp:对应于数据库timestamp型)obj- 列数据pos- 前面已经设置的参数的个数(偏移量)- 返回:
- 最后一次所设置的参数的位置(偏移量)
-
setProcParams
protected String setProcParams(CallableStatement csmt, String[] colsType, Object[] obj, int[] paramType) 设置CallableStatement的参数(存储过程)- 参数:
pstmt- PreparedStatement对象colsType- 列类型信息 (string:对应于数据库string型;timestamp:对应于数据库timestamp型)obj- 列数据paramType- 参数输入、输出类型- 返回:
- 以逗号分隔的返回游标序号
-
getErrorMsg
- 指定者:
getErrorMsg在接口中DataCenter
-
checkErrorMsg
处理错误信息的特殊字符(双引号),若为SQL异常,则返回ORACLE错误代码- 参数:
message-- 返回:
-
loadConfig
从配置文件中获取默认的数据库连接参数- 参数:
name- 文件名- 返回:
- 是否加载成功
- 抛出:
Exception- 加载配置文件过程中出错
-
loadConfig
已过时。从配置文件中获取数据库连接参数 该方法不再使用- 参数:
name- 文件名sector- 数据库连接名称- 返回:
- 是否加载成功
- 抛出:
Exception- 加载配置文件过程中出错
-
createSql
用属性值替换SQL中@userId@中的值- 参数:
sql-- 返回:
- 抛出:
Exception
-
setParams
设置PreparedStatement的参数- 参数:
pstmt- PreparedStatement对象colsType- 列类型信息 (string:对应于数据库string型;timestamp:对应于数据库timestamp型)obj- 列数据- 返回:
- 最后一次所设置的参数的位置(偏移量)
-
beginBatchUpdateByParams
protected String[] beginBatchUpdateByParams(Connection con, String sql, String[] colsType, int refreshCount) 开始进行批量更新,目前只针对带参数类型- 参数:
sql- 执行SQLcolsType- SQL参数类型refreshCount- 批量队列到达该值时刷新- 返回:
- {true|false,操作关键字(后续操作会用到)|错误信息}
-
getExecutionLen
public long getExecutionLen()最后一次执行时长- 指定者:
getExecutionLen在接口中DataCenter- 返回:
- 执行时长,单位:ms
-
getBatchUpdate
- 指定者:
getBatchUpdate在接口中DataCenter
-
addBatch
添加批量操作- 指定者:
addBatch在接口中DataCenter- 参数:
key- 操作序列号,通过beginBatchUpdateByParams获取obj- 参数值- 返回:
- {true|false,|错误信息}
-
refreshBatchUpdate
刷新批量更新- 指定者:
refreshBatchUpdate在接口中DataCenter- 参数:
key- 操作序列号,通过beginBatchUpdateByParams获取- 返回:
- {true|false,当前操作号|错误信息}
-
endBatchUpdateByParams
结束批量更新操作- 指定者:
endBatchUpdateByParams在接口中DataCenter- 参数:
key- 操作序列号,通过beginBatchUpdateByParams获取- 返回:
- {true|false,更新记录条数|错误信息}
-
endBatchUpdateByParams
结束批量更新操作- 指定者:
endBatchUpdateByParams在接口中DataCenter- 参数:
key- 操作序列号,通过beginBatchUpdateByParams获取commit- 自动提交事务,true|false,默认:false- 返回:
- {true|false,更新记录条数|错误信息}
-
getObjectValue
构造执行更新所需要的的sql/colsType/objValue- 参数:
obj- 传入对象operateType- add/mod(添加,更新)/replace- 返回:
- {String sql|String[] colsType|Object[] objValue}
- 抛出:
Exception
-
retrieveByParams2
- 指定者:
retrieveByParams2在接口中DataCenter
-
retrieveByParams2
- 指定者:
retrieveByParams2在接口中DataCenter
-
retrieveByParams2
从接口复制的说明:DataCenter带参数查询数据集- 指定者:
retrieveByParams2在接口中DataCenter- 参数:
sql- 查询SQLcolsTypeList- 参数类型数组objList- 参数值数组- 返回:
- 查询数据集
-
retrieveByParams2
public Datastore retrieveByParams2(String sql, List<String> colsTypeList, List<Object> objList, boolean cacheFlag) 带参数查询数据集- 指定者:
retrieveByParams2在接口中DataCenter- 参数:
sql- 查询SQLcolsTypeList- 参数类型数组objList- 参数值数组cacheFlag- 缓存标志- 返回:
- 查询数据集
-
retrieveObjByParams2
public Object retrieveObjByParams2(String sql, List<String> colsTypeList, List<Object> colsValueList, Class queryObj) 查询对象- 指定者:
retrieveObjByParams2在接口中DataCenter- 参数:
sql- SQL语句queryObj- 带注释的PO对象colsTypeList- 参数类型colsValueList- 参数值- 返回:
- 查询对象
- 抛出:
Exception- 查询异常
-
updateByParams2
public String[] updateByParams2(String sql, List<String> colsTypeList, List<Object> objList, boolean commit) 用参数的方式更新数据库- 指定者:
updateByParams2在接口中DataCenter- 参数:
sql- 更改数据库数据的语句colsTypeList- 参数类型objList- 参数值数组commit- 是否提交- 返回:
- string[0] "true"成功;"false"失败 string[1] 影响行数|出错信息
-
checkAndInitCache
public void checkAndInitCache() -
getDsCacheRedis
从接口复制的说明:DataCenter获取redis- 指定者:
getDsCacheRedis在接口中DataCenter- 返回:
- DSCacheRedis
-
processKey
-
getCacheDs
-
putCacheDs
-
closeCache
public void closeCache() -
close
public void close() -
getConnectStartTime
public long getConnectStartTime() -
isUpdateSilence
public boolean isUpdateSilence() -
setUpdateSilence
public void setUpdateSilence(boolean isUpdateSilence) 从接口复制的说明:DataCenter设置此连接是否为安静模式,即执行update时不会通知缓存等事件- 指定者:
setUpdateSilence在接口中DataCenter- 参数:
isUpdateSilence- 开头
-
replaceObject
- 指定者:
replaceObject在接口中DataCenter
-
createUpdateBuilder
创建添加、修改、删除的SQL生成工具对象为- 指定者:
createUpdateBuilder在接口中DataCenter- 返回:
-
createQueryBuilder
创建查询的SQL生成工具对象为- 指定者:
createQueryBuilder在接口中DataCenter- 返回:
-
createSelectBuilder
创建查询的SQL生成工具对象为- 指定者:
createSelectBuilder在接口中DataCenter- 返回:
-
createColsTypeByValue
通过参数值自动生成参数类型- 指定者:
createColsTypeByValue在接口中DataCenter- 参数:
value-- 返回:
-
initExternalDataSource
初始化外部连接- 返回:
-
initExternalDataSource
初始化外部连接- 参数:
datasource-clazz-
-
setJDBCParam
设置配置的连接信息- 参数:
driver-url-user-password-
-