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

Function executeQuery

src/fe_utils/query_utils.c:21–40  ·  view source on GitHub ↗

* Run a query, return the results, exit program on failure. */

Source from the content-addressed store, hash-verified

19 * Run a query, return the results, exit program on failure.
20 */
21PGresult *
22executeQuery(PGconn *conn, const char *query, bool echo)
23{
24 PGresult *res;
25
26 if (echo)
27 printf("%s\n", query);
28
29 res = PQexec(conn, query);
30 if (!res ||
31 PQresultStatus(res) != PGRES_TUPLES_OK)
32 {
33 pg_log_error("query failed: %s", PQerrorMessage(conn));
34 pg_log_info("query was: %s", query);
35 PQfinish(conn);
36 exit(1);
37 }
38
39 return res;
40}
41
42
43/*

Callers 1

connectDatabaseFunction · 0.70

Calls 4

PQexecFunction · 0.85
PQresultStatusFunction · 0.85
PQerrorMessageFunction · 0.85
PQfinishFunction · 0.85

Tested by

no test coverage detected