本文整理汇总了C++中QueryData::Query方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryData::Query方法的具体用法?C++ QueryData::Query怎么用?C++ QueryData::Query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryData
的用法示例。
在下文中一共展示了QueryData::Query方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteTask
SVAPI_API
bool DeleteTask(string taskname,string user,string addr)
{
if(taskname.empty()||user.empty()||addr.empty())
return false;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_DELETE;
querybuf.datatype=S_TASK;
strcpy(querybuf.qstr,taskname.c_str());
strcpy(querybuf.idcuser,user.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
if(pdata!=NULL)
{
if(len>0)
{
int *pret=(int*)pdata;
if(*pret==SVDB_OK)
{
delete [] pdata;
return true;
}
}
delete [] pdata;
}
}
return false;
}
示例2: GetAllSVSEObjInfo
SVAPI_API
bool GetAllSVSEObjInfo(PAIRLIST &retlist,string infoname,string user,string addr)
{
if(user.empty()||addr.empty())
return false;
if(user.size()>MAXUSERLEN)
return INVALID_VALUE;
if(infoname.size()>MAXQUEREYSTRINGLEN)
return INVALID_VALUE;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_INFO;
querybuf.datatype=S_SVSE;
strcpy(querybuf.idcuser,user.c_str());
strcpy(querybuf.qstr,infoname.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
StringMap *pmtp=new StringMap();
if(pmtp)
{
MAPNODE ret=INVALID_VALUE;
if(pdata!=NULL)
{
try{
if(pmtp->CreateObjectByRawData(pdata,len))
{
delete [] pdata;
ret=reinterpret_cast<MAPNODE>(pmtp);
bool bret=::EnumNodeAttrib(ret,retlist);
delete pmtp;
return bret;
}
}catch(...)
{
return false;
}
delete [] pdata;
}
delete pmtp;
}
}
return false;
}
示例3: GetForestData
SVAPI_API
bool GetForestData(ForestList & flist, string pid, bool onlySon, string addr)
{
if(pid.empty()||addr.empty())
return false;
string sonstr("0");
if(onlySon)
sonstr="1";
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_FAST_GET;
querybuf.datatype=S_SVSE;
strcpy(querybuf.qstr,pid.c_str());
strcpy(querybuf.idcuser,sonstr.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
try{
std::list<SingelRecord> listrcd2;
std::list<SingelRecord>::iterator lit;
if( CreateMassRecordListByRawData(listrcd2,pdata,len) )
{
for(lit=listrcd2.begin(); lit!=listrcd2.end(); ++lit)
{
NodeData ndata;
CreateNodeDataByRawData(ndata, lit->data ,lit->datalen);
flist.push_back( ndata );
}
if(pdata!=NULL)
delete [] pdata;
return true;
}
}catch(...)
{
printf("Exception to GetForestData.");
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}
示例4: sizeof
OBJECT GetSVSEWithVer(string id,string user,string addr,S_UINT & ver)
{
if(atoi(id.c_str())<=0)
return INVALID_VALUE;
if(user.empty()||addr.empty())
return INVALID_VALUE;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_GET;
querybuf.datatype=S_SVSE;
strcpy(querybuf.qstr,id.c_str());
strcpy(querybuf.idcuser,user.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
SVSE *pmtp=new SVSE();
if(pmtp)
{
OBJECT ret=INVALID_VALUE;
if(pdata!=NULL)
{
try{
if(pmtp->CreateObjectByRawData(pdata+sizeof(S_UINT),len-sizeof(S_UINT)))
ret=reinterpret_cast<OBJECT>(pmtp);
memmove(&ver,pdata,sizeof(S_UINT));
if(pdata!=NULL)
delete [] pdata;
}catch(...)
{
if(pdata!=NULL)
delete [] pdata;
return INVALID_VALUE;
}
return ret;
}
}
}
if(pdata!=NULL)
delete [] pdata;
return INVALID_VALUE;
}
示例5: Group
OBJECT GetGroupWithVer(string groupid,string user,string addr,S_UINT & ver)
{
if(groupid.empty()||user.empty()||addr.empty())
return INVALID_VALUE;
if(user.size()>MAXUSERLEN)
return INVALID_VALUE;
SVDBQUERY query={0};
query.len=sizeof(SVDBQUERY);
query.datatype=S_GROUP;
strcpy(query.idcuser,user.c_str());
query.querytype=QUERY_GET;
strcpy(query.qstr,groupid.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&query,(void **)&pdata,len,addr))
{
Group *pg=new Group();
if(pg)
{
OBJECT ret=INVALID_VALUE;
try{
if(pg->CreateObjectByRawData(pdata+sizeof(S_UINT),len-sizeof(S_UINT)))
ret=reinterpret_cast<OBJECT>(pg);
memmove(&ver,pdata,sizeof(S_UINT));
if(pdata!=NULL)
delete [] pdata;
}catch(...)
{
if(pdata!=NULL)
delete [] pdata;
return INVALID_VALUE;
}
return ret;
}
}
if(pdata!=NULL)
delete [] pdata;
return INVALID_VALUE;
}
示例6: GetAllTaskName
SVAPI_API
bool GetAllTaskName(std::list<string> &tasknamelist,string user,string addr)
{
if(user.empty()||addr.empty())
return false;
if(user.size()>MAXUSERLEN)
return INVALID_VALUE;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_INFO;
querybuf.datatype=S_TASK;
// strcpy(querybuf.qstr,infoname.c_str());
strcpy(querybuf.idcuser,user.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
if(pdata!=NULL)
{
try{
tasknamelist.clear();
if(::CreateStrListByRawData(tasknamelist,pdata,len))
{
delete [] pdata;
return true;
}
}catch(...)
{
delete [] pdata;
return false;
}
delete [] pdata;
}
}
return false;
}
示例7: GetTask
SVAPI_API
OBJECT GetTask(string taskname,string user,string addr)
{
if(taskname.empty()||user.empty()||addr.empty())
return INVALID_VALUE;
if(user.size()>MAXUSERLEN)
return INVALID_VALUE;
SVDBQUERY query={0};
query.len=sizeof(SVDBQUERY);
query.datatype=S_TASK;
strcpy(query.idcuser,user.c_str());
query.querytype=QUERY_GET;
strcpy(query.qstr,taskname.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&query,(void **)&pdata,len,addr))
{
Section *pe=new Section();
if(pe)
{
OBJECT ret=INVALID_VALUE;
try{
if(pe->CreateObjectByRawData(pdata,len))
ret=reinterpret_cast<OBJECT>(pe);
if(pdata!=NULL)
delete [] pdata;
}catch(...)
{
return INVALID_VALUE;
}
return ret;
}
}
return INVALID_VALUE;
}
示例8: GetEntityGroup
SVAPI_API
OBJECT GetEntityGroup(string entitygroupid,string user,string addr)
{
if(entitygroupid.empty()||user.empty()||addr.empty())
return INVALID_VALUE;
if(user.size()>MAXUSERLEN)
return INVALID_VALUE;
SVDBQUERY query={0};
query.len=sizeof(SVDBQUERY);
query.datatype=S_ENTITYGROUP;
strcpy(query.idcuser,user.c_str());
query.querytype=QUERY_GET;
strcpy(query.qstr,entitygroupid.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&query,(void **)&pdata,len,addr))
{
EntityGroup *pe=new EntityGroup();
if(pe)
{
OBJECT ret=INVALID_VALUE;
try{
if(pe->CreateObjectByRawData(pdata,len))
ret=reinterpret_cast<OBJECT>(pe);
delete [] pdata;
}catch(...)
{
return INVALID_VALUE;
}
return ret;
}
}
return INVALID_VALUE;
}
示例9: DelChildren
SVAPI_API
bool DelChildren(string pid, bool autoDelTable, string addr)
{
if(pid.empty()||addr.empty())
return false;
if(pid.find(".")==std::string::npos)
return false;
string sonstr("0");
if(autoDelTable)
sonstr="1";
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_FAST_DEL;
querybuf.datatype=S_SVSE;
strcpy(querybuf.qstr,pid.c_str());
strcpy(querybuf.idcuser,sonstr.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
if(pdata!=NULL && len>0)
{
int *pret=(int*)pdata;
if(*pret==SVDB_OK)
{
delete [] pdata;
return true;
}
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}
示例10: CreatIdcUser
SVAPI_API
string CreatIdcUser(string userindex, string pid, string addr)
{
string newid("");
if(userindex.empty()||addr.empty() || pid.empty())
return newid;
try{
S_UINT len=0;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_CREATIDC;
querybuf.datatype=S_GROUP;
strcpy(querybuf.idcuser,userindex.c_str());
strcpy(querybuf.qstr,pid.c_str());
querybuf.datalen=len;
char *pdata=NULL;
QueryData qd;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
if(pdata)
{
if(len>0)
{
newid= pdata;
delete [] pdata;
return newid;
}
delete [] pdata;
}
}
}catch(...)
{
}
return newid;
}
示例11: DeleteEntityGroup
SVAPI_API
bool DeleteEntityGroup(string entitygroupid,string user,string addr)
{
if(entitygroupid.empty()||user.empty()||addr.empty())
return false;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_DELETE;
querybuf.datatype=S_ENTITYGROUP;
strcpy(querybuf.qstr,entitygroupid.c_str());
strcpy(querybuf.idcuser,user.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,addr))
{
if(pdata)
{
if(len>0)
{
int *pret=(int*)pdata;
if(*pret==SVDB_OK)
{
delete [] pdata;
return true;
}
}
delete [] pdata;
}
}
return false;
}
示例12: PutValueIntoChildren
SVAPI_API
bool PutValueIntoChildren(const NodeData & ndata, string pid, string addr)
{
if(pid.empty()||addr.empty())
return false;
if(pid.find(".")==std::string::npos)
return false;
if(ndata.empty())
return false;
NodeData & ndata1= const_cast< NodeData & >( ndata );
unsigned int tlen= GetNodeDataRawDataSize(ndata1);
svutil::buffer tbuf;
if(!tbuf.checksize(tlen))
return false;
const char *data= GetNodeDataRawData(ndata1,tbuf,tlen);
if(data==NULL)
return false;
QueryData qd;
char *pdata=NULL;
S_UINT rlen=0;
S_UINT len=0;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_PUT_VALUE;
querybuf.datatype=S_SVSE;
strcpy(querybuf.qstr,pid.c_str());
INIQUERY iquery={0};
iquery.len=sizeof(INIQUERY);
iquery.datatype=D_STRING;
iquery.datalen=tlen;
len+=sizeof(INIQUERY);
len+=tlen;
querybuf.datalen=len;
buffer buf;
if(!buf.checksize(len))
return false;
char *pt=buf.getbuffer();
memcpy(pt,&iquery,sizeof(INIQUERY));
pt+=sizeof(INIQUERY);
memmove(pt,data,tlen);
if(qd.Query(&querybuf,buf,len,(void **)&pdata,rlen,addr))
{
if(pdata!=NULL && rlen>0)
{
int *pret=(int*)pdata;
if(*pret==SVDB_OK)
{
delete [] pdata;
return true;
}
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}