src/snac/server/database/SQL.php
/**
     * Select the id and role for a given appuser.
     *
     * Maybe this should be called selectAppUserInfo() in keeping
     * with naming conventions for the other methods. Also the return values are in a flat array, and might
     * better be return in an assoc list where the keys are based on our usual conventions.
     *
     * @param string $userString A string value of the users unique username which is appuser.username.
     *
     * @return integer[] A flat list of the appuser.id and related role.id, both are numeric.
     *
     */
Select the id and role for a given appuser.
Maybe this should be called selectAppUserInfo() in keeping
with naming conventions for the other methods. Also the return values are in a flat array, and might
better be return in an assoc list where the keys are based on our usual conventions.

@param string $userString A string value of the users unique username which is appuser.username.

@return integer[] A flat list of the appuser.id and related role.id, both are numeric.
Select the id and role for a given appuser . Maybe this should be called selectAppUserInfo () in keeping with naming conventions for the other methods . Also the return values are in a flat array and might better be return in an assoc list where the keys are based on our usual conventions . @param string $userString A string value of the users unique username which is appuser . username . @return integer [] A flat list of the appuser . id and related role . id both are numeric .
public function selectAppUserInfo($userString)
    {
        $qq = 'get_app_user_info';
        $this->sdb->prepare($qq,
                            'select appuser.id as id,role.id as role from appuser, appuser_role_link, role
                            where
                            appuser.username=$1
                            and appuser.id=appuser_role_link.uid
                            and role.id = appuser_role_link.rid
                            and appuser_role_link.is_primary=true');
        $result = $this->sdb->execute($qq, array($userString));
        $row = $this->sdb->fetchrow($result);
        $this->sdb->deallocate($qq);
        return array($row['id'], $row['role']);
    }
public function selectAppUserInfo ( $ userString ) { $ qq = 'get_app_user_info' ; $ this -> sdb -> prepare ( $ qq , 'select appuser.id as id,role.id as role from appuser, appuser_role_link, role
                            where
                            appuser.username=$1
                            and appuser.id=appuser_role_link.uid
                            and role.id = appuser_role_link.rid
                            and appuser_role_link.is_primary=true' ) ; $ result = $ this -> sdb -> execute ( $ qq , array ( $ userString ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; $ this -> sdb -> deallocate ( $ qq ) ; return array ( $ row [ 'id' ] , $ row [ 'role' ] ) ; }
Select the id and role for a given appuser.
Select the id and role for a given appuser .
/*
         * $result behaves a bit like a cursor. Php docs say the data is in memory, and that a cursor is not
         * used.
         */