From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c31acc89d296bc62 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!i31g2000yqm.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Marcelo_Cora=E7a_de_Freitas?= Newsgroups: comp.lang.ada Subject: Re: naming, was Re: Design problem: generic package vs tagged subtype Date: Thu, 1 Jul 2010 08:48:46 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7df203fd-4b85-4244-94b4-8c826da098b7@i31g2000yqm.googlegroups.com> References: NNTP-Posting-Host: 201.13.174.5 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1277999326 4437 127.0.0.1 (1 Jul 2010 15:48:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 1 Jul 2010 15:48:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i31g2000yqm.googlegroups.com; posting-host=201.13.174.5; posting-account=NclPyQoAAAAE3vS1fHd_8NOSumP9W3Ey User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Sabayon Chrome/5.0.375.55 Safari/533.4,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:13066 Date: 2010-07-01T08:48:46-07:00 List-Id: 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