skip+count
This commit is contained in:
parent
8008fa01b7
commit
8e266dd136
2 changed files with 30 additions and 13 deletions
|
|
@ -1497,6 +1497,7 @@ from_client_get_pageable_list(clicon_handle h,
|
|||
}
|
||||
if ((xtop = xml_new("top", NULL, CX_ELMNT)) == NULL)
|
||||
goto done;
|
||||
/* Parse xpath -> stuctured path tree */
|
||||
if ((ret = clixon_instance_id_parse(yspec, &path_tree, "%s", xpath)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
|
|
@ -1504,12 +1505,13 @@ from_client_get_pageable_list(clicon_handle h,
|
|||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
/* get last element */
|
||||
/* get last element of path, eg /a/b/c, get c */
|
||||
if ((cp = PREVQ(clixon_path *, path_tree)) == NULL){
|
||||
if (netconf_bad_element(cbret, "application", "list-target", "path invalid") < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
/* get yang of last element */
|
||||
if ((y = cp->cp_yang) == NULL){
|
||||
if (netconf_bad_element(cbret, "application", "list-target", "No yang associated with path") < 0)
|
||||
goto done;
|
||||
|
|
@ -1520,7 +1522,10 @@ from_client_get_pageable_list(clicon_handle h,
|
|||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
/* Build a "predicate" cbuf */
|
||||
/* Build a "predicate" cbuf
|
||||
* This solution uses xpath predicates to translate "count" and "skip" to
|
||||
* relational operators <>.
|
||||
*/
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -1529,9 +1534,9 @@ from_client_get_pageable_list(clicon_handle h,
|
|||
if (where)
|
||||
cprintf(cb, "[%s]", where);
|
||||
if (skip){
|
||||
cprintf(cb, "[%u < position()", skip);
|
||||
cprintf(cb, "[%u <= position()", skip);
|
||||
if (count)
|
||||
cprintf(cb, " && position() < %u", count+skip);
|
||||
cprintf(cb, " and position() < %u", count+skip);
|
||||
cprintf(cb, "]");
|
||||
}
|
||||
else if (count)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue