Skip to content
Snippets Groups Projects

ENH: Implement queries and entity retrieval

Merged Florian Spreckelsen requested to merge f-extended-c into dev

Summary

See https://gitlab.indiscale.com/caosdb/customers/lfpb/management/-/issues/386.

Focus

Point the reviewer to the core of the code change. Where should they start
reading? What should they focus on (e.g. security, performance,
maintainability, user-friendliness, compliance with the specs, finding more
corner cases, concrete questions)?

Test Environment

How to set up a test environment for manual testing?

Check List for the Author

Please, prepare your MR for a review. Be sure to write a summary and a focus and create gitlab comments for the reviewer. They should guide the reviewer through the changes, explain your changes and also point out open questions. For further good practices have a look at our review guidelines

  • All automated tests pass
  • Reference related Issues
  • Up-to-date CHANGELOG.md
  • Annotations in code (Gitlab comments)
    • Intent of new code
    • Problems with old code
    • Why this implementation?

Check List for the Reviewer

  • I understand the intent of this MR
  • All automated tests pass
  • Up-to-date CHANGELOG.md
  • The test environment setup works and the intended behavior is reproducible in the test environment
  • In-code documentation and comments are up-to-date.
  • Check: Are there spezifications? Are they satisfied?

For further good practices have a look at our review guidelines.

Edited by Henrik tom Wörden

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
5 5 is meant for expert use only. Only use those if you know what you're
6 6 doing.
7 7
8 ```@index
9 Order = [:module, :function, :macro, :type, :constant]
  • Unfortunately, Documenter.jl doesn't support the Private argument in @index so we have to join everything into one index. I still like having one now that we have so many elements in our API documentation, though.

  • Please register or sign in to reply
  • 118 Add a sub-request to retrieve several entities by their `ids` to the
    119 given `transaction`.
    120
    121 !!! info
    122
    123 This does not execute the transaction.
    124 """
    125 function add_retrieve_by_id(
    126 transaction::Ref{_Transaction},
    127 ids::Vector{T},
    128 ) where {T<:AbstractString}
    129
    130 err_code = ccall(
    131 (:caosdb_transaction_transaction_retrieve_by_ids, CaosDB.library_name),
    132 Cint,
    133 (Ref{_Transaction}, Ptr{Ptr{Cchar}}),
  • added 1 commit

    Compare with previous version

  • added 6 commits

    • 45dabd84 - DRAFT: Begin implementation of entities
    • 5ef97a84 - ENH: Add Exception type for client exceptions
    • 475a378f - FIX: Correct arguments for retrieve_by_ids
    • 2b379aff - DRAFT: Begin implementation of entities
    • f5bd5529 - ENH: Add test for entities
    • 0be053a7 - DRAFT: Add a lot of setters, getters, and helper functions

    Compare with previous version

  • added 2 commits

    • 379a133b - ENH: Add convenience wrappers for Integer indices
    • 20939d95 - ENH: Add size checking to getters

    Compare with previous version

  • added 1 commit

    • b3e4ab79 - MAINT: Move remaining modules to separate files

    Compare with previous version

  • added 1 commit

    • bdcaceb1 - ENH: Finish retrieve and query transactions

    Compare with previous version

  • added 1 commit

    • 1e651982 - DOC: Add hint on COUNT queries

    Compare with previous version

  • 1 # ** header v3.0
  • 57 end
    58
    59 Base.showerror(io::IO, e::CaosDBException) =
    60 print(io, "CaosDBException: ", e.msg, " (Status code ", e.code, ")")
    61
    62 """
    63 Struct containing Messages and codes for status codes<0 that do not
    64 correspond to errors or success.
    65 """
    66 struct CaosDBMessage
    67 msg::String
    68 code::Cint
    69 end
    70
    71 Base.show(io::IO, m::CaosDBMessage) = print(io, m.msg, " (Status code ", m.code, ")")
    102 # include modules from other files
  • 34 34 """
    35 35 mutable struct _Connection
    36 36 wrapped_connection::Ptr{Cvoid}
    37 _deletable::Bool
    • The _deletable flag isn't actually needed on the Julia side, but we still have it in order to prevent any strange memory problems if the structs in Julia didn't exactly match the C structs.

    • Please register or sign in to reply
  • 34 34 """
    35 35 mutable struct _Connection
    36 36 wrapped_connection::Ptr{Cvoid}
    37 _deletable::Bool
    37 38
    38 39 function _Connection(managed_by_julia::Bool = false)
    39 40 conn = new()
    41 conn._deletable = false
  • src/Exceptions.jl 0 → 100644
    1 # ** header v3.0
  • src/Exceptions.jl 0 → 100644
    36
    37 """
    38 A generic exception that will be raised in case of non-zero return
    39 values of the calls to libccaosdb. May carry a message string and a
    40 code.
    41 """
    42 struct GenericCaosDBException <: CaosDBException
    43 msg::String
    44 code::Cint
    45 end
    46
    47 """
    48 Something went wrong on the client-side or the user is attempting to
    49 conduct an invalid operation.
    50 """
    51 struct ClientException <: CaosDBException
  • src/Exceptions.jl 0 → 100644
    42 struct GenericCaosDBException <: CaosDBException
    43 msg::String
    44 code::Cint
    45 end
    46
    47 """
    48 Something went wrong on the client-side or the user is attempting to
    49 conduct an invalid operation.
    50 """
    51 struct ClientException <: CaosDBException
    52 msg::String
    53 code::Cint
    54
    55 function ClientException(message::AbstractString)
    56 client_error_code =
    57 ccall((:caosdb_status_code_OTHER_CLIENT_ERROR, CaosDB.library_name), Cint, ())
  • src/Info.jl 0 → 100644
    1 # ** header v3.0
  • 61 end
    62 return trans
    63 end
    64 end
    65
    66 """
    67 Struct containing a pointer to the wrapped cpp result set of a
    68 transaction. The struct is meant for internal use only and shouldn't
    69 be created directly by the user but is returned by, e.g.,
    70 `get_result_set`.
    71 """
    72 mutable struct _ResultSet
    73 wrapped_result_set::Ptr{Cvoid}
    74 _deletable::Bool
    75
    76 function _ResultSet()
    • This is never created on its own, only as a part of a transaction. That's why we don't add a destructor (i.e., finalizer) here (there aren't even create_result_set and delete_result_set functions in ccaosdb).

    • Please register or sign in to reply
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading