程序包 com.sh.javax
类 ExDataCenter
java.lang.Object
com.sh.javax.DataCenterBase
com.sh.javax.ExDataCenter
- 所有已实现的接口:
DataCenter
- 直接已知子类:
AutoCloseableJDBCDataCenter
Description: 扩展数据中心对象,其中封装了JDBC数据操作的细节。
Title:首亨软件
Company:首亨软件(重庆)有限公司
-
字段概要
字段修饰符和类型字段说明protected static org.apache.commons.dbcp2.BasicDataSourceprotected static com.alibaba.druid.pool.DruidDataSourceprotected static Stringprotected static Stringprotected static Stringprotected static String从类继承的字段 com.sh.javax.DataCenterBase
_lastColType, _lastException, _lastObj, _lastRowCount, _lastSql, autoGeneratedKey, batchMap, checkTimer, checkTimerInstance, con, CONFIG_CONN, connectStartTime, eventRet, executeAutoGeneratedKeys, executeLen, External, External_CONN, isExcute, isUpdateSilence, lastExecuteTime, LOCAL_CONN, log4j, POOL_CONN, queryTimeout, SH_BASIC_POOL, SH_DRUID, SH_POOL, STRUTS_POOL, TOMCAT_POOL, UNDEFINE, WEBLOGIC_POOL, writeLogFlag -
构造器概要
构造器构造器说明默认构造函数,数据中心直接读取配置文件的信息进行连接ExDataCenter(String connType) 已过时。ExDataCenter(String connType, int poolType) 已过时。ExDataCenter(DataSource dataSource) 已过时。 -
方法概要
修饰符和类型方法说明String[]添加表数据String[]添加表数据String[]beginBatchUpdateByParams(String sql, String[] colsType) 开始进行批量更新,目前只针对带参数类型String[]beginBatchUpdateByParams(String sql, String[] colsType, int refreshCount) 开始进行批量更新,目前只针对带参数类型voidcommit()提交事务connect()已过时。连接配置文件中指定的段,这个只对connType=config有效void断开默认的数据库连接voiddisconnect(Connection con) 断开指定的连接获取缓存使用的连接类型获取当前连接的数据类型获取新的连接,不从连接池中取getResultSet(String sql) 根据SQL获取结果集getResultSet(String sql, String[] colsType, Object[] obj) 通过参数方式获取结果集getResultSetByStoreProc(String procName, String[] colsType, Object[] obj) 通过参数方式获取结果集boolean是否主数据库连接boolean是否主数据库连接boolean是否主数据库连接String[]replaceObject(Object obj, boolean commit, boolean showSql) 添加或修改表数据,只有mysql支持从默认的数据库中获取数据 默认不使用缓存从默认的数据库中获取数据retrieve(Connection con, String sql) 从指定的数据中检索数据 不使用缓存retrieve(Connection con, String sql, boolean cacheFlag) 从指定的数据中检索数据retrieveByParams(String sql, Object[] obj) 带参数查询数据集retrieveByParams(String sql, Object[] obj, boolean cacheFlag) 带参数查询数据集retrieveByParams(String sql, String[] colsType, Object[] obj) 通过存储过程的方式修改数据retrieveByParams(String sql, String[] colsType, Object[] obj, boolean cacheFlag) 通过存储过程的方式修改数据retrieveByStoreProc(String procName) 通过存储过程的方式检索数据retrieveByStoreProc(String procName, String[] colsType, Object[] obj) 通过存储过程的方式检索数据retrieveListByStoreProc(String procName, String[] colsType, Object[] obj, int[] paramType) 通过存储过程的方式检索数据,能返回多个游标retrieveObj(String sql, Class queryObj) 通过对象查找retrieveObj(String sql, Class queryObj, boolean cacheFlag) 查询对象 不使用缓存retrieveObjByParams(String sql, Object[] colsValue, Class queryObj) 查询对象retrieveObjByParams(String sql, String[] colsType, Object[] colsValue, Class queryObj) 查询对象 不使用缓存retrieveObjByParams(String sql, String[] colsType, Object[] colsValue, Class queryObj, boolean cacheFlag) 查询对象retrieveObjList(String sql, Class queryObj) 不带参数的多数据集查询retrieveObjList(String sql, Class queryObj, boolean cacheFlag) 不带参数的多数据集查询retrieveObjList(String sql, Object[] colsValue, Class queryObj) 查询多个对象的列表数据retrieveObjList(String sql, String[] colsType, Object[] colsValue, Class queryObj) 查询多个对象的列表数据,不使用缓存retrieveObjList(String sql, String[] colsType, Object[] colsValue, Class queryObj, boolean cacheFlag) 查询多个对象的列表数据voidrollback()事务回滚voidsetAutoCommit(boolean commit) 设置ExDataCenter是否自动提交void设置数据连接属性voidsetConfig(String JDBCDriver, String JDBCConnectionURL, String userID, String password, int maxActive, int maxIdle, int maxWait) 设置数据连接属性voidsetConnType(String connType) 已过时。protected intsetParams(PreparedStatement pstmt, String[] colsType, Object[] obj) 设置PreparedStatement的参数String[]执行SQL并提交数据String[]修改默认的数据库中的数据String[]update(Connection con, String sql, boolean commit) 修改指定的数据库中的数据String[]updateByParams(String sql, Object[] obj) 用参数的方式更新数据库String[]updateByParams(String sql, Object[] obj, boolean commit) 用参数的方式更新数据库String[]updateByParams(String sql, String[] colsType, Object[] obj) 用参数的方式更新数据库String[]updateByParams(String sql, String[] colsType, Object[][] obj, boolean commit) 用参数的方式更新数据库String[]updateByParams(String sql, String[] colsType, Object[][] obj, int start, int end, boolean commit) 用参数的方式更新数据库String[]updateByParams(String sql, String[] colsType, Object[] obj, boolean commit) 用参数的方式更新数据库String[]updateByParams(String sql, String[] colsType, Object[] obj, int start, int end, boolean commit) 用参数的方式更新数据库String[]updateByStoreProc(String procName) String[]updateByStoreProc(String procName, String[] colsType, Object[] obj) 通过存储过程的方式修改数据String[]updateByStoreProc(String procName, String[] colsType, Object[][] obj, boolean commit) 通过存储过程的方式修改数据String[]updateByStoreProc(String procName, String[] colsType, Object[][] obj, int start, int end, boolean commit) 通过存储过程的方式修改数据String[]updateByStoreProc(String procName, String[] colsType, Object[] obj, boolean commit) 通过存储过程的方式修改数据String[]updateByStoreProc(String procName, String[] colsType, Object[] obj, int[] paramType) 通过存储过程的方式修改数据String[]updateByStoreProc(String procName, String[] colsType, Object[] obj, int start, int end, boolean commit) 通过存储过程的方式修改数据String[]updateObject(Object obj, boolean commit) 更新表数据String[]updateObject(Object obj, boolean commit, boolean showSql) 更新表数据从类继承的方法 com.sh.javax.DataCenterBase
_printLog, _printParamLog, addBatch, beginBatchUpdateByParams, beginStatement, checkAndInitCache, checkErrorMsg, checkRetrieveWatcher, checkValidAndReset, close, closeCache, closeStatement, convertClobString, convertGetPropType, convertPwd, convertRsToDs, convertRsToDs, convertSetPropType, createColsTypeByValue, createQueryBuilder, createSelectBuilder, createSql, createUpdateBuilder, endBatchUpdateByParams, endBatchUpdateByParams, finishStatement, getAllField, getAutoGeneratedKey, getAutoGeneratedKey2, getAutoGeneratedKeyStr, getBatchUpdate, getCacheDs, getClassInfo, getConnection, getConnectStartTime, getDcType, getDsCacheRedis, getErrorMsg, getExecutionLen, getIdleTime, getLastException, getLastExecuteSql, getLastRowCount, getObjectByColumnType, getObjectValue, getParam, getQueryTimeout, getWriteEnable, hasConnected, initExternalDataSource, initExternalDataSource, isClosed, isContainCascade, isContainStr, isExecute, isSupportResultSetTypeScrollInsensitive, isTooLongIdle, isUpdateSilence, isValid, isValid, loadConfig, loadConfig, printGetConnectLog, printLog, printLog, printLog, printLog, processKey, putCacheDs, refreshBatchUpdate, replaceObject, retrieveByParams2, retrieveByParams2, retrieveByParams2, retrieveByParams2, retrieveObjByParams2, setAutoGetGeneratedKey, setCheckTimerSchedule, setCheckTimerSchedule, setCheckTimerSchedule, setConnection, setConnectState, setExtProperty, setGeneratedKeys, setInitClassInfo, setJDBCParam, setParam, setParams, setProcParams, setQueryTimeout, setUpdateSilence, setWriteEnable, toConnectBase, toDisconnectBase, updateByParams2, watcherRetrieveFinish, writeDetail, writeDetailByParam, writeExeDetail, writeExeDetail, writeExeDetail
-
字段详细资料
-
sh_JDBCDriverClass
-
sh_JDBCUrl
-
sh_userName
-
sh_password
-
bds
protected static org.apache.commons.dbcp2.BasicDataSource bds -
dds
protected static com.alibaba.druid.pool.DruidDataSource dds
-
-
构造器详细资料
-
ExDataCenter
public ExDataCenter()默认构造函数,数据中心直接读取配置文件的信息进行连接 -
ExDataCenter
已过时。构造函数,设置ExDataCenter选用何种连接池- 参数:
connType- String 连接池类型poolType- int
-
ExDataCenter
已过时。构造函数,设置ExDataCenter选用何种连接池,ExDataCenter.LOCAL_CONN时,setConfig必须赋值- 参数:
connType- int 连接池类型
-
ExDataCenter
已过时。传dataSource对象的构造函数- 参数:
dataSource- dataSource对象
-
-
方法详细资料
-
getCacheDcType
从接口复制的说明:DataCenter获取缓存使用的连接类型- 返回:
- String
-
getDBType
从接口复制的说明:DataCenter获取当前连接的数据类型- 返回:
- String
-
isMainDataCenter
public boolean isMainDataCenter()从接口复制的说明:DataCenter是否主数据库连接- 返回:
- boolean
-
isReportDataCenter
public boolean isReportDataCenter()从接口复制的说明:DataCenter是否主数据库连接- 返回:
- boolean
-
isExDataCenter
public boolean isExDataCenter()从接口复制的说明:DataCenter是否主数据库连接- 返回:
- boolean
-
getDriverName
-
getJDBCUrl
-
getJDBCUserId
-
getJDBCPassword
-
connect
已过时。连接默认数据库,数据库的配置在connection.cfg中- 返回:
- 数据库连接
-
connect
连接配置文件中指定的段,这个只对connType=config有效- 参数:
sector- 段名称- 返回:
- 数据库连接
-
getNewConnection
获取新的连接,不从连接池中取- 返回:
- 连接对象
-
setConfig
设置数据连接属性- 参数:
JDBCDriver- StringJDBCConnectionURL- StringuserID- Stringpassword- String
-
setConfig
public void setConfig(String JDBCDriver, String JDBCConnectionURL, String userID, String password, int maxActive, int maxIdle, int maxWait) 设置数据连接属性- 参数:
JDBCDriver- StringJDBCConnectionURL- StringuserID- Stringpassword- StringmaxActive- StringmaxIdle- StringmaxWait- String
-
disconnect
断开指定的连接- 参数:
con- 数据库连接
-
disconnect
public void disconnect()断开默认的数据库连接 -
getResultSet
根据SQL获取结果集- 参数:
sql- 查询语句- 返回:
- 结果集
-
getResultSet
通过参数方式获取结果集- 参数:
sql- 查询语句colsType- 参数类型obj- 参数值- 返回:
- 结果集
-
getResultSetByStoreProc
通过参数方式获取结果集- 参数:
procName- 存储过程名称colsType- 参数类型obj- 参数值- 返回:
- 结果集
-
retrieve
从指定的数据中检索数据- 参数:
con- 数据库连接sql- 查询语句cacheFlag- 是否使用缓存- 返回:
- Datastore数据集
-
retrieve
从指定的数据中检索数据 不使用缓存- 参数:
con- 数据库连接sql- 查询语句- 返回:
- Datastore数据集
-
retrieve
从默认的数据库中获取数据 默认不使用缓存- 参数:
sql- String- 返回:
- Datastore
-
retrieve
从默认的数据库中获取数据- 参数:
sql- SQLcacheFlag- 是否使用缓存- 返回:
- Datastore
-
retrieveObj
通过对象查找- 参数:
sql- StringqueryObj- Class- 返回:
- Object
-
retrieveObj
查询对象 不使用缓存- 参数:
sql- SQL语句queryObj- 带注释的PO对象cacheFlag- 是否使用缓存- 返回:
- 查询对象
-
retrieveObjByParams
public Object retrieveObjByParams(String sql, String[] colsType, Object[] colsValue, Class queryObj) 查询对象 不使用缓存- 参数:
sql- SQL语句colsType- 参数类型colsValue- 参数值queryObj- 带注释的PO对象- 返回:
- 查询对象
-
retrieveObjByParams
查询对象- 参数:
sql- SQL语句colsValue- 参数值queryObj- 带注释的PO对象- 返回:
- 查询对象
-
retrieveObjByParams
public Object retrieveObjByParams(String sql, String[] colsType, Object[] colsValue, Class queryObj, boolean cacheFlag) 查询对象- 参数:
sql- SQL语句colsType- 参数类型colsValue- 参数值queryObj- 带注释的PO对象cacheFlag- 是否使用缓存- 返回:
- 查询对象
-
retrieveObjList
不带参数的多数据集查询- 参数:
sql- StringqueryObj- Class- 返回:
- List
-
retrieveObjList
不带参数的多数据集查询- 参数:
sql- StringqueryObj- ClasscacheFlag- 是否使用缓存- 返回:
- List
-
retrieveObjList
查询多个对象的列表数据,不使用缓存- 参数:
sql- StringcolsType- String[]colsValue- Object[]queryObj- Class- 返回:
- List
-
retrieveObjList
查询多个对象的列表数据- 参数:
sql- 查询SQLcolsValue- 参数值queryObj- 查询对象- 返回:
- queryObj对应的实例集
-
retrieveObjList
public List retrieveObjList(String sql, String[] colsType, Object[] colsValue, Class queryObj, boolean cacheFlag) 查询多个对象的列表数据- 参数:
sql- StringcolsType- String[]colsValue- Object[]queryObj- ClasscacheFlag- 是否使用缓存- 返回:
- List
-
update
修改指定的数据库中的数据- 参数:
con- 数据库连接sql- 更新语句commit- 是否提交,true提交,false取消数据更新- 返回:
- string[0] "true"成功;"false"失败 string[1] 影响行数|出错信息
-
update
执行SQL并提交数据- 参数:
sql- 修改数据库的语句- 返回:
- 同上
-
updateObject
更新表数据- 参数:
obj- 实例对象commit- 是否自动提交事务showSql- 是否打印出sql 默认为false- 返回:
- String[]
-
updateObject
更新表数据- 参数:
obj- 实例对象commit- 是否自动提交事务- 返回:
- String[]
-
addObject
添加表数据- 参数:
obj- 实例对象commit- 是否自动提交事务showSql- 是否打印出sql 默认为false- 返回:
- String[]
-
replaceObject
添加或修改表数据,只有mysql支持- 参数:
obj- 实例对象commit- 是否自动提交事务showSql- 是否打印出sql 默认为false- 返回:
- String[]
-
addObject
添加表数据- 参数:
obj- 实例对象commit- 是否自动提交事务- 返回:
- String[]
-
update
修改默认的数据库中的数据- 参数:
sql- 更新语句commit- 是否提交,true提交,false取消数据更新- 返回:
- string[0] "true"成功;"false"失败 string[1] 出错信息
-
setParams
设置PreparedStatement的参数- 覆盖:
setParams在类中DataCenterBase- 参数:
pstmt- PreparedStatement对象colsType- 列类型信息 (string:对应于数据库string型;timestamp:对应于数据库timestamp型)obj- 列数据- 返回:
- 最后一次所设置的参数的位置(偏移量)
-
commit
public void commit()提交事务 -
rollback
public void rollback()事务回滚 -
updateByParams
public String[] updateByParams(String sql, String[] colsType, Object[][] obj, int start, int end, boolean commit) 用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句colsType- 参数类型obj- 参数值数组,同时更改多条数据start- 参数起始位置end- 参数结束位置commit- 是否提交- 返回:
- 同上
-
updateByParams
用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句colsType- 参数类型obj- 参数值数组- 返回:
- 同上
-
updateByParams
用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句obj- 参数值数组- 返回:
- string[0] "true"成功;"false"失败 string[1] 影响行数|出错信息
-
updateByParams
用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句colsType- 参数类型obj- 参数值数组commit- 是否提交- 返回:
- 同上
-
updateByParams
用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句obj- 参数值数组commit- 是否提交- 返回:
- string[0] "true"成功;"false"失败 string[1] 影响行数|出错信息
-
updateByParams
public String[] updateByParams(String sql, String[] colsType, Object[] obj, int start, int end, boolean commit) 用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句colsType- 参数类型obj- 参数值数组start- 参数起始位置end- 参数结束位置commit- 是否提交- 返回:
- 同上
-
updateByParams
用参数的方式更新数据库- 参数:
sql- 更改数据库数据的语句colsType- 参数类型obj- 参数值数组,同时更改多条数据commit- 是否提交- 返回:
- 同上
-
updateByStoreProc
-
updateByStoreProc
public String[] updateByStoreProc(String procName, String[] colsType, Object[][] obj, int start, int end, boolean commit) 通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,多行数据start- 参数起始序号end- 参数结束序号commit- 是否提交- 返回:
- 同上
-
updateByStoreProc
通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,一行数据- 返回:
- 同上
-
updateByStoreProc
通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,一行数据commit- 是否提交- 返回:
- 同上
-
updateByStoreProc
public String[] updateByStoreProc(String procName, String[] colsType, Object[] obj, int start, int end, boolean commit) 通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,一行数据start- 参数起始序号end- 参数结束序号commit- 是否提交- 返回:
- 同上
-
updateByStoreProc
public String[] updateByStoreProc(String procName, String[] colsType, Object[][] obj, boolean commit) 通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,多行数据commit- 是否提交- 返回:
- 同上
-
retrieveByParams
通过存储过程的方式修改数据- 参数:
sql- SQLcolsType- 参数类型数组obj- 参数值数组,多行数据- 返回:
- 同上
-
retrieveByParams
带参数查询数据集- 参数:
sql- 查询SQLobj- 参数值数组- 返回:
- 查询数据集
-
retrieveByParams
带参数查询数据集- 参数:
sql- 查询SQLobj- 参数值数组cacheFlag- 是否使用缓存- 返回:
- 查询数据集
-
retrieveByParams
通过存储过程的方式修改数据- 参数:
sql- 查询殒colsType- 参数类型数组obj- 参数值数组,多行数据cacheFlag- 使用缓存- 返回:
- 同上
-
retrieveByStoreProc
通过存储过程的方式检索数据- 参数:
procName- 存储过程名称- 返回:
- 数据集Datastore
-
retrieveByStoreProc
通过存储过程的方式检索数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,多行数据- 返回:
- 数据集Datastore
-
retrieveListByStoreProc
public List<Datastore> retrieveListByStoreProc(String procName, String[] colsType, Object[] obj, int[] paramType) 通过存储过程的方式检索数据,能返回多个游标- 参数:
procName- 存储过程名称,存储过程需要可以任意定义返回游标colsType- 参数类型数组obj- 参数值数组,多行数据paramType- 输入、输出参数类型、DataCenter.PROC_PARAM_TYPE_IN,DataCenter.PROC_PARAM_TYPE_OUT- 返回:
- 多数据集Datastore
-
setAutoCommit
public void setAutoCommit(boolean commit) 设置ExDataCenter是否自动提交- 参数:
commit- true自动提交,false手工提交
-
setConnType
已过时。设置获取数据库连接的方式- 参数:
connType- String strutsPool/config
-
beginBatchUpdateByParams
开始进行批量更新,目前只针对带参数类型- 参数:
sql- 执行SQLcolsType- SQL参数类型- 返回:
- {true|false,操作关键字(后续操作会用到)|错误信息}
-
beginBatchUpdateByParams
开始进行批量更新,目前只针对带参数类型- 参数:
sql- 执行SQLcolsType- SQL参数类型refreshCount- 批量队列到达该值时刷新- 返回:
- {true|false,操作关键字(后续操作会用到)|错误信息}
-
updateByStoreProc
public String[] updateByStoreProc(String procName, String[] colsType, Object[] obj, int[] paramType) 通过存储过程的方式修改数据- 参数:
procName- 存储过程名称colsType- 参数类型数组obj- 参数值数组,一行数据,如果为OUT型参数,可以为空或nullparamType- 参数类型,DataCenter.PROC_PARAM_TYPE_OUT或DataCenter.PROC_PARAM_TYPE_IN- 返回:
- {true,ret1,ret2....}为果[0]为true时,后台参数依次返回指定参数类型的OUT的值 Note:要求colsType/obj/paramType三个数组长度一致
-