Re: SQL->XML mapping

From: Date: Wed, 31 Dec 2003 03:02:11 +0000
Subject: Re: SQL->XML mapping
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24675@lists.php.net to get a copy of this message
Ouch, thats the best example I've seen of why committees should not get involved in technology.. - that is a truly awfully written document.. :) I've been chatting to Lukas on this, in context of reading about propel, and needing to improve the store in DataObjects. DB_Schema - the famous solution :) I need to have another look at the code. - but in principle my view was the class would be a data store which could load/save schemas in multiple formats.. eg. DataObjects (and formbuilder) needs / may need: = At class build time. - get types, names etc. from database (not XML!) - overlay user defined information (eg. links/descriptions/validation rules/text entry field types/sizes) * in ini files/ or xml.../ or whatever... =At run time - get field types (alot) - get autoincrement/primary keys (alot) - get links/join info (less often) - get other info (even less often) Looking through those requirements, DB_Schema could store it's data similar to apache/db (eg. propel), and allow loading from a) a apache/db xml schema b) database quering c) ini files? And therefore write to a) a apache/db xml schema b) rich data xml (eg. data not related to name/type) c) ini files d) serialized arrays (eg. for speed) e) classes (eg. DataObjects generator...) I guess the iso standard could be fitted in there somewhere.. - if anyone could actually understand it :) I've no idea how the original API looked, but this is what I was thinking about. $x = new DB_Schema // load merge .. file, type, options $x->load('mysql:://.......','sql'); $x->merge('somefile.xml','apacheDbXml'); $x->merge('somefile.ini','DataObject',array('format'=>'ini')); // to string - driver / options $serial = $x->toString('DataObject',array('data' =>'types','format'=>'serialize')); $ini = $x->toString('DataObject',array('data' =>'links','format'=>'ini')); $ini = $x->toString('ApacheDbXml'); // update database to match schema.. $x = new DB_Schema $x->load('mysql:://.......','sql'); $y = new DB_Schema $y->load('somefile.xml','apacheDbXml'); $x->toString('sql',array('data'=>'diff','from'=>$x)); .. or $x->toString('sqlxml',array('data'=>'diff','from'=>$x)); (which would probably be the internal way to handle this..) Regards Alan Jesus M. Castagnetto wrote:
I've been working on a set of Java classes (for use at work) for mapping SQL identifiers and values from a database query resultset to XML according to the current ISO/ANSI draft (1). Is there something similar that is planned for database abstraction layers in PEAR? The spec gives the standards on how to the mappings for resultsets, as well as how to map a SQL schema into an XML schema. Not sure if the metainformation needed for the latter is supported in all db backends currently. (1) Document part of WG3 of the "Data Management and Interchange", see: http://www.iso.ch/iso/en/stdsdevelopment/tc/tclist/TechnicalCommitteeDetailPage.TechnicalCommitteeDetail?COMMID=160 and http://www.jtc1sc32.org/sc32/jtc1sc32.nsf/e783d79e26bff9f388256b9f0061b6f5/b7ab89cadb9be5f288256d95005fcc47?OpenDocument (Yes, I know the URLs are very long, but so is the document: 293 pages) ===== -- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ PEAR stuff: http://pear.php.net/user/jmcastagnetto __________________________________ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003


« previous php.pear.dev (#24675) next »