| 891 | } |
| 892 | |
| 893 | SPIPlanPtr |
| 894 | SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, |
| 895 | int cursorOptions) |
| 896 | { |
| 897 | _SPI_plan plan; |
| 898 | SPIPlanPtr result; |
| 899 | |
| 900 | if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL)) |
| 901 | { |
| 902 | SPI_result = SPI_ERROR_ARGUMENT; |
| 903 | return NULL; |
| 904 | } |
| 905 | |
| 906 | SPI_result = _SPI_begin_call(true); |
| 907 | if (SPI_result < 0) |
| 908 | return NULL; |
| 909 | |
| 910 | memset(&plan, 0, sizeof(_SPI_plan)); |
| 911 | plan.magic = _SPI_PLAN_MAGIC; |
| 912 | plan.parse_mode = RAW_PARSE_DEFAULT; |
| 913 | plan.cursor_options = cursorOptions; |
| 914 | plan.nargs = nargs; |
| 915 | plan.argtypes = argtypes; |
| 916 | plan.parserSetup = NULL; |
| 917 | plan.parserSetupArg = NULL; |
| 918 | |
| 919 | _SPI_prepare_plan(src, &plan); |
| 920 | |
| 921 | /* copy plan to procedure context */ |
| 922 | result = _SPI_make_plan_non_temp(&plan); |
| 923 | |
| 924 | _SPI_end_call(true); |
| 925 | |
| 926 | return result; |
| 927 | } |
| 928 | |
| 929 | SPIPlanPtr |
| 930 | SPI_prepare_extended(const char *src, |
no test coverage detected