[ZOOM] Object Owenership (Was: Value Returned from Set Option (Was: Catching up))

Ashley Sanders zzaascs at irwell.mimas.ac.uk
Mon Nov 19 10:41:19 CET 2001


Adam,

> const record &resultSet::getRecordR (size_t pos) const
> {
>     derivedRecord *r = 0;  // get if from a cache, whatever..
> 
>     return *r; 
> }

The above is the crux of the matter. Maybe I've missed something,
and if so my apologies, but if we aren't having a record to represent
that the origin wasn't able to retrieve a record, but instead got
a surrogate diagnostic, then we just can't do the above. If we
use references then we have to return a record. Using references
does away with the memory leaks, but we would need to define
something like a nullRecord so that getRecord() can always return
something. (And I'm not keen on the idea of getRecord() throwing
an exception instead.) nullRecord could just be defined something
like:

class nullRecord : public record {
    recordSyntax recsyn () { return ??????; };
    size_t nfields () { return 0; };
    const char *field (const char *spec) { return ""; };
    const char *render () { return ""; };
    const char *rawdata () { return ""; };
}

I'd be happy with references and an error/null record something
like the above.

Ashley.

-- 
Ashley Sanders                                a.sanders at mcc.ac.uk
COPAC: A public bibliographic database from MIMAS, funded by JISC
             http://copac.ac.uk/ - copac at mimas.ac.uk



More information about the ZOOM mailing list