Hello all
I have problem with LL_ApplyQuery() call. It returns LL_OK but result set is empty (size = 0).
If I specify invalid syntax for LL_ApplyQuery() I still getting LL_OK.
What am I missing ?
I can't find samples for LL_ApplyQuery using C++.
My environment: XP sp3. Visual Studio 2008. Live link server (ver = 9.7.1) runs on remote host in the intranet.
This is simplified code (checks for return codes and release memory was removed)
#define RETURN_IF_FAILED(s) if(s != LL_OK) {printf("error code = %X\n", s); return 1; }
int _tmain(int argc, _TCHAR* argv[])
{
LLSESSION session = NULL;
LLSTATUS status = LL_OK;
status = LL_Initialize( LL_HEADER_VERSION );
status = LL_SessionAllocEx(&session, "ourhostll", 2099, "", "dmitry", "dmitry", NULL);
LLVALUE List;
status = LL_ValueAlloc(&List);
status = LL_GetSearchBrokers(session, List);
LLLONG BrokerId = 0;
LLLONG Size = 0;
status = LL_ValueGetLength(List, &Size);
for(int i = 0; i < Size; i++)
{
LLVALUE Value;
LL_ValueAlloc(&Value);
status = LL_ListGetValue(List, i, Value);
char buf[1024];
LLLONG n = 0;
status = LL_AssocGetString(Value, "NodeName", buf, 1024, &n);
if(strcmp(buf, "Enterprise") == 0)
{
status = LL_AssocGetInteger(Value, "NodeID", &BrokerId);
break;
}
}
LLVALUE SelectList;
status = LL_ValueAlloc(&SelectList);
status = LL_ValueSetList(SelectList);
status = LL_ValueSetLength(SelectList, 2);
status = LL_ListSetString(SelectList, 0, "OTObject");
status = LL_ListSetString(SelectList, 1, "OTName");
LLVALUE Result;
LL_ValueAlloc(&Result);
status = LL_ValueSetList(SelectList);
// I want all objects starting with F
status = LL_ApplyQuery(session, BrokerId, SelectList,
"(OTName : \"F*\")",
LL_SORTBYRELEVANCY, "", 0, 100, "LivelinkQueryLanguage",
Result);
RETURN_IF_FAILED(status);
LLLONG ResSize = 0;
status = LL_ValueGetLength(Result, &ResSize);
printf("Total items in result is %d\n", ResSize);
return 0;
}