Пример #1
0
def add_immobile_object(data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(
        Q.ADD_IMMOBILE_OBJECT % (data['name'], data.get(
            'phone', ''), data['latitude'], data['longitude']))
    db_wrapper.dispose()
    return result
Пример #2
0
def update_immobile_object(id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(
        Q.UPDATE_IMMOBILE_OBJECT % (data['name'], data.get(
            'phone', ''), data['latitude'], data['longitude'], id))
    db_wrapper.dispose()
    return result
Пример #3
0
def search_movables_objects(pattern):
    db_wrapper = DBWrapper()
    objects = db_wrapper.fetch_all(
        Q.SEARCH_MOVABLES.replace('PATTERN',
                                  pattern.strip().lower()))
    db_wrapper.dispose()
    return map(converters.convert_movable, objects)
Пример #4
0
def add_location_point(movable_object_id, hour, minute, second, latitude,
                       longitude):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(
        Q.ADD_LOCATION_POINT %
        (movable_object_id, hour, minute, second, latitude, longitude))
    db_wrapper.dispose()
    return result
Пример #5
0
def add_movable_object(movable_type_id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_MOVABLE_OBJECT % (data['name'], movable_type_id))
    db_wrapper.dispose()
    return result
Пример #6
0
def add_movable_type(data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_MOVABLE_TYPE % (data['name']))
    db_wrapper.dispose()
    return result
Пример #7
0
def update_movable_type(id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.UPDATE_MOVABLE_TYPE % (data['name'], id))
    db_wrapper.dispose()
    return result
Пример #8
0
def add_movable_object(movable_type_id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_MOVABLE_OBJECT %
                                (data['name'], movable_type_id))
    db_wrapper.dispose()
    return result
Пример #9
0
def update_movable_object(id, movable_type_id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.UPDATE_MOVABLE_OBJECT %
                                (data['name'], movable_type_id, id))
    db_wrapper.dispose()
    return result
Пример #10
0
def get_immobile_object(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_IMMOBILE_OBJECT % id)
    db_wrapper.dispose()
    return converters.convert_immobile(result)
Пример #11
0
def get_immobile_object(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_IMMOBILE_OBJECT % id)
    db_wrapper.dispose()
    return converters.convert_immobile(result)
Пример #12
0
def update_movable_type(id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.UPDATE_MOVABLE_TYPE % (data['name'], id))
    db_wrapper.dispose()
    return result
Пример #13
0
def add_location_point(movable_object_id , hour, minute, second, latitude, longitude):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_LOCATION_POINT % (movable_object_id , hour, minute, second, latitude, longitude))
    db_wrapper.dispose()
    return result
Пример #14
0
def add_movable_type(data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_MOVABLE_TYPE % (data['name']))
    db_wrapper.dispose()
    return result
Пример #15
0
def get_movable_type(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_MOVABLE_TYPE % id)
    db_wrapper.dispose()
    return converters.convert_movable_type(result)
Пример #16
0
def delete_movable_type(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_MOVABLE_TYPE % id)
    db_wrapper.dispose()
    return True
Пример #17
0
def update_movable_object(id, movable_type_id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.UPDATE_MOVABLE_OBJECT % (data['name'],movable_type_id, id))
    db_wrapper.dispose()
    return result
Пример #18
0
def get_movable_object(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_MOVABLE_OBJECT % id)
    db_wrapper.dispose()
    return converters.convert_movable(result)
Пример #19
0
def delete_all_location_points_for(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_LOCATION_POINTS_FOR % id)
    db_wrapper.dispose()
Пример #20
0
def get_all_movable_types():
    db_wrapper = DBWrapper()
    movable_types = db_wrapper.fetch_all(Q.SELECT_ALL_MOVABLE_TYPES)
    db_wrapper.dispose()
    return map(converters.convert_movable_type, movable_types)
Пример #21
0
def delete_immobile_object(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_IMMOBILE_OBJECT % id)
    db_wrapper.dispose()
    return True
Пример #22
0
def get_all_immobiles_objects():
    db_wrapper = DBWrapper()
    immobiles = db_wrapper.fetch_all(Q.SELECT_ALL_IMMOBILES)
    db_wrapper.dispose()
    return map(converters.convert_immobile, immobiles)
Пример #23
0
def update_immobile_object(id, data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.UPDATE_IMMOBILE_OBJECT % (data['name'], data.get('phone', ''), data['latitude'], data['longitude'], id))
    db_wrapper.dispose()
    return result
Пример #24
0
def get_all_location_points():
    db_wrapper = DBWrapper()
    lps = db_wrapper.fetch_all(Q.SELECT_ALL_LOCATION_POINTS)
    db_wrapper.dispose()
    return map(converters.convert_point, lps)
Пример #25
0
def delete_movable_object(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_MOVABLE_OBJECT % id)
    db_wrapper.dispose()
    return True
Пример #26
0
def search_movables_objects(pattern):
    db_wrapper = DBWrapper()
    objects = db_wrapper.fetch_all(Q.SEARCH_MOVABLES.replace('PATTERN', pattern.strip().lower()))
    db_wrapper.dispose()
    return map(converters.convert_movable, objects)
Пример #27
0
def get_movable_object(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_MOVABLE_OBJECT % id)
    db_wrapper.dispose()
    return converters.convert_movable(result)
Пример #28
0
def get_all_movable_types():
    db_wrapper = DBWrapper()
    movable_types = db_wrapper.fetch_all(Q.SELECT_ALL_MOVABLE_TYPES)
    db_wrapper.dispose()
    return map(converters.convert_movable_type, movable_types)
Пример #29
0
def delete_movable_type(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_MOVABLE_TYPE % id)
    db_wrapper.dispose()
    return True
Пример #30
0
def get_all_location_points():
    db_wrapper = DBWrapper()
    lps = db_wrapper.fetch_all(Q.SELECT_ALL_LOCATION_POINTS)
    db_wrapper.dispose()
    return map(converters.convert_point, lps)
Пример #31
0
def get_movable_type(id):
    db_wrapper = DBWrapper()
    result = db_wrapper.fetch_one(Q.GET_MOVABLE_TYPE % id)
    db_wrapper.dispose()
    return converters.convert_movable_type(result)
Пример #32
0
def add_immobile_object(data):
    db_wrapper = DBWrapper()
    result = db_wrapper.execute(Q.ADD_IMMOBILE_OBJECT % (data['name'], data.get('phone', ''), data['latitude'], data['longitude']))
    db_wrapper.dispose()
    return result
Пример #33
0
def get_all_location_points_for(id):
    points = ()
    db_wrapper = DBWrapper()
    points = db_wrapper.fetch_all(Q.LOCATION_POINTS_FOR % id)
    db_wrapper.dispose()
    return map(converters.convert_point, points)
Пример #34
0
def delete_movable_object(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_MOVABLE_OBJECT % id)
    db_wrapper.dispose()
    return True
Пример #35
0
def get_all_immobiles_objects():
    db_wrapper = DBWrapper()
    immobiles = db_wrapper.fetch_all(Q.SELECT_ALL_IMMOBILES)
    db_wrapper.dispose()
    return map(converters.convert_immobile, immobiles)
Пример #36
0
def delete_all_location_points_for(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_LOCATION_POINTS_FOR % id)
    db_wrapper.dispose()
Пример #37
0
def get_all_location_points_for(id):
    points = ()
    db_wrapper = DBWrapper()
    points = db_wrapper.fetch_all(Q.LOCATION_POINTS_FOR % id)
    db_wrapper.dispose()
    return map(converters.convert_point, points)
Пример #38
0
def delete_immobile_object(id):
    db_wrapper = DBWrapper()
    db_wrapper.execute(Q.DELETE_IMMOBILE_OBJECT % id)
    db_wrapper.dispose()
    return True