Subject Re: [IBO] Data Module Inheritance
Author paultugwell <>
--- In, "Brian K. Woods" <brian@e...> wrote:
> > -----Original Message-----
> > From: paultugwell <pault@g...> [mailto:pault@g...]
> > Sent: Friday, January 10, 2003 5:17 AM
> > To:
> > Subject: [IBO] Data Module Inheritance
> >
> >
> > I have just started a project where there will be a number of
> > all using a common set of basic queries to which the queries
> > to the particular exe would be added. I thought I'd be clever and
> > create a data module containing these queries and save it in the
> > object repository. The data modules in the individual exe's would
> > then be created by inheritence. This work except for one thing.
> > base datamodule contains a TIBODatabase with the DatabaseName
> > property set to SYS. When I create the inherited data module the
> > DatabaseName is shown as SYS_1. Connecting SYS_1 creates only one
> > connection to IB (as shown by IB_SQL) but SYS also shows as
> > connected. However, connecting SYS does not connect SYS_1.
> > Is this process valid and will it cause me any problems?
> I'm not one with the knowledge to accurately tell you if there are
> with it as
> far as connections, etc goes. However, the programmer in me
doesn't like it
> since it's just
> not clean design, as I figure the programmer in you must be
throwing red
> flags, too (else you wouldn't ask...)
> My suggestion: why don't you replace the TIBODatabase in the base
> class with a TIBODatabase property, that
> gets supplied in a virtual constructor or property when you create
> descendant instance? That
> gets rid of your duplicate database objects as well as avoids any
> problems that they might or
> might not cause. Base classes don't really need anything except the
> interface anyway, since you don't generally
> create an instance of a base class.
> HTH,
> Brian

Interseting idea, but this is really the answer in this case. As well
as the datamodule itself being common to a number of programs, the
TIBODatabase objects and a number of queries will also be common. My
motivation in doing this was to enable me to reuse the queries in
different profgram.