Skip to content
Snippets Groups Projects
Commit fb3f50f2 authored by florian's avatar florian
Browse files

ENH: Implement get_value for references

parent c5d7fdd8
No related branches found
No related tags found
1 merge request!11F get value
Pipeline #13196 failed
......@@ -806,11 +806,29 @@ function get_value(entity::Ref{_Entity})
end
end
end
if @isdefined err_code
CaosDB.Exceptions.evaluate_return_code(err_code)
elseif ent_datatype[2]
# is reference
if !is_list
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_string_value, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
out = unsafe_string(out[])
else
# is list of references
list_length = get_property_list_length(entity)
out = [get_string_list_value_at(entity, Cint(ii)) for ii = 1:list_length]
end
end
if @isdefined err_code
CaosDB.Exceptions.evaluate_return_code(err_code)
end
return out
end
......@@ -897,10 +915,27 @@ function get_value(property::Ref{_Property})
end
end
end
if @isdefined err_code
CaosDB.Exceptions.evaluate_return_code(err_code)
elseif prop_datatype[2]
# is reference
if !is_list
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_string_value, CaosDB.library_name),
Cint,
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
out = unsafe_string(out[])
else
# is list of references
list_length = get_property_list_length(property)
out = [get_string_list_value_at(property, Cint(ii)) for ii = 1:list_length]
end
end
if @isdefined err_code
CaosDB.Exceptions.evaluate_return_code(err_code)
end
return out
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment