|
3 | 3 | * |
4 | 4 | * Copyright 2000-2002 by PostgreSQL Global Development Group |
5 | 5 | * |
6 | | - * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.24 2003/03/20 06:43:35 momjian Exp $ |
| 6 | + * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.25 2003/04/18 23:38:47 tgl Exp $ |
7 | 7 | */ |
8 | 8 | #include"postgres_fe.h" |
9 | 9 | #include"large_obj.h" |
@@ -45,14 +45,15 @@ handle_transaction(void) |
45 | 45 | PQnoticeProcessorold_notice_hook; |
46 | 46 |
|
47 | 47 | switch (SwitchVariable(pset.vars,"LO_TRANSACTION", |
48 | | -"nothing", |
49 | | -"commit", |
50 | | -NULL)) |
| 48 | +"nothing", |
| 49 | +"commit", |
| 50 | +NULL)) |
51 | 51 | { |
52 | | -case1: |
53 | | -return true; |
54 | | -case2: |
55 | | -commit= true; |
| 52 | +case1:/* nothing */ |
| 53 | +return true; |
| 54 | +case2:/* commit */ |
| 55 | +commit= true; |
| 56 | +break; |
56 | 57 | } |
57 | 58 |
|
58 | 59 | notice[0]='\0'; |
@@ -94,7 +95,7 @@ do_lo_export(const char *loid_arg, const char *filename_arg) |
94 | 95 | intstatus; |
95 | 96 | boolown_transaction; |
96 | 97 |
|
97 | | -own_transaction=VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
| 98 | +own_transaction=!VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
98 | 99 |
|
99 | 100 | if (!pset.db) |
100 | 101 | { |
@@ -159,7 +160,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg) |
159 | 160 | unsignedinti; |
160 | 161 | boolown_transaction; |
161 | 162 |
|
162 | | -own_transaction=VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
| 163 | +own_transaction=!VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
163 | 164 |
|
164 | 165 | if (!pset.db) |
165 | 166 | { |
@@ -272,10 +273,9 @@ do_lo_unlink(const char *loid_arg) |
272 | 273 | intstatus; |
273 | 274 | Oidloid=atooid(loid_arg); |
274 | 275 | charbuf[256]; |
275 | | - |
276 | 276 | boolown_transaction; |
277 | 277 |
|
278 | | -own_transaction=VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
| 278 | +own_transaction=!VariableEquals(pset.vars,"LO_TRANSACTION","nothing"); |
279 | 279 |
|
280 | 280 | if (!pset.db) |
281 | 281 | { |
@@ -311,9 +311,10 @@ do_lo_unlink(const char *loid_arg) |
311 | 311 | /* XXX ought to replace this with some kind of COMMENT command */ |
312 | 312 | if (pset.issuper) |
313 | 313 | { |
314 | | -sprintf(buf,"DELETE FROM pg_catalog.pg_description WHERE objoid = '%u' " |
315 | | -"AND classoid = 'pg_catalog.pg_largeobject'::regclass", |
316 | | -loid); |
| 314 | +snprintf(buf,sizeof(buf), |
| 315 | +"DELETE FROM pg_catalog.pg_description WHERE objoid = '%u' " |
| 316 | +"AND classoid = 'pg_catalog.pg_largeobject'::regclass", |
| 317 | +loid); |
317 | 318 | if (!(res=PSQLexec(buf, false))) |
318 | 319 | { |
319 | 320 | if (own_transaction) |
|