/**
* Created: 2005-4-20 12:39:29
* Last Modified: 2005-4-20/2005-4-20
* Description:
* class CMyResultSetsTest
*/
package com.trs.example;
import com.trs.TRSWCMBaseTest;
import com.trs.infra.common.WCMException;
import com.trs.infra.persistent.CMyResultSet;
import com.trs.infra.persistent.CMyResultSets;
/**
* Title: TRS 内容协作平台(TRS WCM)
* Description:
* TODO
* Copyright: Copyright (c) 2004-2005 TRS信息技术有限公司
* Company: TRS信息技术有限公司(www.trs.com.cn)
*
* @author TRS信息技术有限公司
* @version 1.0
*/
public class CMyResultSetsExample extends TRSWCMBaseTest {
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger
.getLogger(CMyResultSetsExample.class);
/*
* Class under test for void open(String, String)
*/
public void queryDocuments() throws WCMException {
// 指定查询的SQL
String sSQL = "select DocTitle,DocId from wcmdocument where docid<10010 and docid>10000";
// 指定这次查询相关的SQL
// 如果确定这次查询没有明确ID字段,系统支持将记录行号作为ID
String sIdFieldName = "docid";
// 发出查询获取集合
CMyResultSets aMyResulteSets = new CMyResultSets();
aMyResulteSets.open(sSQL, sIdFieldName);
// 遍历输出结果
logger.info("find [" + aMyResulteSets.size() + "] record!");
for (int i = 0; i < aMyResulteSets.size(); i++) {
CMyResultSet aObj = (CMyResultSet) aMyResulteSets.getAt(i);
if (aObj == null)
continue;
logger.info("aObj.doctitle:" + aObj.getPropertyAsString("DocTitle"));
logger.info("aObj.docid:" + aObj.getPropertyAsString("DocId"));
}
}
}