PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include "common/keywords.h"
#include "fe_utils/string_utils.h"
Go to the source code of this file.
Macros | |
#define | WHEREAND() |
Functions | |
static PQExpBuffer | defaultGetLocalPQExpBuffer (void) |
const char * | fmtId (const char *rawid) |
const char * | fmtQualifiedId (const char *schema, const char *id) |
char * | formatPGVersionNumber (int version_number, bool include_minor, char *buf, size_t buflen) |
void | appendStringLiteral (PQExpBuffer buf, const char *str, int encoding, bool std_strings) |
void | appendStringLiteralConn (PQExpBuffer buf, const char *str, PGconn *conn) |
void | appendStringLiteralDQ (PQExpBuffer buf, const char *str, const char *dqprefix) |
void | appendByteaLiteral (PQExpBuffer buf, const unsigned char *str, size_t length, bool std_strings) |
void | appendShellString (PQExpBuffer buf, const char *str) |
bool | appendShellStringNoError (PQExpBuffer buf, const char *str) |
void | appendConnStrVal (PQExpBuffer buf, const char *str) |
void | appendPsqlMetaConnect (PQExpBuffer buf, const char *dbname) |
bool | parsePGArray (const char *atext, char ***itemarray, int *nitems) |
bool | appendReloptionsArray (PQExpBuffer buffer, const char *reloptions, const char *prefix, int encoding, bool std_strings) |
bool | processSQLNamePattern (PGconn *conn, PQExpBuffer buf, const char *pattern, bool have_where, bool force_escape, const char *schemavar, const char *namevar, const char *altnamevar, const char *visibilityrule) |
void | patternToSQLRegex (int encoding, PQExpBuffer dbnamebuf, PQExpBuffer schemabuf, PQExpBuffer namebuf, const char *pattern, bool force_escape) |
Variables | |
int | quote_all_identifiers = 0 |
PQExpBuffer(* | getLocalPQExpBuffer )(void) |
#define WHEREAND | ( | ) |
Referenced by processSQLNamePattern().
void appendByteaLiteral | ( | PQExpBuffer | buf, |
const unsigned char * | str, | ||
size_t | length, | ||
bool | std_strings | ||
) |
Definition at line 374 of file string_utils.c.
References PQExpBufferData::data, enlargePQExpBuffer(), hextbl, PQExpBufferData::len, source, and generate_unaccent_rules::str.
void appendConnStrVal | ( | PQExpBuffer | buf, |
const char * | str | ||
) |
Definition at line 545 of file string_utils.c.
References appendPQExpBufferChar(), and appendPQExpBufferStr().
Referenced by appendPsqlMetaConnect(), constructConnStr(), generate_old_dump(), GenerateRecoveryConfig(), get_db_conn(), and runPgDump().
void appendPsqlMetaConnect | ( | PQExpBuffer | buf, |
const char * | dbname | ||
) |
Definition at line 590 of file string_utils.c.
References _, appendConnStrVal(), appendPQExpBufferChar(), appendPQExpBufferStr(), connstr, PQExpBufferData::data, EXIT_FAILURE, fmtId(), fprintf, initPQExpBuffer(), and termPQExpBuffer().
Referenced by _reconnectToDB(), new_9_0_populate_pg_largeobject_metadata(), and old_9_6_invalidate_hash_indexes().
bool appendReloptionsArray | ( | PQExpBuffer | buffer, |
const char * | reloptions, | ||
const char * | prefix, | ||
int | encoding, | ||
bool | std_strings | ||
) |
Definition at line 741 of file string_utils.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), appendStringLiteral(), fmtId(), free, i, name, noptions, options, parsePGArray(), and value.
Referenced by appendReloptionsArrayAH(), and get_create_object_cmd().
void appendShellString | ( | PQExpBuffer | buf, |
const char * | str | ||
) |
Definition at line 429 of file string_utils.c.
References _, appendShellStringNoError(), EXIT_FAILURE, and fprintf.
Referenced by cluster_conn_opts(), generate_old_dump(), main(), output_completion_banner(), and runPgDump().
bool appendShellStringNoError | ( | PQExpBuffer | buf, |
const char * | str | ||
) |
Definition at line 441 of file string_utils.c.
References appendPQExpBufferChar(), and appendPQExpBufferStr().
Referenced by appendShellString(), and psql_get_variable().
void appendStringLiteral | ( | PQExpBuffer | buf, |
const char * | str, | ||
int | encoding, | ||
bool | std_strings | ||
) |
Definition at line 215 of file string_utils.c.
References PQExpBufferData::data, enlargePQExpBuffer(), i, IS_HIGHBIT_SET, PQExpBufferData::len, PQExpBufferData::maxlen, PQmblen(), source, SQL_STR_DOUBLE, and generate_unaccent_rules::str.
Referenced by appendReloptionsArray(), and appendStringLiteralConn().
void appendStringLiteralConn | ( | PQExpBuffer | buf, |
const char * | str, | ||
PGconn * | conn | ||
) |
Definition at line 293 of file string_utils.c.
References appendPQExpBufferChar(), appendStringLiteral(), PQExpBufferData::data, enlargePQExpBuffer(), ESCAPE_STRING_SYNTAX, PQExpBufferData::len, PQclientEncoding(), PQescapeStringConn(), and PQserverVersion().
Referenced by appendQualifiedRelation(), dumpRoles(), dumpTablespaces(), dumpUserConfig(), emitShSecLabels(), exec_command_password(), get_parallel_object_list(), getTables(), lookup_object_oid(), main(), makeAlterConfigCommand(), processSQLNamePattern(), setup_connection(), and vacuum_one_database().
void appendStringLiteralDQ | ( | PQExpBuffer | buf, |
const char * | str, | ||
const char * | dqprefix | ||
) |
Definition at line 331 of file string_utils.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), createPQExpBuffer(), PQExpBufferData::data, and destroyPQExpBuffer().
Referenced by dumpFunc().
|
static |
const char* fmtId | ( | const char * | rawid | ) |
Definition at line 64 of file string_utils.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), PQExpBufferData::data, getLocalPQExpBuffer, quote_all_identifiers, ScanKeywordCategories, ScanKeywordLookup(), ScanKeywords, and UNRESERVED_KEYWORD.
Referenced by _doSetFixedOutputState(), _getObjectDescription(), _printTocEntry(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), append_depends_on_extension(), appendPsqlMetaConnect(), appendReloptionsArray(), binary_upgrade_extension_member(), buildACLCommands(), buildDefaultACLCommands(), createDummyViewAsClause(), describeOneTableDetails(), dropDBs(), dropRoles(), dropTablespaces(), dumpAccessMethod(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpComment(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDomain(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpGroups(), dumpIndex(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationTable(), dumpRangeType(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpStatisticsExt(), dumpSubscription(), dumpTable(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserMappings(), emitShSecLabels(), exec_command_password(), fmtCopyColumnList(), fmtQualifiedId(), format_aggregate_signature(), format_function_arguments(), format_function_arguments_old(), format_function_signature(), get_create_object_cmd(), get_language_name(), getFormattedOperatorName(), main(), makeAlterConfigCommand(), run_reindex_command(), and setup_connection().
const char* fmtQualifiedId | ( | const char * | schema, |
const char * | id | ||
) |
Definition at line 145 of file string_utils.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), and getLocalPQExpBuffer.
Referenced by _disableTriggersIfNecessary(), _enableTriggersIfNecessary(), appendQualifiedRelation(), get_parallel_object_list(), lockTableForWorker(), restore_toc_entry(), and vacuum_one_database().
char* formatPGVersionNumber | ( | int | version_number, |
bool | include_minor, | ||
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 177 of file string_utils.c.
Referenced by connection_warnings(), describeAccessMethods(), describeFunctions(), describePublications(), describeSubscriptions(), describeTablespaces(), exec_command_ef_ev(), exec_command_sf_sv(), listCollations(), listDbRoleSettings(), listDefaultACLs(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listPartitionedTables(), listPublications(), listTSConfigs(), listTSDictionaries(), listTSParsers(), listTSTemplates(), listUserMappings(), SendQuery(), and SyncVariables().
bool parsePGArray | ( | const char * | atext, |
char *** | itemarray, | ||
int * | nitems | ||
) |
Definition at line 657 of file string_utils.c.
References malloc.
Referenced by appendIndexCollationVersion(), appendReloptionsArray(), buildACLCommands(), dumpFunc(), dumpIndex(), dumpSearchPath(), dumpSubscription(), and processExtensionTables().
void patternToSQLRegex | ( | int | encoding, |
PQExpBuffer | dbnamebuf, | ||
PQExpBuffer | schemabuf, | ||
PQExpBuffer | namebuf, | ||
const char * | pattern, | ||
bool | force_escape | ||
) |
Definition at line 967 of file string_utils.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), Assert, buf, PQExpBufferData::data, i, initPQExpBuffer(), pg_tolower(), PQmblen(), and termPQExpBuffer().
Referenced by processSQLNamePattern().
bool processSQLNamePattern | ( | PGconn * | conn, |
PQExpBuffer | buf, | ||
const char * | pattern, | ||
bool | have_where, | ||
bool | force_escape, | ||
const char * | schemavar, | ||
const char * | namevar, | ||
const char * | altnamevar, | ||
const char * | visibilityrule | ||
) |
Definition at line 827 of file string_utils.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendStringLiteralConn(), PQExpBufferData::data, initPQExpBuffer(), PQExpBufferData::len, patternToSQLRegex(), PQclientEncoding(), PQserverVersion(), termPQExpBuffer(), and WHEREAND.
Referenced by describeAccessMethods(), describeAggregates(), describeFunctions(), describeOperators(), describePublications(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), expand_dbname_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), objectDescription(), and permissionsList().
|
default |
Definition at line 27 of file string_utils.c.
Referenced by fmtId(), fmtQualifiedId(), and ParallelBackupStart().
int quote_all_identifiers = 0 |
Definition at line 26 of file string_utils.c.
Referenced by fmtId().