public class DBTableData extends AbstractParameterTableData implements XMLable
TableData
object from database, using JDBC connection. driver
: JDBCdriver,the default JDBC driver is SUN
JDBC-ODBC Bridge(sun.jdbc.odbc.JdbcOdbcDriver), Any database supporting JDBC
can be connected to;url
: database url;user, password
: username and password;type
: database query type,SQL statement and storage
process are supported here;query
: database query;//Create a DBTableData object, the type is SQL. TableData tableData = new DBTableData( "sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Northwind", "sa", "", "select * from Customers"); <p/> //Create a DBTableData object, the type is PROCEDURE. TableData tableData = new DBTableData( "sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Northwind", "sa", "", "{call PI()}");
parameters, ROW_COUNT
ARRAY_XML_TAG, EMPTY_TABLEDATA, RESULT_ALL, RESULT_NOT_NEED, XML_TAG
构造器和说明 |
---|
DBTableData()
Constructor.
|
DBTableData(Connection database,
java.lang.String query)
Constructor.
|
DBTableData(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String query)
Constructs a
DBTableData that is initialized with database driver,
jdbc url, database user, database password and query. |
限定符和类型 | 方法和说明 |
---|---|
java.lang.Object |
clone()
Clone.
|
static AbstractDBDataModel |
createCacheableDBResultSet(Connection database,
java.lang.String query,
long maxMemRowCount)
生成缓存的Adapter,分两种,内存缓存与磁盘缓存
|
DataModel |
createDataModel(Calculator calculator)
返回获取数据的执行对象
系统取数时,调用此方法来返回一个获取数据的执行对象
注意!
|
DataModel |
createDataModel(Calculator calculator,
int rowCount)
返回获取数据的执行对象
|
DataModel |
createDataModel(Calculator calculator,
int rowCount,
int timeout)
返回获取数据的执行对象
|
DataModel |
createDataModelWithTimeout(Calculator calculator,
int timeoutSeconds)
* 返回获取数据的执行对象
系统取数时,调用此方法来返回一个获取数据的执行对象
注意!
|
boolean |
equals(java.lang.Object obj) |
Connection |
getDatabase()
Gets the database.
|
DataCacheKey |
getDataCacheKey(Calculator calculator)
用于判断是否需要重新执行数据集取数的方法,用于缓存的判断,默认实现根据参数parameter数组的hash值做唯一性判断
可以自定义
|
DataQueryProcessor |
getDataQueryProcessor() |
int |
getMaxMemRowCount() |
protected java.lang.String |
getNewQuery(Parameter[] ps)
Gets the new query.
|
java.lang.String |
getPageQuerySql()
get pageQuerySql
|
java.lang.String |
getQuery()
Gets the query.
|
boolean |
isShare()
是否共享
|
boolean |
isShareTableData()
是否共享 需要判断功能点
|
protected Parameter[] |
processParameters(Calculator calculator)
将数据集中的${p1}形式的参数解析成运行时的参数值
|
void |
readXML(XMLableReader reader)
读取子节点,应该会被XMLableReader.readXMLObject()调用多次
|
void |
registerNoPrivilege(java.util.ArrayList<java.lang.String> toBeRemoveList,
java.lang.String nameWillBeRemove,
java.lang.String name)
获取没有权限访问的数据集列表
|
void |
setDatabase(Connection database)
Sets the database.
|
void |
setDataQueryProcessor(DataQueryProcessor dataQueryProcessor) |
void |
setMaxMemRowCount(int maxMemRowCount) |
void |
setPageQuerySql(java.lang.String pageQuerySql)
set pageQuerySql
|
void |
setQuery(java.lang.String query)
Sets the type of JDBC query,supports SQL and PROCEDURE.
|
void |
setShare(boolean share) |
java.lang.String |
toString()
字符串
|
void |
writeXML(XMLPrintWriter writer)
Write XML.
|
createDataModel, getParameters, setDefaultParameters, setParameters
filterDataType, getColumnNames
copy, getId, getNameSpace, setId, setNameSpace
getClassInfo, getData, invalidate, isLoad, setClassInfo, setData
public DBTableData()
public DBTableData(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String query)
DBTableData
that is initialized with database driver,
jdbc url, database user, database password and query.driver
- database driver.url
- jdbc url.user
- database user.password
- database password.query
- query.public DBTableData(Connection database, java.lang.String query)
database
- the databasequery
- the querypublic Connection getDatabase()
public void setDatabase(Connection database)
database
- the database.public java.lang.String getQuery()
public java.lang.String getPageQuerySql()
public void setPageQuerySql(java.lang.String pageQuerySql)
pageQuerySql
- public int getMaxMemRowCount()
public void setMaxMemRowCount(int maxMemRowCount)
maxMemRowCount
- public boolean isShare()
public void setShare(boolean share)
share
- public boolean isShareTableData()
public void setQuery(java.lang.String query)
query
- the new JDBC query.public DataModel createDataModel(Calculator calculator)
构造数据库查询数据集DBTableData并创建数据模型TableData例子: Connection con = DatasourceManager.getProviderInstance().getConnection("FRDemo"); DBTableData tableData = new DBTableData(con, "select * from 销量"); DataModel dm = tableData.createDataModel(Calculator.createCalculator());
createDataModel
在接口中 TableData
calculator
- 算子public DataModel createDataModelWithTimeout(Calculator calculator, int timeoutSeconds)
TableData
createDataModelWithTimeout
在接口中 TableData
createDataModelWithTimeout
在类中 AbstractTableData
calculator
- 连接上下文计算的算子timeoutSeconds
- 超时单位:秒public DataModel createDataModel(Calculator calculator, int rowCount, int timeout)
calculator
- 从calculator中可以获取到当前传入的参数calculator
- 算子rowCount
- 行数public DataModel createDataModel(Calculator calculator, int rowCount)
createDataModel
在接口中 TableData
createDataModel
在类中 AbstractParameterTableData
calculator
- 从calculator中可以获取到当前传入的参数calculator
- 算子rowCount
- 行数public static AbstractDBDataModel createCacheableDBResultSet(Connection database, java.lang.String query, long maxMemRowCount)
database
- 数据连接query
- 查询语句maxMemRowCount
- 最大行数protected Parameter[] processParameters(Calculator calculator)
AbstractParameterTableData
processParameters
在类中 AbstractParameterTableData
calculator
- 连接上下文运算的算子protected java.lang.String getNewQuery(Parameter[] ps)
public void readXML(XMLableReader reader)
XMLReadable
readXML
在接口中 XMLReadable
readXML
在类中 AbstractParameterTableData
- XMLableReader
public void writeXML(XMLPrintWriter writer)
writeXML
在接口中 XMLWriter
writeXML
在类中 AbstractParameterTableData
writer
- the PrintWriter.public java.lang.String toString()
toString
在类中 java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
在接口中 TableData
clone
在接口中 FCloneable
clone
在类中 AbstractParameterTableData
java.lang.CloneNotSupportedException
- 如果克隆失败则抛出此异常public void registerNoPrivilege(java.util.ArrayList<java.lang.String> toBeRemoveList, java.lang.String nameWillBeRemove, java.lang.String name)
registerNoPrivilege
在接口中 TableData
registerNoPrivilege
在类中 AbstractTableData
toBeRemoveList
- 没有权限的列表nameWillBeRemove
- 需要移除的对象name
- 当前数据集名public boolean equals(java.lang.Object obj)
equals
在接口中 TableData
equals
在类中 AbstractParameterTableData
obj
- public DataQueryProcessor getDataQueryProcessor()
public void setDataQueryProcessor(DataQueryProcessor dataQueryProcessor)
public DataCacheKey getDataCacheKey(Calculator calculator)
TableData
getDataCacheKey
在接口中 TableData
getDataCacheKey
在类中 AbstractTableData