| 2761 | |
| 2762 | |
| 2763 | Datum |
| 2764 | cursor_to_xmlschema(PG_FUNCTION_ARGS) |
| 2765 | { |
| 2766 | char *name = text_to_cstring(PG_GETARG_TEXT_PP(0)); |
| 2767 | bool nulls = PG_GETARG_BOOL(1); |
| 2768 | bool tableforest = PG_GETARG_BOOL(2); |
| 2769 | const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(3)); |
| 2770 | const char *xmlschema; |
| 2771 | Portal portal; |
| 2772 | |
| 2773 | SPI_connect(); |
| 2774 | portal = SPI_cursor_find(name); |
| 2775 | if (portal == NULL) |
| 2776 | ereport(ERROR, |
| 2777 | (errcode(ERRCODE_UNDEFINED_CURSOR), |
| 2778 | errmsg("cursor \"%s\" does not exist", name))); |
| 2779 | |
| 2780 | xmlschema = _SPI_strdup(map_sql_table_to_xmlschema(portal->tupDesc, |
| 2781 | InvalidOid, nulls, |
| 2782 | tableforest, targetns)); |
| 2783 | SPI_finish(); |
| 2784 | |
| 2785 | PG_RETURN_XML_P(cstring_to_xmltype(xmlschema)); |
| 2786 | } |
| 2787 | |
| 2788 | |
| 2789 | Datum |
nothing calls this directly
no test coverage detected