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

FIX: Use new string assignement from Extern C

parent 43bdc947
Branches
No related tags found
1 merge request!7ENH: Implement queries and entity retrieval
......@@ -357,19 +357,19 @@ Return the id of the given `entity`
"""
function get_id(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_id, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -379,19 +379,19 @@ Return the id of the given `parent`
"""
function get_id(parent::Ref{_Parent})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_parent_get_id, CaosDB.library_name),
Cint,
(Ref{_Parent}, Ptr{UInt8}),
(Ref{_Parent}, Ref{Ptr{UInt8}}),
parent,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -401,19 +401,19 @@ Return the id of the given `property`
"""
function get_id(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_id, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -423,19 +423,19 @@ Return the role of the given `entity`.
"""
function get_role(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_role, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -445,19 +445,19 @@ Return the name of the given `entity`
"""
function get_name(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_name, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -467,19 +467,19 @@ Return the name of the given `parent`
"""
function get_name(parent::Ref{_Parent})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_parent_get_name, CaosDB.library_name),
Cint,
(Ref{_Parent}, Ptr{UInt8}),
(Ref{_Parent}, Ref{Ptr{UInt8}}),
parent,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -489,19 +489,19 @@ Return the name of the given `property`
"""
function get_name(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_name, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -511,19 +511,19 @@ Return the description of the given `entity`
"""
function get_description(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_description, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -533,19 +533,19 @@ Return the description of the given `parent`
"""
function get_description(parent::Ref{_Parent})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_parent_get_description, CaosDB.library_name),
Cint,
(Ref{_Parent}, Ptr{UInt8}),
(Ref{_Parent}, Ref{Ptr{UInt8}}),
parent,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -555,19 +555,19 @@ Return the description of the given `property`
"""
function get_description(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_description, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -577,19 +577,19 @@ Return the description of the given `message`
"""
function get_description(message::Ref{_Message})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_message_get_description, CaosDB.library_name),
Cint,
(Ref{_Message}, Ptr{UInt8}),
(Ref{_Message}, Ref{Ptr{UInt8}}),
message,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -599,19 +599,19 @@ Return the datatype of the given `entity`
"""
function get_datatype(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_datatype, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -621,19 +621,19 @@ Return the datatype of the given `property`
"""
function get_datatype(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_datatype, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -643,19 +643,19 @@ Return the unit of the given `entity`
"""
function get_unit(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_unit, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -665,19 +665,19 @@ Return the unit of the given `property`
"""
function get_unit(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_unit, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -687,19 +687,19 @@ Return the value of the given `entity`
"""
function get_value(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_value, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -709,19 +709,19 @@ Return the value of the given `property`
"""
function get_value(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_value, CaosDB.library_name),
Cint,
(Ref{_Property}, Ptr{UInt8}),
(Ref{_Property}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -731,19 +731,19 @@ Return the version_id of the given `entity`
"""
function get_version_id(entity::Ref{_Entity})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_entity_get_version_id, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
entity,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......@@ -776,19 +776,19 @@ Return the importance of the given `property`
"""
function get_importance(property::Ref{_Property})
out = Vector{UInt8}(undef, 256)
out = Ref{Ptr{UInt8}}(Ptr{UInt8}())
err_code = ccall(
(:caosdb_entity_property_get_importance, CaosDB.library_name),
Cint,
(Ref{_Entity}, Ptr{UInt8}),
(Ref{_Entity}, Ref{Ptr{UInt8}}),
property,
out,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return GC.@preserve out unsafe_string(pointer(out))
return unsafe_string(out[])
end
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment