From: Eric B. <er...@go...> - 2001-12-14 11:55:12
|
Uwe Sander wrote: > > The problem is slightly different. I am dealing with databases like MySQL, > PostgreSQL and so on and these systems do not deliver objects to my access > classes but simply values, so I have decided to assign exactly one record > object to one cursor and fill the record with values according to its > position. So I have the problem that two cursors never reference the same > record (item) even if they point to the same position in the underlying > dataset. You may have noticed that the postcondition is only in DS_LINEAR.cursor_is_first and not in DS_LINEAR_CURSOR.is_first. The reason why it is in `cursor_is_first' is to guarantee a precise semantics for the internal cursor. However a cursor may decide to traverse the container in reverse order or skip some items, that's why the postcondition on DS_LINEAR_CURSOR.is_first is not as strict as on `cursor_is_first'. Of course if you want to have a cursor with a different semantics than the internal cursor of the container, you need to redefine features in the cursor class such as `is_first' and provide a different implementation from those provided by DS_LINEAR.cursor_*. So with your internal cursor the postcondition of `cursor_is_first' should work (provided that the routine `first' in your container returns the record object associated with your internal cursor), and for external cursor you would have to redefine `is_first' to avoid calling `cursor_is_first'. Or do you have separate record objects for `first' and `last', different from the record object associated with the internal cursor? In this latter case my solution would not work. > Hmm, while I am writing this, I have to realize that it is _not_ sufficient > for database access classes to compare values to decide if a certain record > is really the first one of a set of data :-( Even if SQL rules forbid > duplicate rows within a table, it is still possible to write SELECTs which > yield multiple identical rows. This is not a problem which only occurs with DBs. For example in a list I can insert several times the some object. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |