Subject RE: [IBO] Data Module Inheritance
Author Brian K. Woods
> -----Original Message-----
> From: paultugwell <pault@...> [mailto:pault@...]
> Sent: Friday, January 10, 2003 5:17 AM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Data Module Inheritance
>
>
> I have just started a project where there will be a number of exe's
> all using a common set of basic queries to which the queries specific
> 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. The
> 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 problems
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 datamodule
class with a TIBODatabase property, that
gets supplied in a virtual constructor or property when you create the
descendant instance? That
gets rid of your duplicate database objects as well as avoids any hidden
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