Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • caosdb/src/caosdb-julialib
1 result
Show changes
Commits on Source (4)
...@@ -771,11 +771,11 @@ function get_value(entity::Ref{_Entity}) ...@@ -771,11 +771,11 @@ function get_value(entity::Ref{_Entity})
if ent_datatype[1] in _caosdb_dtypes if ent_datatype[1] in _caosdb_dtypes
if !is_list if !is_list
if ent_datatype[1] == "INTEGER" if ent_datatype[1] == "INTEGER"
out = Ref{Cint}(0) out = Ref{Clong}(0)
err_code = ccall( err_code = ccall(
(:caosdb_entity_entity_get_int_value, CaosDB.library_name), (:caosdb_entity_entity_get_int_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Entity}, Ref{Cint}), (Ref{_Entity}, Ref{Clong}),
entity, entity,
out, out,
) )
...@@ -815,7 +815,7 @@ function get_value(entity::Ref{_Entity}) ...@@ -815,7 +815,7 @@ function get_value(entity::Ref{_Entity})
else else
list_length = get_property_list_length(entity) list_length = get_property_list_length(entity)
if ent_datatype[1] == "INTEGER" if ent_datatype[1] == "INTEGER"
out = Vector{Cint}() out = Vector{Clong}()
for i::Cint = 1:list_length for i::Cint = 1:list_length
temp = get_int_list_value_at(entity, i) temp = get_int_list_value_at(entity, i)
append!(out, temp) append!(out, temp)
...@@ -880,11 +880,11 @@ function get_value(property::Ref{_Property}) ...@@ -880,11 +880,11 @@ function get_value(property::Ref{_Property})
if prop_datatype[1] in _caosdb_dtypes if prop_datatype[1] in _caosdb_dtypes
if !is_list if !is_list
if prop_datatype[1] == "INTEGER" if prop_datatype[1] == "INTEGER"
out = Ref{Cint}(0) out = Ref{Clong}(0)
err_code = ccall( err_code = ccall(
(:caosdb_entity_property_get_int_value, CaosDB.library_name), (:caosdb_entity_property_get_int_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Property}, Ref{Cint}), (Ref{_Property}, Ref{Clong}),
property, property,
out, out,
) )
...@@ -924,7 +924,7 @@ function get_value(property::Ref{_Property}) ...@@ -924,7 +924,7 @@ function get_value(property::Ref{_Property})
else else
list_length = get_property_list_length(property) list_length = get_property_list_length(property)
if prop_datatype[1] == "INTEGER" if prop_datatype[1] == "INTEGER"
out = Vector{Cint}() out = Vector{Clong}()
for i::Cint = 1:list_length for i::Cint = 1:list_length
temp = get_int_list_value_at(property, i) temp = get_int_list_value_at(property, i)
append!(out, temp) append!(out, temp)
...@@ -1024,11 +1024,11 @@ end ...@@ -1024,11 +1024,11 @@ end
Return the value of the INTEGER list of the given `property` at the position `index`. Return the value of the INTEGER list of the given `property` at the position `index`.
""" """
function get_int_list_value_at(property::Ref{_Property}, index::Cint) function get_int_list_value_at(property::Ref{_Property}, index::Cint)
out = Ref{Cint}(0) out = Ref{Clong}(0)
err_code = ccall( err_code = ccall(
(:caosdb_entity_property_get_int_list_value_at, CaosDB.library_name), (:caosdb_entity_property_get_int_list_value_at, CaosDB.library_name),
Cint, Cint,
(Ref{_Property}, Ref{Cint}, Cint), (Ref{_Property}, Ref{Clong}, Cint),
property, property,
out, out,
index - Cint(1), index - Cint(1),
...@@ -1044,11 +1044,11 @@ end ...@@ -1044,11 +1044,11 @@ end
Return the value of the INTEGER list of the given `entity` at the position `index`. Return the value of the INTEGER list of the given `entity` at the position `index`.
""" """
function get_int_list_value_at(entity::Ref{_Entity}, index::Cint) function get_int_list_value_at(entity::Ref{_Entity}, index::Cint)
out = Ref{Cint}(0) out = Ref{Clong}(0)
err_code = ccall( err_code = ccall(
(:caosdb_entity_entity_get_int_list_value_at, CaosDB.library_name), (:caosdb_entity_entity_get_int_list_value_at, CaosDB.library_name),
Cint, Cint,
(Ref{_Entity}, Ref{Cint}, Cint), (Ref{_Entity}, Ref{Clong}, Cint),
entity, entity,
out, out,
index - Cint(1), index - Cint(1),
...@@ -1985,9 +1985,9 @@ function set_value( ...@@ -1985,9 +1985,9 @@ function set_value(
err_code = ccall( err_code = ccall(
(:caosdb_entity_entity_set_int_value, CaosDB.library_name), (:caosdb_entity_entity_set_int_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Entity}, Cint), (Ref{_Entity}, Clong),
entity, entity,
Cint(value), Clong(value),
) )
elseif in_type <: Number elseif in_type <: Number
err_code = ccall( err_code = ccall(
...@@ -2022,9 +2022,9 @@ function set_value( ...@@ -2022,9 +2022,9 @@ function set_value(
err_code = ccall( err_code = ccall(
(:caosdb_entity_entity_set_int_list_value, CaosDB.library_name), (:caosdb_entity_entity_set_int_list_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Entity}, Ptr{Cint}, Cint), (Ref{_Entity}, Ptr{Clong}, Cint),
entity, entity,
Vector{Cint}(value), Vector{Clong}(value),
vec_length, vec_length,
) )
elseif in_type <: Vector{T} where {T<:Number} elseif in_type <: Vector{T} where {T<:Number}
...@@ -2074,9 +2074,9 @@ function set_value( ...@@ -2074,9 +2074,9 @@ function set_value(
err_code = ccall( err_code = ccall(
(:caosdb_entity_property_set_int_value, CaosDB.library_name), (:caosdb_entity_property_set_int_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Property}, Cint), (Ref{_Property}, Clong),
property, property,
Cint(value), Clong(value),
) )
elseif in_type <: Number elseif in_type <: Number
err_code = ccall( err_code = ccall(
...@@ -2111,9 +2111,9 @@ function set_value( ...@@ -2111,9 +2111,9 @@ function set_value(
err_code = ccall( err_code = ccall(
(:caosdb_entity_property_set_int_list_value, CaosDB.library_name), (:caosdb_entity_property_set_int_list_value, CaosDB.library_name),
Cint, Cint,
(Ref{_Property}, Ptr{Cint}, Cint), (Ref{_Property}, Ptr{Clong}, Cint),
property, property,
Vector{Cint}(value), Vector{Clong}(value),
vec_length, vec_length,
) )
elseif in_type <: Vector{T} where {T<:Number} elseif in_type <: Vector{T} where {T<:Number}
......
...@@ -146,8 +146,8 @@ using CaosDB ...@@ -146,8 +146,8 @@ using CaosDB
@test length(CaosDB.Entity.get_properties(rec_with_parent_and_props)) == 3 @test length(CaosDB.Entity.get_properties(rec_with_parent_and_props)) == 3
# properties can be accessed as a list # properties can be accessed as a list
# TODO(henrik, daniel) # TODO(florian) Fix this once we have a reasonable treatment of value objects in Extern C.
@test CaosDB.Entity.get_value( @test_broken CaosDB.Entity.get_value(
CaosDB.Entity.get_properties(rec_with_parent_and_props)[1], CaosDB.Entity.get_properties(rec_with_parent_and_props)[1],
) == "2" ) == "2"
type, is_ref, is_list = CaosDB.Entity.get_datatype( type, is_ref, is_list = CaosDB.Entity.get_datatype(
...@@ -257,10 +257,10 @@ using CaosDB ...@@ -257,10 +257,10 @@ using CaosDB
CaosDB.Entity.set_value(ref_list_prop, ["some_id", "another_id"]) CaosDB.Entity.set_value(ref_list_prop, ["some_id", "another_id"])
@test CaosDB.Entity.get_value(int_list_prop) == [123, 456] @test CaosDB.Entity.get_value(int_list_prop) == [123, 456]
@test CaosDB.Entity.get_value(double_list_prop) == [10.246, 3.14] @test CaosDB.Entity.get_value(double_list_prop) == [10.246, 3.14]
@test CaosDB.Entity.get_value(bool_list_prop) === [true, false] @test CaosDB.Entity.get_value(bool_list_prop) == [true, false]
@test CaosDB.Entity.get_value(string_list_prop) == ["Hello", "World"] @test CaosDB.Entity.get_value(string_list_prop) == ["Hello", "World"]
@test CaosDB.Entity.get_value(ref_list_prop) == ["some_id", "another_id"] @test CaosDB.Entity.get_value(ref_list_prop) == ["some_id", "another_id"]
@test isa(CaosDB.Entity.get_value(int_list_prop), Vector{Cint}) @test isa(CaosDB.Entity.get_value(int_list_prop), Vector{Clong})
@test isa(CaosDB.Entity.get_value(double_list_prop), Vector{Cdouble}) @test isa(CaosDB.Entity.get_value(double_list_prop), Vector{Cdouble})
@test isa(CaosDB.Entity.get_value(bool_list_prop), Vector{Bool}) @test isa(CaosDB.Entity.get_value(bool_list_prop), Vector{Bool})
@test isa(CaosDB.Entity.get_value(string_list_prop), Vector{String}) @test isa(CaosDB.Entity.get_value(string_list_prop), Vector{String})
...@@ -339,10 +339,10 @@ using CaosDB ...@@ -339,10 +339,10 @@ using CaosDB
CaosDB.Entity.set_value(ref_list_prop, ["some_id", "another_id"]) CaosDB.Entity.set_value(ref_list_prop, ["some_id", "another_id"])
@test CaosDB.Entity.get_value(int_list_prop) == [123, 456] @test CaosDB.Entity.get_value(int_list_prop) == [123, 456]
@test CaosDB.Entity.get_value(double_list_prop) == [10.246, 3.14] @test CaosDB.Entity.get_value(double_list_prop) == [10.246, 3.14]
@test CaosDB.Entity.get_value(bool_list_prop) === [true, false] @test CaosDB.Entity.get_value(bool_list_prop) == [true, false]
@test CaosDB.Entity.get_value(string_list_prop) == ["Hello", "World"] @test CaosDB.Entity.get_value(string_list_prop) == ["Hello", "World"]
@test CaosDB.Entity.get_value(ref_list_prop) == ["some_id", "another_id"] @test CaosDB.Entity.get_value(ref_list_prop) == ["some_id", "another_id"]
@test isa(CaosDB.Entity.get_value(int_list_prop), Vector{Cint}) @test isa(CaosDB.Entity.get_value(int_list_prop), Vector{Clong})
@test isa(CaosDB.Entity.get_value(double_list_prop), Vector{Cdouble}) @test isa(CaosDB.Entity.get_value(double_list_prop), Vector{Cdouble})
@test isa(CaosDB.Entity.get_value(bool_list_prop), Vector{Bool}) @test isa(CaosDB.Entity.get_value(bool_list_prop), Vector{Bool})
@test isa(CaosDB.Entity.get_value(string_list_prop), Vector{String}) @test isa(CaosDB.Entity.get_value(string_list_prop), Vector{String})
......