* Prepare for processing of parameters used in remote query. */
| 4848 | * Prepare for processing of parameters used in remote query. |
| 4849 | */ |
| 4850 | static void |
| 4851 | prepare_query_params(PlanState *node, |
| 4852 | List *fdw_exprs, |
| 4853 | int numParams, |
| 4854 | FmgrInfo **param_flinfo, |
| 4855 | List **param_exprs, |
| 4856 | const char ***param_values) |
| 4857 | { |
| 4858 | int i; |
| 4859 | ListCell *lc; |
| 4860 | |
| 4861 | Assert(numParams > 0); |
| 4862 | |
| 4863 | /* Prepare for output conversion of parameters used in remote query. */ |
| 4864 | *param_flinfo = (FmgrInfo *) palloc0(sizeof(FmgrInfo) * numParams); |
| 4865 | |
| 4866 | i = 0; |
| 4867 | foreach(lc, fdw_exprs) |
| 4868 | { |
| 4869 | Node *param_expr = (Node *) lfirst(lc); |
| 4870 | Oid typefnoid; |
| 4871 | bool isvarlena; |
| 4872 | |
| 4873 | getTypeOutputInfo(exprType(param_expr), &typefnoid, &isvarlena); |
| 4874 | fmgr_info(typefnoid, &(*param_flinfo)[i]); |
| 4875 | i++; |
| 4876 | } |
| 4877 | |
| 4878 | /* |
| 4879 | * Prepare remote-parameter expressions for evaluation. (Note: in |
| 4880 | * practice, we expect that all these expressions will be just Params, so |
| 4881 | * we could possibly do something more efficient than using the full |
| 4882 | * expression-eval machinery for this. But probably there would be little |
| 4883 | * benefit, and it'd require postgres_fdw to know more than is desirable |
| 4884 | * about Param evaluation.) |
| 4885 | */ |
| 4886 | *param_exprs = ExecInitExprList(fdw_exprs, node); |
| 4887 | |
| 4888 | /* Allocate buffer for text form of query parameters. */ |
| 4889 | *param_values = (const char **) palloc0(numParams * sizeof(char *)); |
| 4890 | } |
| 4891 | |
| 4892 | /* |
| 4893 | * Construct array of query parameter values in text format. |
no test coverage detected