MCPcopy Create free account
hub / github.com/apache/cloudberry / PSQLexec

Function PSQLexec

src/bin/psql/common.c:539–582  ·  view source on GitHub ↗

* PSQLexec * * This is the way to send "backdoor" queries (those not directly entered * by the user). It is subject to -E but not -e. * * Caller is responsible for handling the ensuing processing if a COPY * command is sent. * * Note: we don't bother to check PQclientEncoding; it is assumed that no * caller uses this path to issue "SET CLIENT_ENCODING". */

Source from the content-addressed store, hash-verified

537 * caller uses this path to issue "SET CLIENT_ENCODING".
538 */
539PGresult *
540PSQLexec(const char *query)
541{
542 PGresult *res;
543
544 if (!pset.db)
545 {
546 pg_log_error("You are currently not connected to a database.");
547 return NULL;
548 }
549
550 if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
551 {
552 printf(_("********* QUERY **********\n"
553 "%s\n"
554 "**************************\n\n"), query);
555 fflush(stdout);
556 if (pset.logfile)
557 {
558 fprintf(pset.logfile,
559 _("********* QUERY **********\n"
560 "%s\n"
561 "**************************\n\n"), query);
562 fflush(pset.logfile);
563 }
564
565 if (pset.echo_hidden == PSQL_ECHO_HIDDEN_NOEXEC)
566 return NULL;
567 }
568
569 SetCancelConn(pset.db);
570
571 res = PQexec(pset.db, query);
572
573 ResetCancelConn();
574
575 if (!AcceptResult(res))
576 {
577 ClearOrSaveResult(res);
578 res = NULL;
579 }
580
581 return res;
582}
583
584
585/*

Callers 15

mainFunction · 0.85
isGPDBFunction · 0.85
isGPDB4200OrLaterFunction · 0.85
isGPDB4300OrLaterFunction · 0.85
isGPDB5000OrLaterFunction · 0.85
describeAggregatesFunction · 0.85
describeAccessMethodsFunction · 0.85
describeTablespacesFunction · 0.85
describeFunctionsFunction · 0.85
describeTypesFunction · 0.85
describeOperatorsFunction · 0.85
listAllDbsFunction · 0.85

Calls 5

SetCancelConnFunction · 0.85
PQexecFunction · 0.85
ResetCancelConnFunction · 0.85
AcceptResultFunction · 0.85
ClearOrSaveResultFunction · 0.85

Tested by

no test coverage detected