File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ Basically it is same as BSD license. See pgbench.c for more details.
164164
165165o History
166166
167+ 2003/06/10
168+ * fix uninitialized memory bug
169+ * add support for PGHOST, PGPORT, PGUSER environment variables
170+
1671712002/07/20
168172 * patch contributed by Neil Conway.
169173 * code/document clean up and add -l option.
Original file line number Diff line number Diff line change @@ -184,6 +184,10 @@ pgbench $B$O@P0f(B $BC#IW$K$h$C$F=q$+$l$^$7$?!%%i%$%;%s%9>r7o$O(B pgbench.c
184184
185185$B"#2~DjMzNr(B
186186
187+ 2003/06/10
188+ * $B%a%b%j$,=i4|2=$5$l$F$$$J$$%P%0$r=$@5(B
189+ * $B4D6-JQ?t(BPGHOST, PGPORT, PGUSER$B$rG'<1$9$k$h$&$K$7$?!%(B
190+
1871912002/07/20
188192 * Nei Conway$B$5$s$N%Q%C%A$rE,MQ!%(B
189193 * -l $B%*%W%7%g%s$NDI2C!%(B
Original file line number Diff line number Diff line change 11/*
2- * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.23 2003/05/14 03:25:56 tgl Exp $
2+ * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.24 2003/06/10 09:07:15 ishii Exp $
33 *
44 * pgbench: a simple TPC-B like benchmark program for PostgreSQL
55 * written by Tatsuo Ishii
@@ -694,6 +694,14 @@ main(int argc, char **argv)
694694
695695 PGconn * con ;
696696 PGresult * res ;
697+ char * env ;
698+
699+ if ((env = getenv ("PGHOST" )) != NULL && * env != '\0' )
700+ pghost = env ;
701+ if ((env = getenv ("PGPORT" )) != NULL && * env != '\0' )
702+ pgport = env ;
703+ else if ((env = getenv ("PGUSER" )) != NULL && * env != '\0' )
704+ login = env ;
697705
698706 while ((c = getopt (argc , argv , "ih:nvp:dc:t:s:U:P:CNSl" )) != -1 )
699707 {
@@ -788,8 +796,11 @@ main(int argc, char **argv)
788796 dbName = argv [optind ];
789797 else
790798 {
791- dbName = getenv ("USER" );
792- if (dbName == NULL )
799+ if ((env = getenv ("PGDATABASE" )) != NULL && * env != '\0' )
800+ dbName = env ;
801+ else if (login != NULL && * login != '\0' )
802+ dbName = login ;
803+ else
793804 dbName = "" ;
794805 }
795806
@@ -802,7 +813,7 @@ main(int argc, char **argv)
802813 remains = nclients ;
803814
804815 state = (CState * ) malloc (sizeof (* state ) * nclients );
805- memset (state , 0 , sizeof (* state ));
816+ memset (state , 0 , sizeof (* state ) * nclients );
806817
807818 if (use_log )
808819 {
You can’t perform that action at this time.
0 commit comments