359 |
#define _arg_node_uri 0 |
#define _arg_node_uri 0 |
360 |
#define _arg_login 1 |
#define _arg_login 1 |
361 |
#define _arg_passwd 2 |
#define _arg_passwd 2 |
362 |
#define _arg_query 3 |
#define _arg_depth 3 |
363 |
#define _arg_attr 4 |
#define _arg_query 4 |
364 |
#define _arg_order 5 |
#define _arg_attr 5 |
365 |
#define _arg_limit 6 |
#define _arg_order 6 |
366 |
#define _arg_offset 7 |
#define _arg_limit 7 |
367 |
#define _arg_attr_array 8 |
#define _arg_offset 8 |
368 |
|
#define _arg_attr_array 9 |
369 |
/* as (foo text, ... ); */ |
/* as (foo text, ... ); */ |
370 |
|
|
371 |
|
|
403 |
int resnum = 0; |
int resnum = 0; |
404 |
int limit = 0; |
int limit = 0; |
405 |
int offset = 0; |
int offset = 0; |
406 |
|
int depth = 0; |
407 |
|
|
408 |
char *node_url; |
char *node_url; |
409 |
char *user, *passwd; |
char *user, *passwd; |
481 |
user = _textout(PG_GETARG_TEXT_P(_arg_login)); |
user = _textout(PG_GETARG_TEXT_P(_arg_login)); |
482 |
passwd = _textout(PG_GETARG_TEXT_P(_arg_passwd)); |
passwd = _textout(PG_GETARG_TEXT_P(_arg_passwd)); |
483 |
|
|
484 |
|
/* depth of search */ |
485 |
|
if (PG_ARGISNULL(_arg_depth)) { |
486 |
|
depth = 0; |
487 |
|
} else { |
488 |
|
depth = PG_GETARG_INT32(_arg_depth); |
489 |
|
} |
490 |
|
|
491 |
/* query string */ |
/* query string */ |
492 |
if (PG_ARGISNULL(_arg_query)) { |
if (PG_ARGISNULL(_arg_query)) { |
493 |
query = ""; |
query = ""; |
535 |
node = est_node_new(node_url); |
node = est_node_new(node_url); |
536 |
est_node_set_auth(node, user, passwd); |
est_node_set_auth(node, user, passwd); |
537 |
|
|
538 |
elog(DEBUG1, "pgest_node: query[%s] attr[%s] limit %d offset %d", query, (PG_ARGISNULL(_arg_attr) ? "NULL" : attr), limit, offset); |
elog(DEBUG1, "pgest_node: node: %s (d:%d) query[%s] attr[%s] limit %d offset %d", node_url, depth, query, (PG_ARGISNULL(_arg_attr) ? "NULL" : attr), limit, offset); |
539 |
|
|
540 |
/* create a search condition object */ |
/* create a search condition object */ |
541 |
if (!(cond = est_cond_new())) { |
if (!(cond = est_cond_new())) { |
571 |
} |
} |
572 |
|
|
573 |
/* get the result of search */ |
/* get the result of search */ |
574 |
/* FIXME: allow user to specify depath of search */ |
nres = est_node_search(node, cond, depth); |
|
nres = est_node_search(node, cond, 0); |
|
575 |
|
|
576 |
if (! nres) { |
if (! nres) { |
577 |
int status = est_node_status(node); |
int status = est_node_status(node); |