Fix buggy method Postgres.php:beginDump() that was calling its non-existant (anymore...
authorioguix <ioguix@free.fr>
Thu, 26 Aug 2010 21:56:44 +0000 (23:56 +0200)
committerioguix <ioguix@free.fr>
Thu, 26 Aug 2010 21:56:44 +0000 (23:56 +0200)
classes/database/Postgres.php

index db263484e60c831a7de45c67472383ca029c7fa3..430717b2242da049228f32a2d78434980c176a8a 100755 (executable)
@@ -2329,9 +2329,26 @@ class Postgres extends ADODB_base {
         * @return 0 success
         */
        function beginDump() {
-               $status = parent::beginDump();
-               if ($status != 0) return $status;
+               // Begin serializable transaction (to dump consistent data)
+               $status = $this->beginTransaction();
+               if ($status != 0) return -1;
 
+               // Set serializable
+               $sql = "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE";
+               $status = $this->execute($sql);
+               if ($status != 0) {
+                       $this->rollbackTransaction();
+                       return -1;
+               }
+
+               // Set datestyle to ISO
+               $sql = "SET DATESTYLE = ISO";
+               $status = $this->execute($sql);
+               if ($status != 0) {
+                       $this->rollbackTransaction();
+                       return -1;
+               }
+               
                // Set extra_float_digits to 2
                $sql = "SET extra_float_digits TO 2";
                $status = $this->execute($sql);
@@ -2339,7 +2356,9 @@ class Postgres extends ADODB_base {
                        $this->rollbackTransaction();
                        return -1;
                }
-               }
+               
+               return 0;
+       }
 
        /**
         * Ends the data object for a dump.