21.03.2013 Views

Object-Oriented Databases Need for Complex Data Types - CWI

Object-Oriented Databases Need for Complex Data Types - CWI

Object-Oriented Databases Need for Complex Data Types - CWI

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Data</strong>base System Concepts<br />

ODMG C++ ODL: Example (Cont.)<br />

class Customer : public Person {<br />

public:<br />

d_Date member_from;<br />

d_Long customer_id;<br />

d_Ref home_branch;<br />

d_Set accounts; };<br />

<strong>Data</strong>base System Concepts<br />

8.29<br />

Implementing Relationships<br />

8.30<br />

©Silberschatz, Korth and Sudarshan<br />

Relationships between classes implemented by references<br />

Special reference types en<strong>for</strong>ces integrity by adding/removing<br />

inverse links.<br />

Type d_Rel_Ref is a reference to Class, where<br />

attribute InvRef of Class is the inverse reference.<br />

Similarly, d_Rel_Set is used <strong>for</strong> a set of references<br />

Assignment method (=) of class d_Rel_Ref is overloaded<br />

Uses type definition to automatically find and update the inverse<br />

link<br />

Frees programmer from task of updating inverse links<br />

Eliminates possibility of inconsistent links<br />

Similarly, insert_element() and delete_element() methods of<br />

d_Rel_Set use type definition to find and update the inverse link<br />

automatically<br />

©Silberschatz, Korth and Sudarshan<br />

15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!