Re: Query-Abstraction

From: Date: Sun, 04 May 2003 12:43:20 +0000
Subject: Re: Query-Abstraction
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5217@lists.php.net to get a copy of this message
Hello, On 05/04/2003 02:37 AM, Flavio Botelho wrote:
I have a specific case where i need SQL-queries schemas to be passed around the application without each part of the application knowing the structure between themselves. And this must work across different databases too so.... Here are some of my preliminary thoughts over the subject: http://docs.xaraya.com/docs/rfcs/rfc0035.html If you want any help I would gladly give you a hand.
Unlike what you say, prepared queries, that you call queries with placeholders, are one of the ways to ensure cross database portability. A better way to compose dynamic queries without the penalty of using an API for composing and processing queries metadata as you propose, is to use a tool to generate compiled queries or generate code that embeds the query statements already composed. This is one of the features of Metastorage, which is a persistence layer API generator tool that lets you model your data objects from a definition in simple a XML format that includes the specification of class variables, validation rules, relationships between objects of the class and functions with the operations that you need to perform on the classes objects. Metastorage generates optimized PHP classes of objects that implement you specification mapping the described classes to database tables. All the code that implicitly executes queries is already optimized using query compiled expression strings, so it will run at top speed. The specification of queries that it will execute is also done in a database agnostic XML syntax that is part of the definition of the classes functions that retrieve single objects of collections (arrays of objects). There would be a lot more to say about this, but you can learn all about it here: http://www.meta-language.net/ http://www.meta-language.net/metastorage.html http://www.meta-language.net/download.html -- Regards, Manuel Lemos

« previous php.pear.general (#5217) next »