|
3 | 3 | *
|
4 | 4 | * Copyright (c) 2000-2005, PostgreSQL Global Development Group
|
5 | 5 | *
|
6 |
| - * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.129 2005/12/18 02:17:16 petere Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.130 2006/02/12 04:04:32 momjian Exp $ |
7 | 7 | */
|
8 | 8 | #include"postgres_fe.h"
|
9 | 9 |
|
@@ -76,6 +76,7 @@ struct adhoc_opts
|
76 | 76 | char*action_string;
|
77 | 77 | boolno_readline;
|
78 | 78 | boolno_psqlrc;
|
| 79 | +boolsingle_txn; |
79 | 80 | };
|
80 | 81 |
|
81 | 82 | staticintparse_version(constchar*versionString);
|
@@ -268,7 +269,7 @@ main(int argc, char *argv[])
|
268 | 269 | if (!options.no_psqlrc)
|
269 | 270 | process_psqlrc(argv[0]);
|
270 | 271 |
|
271 |
| -successResult=process_file(options.action_string); |
| 272 | +successResult=process_file(options.action_string,options.single_txn); |
272 | 273 | }
|
273 | 274 |
|
274 | 275 | /*
|
@@ -425,6 +426,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
|
425 | 426 | {"list",no_argument,NULL,'l'},
|
426 | 427 | {"log-file",required_argument,NULL,'L'},
|
427 | 428 | {"no-readline",no_argument,NULL,'n'},
|
| 429 | +{"single-transaction",no_argument,NULL,'1'}, |
428 | 430 | {"output",required_argument,NULL,'o'},
|
429 | 431 | {"port",required_argument,NULL,'p'},
|
430 | 432 | {"pset",required_argument,NULL,'P'},
|
@@ -453,7 +455,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
|
453 | 455 |
|
454 | 456 | memset(options,0,sizeof*options);
|
455 | 457 |
|
456 |
| -while ((c=getopt_long(argc,argv,"aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:uU:v:VWxX?", |
| 458 | +while ((c=getopt_long(argc,argv,"aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:uU:v:VWxX?1", |
457 | 459 | long_options,&optindex))!=-1)
|
458 | 460 | {
|
459 | 461 | switch (c)
|
@@ -606,6 +608,9 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
|
606 | 608 | case'X':
|
607 | 609 | options->no_psqlrc= true;
|
608 | 610 | break;
|
| 611 | +case'1': |
| 612 | +options->single_txn= true; |
| 613 | +break; |
609 | 614 | case'?':
|
610 | 615 | /* Actual help option given */
|
611 | 616 | if (strcmp(argv[optind-1],"-?")==0||strcmp(argv[optind-1],"--help")==0)
|
@@ -690,9 +695,9 @@ process_psqlrc_file(char *filename)
|
690 | 695 | sprintf(psqlrc,"%s-%s",filename,PG_VERSION);
|
691 | 696 |
|
692 | 697 | if (access(psqlrc,R_OK)==0)
|
693 |
| -(void)process_file(psqlrc); |
| 698 | +(void)process_file(psqlrc, false); |
694 | 699 | elseif (access(filename,R_OK)==0)
|
695 |
| -(void)process_file(filename); |
| 700 | +(void)process_file(filename, false); |
696 | 701 | free(psqlrc);
|
697 | 702 | }
|
698 | 703 |
|
|