22 lines
1.2 KiB
Python

from .StoredProcedureOperation import StoredProcedureOperation
from ..Guid import Guid
from ..SQLParameter import SQLParameter
from ..SQLFunctionCall import SQLFunctionCall
class AssignRelationshipOperation(StoredProcedureOperation):
def __init__(self, instanceId : Guid, relationshipInstanceId : Guid, targetInstanceId : Guid):
self.instanceId = instanceId
self.relationshipInstanceId = relationshipInstanceId
self.targetInstanceId = targetInstanceId
def get_sp_name(self):
return "mocha_assign_relationship"
def get_sp_parameters(self):
return [ SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.instanceId ]), SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.relationshipInstanceId ]), SQLFunctionCall('mocha_get_instance_by_global_identifier', [ self.targetInstanceId ]), None, None ]
#query = "CALL mocha_set_attribute_value(mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + instanceId.get_value() + "')), mocha_get_instance_by_global_identifier(mocha_normalize_uuid('" + attributeInstanceId.get_value() + "')), '" + str(value) + "', NULL, NULL);"
#print(query)
#cur.execute(query)
#self.print_error(cur)