From: "Marcelo Coraça de Freitas" <marcelo.batera@gmail.com>
Subject: Re: naming, was Re: Design problem: generic package vs tagged subtype
Date: Thu, 1 Jul 2010 08:48:46 -0700 (PDT)
Date: 2010-07-01T08:48:46-07:00 [thread overview]
Message-ID: <7df203fd-4b85-4244-94b4-8c826da098b7@i31g2000yqm.googlegroups.com> (raw)
In-Reply-To: i0hoas$33p$1@news.eternal-september.org
First I'd like to say I am sorry if my text writing isn't quite clear.
I am not a native english speaker and I haven't spoken in this
language for quite a while now.
I have come through some of those problems when I was design KOW_Ent
(another Ada ORM, which is MGPL and is based on APQ-Provider which is
a database connection pool implemented using APQ).
I decided to use tagged types all over the place (the only generic
package was for building queries and returning vectors of objects,
which is being replaced by a non-generic implenentation... well, I am
getting off topic now.. hehe).
Each persistent type extends KOW_Ent.Entity_Type (which already has an
ID, a field for storing filtering tags (in the web sence) and the
original entity tag (it is possible to extend a type further).
The columns are represented by the KOW_Ent.Entity_Property_Type. Each
data type is represented by it's very own Entity_Property_Type
implementation which holds access to a function to get the data from
the object and a procedure that sets it.
For the engine to work it is needed to register the entity type and
it's properties:
An example of code generated by a tool created to easy the development
of kow_ent based applications is:
KOW_Ent.Entity_Registry.Register(
Entity_Tag =>
teca.Entities.Content_Entity'Tag,
Table_Name => "teca_contents",
Id_Generator => null,
Factory =>
The_Content_Entity_Factory'Access
);
KOW_Ent.Entity_Registry.Add_Property(
Entity_Tag =>
teca.entities.Content_Entity'Tag,
Property =>
KOW_Ent.Properties.New_UString_Property(
Column_Name => "title",
Getter =>
teca.Entities.Content_Entity_title_hlp.getter'Access,
Setter =>
teca.Entities.Content_Entity_title_hlp.setter'Access
,Length
=> 255
)
);
By the way, the factory is used by the web interface for handling
database data which is part of the KOW_View-Entities module.
The data loading process is done by the KOW_Ent.Load procedure:
procedure Load( Entity : in out Entity_Type'Class; ID : in
ID_Type );
It then queries the registry and load the data - that will come from
different tables when you extend another existing entity type. The
store procedure works basically the same.
I hope my 50 cents can help you in your task.
Regards,
--
Marcelo C. de Freitas
http://framework.kow.com.br
next prev parent reply other threads:[~2010-07-01 15:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 17:52 Design problem: generic package vs tagged subtype Marek Janukowicz
2010-06-30 19:23 ` Simon Wright
2010-06-30 22:33 ` Marek Janukowicz
2010-07-01 4:13 ` naming, was " tmoran
2010-07-01 9:49 ` J-P. Rosen
2010-07-01 15:48 ` Marcelo Coraça de Freitas [this message]
2010-07-01 5:57 ` Simon Wright
2010-07-01 18:30 ` Jeffrey R. Carter
2010-07-01 19:28 ` Simon Wright
2010-07-01 19:59 ` Jeffrey R. Carter
2010-07-01 21:14 ` Per Sandberg
2010-07-02 9:25 ` Stephen Leake
2010-07-02 10:50 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox