Skip to content
Snippets Groups Projects
Commit 375aee2d authored by Alexander Kreft's avatar Alexander Kreft
Browse files

ENH: get_value for non-list items

parent 513cb88d
No related branches found
No related tags found
1 merge request!11F get value
Pipeline #12958 passed with warnings
Pipeline: CaosDB Julia Integration Tests

#12959

    ......@@ -755,19 +755,57 @@ Return the value of the given `property`
    """
    function get_value(property::Ref{_Property})
    out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
    err_code = ccall(
    (:caosdb_entity_property_get_value, CaosDB.library_name),
    Cint,
    (Ref{_Property}, Ref{Ptr{UInt8}}),
    property,
    out,
    )
    CaosDB.Exceptions.evaluate_return_code(err_code)
    _caosdb_dtypes = ("INTEGER", "DOUBLE", "BOOLEAN", "TEXT")
    prop_datatype = get_datatype(property)
    if prop_datatype[1] in _caosdb_dtypes
    if prop_datatype[1] == "INTEGER"
    out = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_property_get_int_value, CaosDB.library_name),
    Cint,
    (Ref{_Property}, Ref{Cint}),
    property,
    out,
    )
    out = out[]
    elseif prop_datatype[1] == "DOUBLE"
    out = Ref{Cdouble}(0)
    err_code = ccall(
    (:caosdb_entity_property_get_double_value, CaosDB.library_name),
    Cint,
    (Ref{_Property}, Ref{Cdouble}),
    property,
    out,
    )
    out = out[]
    elseif prop_datatype[1] == "BOOLEAN"
    out = Ref{Cint}(0)
    err_code = ccall(
    (:caosdb_entity_property_get_boolean_value, CaosDB.library_name),
    Cint,
    (Ref{_Property}, Ref{Cint}),
    property,
    out,
    )
    out = convert(Bool, out[])
    elseif prop_datatype[1] == "TEXT"
    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[])
    end
    CaosDB.Exceptions.evaluate_return_code(err_code)
    end
    return unsafe_string(out[])
    return out
    end
    """
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment