def do_show_topic(self, arg): """ Command: show_topic Description: Show all topics """ if len(arg) != 0: print_error_param_num() return cursor = self.connection.cursor() query = "select * from Topics" cursor.execute(query) print("\nHeader:\n('TopicID')\nData:") print_cursor(cursor) cursor.close()
def do_show_group(self, arg): """ Command: show_group Description: Show all groups """ if len(arg) != 0: print_error_param_num() return cursor = self.connection.cursor() query = "select * from UserGroups" cursor.execute(query) print("\nHeader:\n('GroupID', 'Name', 'CreatedBy')\nData:") print_cursor(cursor) cursor.close()
def do_show_user(self, arg): """ Command: show_user Description: List out all usernames """ if len(arg) != 0: print_error_param_num() return cursor = self.connection.cursor() query = "select * from Users" cursor.execute(query) print("\nHeader:\n('UserID', 'Name', 'Birthday')\nData:") print_cursor(cursor) cursor.close()
def do_show_follow_topic(self, arg): """ Command: show_follow_topic Description: Show all topics you are following """ if len(arg) != 0: print_error_param_num() return if self.login_status == False: print_error_not_login() return cursor = self.connection.cursor() query = "select * from UserFollowsTopic where UserID = \"{}\"".format( self.user_id ) cursor.execute(query) print("\nlist of topic id you are currently following:\n") print_cursor(cursor, 1) cursor.close()