Postgres::setRenameRole PHP Method

setRenameRole() public method

Adjusts a role's info and renames it
public setRenameRole ( $rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold, $newrolename ) : -3
$rolename The name of the role to adjust
$password A password for the role
$superuser Boolean whether or not the role is a superuser
$createdb Boolean whether or not the role can create databases
$createrole Boolean whether or not the role can create other roles
$inherits Boolean whether or not the role inherits the privileges from parent roles
$login Boolean whether or not the role will be allowed to login
$connlimit Number of concurrent connections the role can make
$expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire
$memberof (array) Roles to which the role will be immediately added as a new member
$members (array) Roles which are automatically added as members of the role
$adminmembers (array) Roles which are automatically added as admin members of the role
$memberofold (array) Original roles whose the role belongs to
$membersold (array) Original roles that are members of the role
$adminmembersold (array) Original roles that are admin members of the role
$newrolename The new name of the role
return -3
    function setRenameRole($rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold, $newrolename)
    {
        $status = $this->beginTransaction();
        if ($status != 0) {
            return -1;
        }
        if ($rolename != $newrolename) {
            $status = $this->renameRole($rolename, $newrolename);
            if ($status != 0) {
                $this->rollbackTransaction();
                return -3;
            }
            $rolename = $newrolename;
        }
        $status = $this->setRole($rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold);
        if ($status != 0) {
            $this->rollbackTransaction();
            return -2;
        }
        return $this->endTransaction();
    }
Postgres