Fetching objects

There are a number of ways to fetch objects from the database.

request

Use an object name or object id to retrieve objects.

select

Search for objects using a query language.

dboo::ref

Smart references/pointers that fetch objects only when dereferencing or accessing the object.

request

The request API or command is used to fetch objects by name or object id. An object can be named with the odb::commit() function.




select

Searching for objects based on member field/property values. To select on a member field/property, a field index must exist for that field. See dboo::odb::create_index and create index for creating indices.




For description of the query language, see Query language. Select API: odb.select() and for command line select<class>([<expression>]).

ref

dboo::ref works like a pointer, but instead of loading the object pointed to when fetching the owner, the pointed-to object is fetched the first time it is accessed via the ref-object.




Object graphs

Normally when fetching objects to runtime, all their referenced objects are fetched as well and everything is linked up as they were when saved.