From 9396802f14c404e294ba7a67dec77b10b7c79bd9 Mon Sep 17 00:00:00 2001 From: Marc G. Fournier Date: Mon, 14 Dec 1998 08:11:17 +0000 Subject: more cleanups...of note, appendStringInfo now performs like sprintf(), where you state a format and arguments. the old behavior required each appendStringInfo to have to have a sprintf() before it if any formatting was required. Also shortened several instances where there were multiple appendStringInfo() calls in a row, doing nothing more then adding one more word to the String, instead of doing them all in one call. --- src/backend/commands/user.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/backend/commands/user.c') diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index a547156ed73..e0c0e51ea13 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -5,11 +5,11 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: user.c,v 1.21 1998/12/14 06:50:18 scrappy Exp $ + * $Id: user.c,v 1.22 1998/12/14 08:11:00 scrappy Exp $ * *------------------------------------------------------------------------- */ -#include /* for sprintf() */ +#include #include #include #include @@ -68,7 +68,7 @@ UpdatePgPwdFile(char *sql) * SEPCHAR character as the delimiter between fields. Then rename the * file to its final name. */ - snprintf(sql, QRY_LENGTH, + snprintf(sql, SQL_LENGTH, "copy %s to '%s' using delimiters %s", ShadowRelationName, tempname, CRYPT_PWD_FILE_SEPCHAR); pg_exec_query(sql); @@ -173,7 +173,7 @@ DefineUser(CreateUserStmt *stmt) (stmt->createdb && *stmt->createdb) ? ",'t','t'" : ",'f','t'", (stmt->createuser && *stmt->createuser) ? ",'t','t'" : ",'f','t'", stmt->password ? stmt->password : "''", - stmt->validUntil ? stmt->valudUntil : ""); + stmt->validUntil ? stmt->validUntil : ""); pg_exec_query(sql); @@ -262,20 +262,20 @@ AlterUser(AlterUserStmt *stmt) if (stmt->createdb) { snprintf(sql, SQL_LENGTH, "%s %susecreatedb='%s'", - stmt->password ? "," : "", - *stmt->createdb ? "t" : "f"); + sql, stmt->password ? "," : "", *stmt->createdb ? "t" : "f"); } if (stmt->createuser) { snprintf(sql, SQL_LENGTH, "%s %susesuper='%s'", - (stmt->password || stmt->createdb) ? "," : "", + sql, (stmt->password || stmt->createdb) ? "," : "", *stmt->createuser ? "t" : "f"); } if (stmt->validUntil) { snprintf(sql, SQL_LENGTH, "%s %svaluntil='%s'", + sql, (stmt->password || stmt->createdb || stmt->createuser) ? "," : "", stmt->validUntil); } -- cgit v1.2.3