Developers Manual 1.20

3. Querying

Once you have started creating objects, you will need some way to bring them back into your image. ReStore provides a sophisticated querying mechanism based around similar semantics to standard Smalltalk collection enumeration methods (select:, detect: etc.).

instancesOf:
The starting point for all querying operations is the SSWReStore method instancesOf: - this returns a collection-like object representing all instances of the given class (or its table-sharing subclasses) existing in the database. This pseudo-collection can then be enumerated in almost exactly the same manner as a regular collection. Importantly, however, no objects are actually fetched from the database until specifically referenced. This ensures that the absolute minimum of data is transferred into memory, making querying quick and efficient.

Note that querying is only the starting point for fetching objects from the database - once you have a persistent object in memory then you may traverse its references to other persistent objects exactly as you would with a regular non-persistent object. These linked objects are automatically and transparently fetched from the database the first time they are sent a message. In this way, ReStore allows you to treat releational storage like an object database. 


3. Querying

© 2000-2003 Solutions Software Ltd.

Home | Index | Next