def testAnimal():
    cmd = """
        INSERT INTO 
            Animal (Name, Type)
        VALUES
            ('Cat', 3);
    """
    return sql.EXEC(cmd)
Exemplo n.º 2
0
def addPet(aUser, aStat):  # adds a 'pet' to the database
    sql.EXEC(("""
		INSERT INTO 
			Interactions (User, aStatus)
		VALUES
			('{0}','{1}');
	""").format(aUser, aStat))
    return
def update_MediaType(mediaID, typeID):
    cmd = """
    UPDATE Media
    SET MediaType = {}
    WHERE ID = {};
    """.format(typeID, mediaID)

    return sql.EXEC(cmd)
def update_MediaCategory(mediaID, categoryID):
    cmd = """
    UPDATE Media
    SET MediaCategory = {}
    WHERE ID = {};
    """.format(categoryID, mediaID)

    return sql.EXEC(cmd)
Exemplo n.º 5
0
def insertIssue(server, stat,
                userID):  # adds am Issue as a server number and status
    sql.EXEC(("""
		INSERT INTO 
			Issues (ServerNumber, ServerStatus, SlackID) 
		VALUES
			({0},'{1}', '{2}');
	""").format(server, stat, userID))
    return
def returnAll(slackID):
    cmd = """
    UPDATE 
    Transactions
    SET
    CheckIN = datetime('now','localtime')
    WHERE
    SlackID = '{0}'
    AND CheckIN is null;
    """.format(slackID)

    return sql.EXEC(cmd)
def Media_adminCheckIN(mediaID):
    cmd = """
    UPDATE 
    Transactions
    SET
    CheckIN = datetime('now','localtime')
    WHERE
    MediaID = {0}
    AND CheckIN is null;
    """.format(mediaID)

    return sql.EXEC(cmd)
def Media_adminCheckOUT(mediaID, slackID):
    if isItemCheckedOut(mediaID):  # can't check out something twice ... I hope
        return 5

    cmd = """
    INSERT INTO 
    Transactions
    (MediaID, SlackID, CheckOUT)
    VALUES
    ({0},'{1}', datetime('now','localtime'));
    """.format(mediaID, slackID)

    return sql.EXEC(cmd)
def Media_CheckOUT(mediaID, slackID):
    if isItemCheckedOut(mediaID):  # can't check out something twice
        return 5

    if tooManyOut(slackID):  # can only check out a cuople of items
        return 4

    cmd = """
    INSERT INTO 
    Transactions
    (MediaID, SlackID, CheckOUT)
    VALUES
    ({0},'{1}', datetime('now','localtime'));
    """.format(mediaID, slackID)

    return sql.EXEC(cmd)
Exemplo n.º 10
0
def Media_CheckIN(mediaID, slackID):
    if not isItemCheckedOut(mediaID): # if this doesn't work, you'll need an admin
        return 7

    cmd = """
    UPDATE 
    Transactions
    SET
    CheckIN = datetime('now','localtime')
    WHERE
    MediaID = {0}
    AND SlackID = '{1}'
    AND CheckIN is null;
    """.format(mediaID, slackID)

    return sql.EXEC(cmd)
def createAnimaltable(tableName):
    cmd = ""
    sql.EXEC(cmd)