CMsg* new_msg_v3() {
CMsg *msg = new CMsg;
msg->SetVersion(3);
msg->SetMsgType(MT_REQUEST);
msg->SetMsgID(1001);
/// umx2风格:增加参数
msg->AddParam("p1",(long)100);
msg->AddParam("p2","ddddd");
///< 参数多种数据类型
msg->AddParam("p10",dtBigInt,120);
msg->AddParam("p11",dtDateTime,"2012-2-15");
msg->AddParam("p12",dtVarChar,"12345");
msg->AddParam("p13",dtBinary,"123",3);
///< 参数支持UMX消息
CMsg *tmsg = new CMsg;
tmsg->SetMsgType(MT_REQUEST);
tmsg->SetMsgID(1100);
tmsg->AddParam("p10",dtBigInt,120);
tmsg->AddParam("p11",dtDateTime,"2012-2-15");
tmsg->AddParam("p12",dtVarChar,"12345");
tmsg->AddParam("p13",dtBinary,"123",3);
msg->AddParam("p20",dtMsg,tmsg);
///< 参数支持行集
CRowset *trs = new CRowset;
trs->SetFields("f1","f2",0);
for (int i=0;i<0;i++) {
trs->AddRecord("a","1",0);
}
msg->AddParam("p21",dtRowset,trs);
CRowset *prs = new CRowset;
msg->AddRowset(prs);
prs->SetFields("f1","f2","f3",0);
FieldDescriptor *fd3 = prs->GetFieldInfo(2);
fd3->type = dtVarBinary;
for (int i=0;i<1;i++) {
char buffer[32];
sprintf(buffer,"col:%d",i+1);
prs->AddRecord();
prs->SetFieldValue(i,0,buffer);
///< 行集列支持二进制数据
CDataBlock *data = new CDataBlock;
data->type_ = dtVarBinary;
int len = 10;
char *data_buffer = (char*)rand_buffer(len,false);
data->Attach(data_buffer,len);
prs->SetFieldValue(i,2,data);
}
return msg;
}