Esempio n. 1
0
def registerPlayer(name):
    """Adds a player to the tournament database.

    Args:
      name: the player's full name (need not be unique).
    """
    cursor = DB().cursor()
    # Get already escaped SQL statement
    query = cursor.mogrify("INSERT INTO players (name) VALUES (%s)", (name,))
    DB().execute(query, True)
Esempio n. 2
0
def reportMatch(winner, loser):
    """Records the outcome of a single match between two players.

    Args:
      winner:  the id number of the player who won
      loser:  the id number of the player who lost
    """
    cursor = DB().cursor()
    query = cursor.mogrify(
        "INSERT INTO matches (winner, loser) VALUES (%s, %s)", (winner, loser))
    DB().execute(query, True)