|
@@ -218,24 +218,15 @@ class LeDataSourceSQL(DummyDatasource):
|
218
|
218
|
|
219
|
219
|
return True
|
220
|
220
|
|
221
|
|
- ## @brief Delete a link between two objects given a relation nature
|
222
|
|
- # @param lesup LeObject : a LeObject
|
223
|
|
- # @param lesub LeObject : a LeObject
|
224
|
|
- # @param nature str|None : The relation nature
|
225
|
|
- # @return bool
|
226
|
|
- def del_relation(self, lesup, lesub, nature=None):
|
227
|
|
-
|
228
|
|
- if lesup is None or lesub is None:
|
229
|
|
- raise AttributeError("Missing member(s) of the relation to delete")
|
230
|
|
-
|
231
|
|
- delete_params = {'id_sup': lesup.lodel_id, 'id_sub': lesub.lodel_id}
|
232
|
|
- if nature is not None:
|
233
|
|
- delete_params['nature'] = nature
|
234
|
|
-
|
|
221
|
+ ## @brief Delete a relation between two LeType
|
|
222
|
+ # @note It will delete a relation in a rel2type between lesup.Class and lesub.Type
|
|
223
|
+ # @param id_relation int : The relation identifier
|
|
224
|
+ # @return True if deleted
|
|
225
|
+ def del_relation(self, id_relation):
|
|
226
|
+ delete_params = {'id_relation':id_relation}
|
235
|
227
|
sql = delete(self.datasource_utils.relations_table_name, delete_params)
|
236
|
|
-
|
237
|
228
|
with self.connection as cur:
|
238
|
|
- if cur.execute(sql) != 1:
|
|
229
|
+ if cur.execute(sql)!=1:
|
239
|
230
|
raise RuntimeError("Unknown SQL Error")
|
240
|
231
|
|
241
|
232
|
return True
|