Commit efbbbbc8 authored by Fujii Masao's avatar Fujii Masao

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
parent 5ac372fc
...@@ -967,7 +967,7 @@ exec_command(const char *cmd, ...@@ -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) ...@@ -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) ...@@ -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)
{ {
......
...@@ -426,10 +426,6 @@ AcceptResult(const PGresult *result) ...@@ -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) ...@@ -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) ...@@ -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();
......
...@@ -38,7 +38,7 @@ extern void setup_cancel_handler(void); ...@@ -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);
......
This diff is collapsed.
...@@ -73,7 +73,7 @@ start_lo_xact(const char *operation, bool *own_transaction) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment