Пример #1
0
def DeleteDevice(serial):
    #first verify if it has relations with another device, that is if  in the table exists in connecting with serialp cannot be removed
    query = "select * from conecta where serialp= '%s'" % serial
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete element white serial ", serial, " because has relations whit other device"
    else:
        #We wonder if it exists in the database...
        query = "select * from dispositivo where serial = '%s'" % serial
        if Query.ExistElementInDB(query) == 0:
            print "Delete connection in table conecta"
            #first i have to delete it in the table links ...
            query = "DELETE FROM conecta where serialh = '%s'" % serial
            Query.DeleteDB(query)
            print "Delete device in table device"
            query = "DELETE  FROM dispositivo where serial = '%s'" % serial
            Query.DeleteDB(query)
        else:
            print "Device whit serial input not exists in data base"
Пример #2
0
def DeleteNivel(id_nivel):

    #first we verify if it doesn't have relation with the table rack
    query = "select * from rack where id_nivel = %d" % id_nivel
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete level with id ", id_nivel, " because has relations whit other elements"
    else:
        #We evaluate if the level exists in the database...
        query = "select * from nivel where id_nivel = %d" % id_nivel
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete ...
            print "Delete level"
            query = "DELETE FROM nivel where id_nivel = %d" % id_nivel
            Query.DeleteDB(query)
        else:
            print "Not exists a level whit id ", id_nivel, " registered in data base"
Пример #3
0
def DeleteEdificio(id_edificio):

    #first we verify if it doesn't have relation with the table rack
    query = "select * from rack where id_edif = %d" % id_edificio
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete delete building whit id ", id_edificio, " because has relations whit other elements"
    else:
        #We evaluate if the building exists in the database...
        query = "select * from edificio where id_edif = %d" % id_edificio
        if Query.ExistElementInDB(query) == 0:
            #manage the query...
            print "Delete building"
            query = "DELETE FROM edificio where id_edif = %d" % id_edificio
            Query.DeleteDB(query)
        else:
            print "Not exists a building whit id ", id_edificio, " registered in data base"
Пример #4
0
def DeleteCampus(id_campus):

    #first verify if it doesn't have relation with the table buildings, that is, if building is not referenced to campus with these id...
    query = "select * from edificio where id_campus = %d" % id_campus
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete campus whit id ", id_campus, " because has relations whit other elements"
    else:
        #We ask if the campus exists in the database...
        query = "select * from campus where id_campus = %d" % id_campus
        if Query.ExistElementInDB(query) == 0:
            #manage the consultation ...
            print "Delete campus"
            query = "DELETE FROM campus where id_campus = %d" % id_campus
            Query.DeleteDB(query)
        else:
            print "Not exists a campus whit id ", id_campus, " registered in data base"
Пример #5
0
def DeleteTipoEnlace(id_tipo_enlace):

    #first verify if it has no relations with the table conecta
    query = "select * from conecta where id_tipo_enlace = %d" % id_tipo_enlace
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete kind link whit id ", id_tipo_enlace, " because has relations whit others elements"
    else:
        #We evaluate whether the link type exists in the database...
        query = "select * from tipo_enlace where id_tipo_enlace = %d" % id_tipo_enlace
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete....
            print "Delete kind of link"
            query = "DELETE FROM  tipo_enlace where id_tipo_enlace = %d" % id_tipo_enlace
            Query.DeleteDB(query)
        else:
            print "Not exists kind of link whit id ", id_tipo_enlace, " registered in data base"
Пример #6
0
def DeleteRack(id_rack):

    #first verify if it has no relations with the table device
    query = "select * from dispositivo where id_rack = %d" % id_rack
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete rack whit id ", id_rack, " because has relations whit others elements"
    else:
        #We evaluate whether the rack exists in the database...
        query = "select * from rack where id_rack = %d" % id_rack
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete....
            print "Delete rack"
            query = "DELETE FROM  rack where id_rack = %d" % id_rack
            Query.DeleteDB(query)
        else:
            print "Not exists rack white id ", id_rack, " registered in data base"
Пример #7
0
def DeleteMarca(id_marca):

    #first verify if it has no relations with the table modelo...
    query = "select * from modelo where id_marca = %d" % id_marca
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete marker whit id ", id_marca, " because has relations whit others elements"
    else:
        #we evaluated whether the brand exists in the database
        query = "select * from marca where id_marca = %d" % id_marca
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete....
            print "Delete marker"
            query = "DELETE FROM marca where id_marca = %d" % id_marca
            Query.DeleteDB(query)
        else:
            print "Not exists marker whit id ", id_marca, " registered in data base"
Пример #8
0
def DeleteModelo(id_modelo):

    #first check if it has no relations with the table device
    query = "select * from dispositivo where id_modelo = %d" % id_modelo
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete model with id ", id_modelo, " because has relations whit other elements"
    else:
        #we evaluated whether the model exists in the database
        query = "select * from modelo where id_modelo = %d" % id_modelo
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete
            print "Delete model"
            query = "DELETE FROM modelo where id_modelo = %d" % id_modelo
            Query.DeleteDB(query)
        else:
            print "Not exists model whit id ", id_modelo, " registered in data base"
Пример #9
0
def DeleteTipoDispositivo(id_tipo_disp):

    #first verify if it doesn't have relation with the table modelo
    query = "select * from modelo where id_tipo_disp = %d" % id_tipo_disp
    if Query.ExistElementInDB(query) == 0:
        print "Is not possible delete model whit id ", id_tipo_disp, " because has relations whit other elements"
    else:
        #we evaluate whether the device type in the database
        query = "select * from tipo_disp where id_tipo_disp = %d" % id_tipo_disp
        if Query.ExistElementInDB(query) == 0:
            #manage the query to delete ...
            print "Delete kind of device"
            query = "DELETE FROM tipo_disp where id_tipo_disp = %d" % id_tipo_disp
            Query.DeleteDB(query)
        else:
            print "Not exists a kind device whit id ", id_tipo_disp, " registered in data base"