| 381 | PG_FUNCTION_INFO_V1(xpath_bool); |
| 382 | |
| 383 | Datum |
| 384 | xpath_bool(PG_FUNCTION_ARGS) |
| 385 | { |
| 386 | text *document = PG_GETARG_TEXT_PP(0); |
| 387 | text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ |
| 388 | xmlChar *xpath; |
| 389 | int bRes; |
| 390 | xmlXPathObjectPtr res; |
| 391 | xpath_workspace workspace; |
| 392 | |
| 393 | xpath = pgxml_texttoxmlchar(xpathsupp); |
| 394 | |
| 395 | res = pgxml_xpath(document, xpath, &workspace); |
| 396 | |
| 397 | pfree(xpath); |
| 398 | |
| 399 | if (res == NULL) |
| 400 | PG_RETURN_BOOL(false); |
| 401 | |
| 402 | bRes = xmlXPathCastToBoolean(res); |
| 403 | |
| 404 | cleanup_workspace(&workspace); |
| 405 | |
| 406 | PG_RETURN_BOOL(bRes); |
| 407 | } |
| 408 | |
| 409 | |
| 410 |
nothing calls this directly
no test coverage detected