* fmtQualifiedIdEnc - construct a schema-qualified name, with quoting as * needed. * * Like fmtId, use the result before calling again. * * Since we call fmtId and it also uses getLocalPQExpBuffer() we cannot * use that buffer until we're finished with calling fmtId(). */
| 271 | * use that buffer until we're finished with calling fmtId(). |
| 272 | */ |
| 273 | const char * |
| 274 | fmtQualifiedIdEnc(const char *schema, const char *id, int encoding) |
| 275 | { |
| 276 | PQExpBuffer id_return; |
| 277 | PQExpBuffer lcl_pqexp = createPQExpBuffer(); |
| 278 | |
| 279 | /* Some callers might fail to provide a schema name */ |
| 280 | if (schema && *schema) |
| 281 | { |
| 282 | appendPQExpBuffer(lcl_pqexp, "%s.", fmtIdEnc(schema, encoding)); |
| 283 | } |
| 284 | appendPQExpBufferStr(lcl_pqexp, fmtIdEnc(id, encoding)); |
| 285 | |
| 286 | id_return = getLocalPQExpBuffer(); |
| 287 | |
| 288 | appendPQExpBufferStr(id_return, lcl_pqexp->data); |
| 289 | destroyPQExpBuffer(lcl_pqexp); |
| 290 | |
| 291 | return id_return->data; |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | * fmtQualifiedId - construct a schema-qualified name, with quoting as needed. |
no test coverage detected