Next: , Previous: , Up: Top   [Index]


2 The CaosDB class

Class: Caosdb

This is the main class of the CaosDB client for Octave.

The Caosdb class holds information about the connection to a CaosDB server. It provides a convenient interface to the possible transactions (insert, query, retrieve, update, delete) with the server.

Instance Variable of Caosdb: string connection

The name of the connection which shall be used for transactions via this Caosdb object. The available connections are taken from the active libcaosdb configuration. If connection is the empty string, the default connection will be used.

Method on Caosdb: Caosdb ([string connection])

The constructor takes an optional connection argument which, if given, is used as connection name for transactions via this object.

Method on Caosdb: info ()

Return a string with information about the libraries and the server.

Method on Caosdb: retrieve_by_id( ids, … )

Retrieve entities by IDs.

entities = Caosdb.retrieve_by_id("my_id", {"more", "ids"});

Parameters

ids : string or cell array of strings

The ID(s) of the entity (entities) to be retrieved.

Returns

entities : cell array

The retrieved entities.
Method on Caosdb: query( query_str )

Execute a query.

entities = Caosdb.query("FIND Record Foo WITH bar=baz");
entities = Caosdb.query("COUNT Record Foo WITH bar=baz");

Parameters

query_str : string

The query to be executed.

Returns

entities : cell array

The retrieved entities.  If the query was a COUNT query, the
result is an int64 instead.
Method on Caosdb: insert( entities )

Insert an entity.

inserted = Caosdb.insert(entities);

Parameters

entities : cell array

A cell array with the entities to be inserted.

Returns

inserted : cell array

The resulting inserted entities (sparse, only for ID and
version).
Method on Caosdb: update( entities )

Update an entity.

updated = Caosdb.update(entities);

Parameters

entities : cell array

A cell array with the entities to be updated.  All entities must have a
valid ID.

Returns

updated : cell array

The resulting updated entities.
Method on Caosdb: retrieve_by_id( ids, … )

Delete entities by IDs.

entities = Caosdb.delete_by_id("my_id", {"more", "ids"});

The usage is equivalent to retrieve_by_id(...).

Note: Caosdb.delete() will call the destructor of the Caosdb object.

Parameters

ids : string or cell array of strings

The ID(s) of the entity (entities) to be deleted.

Returns

entities : cell array

The deleted entities.
Method on Caosdb: download_file_by_single_id( id, local_path )

Download a file by ID.

entity = Caosdb.download_file_by_single_id("my_id", "/save/file/here.dat");

Inserting files is done by creating a "FILE" Entity and inserting it.

Parameters

ids : string

The ID of the file to be downloaded.

local_path : string

The location where the file shall be saved.

Returns

entity : cell array

1x1 cell array with the retrieved file entity.

Next: , Previous: , Up: Top   [Index]