Do not set connection values if no connection is open.
authorMichael Meskes
Thu, 3 Sep 2009 09:09:01 +0000 (09:09 +0000)
committerMichael Meskes
Thu, 3 Sep 2009 09:09:01 +0000 (09:09 +0000)
src/interfaces/ecpg/ecpglib/misc.c

index 1a261252538d03d18e1ae496a4df4fed76e3e78d..f70e3734ba5f24d959256711874e3b830bc4ee70 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.50 2009/08/07 10:51:20 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.51 2009/09/03 09:09:01 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -202,12 +202,12 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
        if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL))
            return FALSE;
        PQclear(res);
-   }
 
-   if (strncmp(transaction, "commit", 6) == 0 || strncmp(transaction, "rollback", 8) == 0)
-       con->committed = true;
-   else
-       con->committed = false;
+       if (strncmp(transaction, "commit", 6) == 0 || strncmp(transaction, "rollback", 8) == 0)
+           con->committed = true;
+       else
+           con->committed = false;
+   }
 
    return true;
 }