Skip to content

Commit

Permalink
add ArrKey attribute for label FOR,SQLFOR
Browse files Browse the repository at this point in the history
  • Loading branch information
KenelLiu authored and KenelLiu committed Sep 14, 2017
1 parent 9048de7 commit 6634d55
Show file tree
Hide file tree
Showing 8 changed files with 1,158 additions and 1,077 deletions.
23 changes: 19 additions & 4 deletions CDODesign/Design/DataService.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- 编辑使用 XMLSpy v2006 U (http://www.altova.com) 由 any (any) -->
<!-- 编辑使用 XMLSpy v2006 U (http://www.altova.com) 由 any (any) -->
<!-- 编辑使用 XMLSpy v2006 U (http://www.altova.com) 由 any (any) -->
<!-- 编辑使用 XMLSpy v2006 U (http://www.altova.com) 由 any (any) -->
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by XXXXXX (ORiON) -->
<!-- edited with XMLSpy v2005 sp1 U (http://www.xmlspy.com) by any (Ru-Board) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
Expand Down Expand Up @@ -107,14 +108,21 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Count" use="optional" default="0">
<xs:attribute name="Count" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]{1,9})|(\{([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|\.|\[|\])*\})"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="cdosKey" type="xs:string" use="optional"/>
<xs:attribute name="ArrKey" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:pattern value="\{([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*\}"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down Expand Up @@ -290,14 +298,21 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Count" use="optional" default="0">
<xs:attribute name="Count" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]{1,9})|(\{([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|\.|\[|\])*\})"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="cdosKey" type="xs:string" use="optional"/>
<xs:attribute name="ArrKey" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:pattern value="\{([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|\.|\[|\])*\}"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,12 @@ private int handleSQLIf(SQLIf sqlIf,CDO cdoRequest,StringBuilder strbSQL)
protected int handleSQLFor(SQLFor sqlFor,CDO cdoRequest,StringBuilder strbSQL)
{
// 获取循环数据
// int nFromIndex=this.getIntegerValue(sqlFor.getFromIndex(),cdoRequest);
// int nCount=this.getIntegerValue(sqlFor.getCount(),cdoRequest);
int nFromIndex=0;
int nCount=0;
int nCount=DataEngineHelp.getArrayLength(sqlFor.getArrKey(), cdoRequest);
if(sqlFor.getFromIndex()!=null)
nFromIndex=DataEngineHelp.getIntegerValue(sqlFor.getFromIndex(),cdoRequest);
if(sqlFor.getCount()!=null)
nCount=DataEngineHelp.getIntegerValue(sqlFor.getCount(),cdoRequest);
if(sqlFor.getCdosKey()!=null){
String cdosKey=sqlFor.getCdosKey();
if(cdosKey.startsWith("{") && cdosKey.endsWith("}")){
cdosKey=cdosKey.substring(1,cdosKey.length()-1);
}
nCount=cdoRequest.exists(cdosKey)?cdoRequest.getCDOArrayValue(cdosKey).length:nCount;
}

String strIndexId=sqlFor.getIndexId();
strIndexId=strIndexId.substring(1,strIndexId.length()-1);
Expand Down Expand Up @@ -440,22 +431,13 @@ private int handleIf(HashMap<String,CycleList<IDataEngine>> hmDataGroup,DataServ
private int handleFor(HashMap<String,CycleList<IDataEngine>> hmDataGroup,DataService dataService,HashMap<String,DataAccess> hmDataAccess,SQLTrans trans,For forItem,CDO cdoRequest,CDO cdoResponse,Return ret) throws SQLException,IOException
{
// 获取循环数据
// int nFromIndex=this.getIntegerValue(forItem.getFromIndex(),cdoRequest);
// int nCount=this.getIntegerValue(forItem.getCount(),cdoRequest);
int nFromIndex=0;
int nCount=0;
int nCount=DataEngineHelp.getArrayLength(forItem.getArrKey(), cdoRequest);
if(forItem.getFromIndex()!=null)
nFromIndex=DataEngineHelp.getIntegerValue(forItem.getFromIndex(),cdoRequest);
if(forItem.getCount()!=null)
nCount=DataEngineHelp.getIntegerValue(forItem.getCount(),cdoRequest);
if(forItem.getCdosKey()!=null){
String cdosKey=forItem.getCdosKey();
if(cdosKey.startsWith("{") && cdosKey.endsWith("}")){
cdosKey=cdosKey.substring(1,cdosKey.length()-1);
}
nCount=cdoRequest.exists(cdosKey)?cdoRequest.getCDOArrayValue(cdosKey).length:nCount;
}


String strIndexId=forItem.getIndexId();
strIndexId=strIndexId.substring(1,strIndexId.length()-1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,24 +988,15 @@ protected int handleSQLIf(SQLIf sqlIf,CDO cdoRequest,StringBuilder strbSQL)
protected int handleSQLFor(SQLFor sqlFor,CDO cdoRequest,StringBuilder strbSQL)
{
// 获取循环数据
// int nFromIndex=this.getIntegerValue(sqlFor.getFromIndex(),cdoRequest);
// int nCount=this.getIntegerValue(sqlFor.getCount(),cdoRequest);
int nFromIndex=0;
int nCount=0;
int nCount=DataEngineHelp.getArrayLength(sqlFor.getArrKey(), cdoRequest);
if(sqlFor.getFromIndex()!=null)
nFromIndex=DataEngineHelp.getIntegerValue(sqlFor.getFromIndex(),cdoRequest);
if(sqlFor.getCount()!=null)
nCount=DataEngineHelp.getIntegerValue(sqlFor.getCount(),cdoRequest);
if(sqlFor.getCdosKey()!=null){
String cdosKey=sqlFor.getCdosKey();
if(cdosKey.startsWith("{") && cdosKey.endsWith("}")){
cdosKey=cdosKey.substring(1,cdosKey.length()-1);
}
nCount=cdoRequest.exists(cdosKey)?cdoRequest.getCDOArrayValue(cdosKey).length:nCount;
}

String strIndexId=sqlFor.getIndexId();
strIndexId=strIndexId.substring(1,strIndexId.length()-1);

// 执行循环
for(int i=nFromIndex;i<nFromIndex+nCount;i++)
{
Expand Down Expand Up @@ -1138,21 +1129,12 @@ protected int handleFor(Connection conn,HashMap<String,SQLTrans> hmTrans,For for
boolean bUseTransFlag,CDO cdoResponse,Return ret) throws SQLException,IOException
{
// 获取循环数据
// int nFromIndex=this.getIntegerValue(forItem.getFromIndex(),cdoRequest);
// int nCount=this.getIntegerValue(forItem.getCount(),cdoRequest);
int nFromIndex=0;
int nCount=0;
int nCount=DataEngineHelp.getArrayLength(forItem.getArrKey(), cdoRequest);
if(forItem.getFromIndex()!=null)
nFromIndex=DataEngineHelp.getIntegerValue(forItem.getFromIndex(),cdoRequest);
if(forItem.getCount()!=null)
nCount=DataEngineHelp.getIntegerValue(forItem.getCount(),cdoRequest);
if(forItem.getCdosKey()!=null){
String cdosKey=forItem.getCdosKey();
if(cdosKey.startsWith("{") && cdosKey.endsWith("}")){
cdosKey=cdosKey.substring(1,cdosKey.length()-1);
}
nCount=cdoRequest.exists(cdosKey)?cdoRequest.getCDOArrayValue(cdosKey).length:nCount;
}

String strIndexId=forItem.getIndexId();
strIndexId=strIndexId.substring(1,strIndexId.length()-1);
Expand Down
Loading

0 comments on commit 6634d55

Please sign in to comment.