Skip to content
Snippets Groups Projects

ENH: Implement queries and entity retrieval

Merged Florian Spreckelsen requested to merge f-extended-c into dev
1 file
+ 36
0
Compare changes
  • Side-by-side
  • Inline
+ 36
0
@@ -23,6 +23,8 @@
module Transaction
export create_transaction
using CaosDB
"""
@@ -50,4 +52,38 @@ mutable struct _Transaction
end
end
"""
create_transaction(name::AbstractString = "default")
Return a transaction created with the connection of the given name. If
none is given, the defult connection is used.
"""
function create_transaction(name::AbstractString = "default")
connection = CaosDB.Connection.get_connection(name)
return create_transaction(connection)
end
"""
function create_transaction(connection::Ref{CaosDB.Connection._Connection})
Return a transactioncreated with the given connection object.
"""
function create_transaction(connection::Ref{CaosDB.Connection._Connection})
transaction = Ref{_Transaction}(_Transaction(true))
err_code = ccall(
(:caosdb_connection_connection_create_transaction, CaosDB.library_name),
Cint,
(Ref{CaosDB.Connection._Connection}, Ref{_Transaction}),
connection,
transaction,
)
CaosDB.Exceptions.evaluate_return_code(err_code)
return transaction
end
end # Transaction
Loading