예제 #1
0
    def check_company(self, cname):

        self.cursor.execute("SELECT company_name FROM company WHERE company_name='{}' ".format(cname))
        company = dictfetchall(self.cursor)
        if len(company) <= 0:
            return False
        else:
            return True
예제 #2
0
    def list_company(self):

        self.cursor.execute("SELECT company_name FROM company ORDER BY created_date DESC ")
        company = dictfetchall(self.cursor)
        if len(company) <= 0:
            return False
        else:
            return company
예제 #3
0
 def get_all_games(self):
     try:
         self.cursor.execute(
             "SELECT name, logo, price, content, id FROM game")
     except:
         return False
     games = dictfetchall(self.cursor)
     return games
예제 #4
0
    def list_category(self):
        try:
            self.cursor.execute("Select genre_name from genre ")

        except:
            return False

        category = dictfetchall(self.cursor)
        return category
예제 #5
0
    def list_platform(self):
        try:
            self.cursor.execute("Select platform_name from platform")

        except:
            return False

        platform = dictfetchall(self.cursor)
        return platform
예제 #6
0
    def check_game(self, gname):

        self.cursor.execute(
            "SELECT name FROM game WHERE name='{}' ".format(gname))
        company = dictfetchall(self.cursor)
        if len(company) <= 0:
            return False
        else:
            return True
예제 #7
0
 def get_game_byid(self, game_id):
     try:
         self.cursor.execute(
             "SELECT name, logo, price, id FROM game WHERE id = {}".format(
                 game_id))
     except:
         return False
     game = dictfetchall(self.cursor)
     return game
예제 #8
0
 def game_search(self, search_text):
     try:
         self.cursor.execute(
             "select name from game where name ilike '%{}%'".format(
                 str(search_text)))
     except:
         return False
     games = dictfetchall(self.cursor)
     return games
예제 #9
0
 def find_user(self, username):
     """ Gets the user for given username and returns user
         Returns false if the user does not exist """
     ''' Sercan : 13.07.2017 '''
     self.cursor.execute("SELECT email, full_name FROM users WHERE username='******'".format(username))
     user = dictfetchall(self.cursor)
     if len(user) <= 0:
         return False
     else:
         return user
예제 #10
0
    def list_game(self):
        try:
            """Inner join ile company_name pltform_name genre_name game tablosu ile cekildi"""
            self.cursor.execute(
                "select game.*,company.company_name,platform.platform_name,genre.genre_name from game INNER JOIN company ON game.company_id = company.id INNER JOIN platform ON game.platform_id = platform.id INNER JOIN genre on game.genre_id = genre.id ORDER BY game.update_date DESC ;"
            )
        except:
            return False

        game = dictfetchall(self.cursor)
        return game
예제 #11
0
    def check_user(self):
        """ Check whether the corresponding user exists or not
            If user exists returns True, if not returns False """
        ''' Sercan : 13.07.2017 '''
        t1 = self.request_object['username']
        t2 = self.request_object['email']

        self.cursor.execute("SELECT username FROM users WHERE username='******' or email='{}'".format(t1, str(t2)))
        user = dictfetchall(self.cursor)
        if len(user) <= 0:
            return False
        else:
            return True
예제 #12
0
 def login_event(self):
     """ Checks if the username and password matches in the database
         Returns username as a dictionary """
     ''' Sercan : 12.07.2017'''
     t1 = self.request_object['username']
     t2 = self.request_object['password']
     if ("'" in t1 or "'" in t2):
         return False
     self.cursor.execute(
         "SELECT username, admin_id FROM users WHERE username='******' AND password='******'"
         .format(t1, str(t2)))
     user = dictfetchall(self.cursor)
     return user
예제 #13
0
 def list_users(self):
     """ Returns all users as a list of dictionaries"""
     ''' Sercan : 13.07.2017 '''
     self.cursor.execute("SELECT username, email, full_name, status_id, admin_id FROM users ORDER BY c_date DESC ")
     users = dictfetchall(self.cursor)
     return users
예제 #14
0
 def xbox_games(self, id):
     if (id == 4):
         self.cursor.execute(
             "select name from game where platform_id = {}".format(id))
         return dictfetchall(self.cursor)