Re: Re: xsd2db
| From: | Manuel Lemos | Date: | Thu, 27 Feb 2003 17:27:17 +0000 |
| Subject: | Re: Re: xsd2db | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14007@lists.php.net to get a copy of this message | ||
Hello,
On 02/27/2003 01:13 PM, Sandro Zic wrote:
Metabase schema is focused on the data types that most databases provide. I find it a bit unrealistic to try to map all XSD data types to the SQL data types. If you can map some datatypes to just a few databases, your solution will not be portable and you loose that advantage. Another point is that schema management is not only creating databases. It is also and more important to me, be able to upgrade a previously installed schema without disturbing data that was added to the database since the schema was installed for the first time or upgraded for the last time. This is very important because it lets developers evolve their applications altering their schemas without worrying with mistakes because Metabase/MDB take care of that safely. I don't know what you think, but I don't see how a XSLT solution can solve this. Actually, I find XSLT so awkward that I have an hard time understanding why people still bother learning yet another language that is so limited and compromises your ability to satisfy your real needs.Basically you seem to want to replicate a functionality that Metabase/MDB already provide and works well. What would be the advantage of using XSLT for the same purpose?It is not only about using XSLT instead of PHP/Expat, but using XSD instead of Metabase/MDB XML vocabulary. As far as I see, the MDB schema vocabulary is rather focused on databases and does not allow for flexible data type definitions like XSD (e.g. maxLength and minLength of strings).
The proof-of-concept I am working on is to define arbitrary data structures with XSD, to not only derive e.g. table definitions or LDAP schema files, but also HTML forms and application logic from it (e.g. evaluating the minimum and maximum lengt of a form post).That is the goal of Metastorage. It is an application that lets you model with a simple XML format the classes of objects that you will want to store in persistent containers (databases, LDAP servers, XML files, flat files, etc...). http://www.meta-language.net/news-2002-12-05-metastorage.html Metastorage is a work in progress but it already does the most important which is to generate self-contained classes that model your data objects so you can store and retrieve them for persistent storage. Currently only code for storing objects in SQL databases is generated using Metabase API. Still, CPML is a XML format that is independent of the type of persistent storage that you may use, so making it generate code to manage data objects in LDAP servers is absolutely feasible without any change in the format. In CPML (Component Persistence Markup Language) you can define a set of classes with their variables, validation rules, relationships between classes and the functions that you need you classes to perform on the data objects. Here is an example of a simple CMS (Content Management System) model defined in CPML: http://www.meta-language.net/metastorage.html#example As a bonus, Metastorage also generates class diagrams in UML to make it easier to show and document your projects, but this is secondary: http://www.meta-language.net/news-2002-12-09-metastorage.html For now the generated code only takes care of storing and retrieving data objects from the persistent container but I am already working on integration with forms because I have an immediate need for that. The main goal is to drastically reduce the development time by generating adequate code in a few seconds that otherwise would take days or weeks to write, test and debug by hand. So far I am very satisfied with the results because it is very empowering. If you want to learn more about this just take a look at the current documentation: http://www.meta-language.net/metastorage.html -- Regards, Manuel Lemos