Remove the unused argument of PSQLexec().

This commit simply removes the second argument of PSQLexec that was
set to the same value everywhere. Comments and code blocks related
to this parameter are removed.

Noticed by Heikki Linnakangas, reviewed by Michael Paquier
This commit is contained in:
Fujii Masao 2014-10-23 22:33:56 +09:00
parent 5ac372fc1a
commit efbbbbc8b5
5 changed files with 65 additions and 84 deletions

View File

@ -967,7 +967,7 @@ exec_command(const char *cmd,
printfPQExpBuffer(&buf, "ALTER USER %s PASSWORD ", printfPQExpBuffer(&buf, "ALTER USER %s PASSWORD ",
fmtId(user)); fmtId(user));
appendStringLiteralConn(&buf, encrypted_password, pset.db); appendStringLiteralConn(&buf, encrypted_password, pset.db);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
success = false; success = false;
@ -2181,7 +2181,7 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
if (single_txn) if (single_txn)
{ {
if ((res = PSQLexec("BEGIN", false)) == NULL) if ((res = PSQLexec("BEGIN")) == NULL)
{ {
if (pset.on_error_stop) if (pset.on_error_stop)
{ {
@ -2197,7 +2197,7 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
if (single_txn) if (single_txn)
{ {
if ((res = PSQLexec("COMMIT", false)) == NULL) if ((res = PSQLexec("COMMIT")) == NULL)
{ {
if (pset.on_error_stop) if (pset.on_error_stop)
{ {

View File

@ -426,10 +426,6 @@ AcceptResult(const PGresult *result)
* This is the way to send "backdoor" queries (those not directly entered * This is the way to send "backdoor" queries (those not directly entered
* by the user). It is subject to -E but not -e. * by the user). It is subject to -E but not -e.
* *
* In autocommit-off mode, a new transaction block is started if start_xact
* is true; nothing special is done when start_xact is false. Typically,
* start_xact = false is used for SELECTs and explicit BEGIN/COMMIT commands.
*
* Caller is responsible for handling the ensuing processing if a COPY * Caller is responsible for handling the ensuing processing if a COPY
* command is sent. * command is sent.
* *
@ -437,7 +433,7 @@ AcceptResult(const PGresult *result)
* caller uses this path to issue "SET CLIENT_ENCODING". * caller uses this path to issue "SET CLIENT_ENCODING".
*/ */
PGresult * PGresult *
PSQLexec(const char *query, bool start_xact) PSQLexec(const char *query)
{ {
PGresult *res; PGresult *res;
@ -468,21 +464,6 @@ PSQLexec(const char *query, bool start_xact)
SetCancelConn(); SetCancelConn();
if (start_xact &&
!pset.autocommit &&
PQtransactionStatus(pset.db) == PQTRANS_IDLE)
{
res = PQexec(pset.db, "BEGIN");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
psql_error("%s", PQerrorMessage(pset.db));
PQclear(res);
ResetCancelConn();
return NULL;
}
PQclear(res);
}
res = PQexec(pset.db, query); res = PQexec(pset.db, query);
ResetCancelConn(); ResetCancelConn();

View File

@ -38,7 +38,7 @@ extern void setup_cancel_handler(void);
extern void SetCancelConn(void); extern void SetCancelConn(void);
extern void ResetCancelConn(void); extern void ResetCancelConn(void);
extern PGresult *PSQLexec(const char *query, bool start_xact); extern PGresult *PSQLexec(const char *query);
extern int PSQLexecWatch(const char *query, const printQueryOpt *opt); extern int PSQLexecWatch(const char *query, const printQueryOpt *opt);
extern bool SendQuery(const char *query); extern bool SendQuery(const char *query);

View File

@ -114,7 +114,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -195,7 +195,7 @@ describeTablespaces(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -458,7 +458,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -570,7 +570,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -645,7 +645,7 @@ describeOperators(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3, 4;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3, 4;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -716,7 +716,7 @@ listAllDbs(const char *pattern, bool verbose)
NULL, "d.datname", NULL, NULL); NULL, "d.datname", NULL, NULL);
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -827,7 +827,7 @@ permissionsList(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
{ {
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
@ -901,7 +901,7 @@ listDefaultACLs(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
{ {
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
@ -1077,7 +1077,7 @@ objectDescription(const char *pattern, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -1129,7 +1129,7 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 2, 3;"); appendPQExpBufferStr(&buf, "ORDER BY 2, 3;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -1338,7 +1338,7 @@ describeOneTableDetails(const char *schemaname,
oid); oid);
} }
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
goto error_return; goto error_return;
@ -1381,7 +1381,7 @@ describeOneTableDetails(const char *schemaname,
/* must be separate because fmtId isn't reentrant */ /* must be separate because fmtId isn't reentrant */
appendPQExpBuffer(&buf, ".%s;", fmtId(relationname)); appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
goto error_return; goto error_return;
@ -1441,7 +1441,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid); appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid);
appendPQExpBufferStr(&buf, "\nORDER BY a.attnum;"); appendPQExpBufferStr(&buf, "\nORDER BY a.attnum;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
goto error_return; goto error_return;
numrows = PQntuples(res); numrows = PQntuples(res);
@ -1555,7 +1555,7 @@ describeOneTableDetails(const char *schemaname,
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);", "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
@ -1694,7 +1694,7 @@ describeOneTableDetails(const char *schemaname,
"AND i.indrelid = c2.oid;", "AND i.indrelid = c2.oid;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else if (PQntuples(result) != 1) else if (PQntuples(result) != 1)
@ -1773,7 +1773,7 @@ describeOneTableDetails(const char *schemaname,
"\n AND d.deptype='a'", "\n AND d.deptype='a'",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else if (PQntuples(result) == 1) else if (PQntuples(result) == 1)
@ -1830,7 +1830,7 @@ describeOneTableDetails(const char *schemaname,
"WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n" "WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n"
"ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;", "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -1914,7 +1914,7 @@ describeOneTableDetails(const char *schemaname,
"WHERE r.conrelid = '%s' AND r.contype = 'c'\n" "WHERE r.conrelid = '%s' AND r.contype = 'c'\n"
"ORDER BY 1;", "ORDER BY 1;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -1945,7 +1945,7 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_constraint r\n" "FROM pg_catalog.pg_constraint r\n"
"WHERE r.conrelid = '%s' AND r.contype = 'f' ORDER BY 1;", "WHERE r.conrelid = '%s' AND r.contype = 'f' ORDER BY 1;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -1976,7 +1976,7 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_constraint c\n" "FROM pg_catalog.pg_constraint c\n"
"WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1;", "WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2024,7 +2024,7 @@ describeOneTableDetails(const char *schemaname,
"WHERE rs.rsecrelid = '%s' ORDER BY 1;", "WHERE rs.rsecrelid = '%s' ORDER BY 1;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2095,7 +2095,7 @@ describeOneTableDetails(const char *schemaname,
"WHERE r.ev_class = '%s' ORDER BY 1;", "WHERE r.ev_class = '%s' ORDER BY 1;",
oid); oid);
} }
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2186,7 +2186,7 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_rewrite r\n" "FROM pg_catalog.pg_rewrite r\n"
"WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;", "WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
@ -2243,7 +2243,7 @@ describeOneTableDetails(const char *schemaname,
" WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))"); " WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))");
appendPQExpBufferStr(&buf, "\nORDER BY 1;"); appendPQExpBufferStr(&buf, "\nORDER BY 1;");
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2372,7 +2372,7 @@ describeOneTableDetails(const char *schemaname,
" pg_catalog.pg_foreign_server s\n" " pg_catalog.pg_foreign_server s\n"
"WHERE f.ftrelid = %s AND s.oid = f.ftserver;", "WHERE f.ftrelid = %s AND s.oid = f.ftserver;",
oid); oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else if (PQntuples(result) != 1) else if (PQntuples(result) != 1)
@ -2399,7 +2399,7 @@ describeOneTableDetails(const char *schemaname,
/* print inherited tables */ /* print inherited tables */
printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhparent AND i.inhrelid = '%s' ORDER BY inhseqno;", oid); printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhparent AND i.inhrelid = '%s' ORDER BY inhseqno;", oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2432,7 +2432,7 @@ describeOneTableDetails(const char *schemaname,
else else
printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.relname;", oid); printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.relname;", oid);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
goto error_return; goto error_return;
else else
@ -2579,7 +2579,7 @@ add_tablespace_footer(printTableContent *const cont, char relkind,
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT spcname FROM pg_catalog.pg_tablespace\n" "SELECT spcname FROM pg_catalog.pg_tablespace\n"
"WHERE oid = '%u';", tablespace); "WHERE oid = '%u';", tablespace);
result = PSQLexec(buf.data, false); result = PSQLexec(buf.data);
if (!result) if (!result)
return; return;
/* Should always be the case, but.... */ /* Should always be the case, but.... */
@ -2683,7 +2683,7 @@ describeRoles(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
return false; return false;
@ -2818,7 +2818,7 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
return false; return false;
} }
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
if (!res) if (!res)
return false; return false;
@ -2979,7 +2979,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
appendPQExpBufferStr(&buf, "ORDER BY 1,2;"); appendPQExpBufferStr(&buf, "ORDER BY 1,2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3066,7 +3066,7 @@ listLanguages(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3153,7 +3153,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3227,7 +3227,7 @@ listConversions(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3293,7 +3293,7 @@ listEventTriggers(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1"); appendPQExpBufferStr(&buf, "ORDER BY 1");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3392,7 +3392,7 @@ listCasts(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, ") )\nORDER BY 1, 2;"); appendPQExpBufferStr(&buf, ") )\nORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3468,7 +3468,7 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3527,7 +3527,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3584,7 +3584,7 @@ listTSParsers(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3625,7 +3625,7 @@ listTSParsersVerbose(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3722,7 +3722,7 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
gettext_noop("Get token types"), gettext_noop("Get token types"),
oid); oid);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3754,7 +3754,7 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
gettext_noop("Description"), gettext_noop("Description"),
oid); oid);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3830,7 +3830,7 @@ listTSDictionaries(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3898,7 +3898,7 @@ listTSTemplates(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3955,7 +3955,7 @@ listTSConfigs(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -3997,7 +3997,7 @@ listTSConfigsVerbose(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 3, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 3, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4075,7 +4075,7 @@ describeOneTSConfig(const char *oid, const char *nspname, const char *cfgname,
gettext_noop("Dictionaries"), gettext_noop("Dictionaries"),
oid); oid);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4176,7 +4176,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4255,7 +4255,7 @@ listForeignServers(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4313,7 +4313,7 @@ listUserMappings(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4387,7 +4387,7 @@ listForeignTables(const char *pattern, bool verbose)
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4441,7 +4441,7 @@ listExtensions(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4487,7 +4487,7 @@ listExtensionContents(const char *pattern)
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;
@ -4547,7 +4547,7 @@ listOneExtensionContents(const char *extname, const char *oid)
gettext_noop("Object Description"), gettext_noop("Object Description"),
oid); oid);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
if (!res) if (!res)
return false; return false;

View File

@ -73,7 +73,7 @@ start_lo_xact(const char *operation, bool *own_transaction)
{ {
case PQTRANS_IDLE: case PQTRANS_IDLE:
/* need to start our own xact */ /* need to start our own xact */
if (!(res = PSQLexec("BEGIN", false))) if (!(res = PSQLexec("BEGIN")))
return false; return false;
PQclear(res); PQclear(res);
*own_transaction = true; *own_transaction = true;
@ -103,9 +103,9 @@ finish_lo_xact(const char *operation, bool own_transaction)
if (own_transaction && pset.autocommit) if (own_transaction && pset.autocommit)
{ {
/* close out our own xact */ /* close out our own xact */
if (!(res = PSQLexec("COMMIT", false))) if (!(res = PSQLexec("COMMIT")))
{ {
res = PSQLexec("ROLLBACK", false); res = PSQLexec("ROLLBACK");
PQclear(res); PQclear(res);
return false; return false;
} }
@ -126,7 +126,7 @@ fail_lo_xact(const char *operation, bool own_transaction)
if (own_transaction && pset.autocommit) if (own_transaction && pset.autocommit)
{ {
/* close out our own xact */ /* close out our own xact */
res = PSQLexec("ROLLBACK", false); res = PSQLexec("ROLLBACK");
PQclear(res); PQclear(res);
} }
@ -209,7 +209,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg)
bufptr += PQescapeStringConn(pset.db, bufptr, comment_arg, slen, NULL); bufptr += PQescapeStringConn(pset.db, bufptr, comment_arg, slen, NULL);
strcpy(bufptr, "'"); strcpy(bufptr, "'");
if (!(res = PSQLexec(cmdbuf, false))) if (!(res = PSQLexec(cmdbuf)))
{ {
free(cmdbuf); free(cmdbuf);
return fail_lo_xact("\\lo_import", own_transaction); return fail_lo_xact("\\lo_import", own_transaction);
@ -301,7 +301,7 @@ do_lo_list(void)
gettext_noop("Description")); gettext_noop("Description"));
} }
res = PSQLexec(buf, false); res = PSQLexec(buf);
if (!res) if (!res)
return false; return false;