SOURCES: phpPgAdmin-alter-db.patch (NEW) - from phpPgAdmin CVS: ...

hawk hawk at pld-linux.org
Wed Aug 29 14:19:24 CEST 2007


Author: hawk                         Date: Wed Aug 29 12:19:24 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- from phpPgAdmin CVS:
  Bugfix: alterDatabase for 8.2 didn't use transactions and didn't change the owner.

---- Files affected:
SOURCES:
   phpPgAdmin-alter-db.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/phpPgAdmin-alter-db.patch
diff -u /dev/null SOURCES/phpPgAdmin-alter-db.patch:1.1
--- /dev/null	Wed Aug 29 14:19:24 2007
+++ SOURCES/phpPgAdmin-alter-db.patch	Wed Aug 29 14:19:19 2007
@@ -0,0 +1,52 @@
+--- classes/database/Postgres82.php	2006/12/31 19:06:16	1.4
++++ classes/database/Postgres82.php	2007/03/28 18:52:34	1.5
+@@ -112,21 +112,41 @@
+ 	 * @return -3 rename error
+ 	 * @return -4 comment error
+ 	 */
+-	function alterDatabase($dbName, $newName, $newOwner = '',$comment = '')
++	function alterDatabase($dbName, $newName, $newOwner = '', $comment = '')
+ 	{
+-		//ignore $newowner, not supported pre 8.0
+-		//ignore $comment, not supported pre 8.2
+ 		$this->clean($dbName);
+ 		$this->clean($newName);
++		$this->clean($newOwner);
++		$this->clean($comment);
+ 		
+-		$status = $this->alterDatabaseRename($dbName, $newName);
+-		if ($status != 0) return -3;
++		$status = $this->beginTransaction();
++		if ($status != 0) {
++			$this->rollbackTransaction();
++			return -1;
++		}
++		
++		if ($dbName != $newName) {
++			$status = $this->alterDatabaseRename($dbName, $newName);
++			if ($status != 0) {
++				$this->rollbackTransaction();
++				return -3;
++			}
++		}
++
++		$status = $this->alterDatabaseOwner($newName, $newOwner);
++		if ($status != 0) {
++			$this->rollbackTransaction();
++			return -2;
++		}
+ 
+ 		if (trim($comment) != '' ) {	
+-			$status = $this->setComment('DATABASE',$dbName,'', $comment);
+-			if ($status != 0) return -4;
++			$status = $this->setComment('DATABASE', $dbName, '', $comment);
++			if ($status != 0) {
++				$this->rollbackTransaction();
++				return -4;
++			}
+ 		}
+-		else return 0;
++		return $this->endTransaction();
+ 	}
+ 
+ 	/**
================================================================


More information about the pld-cvs-commit mailing list