Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

WorkingWithBasicCrud

The RDB DAS provides a simple, command-oriented approach for reading and writing to the database.

A simple read

The following illustrates the simplest possible read:

...

Once we have a handle to the root we can pull information from the returned customer object using the dynamic SDO apis like this:

DataObjectPtr cust = root->getDataObject("CUSTOMER\[1\]");
wstring name = cust->getCString("LASTNAME");

Panel

Wiki Markup

The first line retreives the first Customer from the root's list of returned Customers (since we queried by ID, thereis only one). The second line pulls the LASTNAME value from the customer.

A simple write

The DAS leverages the SDO Change Summary to provide a very simple mechanism to flush data changes back to the database. We can illustrate this by continuing the previous example:

...

Although this simple example demonstrates a single property change to a single object, the das will process any numbers of changes made to any number of objects in a graph. Even if we read 1000 customers from the database and made several changes to each, flushing those changes back to the database is still just one call to das->applyChanges().

A write commmand

Writes to the database can also be done without using the change summary. To do this, we simply use the das instance as a factory to create a command initialized with a CREATE/UPDATE or DELETE statement.

...