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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2843c5eea3415584,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: APQ From: Brian May Date: Thu, 16 Dec 2004 10:31:49 +1100 Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:ysPimWaLG2NiQGsBA6pVFc6owGI= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: news.melbourne.pipenetworks.com 1103153483 202.173.153.89 (16 Dec 2004 09:31:23 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!news1.optus.net.au!optus!news.mel.connect.com.au!news-north.connect.com.au!duster.adelaide.on.net!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:6983 Date: 2004-12-16T10:31:49+11:00 List-Id: Hello, Here are my suggested changes to APQ (not actually done or tested). 1. Decide on or write a "smart pointer" library. ie. a library that manages pointers based on a reference count. Obviously the license must be compatible with the license of APQ. 2. No change to Connection_Type or Root_Connection_Type. 3. Create new Database_Type. This type should not be tagged. Applications will use this instead of the Root_Connection_Type. It has the following data: * Smart pointer to Root_Connection_Type'Class. This is dynamically allocated when the connection is created. It has the following methods: * Connect method takes a string, which is the connection URL. Note: Two ways of implementing: 1. connect is hard-coded to support every possible database, and parses the URL itself. 2. each database is registered in a global list, connect determines the most appropriate database based on prefix in URL and calls appropriate connect method with URL. The second method is more complicated but more flexible. In any case, changing this should not require changing the user API. * All methods associated with Root_Connection_Type. This does *not* include options to set options specific to the database, like user name or password. These call the appropriate routine in the Root_Connection_Type'Class. Status information should perhaps be cached, so it remains constant even after queries (might be more appropriate way to handle errors). * New_Query takes a *Database_Type* parameter, not a Root_Connection_Type parameter. This function constraints a query and saves a smart pointer to the Root_Connection_Type contained within the Database_Type variable. * Debatable: Function that returns smart pointer to Root_Connection_Type'Class. This might be required to access database specific functions. Ideally it shouldn't be required. 4. Modify Root_Query_Type class: New_Query is the only function that takes a *Database_Type* parameter. The functions that use to require Root_Connection_Type now use the smart pointer that was saved instead. Why not make the procedures abstract instead of having them raise an Is_Abstract? This way the checks can be done at compile time. Execute already returns exception if not connected. Add methods for obtaining and clearing status information. This should be cached so if you execute two separate queries (in two separate variables) on the same database, you will get two status messages saved. I hope this helps explain what I said earlier... I believe this solves a number of concerns with the existing system in one go. The major difference is that I have created a new Database_Type class, which allows the Connection_Type to be shared in a safe manner between the user Database_Type and the user Query_Type classes. This would involve making incompatible changes to Root_Query_Type. It might be possible to avoid this, not sure if it would be worth the effort. Comments? -- Brian May