Commit a7cba471 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added 'getStorageList()' method.

parent d2b8fe7d
Loading
Loading
Loading
Loading
+46 −40
Original line number Diff line number Diff line
@@ -97,15 +97,21 @@ class DbConnector(object):
    def getRapId(self, username):
        """Returns the RAP id for a given user name."""
        if self.conn:
            self.cursor.execute("SELECT rap_id FROM Users WHERE user_name = %s;", (username,))            
            self.cursor.execute("SELECT rap_id FROM users WHERE user_name = %s;", (username,))
            return self.cursor.fetchall()[0]["rap_id"]

    def getUserName(self, rapId):
        """Returns the user name for a given RAP id."""
        if self.conn:
            self.cursor.execute("SELECT user_name FROM Users WHERE rap_id = %s;", (rapId,))            
            self.cursor.execute("SELECT user_name FROM users WHERE rap_id = %s;", (rapId,))
            return self.cursor.fetchall()[0]["user_name"]

    def getStorageList(self, storageType):
        """Returns a list of storage locations for a given storage type"""
        if self.conn:
            self.cursor.execute("SELECT * FROM storage WHERE storage_type = %s;", (storageType,))
            return self.cursor.fetchall()

    """
    Setters
    """