* Print literal `outputstr' already represented as string of type `typid' * into stringbuf `s'. * * Some builtin types aren't quoted, the rest is quoted. Escaping is done as * if standard_conforming_strings were enabled. */
| 469 | * if standard_conforming_strings were enabled. |
| 470 | */ |
| 471 | static void |
| 472 | print_literal(StringInfo s, Oid typid, char *outputstr) |
| 473 | { |
| 474 | const char *valptr; |
| 475 | |
| 476 | switch (typid) |
| 477 | { |
| 478 | case INT2OID: |
| 479 | case INT4OID: |
| 480 | case INT8OID: |
| 481 | case OIDOID: |
| 482 | case FLOAT4OID: |
| 483 | case FLOAT8OID: |
| 484 | case NUMERICOID: |
| 485 | /* NB: We don't care about Inf, NaN et al. */ |
| 486 | appendStringInfoString(s, outputstr); |
| 487 | break; |
| 488 | |
| 489 | case BITOID: |
| 490 | case VARBITOID: |
| 491 | appendStringInfo(s, "B'%s'", outputstr); |
| 492 | break; |
| 493 | |
| 494 | case BOOLOID: |
| 495 | if (strcmp(outputstr, "t") == 0) |
| 496 | appendStringInfoString(s, "true"); |
| 497 | else |
| 498 | appendStringInfoString(s, "false"); |
| 499 | break; |
| 500 | |
| 501 | default: |
| 502 | appendStringInfoChar(s, '\''); |
| 503 | for (valptr = outputstr; *valptr; valptr++) |
| 504 | { |
| 505 | char ch = *valptr; |
| 506 | |
| 507 | if (SQL_STR_DOUBLE(ch, false)) |
| 508 | appendStringInfoChar(s, ch); |
| 509 | appendStringInfoChar(s, ch); |
| 510 | } |
| 511 | appendStringInfoChar(s, '\''); |
| 512 | break; |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | /* print the tuple 'tuple' into the StringInfo s */ |
| 517 | static void |
no test coverage detected