* append_database_pattern * * Adds the given pattern interpreted as a database name pattern. * * pia: the pattern info array to be appended * pattern: the database name pattern * encoding: client encoding for parsing the pattern */
| 1340 | * encoding: client encoding for parsing the pattern |
| 1341 | */ |
| 1342 | static void |
| 1343 | append_database_pattern(PatternInfoArray *pia, const char *pattern, int encoding) |
| 1344 | { |
| 1345 | PQExpBufferData buf; |
| 1346 | int dotcnt; |
| 1347 | PatternInfo *info = extend_pattern_info_array(pia); |
| 1348 | |
| 1349 | initPQExpBuffer(&buf); |
| 1350 | patternToSQLRegex(encoding, NULL, NULL, &buf, pattern, false, false, |
| 1351 | &dotcnt); |
| 1352 | if (dotcnt > 0) |
| 1353 | { |
| 1354 | pg_log_error("improper qualified name (too many dotted names): %s", pattern); |
| 1355 | exit(2); |
| 1356 | } |
| 1357 | info->pattern = pattern; |
| 1358 | info->db_regex = pstrdup(buf.data); |
| 1359 | |
| 1360 | termPQExpBuffer(&buf); |
| 1361 | } |
| 1362 | |
| 1363 | /* |
| 1364 | * append_schema_pattern |
no test coverage detected