Closed lilililizheng closed 1 year ago
The failed assert should be fixed in libyang in the latest devel
branch. As for the other problem, please include prints of all the xpath
members of the returned values, I do not understand the problem from your description.
I'm pretty sure the database doesn't have data that meets the criteria, but "val_count" prints 140
You will have to include much more details if you want me to help/fix any problem. What was the value of del_sa_list.sp[i].sa_name
in the problematic case? And like I said, can you include the prints of all the 140 returned values? Ideally not as a picture but text, you can even attach it as a text file.
Hello, I'm using xpath functions for queries, and I'm having a few problems:
snprintf(buf,sizeof(buf),"/zdxlz-device-policy:policys/policy[contains(re_ike_name,'%s') and contains(enabled,'true')]/uuid_sp",name_key); printf("buf = %s\n",buf); sr_get_items(session, buf, 0, 0, &val, &val_count);
Using the "and" function causes segment errors,following the GDB debugging result,There seems to be a problem with the call on line 8:
Another problem:
snprintf(buf,sizeof(buf),"/zdxlz-device-policy:policys/policy[contains(re_ike_name,\"%s\")]",del_sa_list.sp[i].sa_name); sr_get_items(session, buf, 0, 0, &val, &val_count);
There is a problem with the return value of the above function. I can be sure that there is no data in the database that satisfies this condition, but sometimes "val_count" does not equal 0, and the value of "val" is the "key" value of the first data in the database