本节对返回值标准进行了详细说明,包括返回值相关类型和返回值数据标准。
返回值相关类:
TXmlReturn
public class TXmlReturn<o:p></o:p> {<o:p></o:p> private int frno;<o:p></o:p> private string frmsg;<o:p></o:p> private ArrayList fdatalist;<o:p></o:p> private TStrList fhead;<o:p></o:p> private string fxml;<o:p></o:p> private TStrList fcolumnlist;<o:p></o:p> private DataTable fdatatable;<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 构造函数<o:p></o:p> /// </summary><o:p></o:p> /// <param name="rxml">需要解析的已编码数据</param><o:p></o:p> public TXmlReturn( string rxml ){}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 将已编码数据进行解码<o:p></o:p> /// </summary><o:p></o:p> private void decodeReturn(){}}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 填充列列表<o:p></o:p> /// </summary><o:p></o:p> private void fillFColumnList(){}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 填充数据列表<o:p></o:p> /// </summary><o:p></o:p> private void fillFDataList(){}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 将数据还原为DataTable类型<o:p></o:p> /// </summary><o:p></o:p> private void decodeToDataTable(){}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 根据数据类型字符串返回系统类型<o:p></o:p> /// </summary><o:p></o:p> /// <param name="typestr"></param><o:p></o:p> /// <returns></returns><o:p></o:p> private System.Type getTypeByTypeString(string typestr){}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// DataTable类型数据返回值<o:p></o:p> /// </summary><o:p></o:p> public DataTable rdatatable{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 返回状态码<o:p></o:p> /// </summary><o:p></o:p> public int rno{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 返回的状态信息<o:p></o:p> /// </summary><o:p></o:p> public string rmsg{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 返回的数据头部,如果为DataTable序列化数据,则无此项<o:p></o:p> /// </summary><o:p></o:p> public TStrList rhead{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 数据列表,每一项为TStrList类型<o:p></o:p> /// </summary><o:p></o:p> public ArrayList rdata{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 列列表<o:p></o:p> /// </summary><o:p></o:p> public TStrList rcolumnlist{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 数据记录条数<o:p></o:p> /// </summary><o:p></o:p> public int DataRowCount{get;}<o:p></o:p> <o:p> </o:p> /// <summary><o:p></o:p> /// 数据列数<o:p></o:p> /// </summary><o:p></o:p> public int DataColumnCount{get;}<o:p></o:p> } |
该类对TReturnManager返回的数据进行解析,将字符串型数据还原为包含返回状态码,返回状态信息,返回状态数据的原始数据。
返回值标准
返回数据形式由TReturnManager的XML_TYPE_SCHEMA常量决定,标准如下:
XML_TYPE_SCHEMA = true,DataTable序列化的传输方式
§ 使用标准XML格式
§ 分为状态、dataSchema、data三个节点
§ 状态为必须具备的节点,其他两个节点可选
<o:p> </o:p>
示例为:
<?xml version="1.0" encoding="UTF-8" ?><o:p></o:p> <return rno="0" rmsg="成功"><o:p></o:p> <dataSchema><o:p></o:p> <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><o:p></o:p> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="zh-CN"><o:p></o:p> <xs:complexType><o:p></o:p> <xs:choice maxOccurs="unbounded"><o:p></o:p> <xs:element name="Table1"><o:p></o:p> <xs:complexType><o:p></o:p> <xs:sequence><o:p></o:p> <xs:element name="id" type="xs:string" minOccurs="0" /><o:p></o:p> <xs:element name="password" type="xs:string" minOccurs="0" /><o:p></o:p> <xs:element name="sex" type="xs:string" minOccurs="0" /><o:p></o:p> <xs:element name="name" type="xs:string" minOccurs="0" /><o:p></o:p> </xs:sequence><o:p></o:p> </xs:complexType><o:p></o:p> </xs:element><o:p></o:p> </xs:choice><o:p></o:p> </xs:complexType><o:p></o:p> </xs:element><o:p></o:p> </xs:schema><o:p></o:p> </dataSchema><o:p></o:p> <data><o:p></o:p> <NewDataSet><o:p></o:p> <Table1><o:p></o:p> <id>123456</id><o:p></o:p> <passwo |