* funcname_signature_string * Build a string representing a function name, including arg types. * The result is something like "foo(integer)". * * If argnames isn't NIL, it is a list of C strings representing the actual * arg names for the last N arguments. This must be considered part of the * function signature too, when dealing with named-notation function calls. * * This is typicall
| 2045 | * messages. |
| 2046 | */ |
| 2047 | const char * |
| 2048 | funcname_signature_string(const char *funcname, int nargs, |
| 2049 | List *argnames, const Oid *argtypes) |
| 2050 | { |
| 2051 | StringInfoData argbuf; |
| 2052 | int numposargs; |
| 2053 | ListCell *lc; |
| 2054 | int i; |
| 2055 | |
| 2056 | initStringInfo(&argbuf); |
| 2057 | |
| 2058 | appendStringInfo(&argbuf, "%s(", funcname); |
| 2059 | |
| 2060 | numposargs = nargs - list_length(argnames); |
| 2061 | lc = list_head(argnames); |
| 2062 | |
| 2063 | for (i = 0; i < nargs; i++) |
| 2064 | { |
| 2065 | if (i) |
| 2066 | appendStringInfoString(&argbuf, ", "); |
| 2067 | if (i >= numposargs) |
| 2068 | { |
| 2069 | appendStringInfo(&argbuf, "%s => ", (char *) lfirst(lc)); |
| 2070 | lc = lnext(argnames, lc); |
| 2071 | } |
| 2072 | appendStringInfoString(&argbuf, format_type_be(argtypes[i])); |
| 2073 | } |
| 2074 | |
| 2075 | appendStringInfoChar(&argbuf, ')'); |
| 2076 | |
| 2077 | return argbuf.data; /* return palloc'd string buffer */ |
| 2078 | } |
| 2079 | |
| 2080 | /* |
| 2081 | * func_signature_string |
no test coverage detected