Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2013-11-18 16:29:01 +0000
committerHeikki Linnakangas2013-11-18 16:34:51 +0000
commit32ceba3ea730b6b1bd3eca786f72d61945ad42b7 (patch)
tree4370209d2561aeff498b30303ead012e162f2cd9 /src/bin/scripts
parentf1df4731eea6bc05e0769e9cc789e7304722efe4 (diff)
Replace appendPQExpBuffer(..., <constant>) with appendPQExpBufferStr
Arguably makes the code a bit more readable, and might give a small performance gain. David Rowley
Diffstat (limited to 'src/bin/scripts')
-rw-r--r--src/bin/scripts/clusterdb.c6
-rw-r--r--src/bin/scripts/createdb.c4
-rw-r--r--src/bin/scripts/createuser.c32
-rw-r--r--src/bin/scripts/reindexdb.c4
-rw-r--r--src/bin/scripts/vacuumdb.c18
5 files changed, 32 insertions, 32 deletions
diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c
index 0ac213d3c31..cd54e8f47f7 100644
--- a/src/bin/scripts/clusterdb.c
+++ b/src/bin/scripts/clusterdb.c
@@ -196,12 +196,12 @@ cluster_one_database(const char *dbname, bool verbose, const char *table,
initPQExpBuffer(&sql);
- appendPQExpBuffer(&sql, "CLUSTER");
+ appendPQExpBufferStr(&sql, "CLUSTER");
if (verbose)
- appendPQExpBuffer(&sql, " VERBOSE");
+ appendPQExpBufferStr(&sql, " VERBOSE");
if (table)
appendPQExpBuffer(&sql, " %s", table);
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
conn = connectDatabase(dbname, host, port, username, prompt_password,
progname, false);
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index 5b28f18a81a..14cd1284906 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
if (lc_ctype)
appendPQExpBuffer(&sql, " LC_CTYPE '%s'", lc_ctype);
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
/* No point in trying to use postgres db when creating postgres db. */
if (maintenance_db == NULL && strcmp(dbname, "postgres") == 0)
@@ -222,7 +222,7 @@ main(int argc, char *argv[])
{
printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname));
appendStringLiteralConn(&sql, comment, conn);
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index d1542d945ac..83623ea8792 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -254,10 +254,10 @@ main(int argc, char *argv[])
if (newpassword)
{
if (encrypted == TRI_YES)
- appendPQExpBuffer(&sql, " ENCRYPTED");
+ appendPQExpBufferStr(&sql, " ENCRYPTED");
if (encrypted == TRI_NO)
- appendPQExpBuffer(&sql, " UNENCRYPTED");
- appendPQExpBuffer(&sql, " PASSWORD ");
+ appendPQExpBufferStr(&sql, " UNENCRYPTED");
+ appendPQExpBufferStr(&sql, " PASSWORD ");
if (encrypted != TRI_NO)
{
@@ -277,32 +277,32 @@ main(int argc, char *argv[])
appendStringLiteralConn(&sql, newpassword, conn);
}
if (superuser == TRI_YES)
- appendPQExpBuffer(&sql, " SUPERUSER");
+ appendPQExpBufferStr(&sql, " SUPERUSER");
if (superuser == TRI_NO)
- appendPQExpBuffer(&sql, " NOSUPERUSER");
+ appendPQExpBufferStr(&sql, " NOSUPERUSER");
if (createdb == TRI_YES)
- appendPQExpBuffer(&sql, " CREATEDB");
+ appendPQExpBufferStr(&sql, " CREATEDB");
if (createdb == TRI_NO)
- appendPQExpBuffer(&sql, " NOCREATEDB");
+ appendPQExpBufferStr(&sql, " NOCREATEDB");
if (createrole == TRI_YES)
- appendPQExpBuffer(&sql, " CREATEROLE");
+ appendPQExpBufferStr(&sql, " CREATEROLE");
if (createrole == TRI_NO)
- appendPQExpBuffer(&sql, " NOCREATEROLE");
+ appendPQExpBufferStr(&sql, " NOCREATEROLE");
if (inherit == TRI_YES)
- appendPQExpBuffer(&sql, " INHERIT");
+ appendPQExpBufferStr(&sql, " INHERIT");
if (inherit == TRI_NO)
- appendPQExpBuffer(&sql, " NOINHERIT");
+ appendPQExpBufferStr(&sql, " NOINHERIT");
if (login == TRI_YES)
- appendPQExpBuffer(&sql, " LOGIN");
+ appendPQExpBufferStr(&sql, " LOGIN");
if (login == TRI_NO)
- appendPQExpBuffer(&sql, " NOLOGIN");
+ appendPQExpBufferStr(&sql, " NOLOGIN");
if (replication == TRI_YES)
- appendPQExpBuffer(&sql, " REPLICATION");
+ appendPQExpBufferStr(&sql, " REPLICATION");
if (replication == TRI_NO)
- appendPQExpBuffer(&sql, " NOREPLICATION");
+ appendPQExpBufferStr(&sql, " NOREPLICATION");
if (conn_limit != NULL)
appendPQExpBuffer(&sql, " CONNECTION LIMIT %s", conn_limit);
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c
index 342e4c94d1a..f7c09bebf8a 100644
--- a/src/bin/scripts/reindexdb.c
+++ b/src/bin/scripts/reindexdb.c
@@ -246,14 +246,14 @@ reindex_one_database(const char *name, const char *dbname, const char *type,
initPQExpBuffer(&sql);
- appendPQExpBuffer(&sql, "REINDEX");
+ appendPQExpBufferStr(&sql, "REINDEX");
if (strcmp(type, "TABLE") == 0)
appendPQExpBuffer(&sql, " TABLE %s", name);
else if (strcmp(type, "INDEX") == 0)
appendPQExpBuffer(&sql, " INDEX %s", name);
else if (strcmp(type, "DATABASE") == 0)
appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name));
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
conn = connectDatabase(dbname, host, port, username, prompt_password,
progname, false);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index e4dde1fc9bf..616d9339e1e 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -248,13 +248,13 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
if (analyze_only)
{
- appendPQExpBuffer(&sql, "ANALYZE");
+ appendPQExpBufferStr(&sql, "ANALYZE");
if (verbose)
- appendPQExpBuffer(&sql, " VERBOSE");
+ appendPQExpBufferStr(&sql, " VERBOSE");
}
else
{
- appendPQExpBuffer(&sql, "VACUUM");
+ appendPQExpBufferStr(&sql, "VACUUM");
if (PQserverVersion(conn) >= 90000)
{
const char *paren = " (";
@@ -282,23 +282,23 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
sep = comma;
}
if (sep != paren)
- appendPQExpBuffer(&sql, ")");
+ appendPQExpBufferStr(&sql, ")");
}
else
{
if (full)
- appendPQExpBuffer(&sql, " FULL");
+ appendPQExpBufferStr(&sql, " FULL");
if (freeze)
- appendPQExpBuffer(&sql, " FREEZE");
+ appendPQExpBufferStr(&sql, " FREEZE");
if (verbose)
- appendPQExpBuffer(&sql, " VERBOSE");
+ appendPQExpBufferStr(&sql, " VERBOSE");
if (and_analyze)
- appendPQExpBuffer(&sql, " ANALYZE");
+ appendPQExpBufferStr(&sql, " ANALYZE");
}
}
if (table)
appendPQExpBuffer(&sql, " %s", table);
- appendPQExpBuffer(&sql, ";\n");
+ appendPQExpBufferStr(&sql, ";\n");
if (!executeMaintenanceCommand(conn, sql.data, echo))
{