-- ----------------------------------------------------- -- function object_CreateByUser -- ----------------------------------------------------- DROP function IF EXISTS `object_CreateByUser`; DELIMITER $$$ create function object_CreateByUser( address_ text, description_ text, status_id_ char(10) binary, latitude_ decimal(12, 7), longitude_ decimal(12, 7), note_for_moderator_ text, note_for_user_ text ) returns int unsigned not deterministic modifies sql data begin return nodeLink_Create2( 'owns', user_CurrentId(), object_Create( address_, description_, status_id_, latitude_, longitude_, 0, note_for_moderator_, note_for_user_)); end$$$ DELIMITER ; -- ----------------------------------------------------- -- function attribute_SetValueText -- ----------------------------------------------------- DROP function IF EXISTS `attribute_SetValueText`; DELIMITER $$$ create function attribute_SetValueText( attribute_id_ int unsigned, object_id_ int unsigned, lang_id_ char(3), value_text_ text ) returns int unsigned not deterministic modifies sql data begin declare val text default if(value_text_ = '', null, value_text_); set @1 = __attribute_ValidateIdDataType(attribute_id_, 'text') and __object_ValidateId(object_id_); set @3 = __attribute_SetValueText(attribute_id_, object_id_, lang_id_, val); set @2 = __attribute_SetLink(attribute_id_, object_id_, val is not null); return attribute_id_; end$$$ DELIMITER ; -- ----------------------------------------------------- -- function attribute_SetValue -- ----------------------------------------------------- DROP function IF EXISTS `attribute_SetValue`; DELIMITER $$$ create function attribute_SetValue( attribute_id_ int unsigned, object_id_ int unsigned, lang_id_ char(3), value_ text ) returns int unsigned not deterministic modifies sql data begin declare data_type varchar(10) default (select dataTypeId from attributeT where id = attribute_id_); declare val text default if(value_ = '', null, value_); set @1 = __attribute_ValidateId(attribute_id_) and __object_ValidateId(object_id_); case data_type when 'numeric' then set @3 = __attribute_SetValueNumeric(attribute_id_, object_id_, cast(val as decimal(22, 6))); when 'datetime' then set @3 = __attribute_SetValueDatetime(attribute_id_, object_id_, cast(val as datetime)); else set @3 = __attribute_SetValueText(attribute_id_, object_id_, lang_id_, val); end case; set @2 = __attribute_SetLink(attribute_id_, object_id_, val is not null); return attribute_id_; end$$$ DELIMITER ;